|
@@ -1,7 +1,5 @@
|
|
|
package com.sckw.system.service;
|
|
package com.sckw.system.service;
|
|
|
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
@@ -15,10 +13,12 @@ import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.model.EntCertificateInfo;
|
|
import com.sckw.core.web.model.EntCertificateInfo;
|
|
|
import com.sckw.excel.utils.ExcelUtil;
|
|
import com.sckw.excel.utils.ExcelUtil;
|
|
|
|
|
+import com.sckw.redis.utils.RedissonUtils;
|
|
|
import com.sckw.stream.enums.MessageEnum;
|
|
import com.sckw.stream.enums.MessageEnum;
|
|
|
import com.sckw.stream.model.UserInfo;
|
|
import com.sckw.stream.model.UserInfo;
|
|
|
import com.sckw.system.api.model.dto.req.RegisterReqDto;
|
|
import com.sckw.system.api.model.dto.req.RegisterReqDto;
|
|
|
-import com.sckw.system.api.model.dto.res.*;
|
|
|
|
|
|
|
+import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
|
|
|
+import com.sckw.system.api.model.dto.res.RegisterResDto;
|
|
|
import com.sckw.system.dao.*;
|
|
import com.sckw.system.dao.*;
|
|
|
import com.sckw.system.dubbo.RemoteSystemServiceImpl;
|
|
import com.sckw.system.dubbo.RemoteSystemServiceImpl;
|
|
|
import com.sckw.system.model.*;
|
|
import com.sckw.system.model.*;
|
|
@@ -30,7 +30,6 @@ import com.sckw.system.model.report.EntCustomerExcel;
|
|
|
import com.sckw.system.model.report.EntSettleExcel;
|
|
import com.sckw.system.model.report.EntSettleExcel;
|
|
|
import com.sckw.system.model.vo.req.*;
|
|
import com.sckw.system.model.vo.req.*;
|
|
|
import com.sckw.system.model.vo.res.*;
|
|
import com.sckw.system.model.vo.res.*;
|
|
|
-import com.sckw.system.model.vo.res.KwsUserResVo;
|
|
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -80,6 +79,9 @@ public class KwsEnterpriseService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private KwsMenuDao kwsMenuDao;
|
|
private KwsMenuDao kwsMenuDao;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private KwsUserDao userDao;
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private RemoteSystemServiceImpl remoteSystemService;
|
|
private RemoteSystemServiceImpl remoteSystemService;
|
|
|
|
|
|
|
@@ -212,9 +214,13 @@ public class KwsEnterpriseService {
|
|
|
*/
|
|
*/
|
|
|
public PageResult findPage(EntFindPageReqVo reqVo) {
|
|
public PageResult findPage(EntFindPageReqVo reqVo) {
|
|
|
PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
|
|
PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
|
|
|
- List<FindEntListPojo> list = findPojo(reqVo);
|
|
|
|
|
List<EntFindPageResVo> result = new ArrayList<>();
|
|
List<EntFindPageResVo> result = new ArrayList<>();
|
|
|
-
|
|
|
|
|
|
|
+// List<FindEntListPojo> list = findPojo(reqVo);
|
|
|
|
|
+ List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
|
|
|
|
|
+ if (authEntIdList.size() < 1) {
|
|
|
|
|
+ return PageHelperUtil.getPageResult(new PageInfo<>(result));
|
|
|
|
|
+ }
|
|
|
|
|
+ List<FindEntListPojo> list = findPojoManager(reqVo);
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
return PageHelperUtil.getPageResult(new PageInfo<>(result));
|
|
return PageHelperUtil.getPageResult(new PageInfo<>(result));
|
|
|
}
|
|
}
|
|
@@ -227,11 +233,26 @@ public class KwsEnterpriseService {
|
|
|
entFindPageResVo.setEntTypes(item.getType());
|
|
entFindPageResVo.setEntTypes(item.getType());
|
|
|
entFindPageResVo.setEntryType(item.getSystemType().equals(SystemTypeEnum.MANAGE.getCode()) ? EntryTypeEnum.PLATFORM.getCode() : EntryTypeEnum.SELF.getCode());
|
|
entFindPageResVo.setEntryType(item.getSystemType().equals(SystemTypeEnum.MANAGE.getCode()) ? EntryTypeEnum.PLATFORM.getCode() : EntryTypeEnum.SELF.getCode());
|
|
|
entFindPageResVo.setEntryTypeStr(EntryTypeEnum.getName(entFindPageResVo.getEntryType()).getName());
|
|
entFindPageResVo.setEntryTypeStr(EntryTypeEnum.getName(entFindPageResVo.getEntryType()).getName());
|
|
|
|
|
+ if (entFindPageResVo.getManager() != null) {
|
|
|
|
|
+ KwsUser kwsUser = userDao.selectByKey(entFindPageResVo.getManager());
|
|
|
|
|
+ entFindPageResVo.setManagerName(kwsUser == null ? null : kwsUser.getName());
|
|
|
|
|
+ }
|
|
|
result.add(entFindPageResVo);
|
|
result.add(entFindPageResVo);
|
|
|
}
|
|
}
|
|
|
return PageHelperUtil.getPageResult(new PageInfo<>(result), list, reqVo.getPageSize());
|
|
return PageHelperUtil.getPageResult(new PageInfo<>(result), list, reqVo.getPageSize());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private List<FindEntListPojo> findPojoManager(EntFindPageReqVo reqVo) {
|
|
|
|
|
+ FindPojoParam findPojoParam = new FindPojoParam();
|
|
|
|
|
+ BeanUtils.copyProperties(reqVo, findPojoParam);
|
|
|
|
|
+ findPojoParam.setIdList(StringUtils.splitStrToList(reqVo.getIds(), Long.class));
|
|
|
|
|
+ if (StringUtils.isNotBlank(reqVo.getEntTypes())) {
|
|
|
|
|
+ findPojoParam.setTypeList(Arrays.stream(reqVo.getEntTypes().split(Global.COMMA)).map(Integer::parseInt).toList());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return kwsEnterpriseDao.findPojoAndManager(findPojoParam);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @param reqVo 查所有企业
|
|
* @param reqVo 查所有企业
|
|
|
* @return List<KwsEnterprise>
|
|
* @return List<KwsEnterprise>
|
|
@@ -398,7 +419,8 @@ public class KwsEnterpriseService {
|
|
|
|
|
|
|
|
|
|
|
|
|
//子公司不用新建机构、角色等,直接返回
|
|
//子公司不用新建机构、角色等,直接返回
|
|
|
- Map<String, Object> map = CollectionUtils.createHashMap();;
|
|
|
|
|
|
|
+ Map<String, Object> map = CollectionUtils.createHashMap();
|
|
|
|
|
+ ;
|
|
|
map.put("entName", kwsEnterprise.getFirmName());
|
|
map.put("entName", kwsEnterprise.getFirmName());
|
|
|
map.put("createByName", kwsEnterprise.getContacts());
|
|
map.put("createByName", kwsEnterprise.getContacts());
|
|
|
if (Objects.nonNull(reqVo.getEntPid())) {
|
|
if (Objects.nonNull(reqVo.getEntPid())) {
|
|
@@ -1255,13 +1277,16 @@ public class KwsEnterpriseService {
|
|
|
* @date: 2023/9/21
|
|
* @date: 2023/9/21
|
|
|
*/
|
|
*/
|
|
|
public void exportEntSettle(EntFindPageReqVo reqVo, HttpServletResponse response) {
|
|
public void exportEntSettle(EntFindPageReqVo reqVo, HttpServletResponse response) {
|
|
|
|
|
+ List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
|
|
|
|
|
+ if (CollectionUtils.isEmpty(authEntIdList)) {
|
|
|
|
|
+ throw new SystemException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认!");
|
|
|
|
|
+ }
|
|
|
List<FindEntListPojo> list = findPojo(reqVo);
|
|
List<FindEntListPojo> list = findPojo(reqVo);
|
|
|
List<EntFindPageResVo> result = new ArrayList<>();
|
|
List<EntFindPageResVo> result = new ArrayList<>();
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
throw new SystemException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认!");
|
|
throw new SystemException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认!");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
for (FindEntListPojo item : list) {
|
|
for (FindEntListPojo item : list) {
|
|
|
EntFindPageResVo entFindPageResVo = new EntFindPageResVo();
|
|
EntFindPageResVo entFindPageResVo = new EntFindPageResVo();
|
|
|
BeanUtils.copyProperties(item, entFindPageResVo);
|
|
BeanUtils.copyProperties(item, entFindPageResVo);
|
|
@@ -1283,7 +1308,10 @@ public class KwsEnterpriseService {
|
|
|
if (item.getType().contains(String.valueOf(EntTypeEnum.LOGISTICS4.getCode()))) {
|
|
if (item.getType().contains(String.valueOf(EntTypeEnum.LOGISTICS4.getCode()))) {
|
|
|
entFindPageResVo.setEnt4("是");
|
|
entFindPageResVo.setEnt4("是");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ if (entFindPageResVo.getManager() != null) {
|
|
|
|
|
+ KwsUser kwsUser = userDao.selectByKey(entFindPageResVo.getManager());
|
|
|
|
|
+ entFindPageResVo.setManagerName(kwsUser == null ? null : kwsUser.getName());
|
|
|
|
|
+ }
|
|
|
result.add(entFindPageResVo);
|
|
result.add(entFindPageResVo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1294,4 +1322,26 @@ public class KwsEnterpriseService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 企业用户绑定客户经理
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param vo
|
|
|
|
|
+ */
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ public void enterpriseBindManage(EnterpriseBindManagerVo vo) {
|
|
|
|
|
+ long managerId = Long.parseLong(vo.getManagerId());
|
|
|
|
|
+ String enterpriseIds = vo.getEnterpriseIds();
|
|
|
|
|
+ List<Long> enterpriseList = StringUtils.splitStrToList(enterpriseIds, Long.class);
|
|
|
|
|
+ enterpriseList.forEach(id -> {
|
|
|
|
|
+ KwsEnterprise enterprise = kwsEnterpriseDao.selectByKey(id);
|
|
|
|
|
+ enterprise.setManager(managerId);
|
|
|
|
|
+ kwsEnterpriseDao.update(enterprise);
|
|
|
|
|
+ });
|
|
|
|
|
+ //清除缓存 新增缓存
|
|
|
|
|
+ String key = Global.getCustomerManagerUserLoginKey(SystemTypeEnum.MANAGE.getCode(), managerId);
|
|
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(key)) {
|
|
|
|
|
+ RedissonUtils.delete(key);
|
|
|
|
|
+ }
|
|
|
|
|
+ RedissonUtils.putSet(key, enterpriseIds);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|