|
@@ -13,42 +13,38 @@ import jakarta.servlet.http.HttpServletRequest;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import net.mingsoft.base.entity.ResultData;
|
|
import net.mingsoft.base.entity.ResultData;
|
|
|
import net.mingsoft.base.exception.BusinessException;
|
|
import net.mingsoft.base.exception.BusinessException;
|
|
|
-import net.mingsoft.basic.bean.UploadConfigBean;
|
|
|
|
|
import net.mingsoft.mdiy.action.web.DictAction;
|
|
import net.mingsoft.mdiy.action.web.DictAction;
|
|
|
import net.mingsoft.mdiy.biz.IModelBiz;
|
|
import net.mingsoft.mdiy.biz.IModelBiz;
|
|
|
import net.mingsoft.mdiy.biz.IModelDataBiz;
|
|
import net.mingsoft.mdiy.biz.IModelDataBiz;
|
|
|
import net.mingsoft.mdiy.entity.DictEntity;
|
|
import net.mingsoft.mdiy.entity.DictEntity;
|
|
|
import net.mingsoft.mdiy.entity.ModelEntity;
|
|
import net.mingsoft.mdiy.entity.ModelEntity;
|
|
|
import net.mingsoft.people.action.BaseAction;
|
|
import net.mingsoft.people.action.BaseAction;
|
|
|
-import net.mingsoft.people.action.people.FileAction;
|
|
|
|
|
import net.mingsoft.people.action.people.PeopleUserAction;
|
|
import net.mingsoft.people.action.people.PeopleUserAction;
|
|
|
import net.mingsoft.people.action.web.PeopleAction;
|
|
import net.mingsoft.people.action.web.PeopleAction;
|
|
|
import net.mingsoft.people.biz.IPeopleBiz;
|
|
import net.mingsoft.people.biz.IPeopleBiz;
|
|
|
import net.mingsoft.people.entity.PeopleEntity;
|
|
import net.mingsoft.people.entity.PeopleEntity;
|
|
|
-import net.mingsoft.people.util.PeopleUtil;
|
|
|
|
|
-import net.mingsoft.tf.action.ExhibitorAction;
|
|
|
|
|
-import net.mingsoft.tf.entity.ExhibitorEntity;
|
|
|
|
|
|
|
+import net.mingsoft.tf.biz.IExhibitorBiz;
|
|
|
|
|
+import net.mingsoft.tf.biz.IPeopleExhibitorBiz;
|
|
|
|
|
+import net.mingsoft.tf.entity.PeopleExhibitorEntity;
|
|
|
|
|
+import net.mingsoft.tf.wx.dto.WxCustomUserNamePasswordToken;
|
|
|
|
|
+import net.mingsoft.tf.wx.dto.WxRegisterRequest;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.apache.shiro.subject.Subject;
|
|
import org.apache.shiro.subject.Subject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.ExtendedModelMap;
|
|
import org.springframework.ui.ExtendedModelMap;
|
|
|
import org.springframework.ui.ModelMap;
|
|
import org.springframework.ui.ModelMap;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
-import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
|
|
-import java.time.LocalDateTime;
|
|
|
|
|
-import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
import java.util.Optional;
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
-@Tag(name = "前端-微信-会员模块接口")
|
|
|
|
|
|
|
+@Tag(name = "微信-会员模块接口")
|
|
|
@Controller
|
|
@Controller
|
|
|
|
|
+@RequestMapping("/wx")
|
|
|
public class WxPeopleAction extends BaseAction {
|
|
public class WxPeopleAction extends BaseAction {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IPeopleBiz peopleBiz;
|
|
private IPeopleBiz peopleBiz;
|
|
@@ -63,15 +59,19 @@ public class WxPeopleAction extends BaseAction {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private DictAction dictAction;
|
|
private DictAction dictAction;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private FileAction fileAction;
|
|
|
|
|
|
|
+ private IExhibitorBiz exhibitorBiz;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private ExhibitorAction exhibitorAction;
|
|
|
|
|
|
|
+ private IPeopleExhibitorBiz peopleExhibitorBiz;
|
|
|
|
|
+ @Value("${wx.appid}")
|
|
|
|
|
+ private String appid;
|
|
|
|
|
+ @Value("${wx.secret}")
|
|
|
|
|
+ private String secret;
|
|
|
|
|
|
|
|
@Operation(summary = "微信-获得电话号码")
|
|
@Operation(summary = "微信-获得电话号码")
|
|
|
@Parameters({
|
|
@Parameters({
|
|
|
@Parameter(name = "code", description = "code", required = true, in = ParameterIn.QUERY)
|
|
@Parameter(name = "code", description = "code", required = true, in = ParameterIn.QUERY)
|
|
|
})
|
|
})
|
|
|
- @GetMapping(value = "/wx/phone")
|
|
|
|
|
|
|
+ @GetMapping(value = "/phone")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
public ResultData wxGetPhone(String code) {
|
|
public ResultData wxGetPhone(String code) {
|
|
|
// TODO
|
|
// TODO
|
|
@@ -82,11 +82,11 @@ public class WxPeopleAction extends BaseAction {
|
|
|
@Parameters({
|
|
@Parameters({
|
|
|
@Parameter(name = "code", description = "code", required = true, in = ParameterIn.QUERY)
|
|
@Parameter(name = "code", description = "code", required = true, in = ParameterIn.QUERY)
|
|
|
})
|
|
})
|
|
|
- @GetMapping(value = "/wx/login")
|
|
|
|
|
|
|
+ @GetMapping(value = "/login")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
public ResultData wxCheckLogin(String code, HttpServletRequest request, HttpServletResponse response) {
|
|
public ResultData wxCheckLogin(String code, HttpServletRequest request, HttpServletResponse response) {
|
|
|
return Optional.ofNullable(code)
|
|
return Optional.ofNullable(code)
|
|
|
- .map(c -> "https://api.weixin.qq.com/sns/jscode2session?appid=wx0a115eb69d6e9359&secret=d906c8ca51acfd61e13dd61b62364050&js_code=" + c + "&grant_type=authorization_code")
|
|
|
|
|
|
|
+ .map(c -> "https://api.weixin.qq.com/sns/jscode2session?appid=" + appid + "&secret=" + secret + "&js_code=" + c + "&grant_type=authorization_code")
|
|
|
.map(HttpUtil::get)
|
|
.map(HttpUtil::get)
|
|
|
.map(JSONObject::new)
|
|
.map(JSONObject::new)
|
|
|
.map(json -> json.getStr("openid"))
|
|
.map(json -> json.getStr("openid"))
|
|
@@ -99,6 +99,12 @@ public class WxPeopleAction extends BaseAction {
|
|
|
ResultData login = executeLogin(openid, request, response);
|
|
ResultData login = executeLogin(openid, request, response);
|
|
|
if (login.isSuccess()) {
|
|
if (login.isSuccess()) {
|
|
|
map.putAll(login.getData(Map.class));
|
|
map.putAll(login.getData(Map.class));
|
|
|
|
|
+ map.put("guest", false);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ PeopleExhibitorEntity entity = peopleExhibitorBiz.saveGuest(openid);
|
|
|
|
|
+ map.put("puIcon", entity.getIcon());
|
|
|
|
|
+ map.put("puNickname", entity.getNickName());
|
|
|
|
|
+ map.put("guest", true);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return ResultData.build().success(map);
|
|
return ResultData.build().success(map);
|
|
@@ -107,7 +113,7 @@ public class WxPeopleAction extends BaseAction {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "微信-字典查询")
|
|
@Operation(summary = "微信-字典查询")
|
|
|
- @GetMapping(value = "/wx/dictionary")
|
|
|
|
|
|
|
+ @GetMapping(value = "/dictionary")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
public ResultData dictionary(String type, HttpServletRequest request, HttpServletResponse response) {
|
|
public ResultData dictionary(String type, HttpServletRequest request, HttpServletResponse response) {
|
|
|
DictEntity dict = new DictEntity();
|
|
DictEntity dict = new DictEntity();
|
|
@@ -131,27 +137,26 @@ public class WxPeopleAction extends BaseAction {
|
|
|
@Parameter(name = "channel", description = "了解渠道", required = true, in = ParameterIn.QUERY),
|
|
@Parameter(name = "channel", description = "了解渠道", required = true, in = ParameterIn.QUERY),
|
|
|
@Parameter(name = "purpose", description = "参观目的", required = true, in = ParameterIn.QUERY),
|
|
@Parameter(name = "purpose", description = "参观目的", required = true, in = ParameterIn.QUERY),
|
|
|
})
|
|
})
|
|
|
- @PostMapping(value = "/wx/register")
|
|
|
|
|
|
|
+ @PostMapping(value = "/register")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
public ResultData wxRegister(@RequestBody WxRegisterRequest people, String modelId, HttpServletRequest request, HttpServletResponse response) {
|
|
public ResultData wxRegister(@RequestBody WxRegisterRequest people, String modelId, HttpServletRequest request, HttpServletResponse response) {
|
|
|
people.setPeoplePassword(RandomUtil.randomString(8));
|
|
people.setPeoplePassword(RandomUtil.randomString(8));
|
|
|
ResultData register = peopleAction.register(people, request, response);
|
|
ResultData register = peopleAction.register(people, request, response);
|
|
|
if (register.isSuccess()) {
|
|
if (register.isSuccess()) {
|
|
|
|
|
+ peopleExhibitorBiz.deleteGuest(people.getPeopleName());
|
|
|
PeopleEntity user = this.peopleBiz.getEntityByUserName(people.getPeopleName());
|
|
PeopleEntity user = this.peopleBiz.getEntityByUserName(people.getPeopleName());
|
|
|
String linkId = user.getId();
|
|
String linkId = user.getId();
|
|
|
ModelMap modelData = new ExtendedModelMap();
|
|
ModelMap modelData = new ExtendedModelMap();
|
|
|
modelData.put("companyName", people.getCompanyName());
|
|
modelData.put("companyName", people.getCompanyName());
|
|
|
modelData.put("position", people.getPosition());
|
|
modelData.put("position", people.getPosition());
|
|
|
- modelData.put("invitationCode", people.getInvitationCode());
|
|
|
|
|
modelData.put("channel", people.getChannel());
|
|
modelData.put("channel", people.getChannel());
|
|
|
modelData.put("purpose", people.getPurpose());
|
|
modelData.put("purpose", people.getPurpose());
|
|
|
modelData.put("linkId", linkId);
|
|
modelData.put("linkId", linkId);
|
|
|
- // TODO 根据邀请码查出用户ID
|
|
|
|
|
- modelData.put("invitation_user_id", "根据邀请码查出用户ID");
|
|
|
|
|
|
|
+ // 关联邀请
|
|
|
|
|
+ peopleExhibitorBiz.join(linkId, people.getInvitationCode());
|
|
|
ModelEntity model = modelBiz.getById(modelId);
|
|
ModelEntity model = modelBiz.getById(modelId);
|
|
|
- // 转换成小写
|
|
|
|
|
- CaseInsensitiveMap<String, Object> map = new CaseInsensitiveMap<>(modelData);
|
|
|
|
|
- modelDataBiz.spliceInsertSql(model, map);
|
|
|
|
|
|
|
+ // 保存扩展表数据
|
|
|
|
|
+ modelDataBiz.spliceInsertSql(model, new CaseInsensitiveMap<>(modelData));
|
|
|
return executeLogin(people.getPeopleName(), request, response);
|
|
return executeLogin(people.getPeopleName(), request, response);
|
|
|
}
|
|
}
|
|
|
return register;
|
|
return register;
|
|
@@ -175,58 +180,4 @@ public class WxPeopleAction extends BaseAction {
|
|
|
return ResultData.build().error(
|
|
return ResultData.build().error(
|
|
|
this.getResString("err.error", this.getResString("people.no.exist")));
|
|
this.getResString("err.error", this.getResString("people.no.exist")));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- @Operation(summary = "微信-邀请的用户汇总")
|
|
|
|
|
- @GetMapping(value = "/people/invitation/summary")
|
|
|
|
|
- @ResponseBody
|
|
|
|
|
- public ResultData invitationSummary() {
|
|
|
|
|
- // TODO
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Operation(summary = "微信-邀请的用户明细")
|
|
|
|
|
- @GetMapping(value = "/people/invitation/details")
|
|
|
|
|
- @ResponseBody
|
|
|
|
|
- public ResultData invitationDetails() {
|
|
|
|
|
- // TODO
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Operation(summary = "微信-生成入场二维码")
|
|
|
|
|
- @GetMapping(value = "/people/qrcode")
|
|
|
|
|
- @ResponseBody
|
|
|
|
|
- public ResultData qrcode() {
|
|
|
|
|
- // TODO
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Operation(summary = "微信-展商-上传LOGO")
|
|
|
|
|
- @PostMapping(value = "/people/upload/logo")
|
|
|
|
|
- @ResponseBody
|
|
|
|
|
- public ResultData logo(@Parameter(hidden = true) UploadConfigBean bean, HttpServletRequest req, HttpServletResponse res) throws IOException {
|
|
|
|
|
- bean.setUploadPath(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMM")));
|
|
|
|
|
- return fileAction.upload(bean, req, res);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Operation(summary = "微信-展商-申请")
|
|
|
|
|
- @PostMapping(value = "/people/exhibitor/create")
|
|
|
|
|
- @ResponseBody
|
|
|
|
|
- public ResultData exhibitorCreate(@RequestBody ExhibitorEntity exhibitor) {
|
|
|
|
|
- exhibitor.setExhibitorUser(PeopleUtil.getPeopleBean().getPeopleId());
|
|
|
|
|
- // TODO 查到最新的展会
|
|
|
|
|
- exhibitor.setExhibitorActivities("");
|
|
|
|
|
- // TODO 检查一下是否会重复
|
|
|
|
|
- exhibitor.setExhibitorCode(RandomUtil.randomString(9));
|
|
|
|
|
- return exhibitorAction.save(exhibitor);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Operation(summary = "微信-展商-详情")
|
|
|
|
|
- @GetMapping(value = "/people/exhibitor/info")
|
|
|
|
|
- @ResponseBody
|
|
|
|
|
- public ResultData exhibitorInfo() {
|
|
|
|
|
- // TODO 查出当前用户最新的一条
|
|
|
|
|
- ExhibitorEntity exhibitor = new ExhibitorEntity();
|
|
|
|
|
- exhibitor.setId("");
|
|
|
|
|
- return exhibitorAction.get(exhibitor);
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
|
|
+}
|