|
@@ -1,6 +1,10 @@
|
|
|
package org.jeecg.modules.smscheck.controller;
|
|
package org.jeecg.modules.smscheck.controller;
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
|
|
+import cn.hutool.core.lang.Tuple;
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -16,9 +20,11 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
|
|
+import org.jeecg.common.constant.CommonConstant;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
|
|
+import org.jeecg.common.system.vo.SysDepartModel;
|
|
|
import org.jeecg.common.util.CommonUtils;
|
|
import org.jeecg.common.util.CommonUtils;
|
|
|
import org.jeecg.common.util.MinioUtil;
|
|
import org.jeecg.common.util.MinioUtil;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
@@ -26,6 +32,7 @@ import org.jeecg.modules.smscheck.configs.CheckStateCode;
|
|
|
import org.jeecg.modules.smscheck.configs.ObjectComparator;
|
|
import org.jeecg.modules.smscheck.configs.ObjectComparator;
|
|
|
import org.jeecg.modules.smscheck.entity.*;
|
|
import org.jeecg.modules.smscheck.entity.*;
|
|
|
import org.jeecg.modules.smscheck.service.*;
|
|
import org.jeecg.modules.smscheck.service.*;
|
|
|
|
|
+import org.jeecg.modules.smscheck.vo.SmsCheckCustomerInfoVo;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.cglib.beans.BeanMap;
|
|
import org.springframework.cglib.beans.BeanMap;
|
|
@@ -36,9 +43,12 @@ import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
+import java.lang.reflect.Array;
|
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.Field;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.function.Function;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @description 客户资料
|
|
* @description 客户资料
|
|
@@ -62,7 +72,12 @@ public class SmsCheckCustomerDataController extends JeecgController<SmsCheckCust
|
|
|
private ISmsCheckCustomerInfoService iSmsCheckCustomerInfoService;
|
|
private ISmsCheckCustomerInfoService iSmsCheckCustomerInfoService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SmsCheckZGHistoryService smsCheckZGHistoryService;
|
|
private SmsCheckZGHistoryService smsCheckZGHistoryService;
|
|
|
-
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ISysUserService sysUserService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ISmsCheckCustomerInfoService customerInfoService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ISmsCheckTaskService taskService;
|
|
|
/**
|
|
/**
|
|
|
* 分页列表查询
|
|
* 分页列表查询
|
|
|
*
|
|
*
|
|
@@ -225,7 +240,93 @@ public class SmsCheckCustomerDataController extends JeecgController<SmsCheckCust
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ @AutoLog(value = "客户资料-转派")
|
|
|
|
|
+ @ApiOperation(value = "客户资料转派", notes = "客户资料转派")
|
|
|
|
|
+ @PostMapping(value = "/transfer")
|
|
|
|
|
+ public Result<String> transfer(@RequestBody TransferVo transferVo) throws IllegalAccessException {
|
|
|
|
|
+
|
|
|
|
|
+ String userId = transferVo.getUserId();
|
|
|
|
|
+ SysUser userServiceById = sysUserService.getById(userId);
|
|
|
|
|
+ List<String> ids = transferVo.getIds();
|
|
|
|
|
+
|
|
|
|
|
+ for (String id : ids) {
|
|
|
|
|
+ SmsCheckCustomerInfo byId = customerInfoService.getById(id);
|
|
|
|
|
+ byId.setStaffNo(userServiceById.getWorkNo());
|
|
|
|
|
+ byId.setStaffInfo(userServiceById.getWorkNo());
|
|
|
|
|
+ SmsCheckCustomerInfo smsCheckCustomerInfo = checkCustomerInfo(byId);
|
|
|
|
|
+ customerInfoService.saveOrUpdate(smsCheckCustomerInfo);
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ private SmsCheckCustomerInfo checkCustomerInfo(SmsCheckCustomerInfo vo ) {
|
|
|
|
|
+ // TODO 客户重复性校验、数据合法性校验等
|
|
|
|
|
+ // 过滤客户编号和员工编号为空的信息
|
|
|
|
|
+ if (StrUtil.isBlank(vo.getCustomerNo()) && StrUtil.isBlank(vo.getUserNo())) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 员工工号
|
|
|
|
|
+ String staffInfo = vo.getStaffInfo();
|
|
|
|
|
+ vo.setStaffNo(staffInfo);
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ //用户状态
|
|
|
|
|
+ List<SysUser> userList = sysUserService.list(new LambdaQueryWrapper<SysUser>()
|
|
|
|
|
+ .eq(SysUser::getDelFlag, CommonConstant.DEL_FLAG_0));
|
|
|
|
|
+ Map<String, SysUser> userMap
|
|
|
|
|
+ = userList.stream().collect(Collectors.toMap(SysUser::getWorkNo, Function.identity(), (o, n) -> o));
|
|
|
|
|
+ SysUser sysUser = userMap.get(vo.getStaffNo());
|
|
|
|
|
+ // 状态(1:正常 2:冻结 )
|
|
|
|
|
+ String orgCode="";
|
|
|
|
|
+ //员工姓名
|
|
|
|
|
+ if (sysUser!=null){
|
|
|
|
|
+ vo.setStaffName(sysUser.getRealname());
|
|
|
|
|
+ vo.setStaffUsername( sysUser.getUsername());
|
|
|
|
|
+ Integer status = sysUser.getStatus();
|
|
|
|
|
+ if (status==1){
|
|
|
|
|
+ vo.setUserState("冻结");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ vo.setUserState("正常");
|
|
|
|
|
+ }
|
|
|
|
|
+ orgCode = sysUser.getOrgCode();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<SysDepartModel> sysDepartModel = customerInfoService.getSysDepartModel();
|
|
|
|
|
+ Map<String, SysDepartModel> sysDepartModelMap
|
|
|
|
|
+ = sysDepartModel.stream().collect(Collectors.toMap(SysDepartModel::getOrgCode,Function.identity(), (o, n) -> o));
|
|
|
|
|
+ //员工二级部门
|
|
|
|
|
+ if (sysUser!=null){
|
|
|
|
|
+ List<String> deptNameByUserId = taskService.getDeptNameByUserId( sysUser.getWorkNo());
|
|
|
|
|
+ if (!deptNameByUserId.isEmpty()){
|
|
|
|
|
+ Set<String>strings=new HashSet<>();
|
|
|
|
|
+ Set<String>stringsOrg=new HashSet<>();
|
|
|
|
|
+ Set<String>stringsThree=new HashSet<>();
|
|
|
|
|
+ Set<String>stringsThreeOrg=new HashSet<>();
|
|
|
|
|
+ for (String s : deptNameByUserId) {
|
|
|
|
|
+ if (s.length()>=3){
|
|
|
|
|
+ String substring = s.substring(0, 3);
|
|
|
|
|
+ strings.add(sysDepartModelMap.get(substring).getDepartName());
|
|
|
|
|
+ stringsOrg.add(substring);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (s.length()>=6){
|
|
|
|
|
+ String substring = s.substring(0, 6);
|
|
|
|
|
+ stringsThree.add(sysDepartModelMap.get(substring).getDepartName());
|
|
|
|
|
+ stringsThreeOrg.add(substring);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 等确认
|
|
|
|
|
+ vo.setSysOrgCode(deptNameByUserId.get(0));
|
|
|
|
|
+ vo.setStaffDeptLevel2No(stringsOrg.toString());
|
|
|
|
|
+ vo.setStaffDeptLevel2Name(strings.toString());
|
|
|
|
|
+ vo.setStaffDeptLevel2(strings.toString()+"("+stringsOrg.toString()+")");
|
|
|
|
|
+ vo.setStaffDeptLevel3No(stringsThreeOrg.toString());
|
|
|
|
|
+ vo.setStaffDeptLevel3Name(stringsThree.toString());
|
|
|
|
|
+ vo.setStaffDeptLevel3(stringsThree.toString()+"("+stringsThreeOrg.toString()+")");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return vo;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
private Map<String,String>getMapByResult(SmsCheckCustomerDataLog smsCheckCustomerDataLog){
|
|
private Map<String,String>getMapByResult(SmsCheckCustomerDataLog smsCheckCustomerDataLog){
|
|
|
HashMap <String,String> map =new HashMap<>();
|
|
HashMap <String,String> map =new HashMap<>();
|