|
@@ -1,5 +1,6 @@
|
|
|
package net.mingsoft.tf.wx;
|
|
package net.mingsoft.tf.wx;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.map.CaseInsensitiveMap;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
import cn.hutool.http.HttpUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
@@ -12,22 +13,36 @@ 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.mdiy.action.ModelAction;
|
|
|
|
|
|
|
+import net.mingsoft.basic.bean.UploadConfigBean;
|
|
|
|
|
+import net.mingsoft.mdiy.action.web.DictAction;
|
|
|
|
|
+import net.mingsoft.mdiy.biz.IModelBiz;
|
|
|
|
|
+import net.mingsoft.mdiy.biz.IModelDataBiz;
|
|
|
|
|
+import net.mingsoft.mdiy.entity.DictEntity;
|
|
|
|
|
+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.bean.PeopleBean;
|
|
|
|
|
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 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.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
+import org.springframework.ui.ExtendedModelMap;
|
|
|
|
|
+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.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
|
|
|
|
+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;
|
|
@@ -42,13 +57,21 @@ public class WxPeopleAction extends BaseAction {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private PeopleAction peopleAction;
|
|
private PeopleAction peopleAction;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private ModelAction modelAction;
|
|
|
|
|
|
|
+ private IModelDataBiz modelDataBiz;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IModelBiz modelBiz;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private DictAction dictAction;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private FileAction fileAction;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ExhibitorAction exhibitorAction;
|
|
|
|
|
|
|
|
@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)
|
|
|
})
|
|
})
|
|
|
- @PostMapping(value = "/wx/phone")
|
|
|
|
|
|
|
+ @GetMapping(value = "/wx/phone")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
public ResultData wxGetPhone(String code) {
|
|
public ResultData wxGetPhone(String code) {
|
|
|
// TODO
|
|
// TODO
|
|
@@ -59,7 +82,7 @@ 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)
|
|
|
})
|
|
})
|
|
|
- @PostMapping(value = "/wx/login")
|
|
|
|
|
|
|
+ @GetMapping(value = "/wx/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)
|
|
@@ -83,6 +106,15 @@ public class WxPeopleAction extends BaseAction {
|
|
|
.orElse(ResultData.build().error("登录失败"));
|
|
.orElse(ResultData.build().error("登录失败"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Operation(summary = "微信-字典查询")
|
|
|
|
|
+ @GetMapping(value = "/wx/dictionary")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public ResultData dictionary(String type, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
+ DictEntity dict = new DictEntity();
|
|
|
|
|
+ dict.setDictType(type);
|
|
|
|
|
+ return dictAction.list(dict, response, request);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Operation(summary = "微信-用户注册")
|
|
@Operation(summary = "微信-用户注册")
|
|
|
@Parameters({
|
|
@Parameters({
|
|
|
@Parameter(name = "peopleName", description = "openid", required = true, in = ParameterIn.QUERY),
|
|
@Parameter(name = "peopleName", description = "openid", required = true, in = ParameterIn.QUERY),
|
|
@@ -91,20 +123,35 @@ public class WxPeopleAction extends BaseAction {
|
|
|
@Parameter(name = "puRealName", description = "真实姓名", required = true, in = ParameterIn.QUERY),
|
|
@Parameter(name = "puRealName", description = "真实姓名", required = true, in = ParameterIn.QUERY),
|
|
|
@Parameter(name = "peoplePhone", description = "手机号", required = true, in = ParameterIn.QUERY),
|
|
@Parameter(name = "peoplePhone", description = "手机号", required = true, in = ParameterIn.QUERY),
|
|
|
@Parameter(name = "puCard", description = "身份证", required = true, in = ParameterIn.QUERY),
|
|
@Parameter(name = "puCard", description = "身份证", required = true, in = ParameterIn.QUERY),
|
|
|
- @Parameter(name = "", description = "公司名称", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
- @Parameter(name = "", description = "职位", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
- @Parameter(name = "", description = "展商邀请码", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
- @Parameter(name = "", description = "身份类型", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
- @Parameter(name = "", description = "了解渠道", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
- @Parameter(name = "", description = "参观目的", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
|
|
+ @Parameter(name = "puLevel", description = "身份类型-编码", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "puLevelName", description = "身份类型-名称", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "companyName", description = "公司名称", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "position", description = "职位", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "invitationCode", description = "展商邀请码", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "channel", description = "了解渠道", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "purpose", description = "参观目的", required = true, in = ParameterIn.QUERY),
|
|
|
})
|
|
})
|
|
|
@PostMapping(value = "/wx/register")
|
|
@PostMapping(value = "/wx/register")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
- public ResultData wxRegister(@RequestBody PeopleBean people, 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));
|
|
|
- // TODO 7个新字段保存,还有一个邀请用户ID
|
|
|
|
|
ResultData register = peopleAction.register(people, request, response);
|
|
ResultData register = peopleAction.register(people, request, response);
|
|
|
if (register.isSuccess()) {
|
|
if (register.isSuccess()) {
|
|
|
|
|
+ PeopleEntity user = this.peopleBiz.getEntityByUserName(people.getPeopleName());
|
|
|
|
|
+ String linkId = user.getId();
|
|
|
|
|
+ ModelMap modelData = new ExtendedModelMap();
|
|
|
|
|
+ modelData.put("companyName", people.getCompanyName());
|
|
|
|
|
+ modelData.put("position", people.getPosition());
|
|
|
|
|
+ modelData.put("invitationCode", people.getInvitationCode());
|
|
|
|
|
+ modelData.put("channel", people.getChannel());
|
|
|
|
|
+ modelData.put("purpose", people.getPurpose());
|
|
|
|
|
+ modelData.put("linkId", linkId);
|
|
|
|
|
+ // TODO 根据邀请码查出用户ID
|
|
|
|
|
+ modelData.put("invitation_user_id", "根据邀请码查出用户ID");
|
|
|
|
|
+ ModelEntity model = modelBiz.getById(modelId);
|
|
|
|
|
+ // 转换成小写
|
|
|
|
|
+ CaseInsensitiveMap<String, Object> map = new CaseInsensitiveMap<>(modelData);
|
|
|
|
|
+ modelDataBiz.spliceInsertSql(model, map);
|
|
|
return executeLogin(people.getPeopleName(), request, response);
|
|
return executeLogin(people.getPeopleName(), request, response);
|
|
|
}
|
|
}
|
|
|
return register;
|
|
return register;
|
|
@@ -117,19 +164,7 @@ public class WxPeopleAction extends BaseAction {
|
|
|
LOG.debug("people 尝试登陆");
|
|
LOG.debug("people 尝试登陆");
|
|
|
subject.login(cupt);
|
|
subject.login(cupt);
|
|
|
LOG.debug("people 登陆成功");
|
|
LOG.debug("people 登陆成功");
|
|
|
- ResultData info = peopleUserAction.info(request, response);
|
|
|
|
|
- if (info.isSuccess()) {
|
|
|
|
|
- Map<String, Object> data = info.getData(Map.class);
|
|
|
|
|
- PeopleBean tempPeople = new PeopleBean();
|
|
|
|
|
- // TODO
|
|
|
|
|
- // tempPeople.setId(peopleEntity.getId());
|
|
|
|
|
- // tempPeople.setPeopleName(peopleEntity.getPeopleName());
|
|
|
|
|
- // tempPeople.setPeoplePhone(peopleEntity.getPeoplePhone());
|
|
|
|
|
- // tempPeople.setPuIcon(peopleEntity.getPuIcon());
|
|
|
|
|
- // tempPeople.setPuNickname(peopleEntity.getPuNickname());
|
|
|
|
|
- return ResultData.build().success(tempPeople);
|
|
|
|
|
- }
|
|
|
|
|
- return info;
|
|
|
|
|
|
|
+ return peopleUserAction.info(request, response);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
LOG.debug("people 登陆失败");
|
|
LOG.debug("people 登陆失败");
|
|
|
if (e.getCause() instanceof BusinessException) {
|
|
if (e.getCause() instanceof BusinessException) {
|
|
@@ -142,7 +177,7 @@ public class WxPeopleAction extends BaseAction {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "微信-邀请的用户汇总")
|
|
@Operation(summary = "微信-邀请的用户汇总")
|
|
|
- @PostMapping(value = "/people/invitation/summary")
|
|
|
|
|
|
|
+ @GetMapping(value = "/people/invitation/summary")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
public ResultData invitationSummary() {
|
|
public ResultData invitationSummary() {
|
|
|
// TODO
|
|
// TODO
|
|
@@ -150,7 +185,7 @@ public class WxPeopleAction extends BaseAction {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "微信-邀请的用户明细")
|
|
@Operation(summary = "微信-邀请的用户明细")
|
|
|
- @PostMapping(value = "/people/invitation/details")
|
|
|
|
|
|
|
+ @GetMapping(value = "/people/invitation/details")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
public ResultData invitationDetails() {
|
|
public ResultData invitationDetails() {
|
|
|
// TODO
|
|
// TODO
|
|
@@ -158,7 +193,7 @@ public class WxPeopleAction extends BaseAction {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "微信-生成入场二维码")
|
|
@Operation(summary = "微信-生成入场二维码")
|
|
|
- @PostMapping(value = "/people/qrcode")
|
|
|
|
|
|
|
+ @GetMapping(value = "/people/qrcode")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
public ResultData qrcode() {
|
|
public ResultData qrcode() {
|
|
|
// TODO
|
|
// TODO
|
|
@@ -168,24 +203,30 @@ public class WxPeopleAction extends BaseAction {
|
|
|
@Operation(summary = "微信-展商-上传LOGO")
|
|
@Operation(summary = "微信-展商-上传LOGO")
|
|
|
@PostMapping(value = "/people/upload/logo")
|
|
@PostMapping(value = "/people/upload/logo")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
- public ResultData logo() {
|
|
|
|
|
- // TODO
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ 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 = "微信-展商-申请")
|
|
@Operation(summary = "微信-展商-申请")
|
|
|
@PostMapping(value = "/people/exhibitor/create")
|
|
@PostMapping(value = "/people/exhibitor/create")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
- public ResultData exhibitorCreate() {
|
|
|
|
|
- // TODO
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ 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 = "微信-展商-详情")
|
|
@Operation(summary = "微信-展商-详情")
|
|
|
- @PostMapping(value = "/people/exhibitor/info")
|
|
|
|
|
|
|
+ @GetMapping(value = "/people/exhibitor/info")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
public ResultData exhibitorInfo() {
|
|
public ResultData exhibitorInfo() {
|
|
|
- // TODO
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ // TODO 查出当前用户最新的一条
|
|
|
|
|
+ ExhibitorEntity exhibitor = new ExhibitorEntity();
|
|
|
|
|
+ exhibitor.setId("");
|
|
|
|
|
+ return exhibitorAction.get(exhibitor);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|