|
@@ -1,7 +1,9 @@
|
|
|
package com.jpsoft.picc.modules.admin.controller;
|
|
|
|
|
|
+import com.jpsoft.picc.modules.base.entity.Company;
|
|
|
import com.jpsoft.picc.modules.base.entity.CompanyUser;
|
|
|
import com.jpsoft.picc.modules.base.entity.ReplyMessage;
|
|
|
+import com.jpsoft.picc.modules.base.service.CompanyService;
|
|
|
import com.jpsoft.picc.modules.base.service.CompanyUserService;
|
|
|
import com.jpsoft.picc.modules.base.service.ReplyMessageService;
|
|
|
import com.jpsoft.picc.modules.common.config.WeixinConfig;
|
|
@@ -63,6 +65,9 @@ public class JwtsUserController {
|
|
|
@Autowired
|
|
|
private CompanyUserService companyUserService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CompanyService companyService;
|
|
|
+
|
|
|
@PostMapping("/login")
|
|
|
@ApiOperation(value="登录获取token,在swagger ui中获取token时将写入session,调用其它接口时不用再设置header")
|
|
|
@ApiImplicitParams({
|
|
@@ -279,13 +284,11 @@ public class JwtsUserController {
|
|
|
|
|
|
try {
|
|
|
CompanyUser companyUser = companyUserService.findByOpenId(openId);
|
|
|
+ String[] arr = eventKey.split(",");
|
|
|
+ String promoter = arr[1];
|
|
|
|
|
|
if(companyUser==null) {
|
|
|
//未注册用户
|
|
|
- String[] arr = eventKey.split(",");
|
|
|
-
|
|
|
- String promoter = arr[1];
|
|
|
-
|
|
|
ReplyMessage replyMessage = replyMessageService.findByEvent(wechatId,
|
|
|
String.valueOf(WeixinEvent.PICC_ADMIN_SCAN_QRCODE_PROMOTION));
|
|
|
|
|
@@ -305,10 +308,21 @@ public class JwtsUserController {
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
- ReplyMessage replyMessage = replyMessageService.findByEvent(wechatId,String.valueOf(WeixinEvent.PICC_ADMIN_SCAN_QRCODE_PROMOTION_EXIST));
|
|
|
- //message = "您已注册!请在电脑端登录荆州人才超市联盟平台(http://picc.jzrccs.com)完成投保申请。";
|
|
|
+ //企业用户已注册,但推广人未填写时,企业用户扫描推广人的推广二维码后自动将关联推广人
|
|
|
+ if(StringUtils.isNotEmpty(companyUser.getCompanyId())){
|
|
|
+ Company company = companyService.get(companyUser.getCompanyId());
|
|
|
+
|
|
|
+ if (company!=null && StringUtils.isEmpty(company.getPromoter())){
|
|
|
+ company.setPromoter(promoter);
|
|
|
+ company.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ companyService.update(company);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ReplyMessage replyMessage = replyMessageService.findByEvent(wechatId, String.valueOf(WeixinEvent.PICC_ADMIN_SCAN_QRCODE_PROMOTION_EXIST));
|
|
|
|
|
|
- if (replyMessage!=null){
|
|
|
+ if (replyMessage != null) {
|
|
|
message = replyMessage.getMessage();
|
|
|
}
|
|
|
}
|