|
@@ -1,5 +1,8 @@
|
|
|
package org.jeecg.modules.smscheck.controller;
|
|
package org.jeecg.modules.smscheck.controller;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
@@ -9,19 +12,15 @@ 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.system.base.controller.JeecgController;
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
import org.jeecg.modules.smscheck.configs.CheckStateCode;
|
|
import org.jeecg.modules.smscheck.configs.CheckStateCode;
|
|
|
-import org.jeecg.modules.smscheck.entity.SmcLotCheckLog;
|
|
|
|
|
-import org.jeecg.modules.smscheck.entity.SmsCheckCustomerInfo;
|
|
|
|
|
-import org.jeecg.modules.smscheck.entity.SmsLotCustomerData;
|
|
|
|
|
-import org.jeecg.modules.smscheck.service.ISmsCheckCustomerInfoService;
|
|
|
|
|
-import org.jeecg.modules.smscheck.service.SmcLotCheckLogService;
|
|
|
|
|
-import org.jeecg.modules.smscheck.service.SmsLotCustomerService;
|
|
|
|
|
|
|
+import org.jeecg.modules.smscheck.configs.ObjectComparator;
|
|
|
|
|
+import org.jeecg.modules.smscheck.entity.*;
|
|
|
|
|
+import org.jeecg.modules.smscheck.service.*;
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
@Api(tags = "物联网")
|
|
@Api(tags = "物联网")
|
|
|
@RestController
|
|
@RestController
|
|
@@ -34,12 +33,217 @@ public class SmsLotCustomerController extends JeecgController<SmsLotCustomerData
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SmsLotCustomerService smsLotCustomerService;
|
|
private SmsLotCustomerService smsLotCustomerService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
|
+ private ISmsLotCustomerDataLogBillService iSmsLotCustomerDataLogBillService;
|
|
|
|
|
+ @Autowired
|
|
|
private SmcLotCheckLogService smcLotCheckLogService;
|
|
private SmcLotCheckLogService smcLotCheckLogService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private SmsCheckZGHistoryService smsCheckZGHistoryService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private SmsLotCustomerService lotCustomerService;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 客户信息业务
|
|
* 客户信息业务
|
|
|
*/
|
|
*/
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ISmsCheckCustomerInfoService infoService;
|
|
private ISmsCheckCustomerInfoService infoService;
|
|
|
|
|
+ @AutoLog(value = "客户资料-添加-暂存")
|
|
|
|
|
+ @ApiOperation(value = "客户资料-添加-暂存", notes = "客户资料-添加")
|
|
|
|
|
+ @PostMapping(value = "/addIsStaging")
|
|
|
|
|
+ public Result<String> addIsStaging(@RequestBody JSONObject jsonObject){
|
|
|
|
|
+ SmsLotCustomerData lotCustomerData = JSON.parseObject(jsonObject.toJSONString(), SmsLotCustomerData.class);
|
|
|
|
|
+ boolean save = lotCustomerService.saveOrUpdate(lotCustomerData);
|
|
|
|
|
+ if (save){
|
|
|
|
|
+ // 修改客户状态为 未完善/未上传
|
|
|
|
|
+ SmsCheckCustomerInfo smsCheckCustomerInfo = new SmsCheckCustomerInfo();
|
|
|
|
|
+ /** 稽核状态 0:未处理;1:未完善;2:待稽核; ;4:待整改;5:稽核通过; 6:未上传 */
|
|
|
|
|
+ smsCheckCustomerInfo.setCheckState(CheckStateCode.CHECK_STSTE_1);
|
|
|
|
|
+ smsCheckCustomerInfo.setId(lotCustomerData.getInfoId());
|
|
|
|
|
+ infoService.updateState(smsCheckCustomerInfo);
|
|
|
|
|
+ return Result.OK();
|
|
|
|
|
+ }
|
|
|
|
|
+ return Result.error("暂存失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ @PostMapping(value = "/add")
|
|
|
|
|
+ public Result<String> add(@RequestBody JSONObject jsonObject) {
|
|
|
|
|
+ SmsLotCustomerData lotCustomerData = JSON.parseObject(jsonObject.toJSONString(), SmsLotCustomerData.class);
|
|
|
|
|
+ boolean save = lotCustomerService.saveOrUpdate(lotCustomerData);
|
|
|
|
|
+ if (save){
|
|
|
|
|
+ // 修改客户状态为 未完善/未上传
|
|
|
|
|
+ SmsCheckCustomerInfo smsCheckCustomerInfo = new SmsCheckCustomerInfo();
|
|
|
|
|
+ /** 稽核状态 0:未处理;1:未完善;2:待稽核;3:已整改;4:待整改;5:稽核通过; 6:未上传 */
|
|
|
|
|
+ smsCheckCustomerInfo.setId(lotCustomerData.getInfoId());
|
|
|
|
|
+ smsCheckCustomerInfo.setCheckState(CheckStateCode.CHECK_STSTE_2);
|
|
|
|
|
+ smsCheckCustomerInfo.setDataId(lotCustomerData.getId());
|
|
|
|
|
+ infoService.updateState(smsCheckCustomerInfo);
|
|
|
|
|
+ return Result.OK();
|
|
|
|
|
+ }
|
|
|
|
|
+ return Result.error("新增失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ @ApiOperation(value = "中继线资料-通过id查询", notes = "中继线资料-通过客户表id查询")
|
|
|
|
|
+ @GetMapping(value = "/queryDataLogByInfoId")
|
|
|
|
|
+ public Result<Map<String, Object>> queryDatalogByInfoId(@RequestParam(name = "infoId") String infoId) {
|
|
|
|
|
+ if (StringUtils.isEmpty(infoId)) {
|
|
|
|
|
+ return Result.error("客户编码不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ Map<String, Object> map =new HashMap<>();
|
|
|
|
|
+ LambdaQueryWrapper<SmsLotCustomerData> queryWrapperData = new LambdaQueryWrapper<>();
|
|
|
|
|
+ queryWrapperData.eq(SmsLotCustomerData::getInfoId, infoId);
|
|
|
|
|
+ SmsLotCustomerData smsCheckCustomerData = lotCustomerService.getOne(queryWrapperData);
|
|
|
|
|
+ if (smsCheckCustomerData == null) {
|
|
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
|
|
+ }
|
|
|
|
|
+ //任务数据
|
|
|
|
|
+ SmsCheckCustomerInfo byId = infoService.getById(infoId);
|
|
|
|
|
+
|
|
|
|
|
+ //查询 稽核结果数据
|
|
|
|
|
+ LambdaQueryWrapper<SmcLotCheckLog> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ queryWrapper.eq(SmcLotCheckLog::getInfoId, infoId);
|
|
|
|
|
+ SmcLotCheckLog logServiceOne = smcLotCheckLogService.getOne(queryWrapper);
|
|
|
|
|
+ LambdaQueryWrapper<SmsCheckZGHistory> var11 = new LambdaQueryWrapper<SmsCheckZGHistory>()
|
|
|
|
|
+ .eq(SmsCheckZGHistory::getDataId, smsCheckCustomerData.getId());
|
|
|
|
|
+ List<SmsCheckZGHistory> list = smsCheckZGHistoryService.list(var11);
|
|
|
|
|
+ Map<String, Object> stringObjectMap = BeanUtil.beanToMap(logServiceOne);
|
|
|
|
|
+ Map<String, Object> stringObjectMap1 = BeanUtil.beanToMap(smsCheckCustomerData);
|
|
|
|
|
+ if (smsCheckCustomerData!=null){
|
|
|
|
|
+ map.put("dataId",smsCheckCustomerData.getId());
|
|
|
|
|
+ map.putAll(stringObjectMap1);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (logServiceOne!=null){
|
|
|
|
|
+ map.put("logId",logServiceOne.getId());
|
|
|
|
|
+ stringObjectMap.remove("id");
|
|
|
|
|
+ map.putAll(stringObjectMap);
|
|
|
|
|
+ }
|
|
|
|
|
+ map.put("taskId",byId.getTaskId());
|
|
|
|
|
+ map.put("history",list);
|
|
|
|
|
+ if (smsCheckCustomerData == null) {
|
|
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
|
|
+ }
|
|
|
|
|
+ return Result.OK(map);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @AutoLog(value = "客户资料Log-添加")
|
|
|
|
|
+ @ApiOperation(value = "客户资料Log-添加", notes = "客户资料Log-添加")
|
|
|
|
|
+ @PostMapping(value = "/addLog")
|
|
|
|
|
+ public Result<String> addLog(@RequestBody JSONObject jsonObject) throws IllegalAccessException {
|
|
|
|
|
+
|
|
|
|
|
+ SmsLotCheckCustomerDataAndLog lotCheckCustomerDataAndLog = JSON.parseObject(jsonObject.toJSONString(), SmsLotCheckCustomerDataAndLog.class);
|
|
|
|
|
+
|
|
|
|
|
+ SmcLotCheckLog lotCheckLog = new SmcLotCheckLog();
|
|
|
|
|
+ BeanUtils.copyProperties(lotCheckCustomerDataAndLog,lotCheckLog);
|
|
|
|
|
+
|
|
|
|
|
+ SmsLotCustomerData lotCustomerData =new SmsLotCustomerData();
|
|
|
|
|
+ BeanUtils.copyProperties(lotCheckCustomerDataAndLog,lotCustomerData);
|
|
|
|
|
+
|
|
|
|
|
+ lotCheckLog.setId(lotCheckCustomerDataAndLog.getLogId());
|
|
|
|
|
+
|
|
|
|
|
+ lotCustomerData.setId(lotCheckCustomerDataAndLog.getDataId());
|
|
|
|
|
+
|
|
|
|
|
+ SmsCheckCustomerInfo byId = infoService.getById(lotCheckLog.getInfoId());
|
|
|
|
|
+ lotCheckLog.setDataId(byId.getDataId());
|
|
|
|
|
+
|
|
|
|
|
+ List<SmsCheckZGHistory> smsCheckZGHistories = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ // SmsCheckCustomerDataLog 如果id不是空的 则存在以前数据
|
|
|
|
|
+// if (StringUtils.isNotBlank(lotCheckLog.getId())){
|
|
|
|
|
+// SmcLotCheckLog logServiceById = smcLotCheckLogService.getById(lotCheckLog.getId());
|
|
|
|
|
+// Map<String, Object> diffProperties = ObjectComparator.compareObjects(lotCheckLog, logServiceById);
|
|
|
|
|
+// for (Map.Entry<String, Object> entry : diffProperties.entrySet()) {
|
|
|
|
|
+// SmsCheckZGHistory checkZGHistory = new SmsCheckZGHistory();
|
|
|
|
|
+// checkZGHistory.setDataId(byId.getDataId());
|
|
|
|
|
+// checkZGHistory.setContext(entry.getValue().toString());
|
|
|
|
|
+// checkZGHistory.setUpdateField(entry.getKey());
|
|
|
|
|
+// Date date = new Date();
|
|
|
|
|
+// SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
|
|
|
|
|
+// checkZGHistory.setUpdateDate(dateFormat.format(date));
|
|
|
|
|
+// smsCheckZGHistories.add(checkZGHistory);
|
|
|
|
|
+// System.out.println("Property: " + entry.getKey() + ", Value: " + entry.getValue());
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// //SmsCheckCustomerData 如果id不是空的 则存在以前数据
|
|
|
|
|
+// if (StringUtils.isNotBlank(lotCustomerData.getId())){
|
|
|
|
|
+// SmsLotCustomerData dataServiceById = smsLotCustomerService.getById(lotCustomerData.getId());
|
|
|
|
|
+// Map<String, Object> diffProperties = ObjectComparator.compareObjects(lotCustomerData, dataServiceById);
|
|
|
|
|
+// for (Map.Entry<String, Object> entry : diffProperties.entrySet()) {
|
|
|
|
|
+// SmsCheckZGHistory checkZGHistory = new SmsCheckZGHistory();
|
|
|
|
|
+// checkZGHistory.setDataId(byId.getDataId());
|
|
|
|
|
+// checkZGHistory.setContext(entry.getValue().toString());
|
|
|
|
|
+// checkZGHistory.setUpdateField(entry.getKey());
|
|
|
|
|
+// Date date = new Date();
|
|
|
|
|
+// SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
|
|
|
|
|
+// checkZGHistory.setUpdateDate(dateFormat.format(date));
|
|
|
|
|
+// smsCheckZGHistories.add(checkZGHistory);
|
|
|
|
|
+// System.out.println("Property: " + entry.getKey() + ", Value: " + entry.getValue());
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+ if (smsCheckZGHistories.size()>0){
|
|
|
|
|
+ smsCheckZGHistoryService.saveBatch(smsCheckZGHistories);
|
|
|
|
|
+ }
|
|
|
|
|
+ boolean saveLog = smcLotCheckLogService.saveOrUpdate(lotCheckLog);
|
|
|
|
|
+
|
|
|
|
|
+ SmsLotCheckCustomerDataLogBill smsLotCheckCustomerDataLogBill = new SmsLotCheckCustomerDataLogBill();
|
|
|
|
|
+ BeanUtils.copyProperties(lotCheckLog,smsLotCheckCustomerDataLogBill);
|
|
|
|
|
+ smsLotCheckCustomerDataLogBill.setId(null);
|
|
|
|
|
+ smsLotCheckCustomerDataLogBill.setCreateDate(new Date());
|
|
|
|
|
+ iSmsLotCustomerDataLogBillService.save(smsLotCheckCustomerDataLogBill);
|
|
|
|
|
+
|
|
|
|
|
+ boolean saveData = lotCustomerService.saveOrUpdate(lotCustomerData);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (saveLog && saveData){
|
|
|
|
|
+ Map<String, String> mapByResult = getMapByResult(lotCheckLog);
|
|
|
|
|
+ // 修改客户状态为 未完善/未上传
|
|
|
|
|
+ SmsCheckCustomerInfo smsCheckCustomerInfo = new SmsCheckCustomerInfo();
|
|
|
|
|
+ /** 稽核状态 0:未处理;1:未完善;2:待稽核;3:已整改;4:待整改;5:稽核通过; */
|
|
|
|
|
+ if (byId.getCheckState().equals(CheckStateCode.CHECK_STSTE_4)){
|
|
|
|
|
+ smsCheckCustomerInfo.setCheckState(CheckStateCode.CHECK_STSTE_2);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ if (mapByResult.isEmpty()){
|
|
|
|
|
+ smsCheckCustomerInfo.setCheckState(CheckStateCode.CHECK_STSTE_5);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ smsCheckCustomerInfo.setCheckState(CheckStateCode.CHECK_STSTE_4);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ smsCheckCustomerInfo.setId(byId.getId());
|
|
|
|
|
+
|
|
|
|
|
+ smsCheckCustomerInfo.setDataLogId(lotCheckLog.getId());
|
|
|
|
|
+ infoService.updateState(smsCheckCustomerInfo);
|
|
|
|
|
+ return Result.OK();
|
|
|
|
|
+ }
|
|
|
|
|
+ return Result.error("新增失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ private Map<String,String>getMapByResult(SmcLotCheckLog smsCheckCustomerDataLog){
|
|
|
|
|
+ HashMap <String,String> map =new HashMap<>();
|
|
|
|
|
+ if (StringUtils.isNotBlank(smsCheckCustomerDataLog.getTestCardResult() ) && !smsCheckCustomerDataLog.getTestCardResult().equals("1")){
|
|
|
|
|
+ map.put("getTestCardResult","未通过");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotBlank(smsCheckCustomerDataLog.getContractResult() ) && !smsCheckCustomerDataLog.getContractResult().equals("1")){
|
|
|
|
|
+ map.put("getContractResult","未通过");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotBlank(smsCheckCustomerDataLog.getHandlingCardResult() ) && !smsCheckCustomerDataLog.getHandlingCardResult().equals("1")){
|
|
|
|
|
+ map.put("getHandlingCardResult","未通过");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotBlank(smsCheckCustomerDataLog.getHandlingContractResult() ) && !smsCheckCustomerDataLog.getHandlingContractResult().equals("1")){
|
|
|
|
|
+ map.put("getHandlingContractResult","未通过");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotBlank(smsCheckCustomerDataLog.getCustomerCardScanningResult() ) && !smsCheckCustomerDataLog.getCustomerCardScanningResult().equals("1")){
|
|
|
|
|
+ map.put("getCustomerCardScanningResult","未通过");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotBlank(smsCheckCustomerDataLog.getRiskTableResult() ) && !smsCheckCustomerDataLog.getRiskTableResult().equals("1")){
|
|
|
|
|
+ map.put("getRiskTableResult","未通过");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotBlank(smsCheckCustomerDataLog.getPriceTableResult() ) && !smsCheckCustomerDataLog.getPriceTableResult().equals("1")){
|
|
|
|
|
+ map.put("getPriceTableResult","未通过");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotBlank(smsCheckCustomerDataLog.getCommitmentResult() ) && !smsCheckCustomerDataLog.getCommitmentResult().equals("1")){
|
|
|
|
|
+ map.put("getCommitmentResult","未通过");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ return map;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
//日志
|
|
//日志
|
|
|
@AutoLog(value = "物联网客户资料-插入修改")
|
|
@AutoLog(value = "物联网客户资料-插入修改")
|