|
|
@@ -3,6 +3,7 @@ package com.sckw.system.service;
|
|
|
import com.sckw.core.common.enums.enums.DictEnum;
|
|
|
import com.sckw.core.exception.SystemException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
+import com.sckw.core.model.constant.NumberConstant;
|
|
|
import com.sckw.core.model.enums.ApprovalEnum;
|
|
|
import com.sckw.core.model.enums.SystemTypeEnum;
|
|
|
import com.sckw.core.utils.*;
|
|
|
@@ -67,6 +68,9 @@ public class KwsUserService {
|
|
|
@Autowired
|
|
|
KwsEnterpriseDao kwsEnterpriseDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private KwsSpecialService kwsSpecialService;
|
|
|
+
|
|
|
@Autowired
|
|
|
KwsMenuService kwsMenuService;
|
|
|
|
|
|
@@ -167,6 +171,7 @@ public class KwsUserService {
|
|
|
long entId = new IdWorker(1L).nextId();
|
|
|
kwsEnterprise.setId(entId);
|
|
|
kwsEnterprise.setCode("");
|
|
|
+ kwsEnterprise.setRegTime(new Date());
|
|
|
kwsEnterprise.setFirmName(reqDto.getEntName());
|
|
|
kwsEnterprise.setApproval(ApprovalEnum.NO.getCode());
|
|
|
kwsEnterprise.setContacts(reqDto.getName());
|
|
|
@@ -174,6 +179,29 @@ public class KwsUserService {
|
|
|
kwsEnterprise.setCreateBy(createBy);
|
|
|
kwsEnterprise.setUpdateBy(createBy);
|
|
|
|
|
|
+ //客户经理
|
|
|
+ if (StringUtils.isNotBlank(reqDto.getSpecial())) {
|
|
|
+ List<KwsSpecial> specials = kwsSpecialService.findList(new HashMap<>(){{put("code", reqDto.getSpecial());}});
|
|
|
+ if (CollectionUtils.isNotEmpty(specials)) {
|
|
|
+ KwsSpecial special = specials.get(NumberConstant.ZERO);
|
|
|
+ kwsEnterprise.setManager(special.getManager());
|
|
|
+ //专场平台注册自动加入专场
|
|
|
+ if (special.getIsMain() == NumberConstant.ZERO) {
|
|
|
+ KwsEntSpecial entSpecial = new KwsEntSpecial();
|
|
|
+ entSpecial.setSpecialId(special.getId());
|
|
|
+ entSpecial.setEntId(entId);
|
|
|
+ kwsSpecialService.joinSpecial(entSpecial);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //默认给一个客户经理(admin账号)-公共平台
|
|
|
+ List<KwsUserSystemTypeVo> userSystemTypeVos = kwsUserDao.selectUserBySystemType(SystemTypeEnum.MANAGE.getCode());
|
|
|
+ if (CollectionUtils.isNotEmpty(userSystemTypeVos)) {
|
|
|
+ KwsUserSystemTypeVo kwsUserSystemTypeVo = userSystemTypeVos.get(0);
|
|
|
+ kwsEnterprise.setManager(kwsUserSystemTypeVo.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (kwsEnterpriseDao.insert(kwsEnterprise) <= 0) {
|
|
|
throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
|
|
|
}
|