|
|
@@ -1,4 +1,4 @@
|
|
|
-package org.jeecg.modules.smscheck.controller;
|
|
|
+package org.jeecg.modules.smscheck.annotation.controller;
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
@@ -6,6 +6,7 @@ import cn.hutool.core.lang.Dict;
|
|
|
import cn.hutool.core.lang.Tuple;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.druid.sql.visitor.functions.If;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
@@ -15,6 +16,7 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.models.auth.In;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.beanutils.PropertyUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
@@ -35,13 +37,18 @@ import org.jeecg.modules.smscheck.configs.CheckStateCode;
|
|
|
import org.jeecg.modules.smscheck.configs.CheckTypeCode;
|
|
|
import org.jeecg.modules.smscheck.configs.ShutdownLabelByCode;
|
|
|
import org.jeecg.modules.smscheck.entity.*;
|
|
|
+import org.jeecg.modules.smscheck.entity.excel.SpecialExaminationExport;
|
|
|
import org.jeecg.modules.smscheck.service.*;
|
|
|
import org.jeecg.modules.smscheck.vo.SmsCheckCustomerInfoVo;
|
|
|
import org.jeecg.modules.smscheck.vo.SpecialExaminationCustomerVo;
|
|
|
import org.jeecg.modules.smscheck.vo.SpecialExaminationVo;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
|
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
+import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
|
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
|
@@ -51,17 +58,17 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.lang.reflect.Field;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Api(tags = "特审复开审批")
|
|
|
@RestController
|
|
|
@RequestMapping("/special/examination")
|
|
|
@Slf4j
|
|
|
public class SpecialExaminationContrller extends JeecgController<SmsCheckCustomerSpeciaInfo, SmsCheckCustomerSpeciaInfoService> {
|
|
|
-
|
|
|
+ @Value("${jeecg.path.upload}")
|
|
|
+ private String upLoadPath;
|
|
|
@Resource
|
|
|
private SpecialExaminationService specialExaminationService;
|
|
|
|
|
|
@@ -260,7 +267,7 @@ public class SpecialExaminationContrller extends JeecgController<SmsCheckCustome
|
|
|
@PostMapping(value = "/add")
|
|
|
public Result<String> add(@RequestBody SpecialExamination specialExamination) {
|
|
|
//关停标签
|
|
|
- Integer shutdownLabel = specialExamination.getShutdownLabel();
|
|
|
+ String shutdownLabel = specialExamination.getShutdownLabel();
|
|
|
//材料标签
|
|
|
Integer materialLabel = specialExamination.getMaterialLabel();
|
|
|
//用户标签
|
|
|
@@ -280,6 +287,12 @@ public class SpecialExaminationContrller extends JeecgController<SmsCheckCustome
|
|
|
if (StrUtil.isBlank(infoId)) {
|
|
|
return Result.error("暂存失败");
|
|
|
}
|
|
|
+ // 互获取客户信息
|
|
|
+ SmsCheckCustomerInfo customerInfo = infoService.getById(infoId);
|
|
|
+ Integer checkState = customerInfo.getCheckState();
|
|
|
+ if (!CheckStateCode.CHECK_STSTE_0.equals(checkState) && !CheckStateCode.CHECK_STSTE_1.equals(checkState)){
|
|
|
+ return Result.error("暂存失败,该客户状态不允许暂存");
|
|
|
+ }
|
|
|
SpecialExamination specialExamination = new SpecialExamination();
|
|
|
BeanUtil.copyProperties(specialExaminationVo,specialExamination);
|
|
|
// 暂存特审复开数据
|
|
|
@@ -291,7 +304,7 @@ public class SpecialExaminationContrller extends JeecgController<SmsCheckCustome
|
|
|
specialExaminationService.updateById(specialExamination);
|
|
|
}
|
|
|
// 修改客户状态
|
|
|
- SmsCheckCustomerInfo customerInfo = infoService.getById(infoId);
|
|
|
+
|
|
|
customerInfo.setCheckState(CheckStateCode.CHECK_STSTE_1);
|
|
|
customerInfo.setShutdownLabel(specialExamination.getShutdownLabel().toString());
|
|
|
customerInfo.setShutdownLabelDate(specialExamination.getShutdownTime());
|
|
|
@@ -420,12 +433,12 @@ public class SpecialExaminationContrller extends JeecgController<SmsCheckCustome
|
|
|
public Result<?> importCustomerData(@PathVariable String taskId, @RequestBody List<SpecialExaminationCustomerVo> list) {
|
|
|
// 获取当前登录用户
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
- ISysBaseAPI iSysBaseAPI = SpringContextUtils.getBean(ISysBaseAPI.class);
|
|
|
- List<String> departNamesByUsername = iSysBaseAPI.getDepartNamesByUsername(sysUser.getUsername());
|
|
|
// 随斤生成任务ID,批量上传关联文件包
|
|
|
String generate = UUIDGenerator.generate();
|
|
|
- //导入数据
|
|
|
+ // 导入数据
|
|
|
List<SpecialExaminationCustomerVo> listExcel = new ArrayList<>();
|
|
|
+ // 当前已存入数据
|
|
|
+ HashMap<String, SpecialExaminationCustomerVo> saveLogMap = new HashMap<>();
|
|
|
int customerCount = 0;
|
|
|
for (SpecialExaminationCustomerVo infoVo : list) {
|
|
|
SmsCheckCustomerInfo info = new SmsCheckCustomerInfo();
|
|
|
@@ -437,7 +450,11 @@ public class SpecialExaminationContrller extends JeecgController<SmsCheckCustome
|
|
|
// 0:未处理;1:未完善;2:待稽核;3:待整改;4:已整改;5:稽核通过;
|
|
|
info.setCheckState(CheckStateCode.CHECK_STSTE_0);
|
|
|
info.setType(CheckTypeCode.CHECK_TYPE_3);
|
|
|
- if (StringUtils.isNotEmpty(info.getCustomerName())
|
|
|
+ if (saveLogMap.get(info.getSmsNumber()) != null){
|
|
|
+ infoVo.setResult("0");
|
|
|
+ infoVo.setErrorMsg("本次已导入过此号码");
|
|
|
+
|
|
|
+ } else if (StringUtils.isNotEmpty(info.getCustomerName())
|
|
|
&& StringUtils.isNotEmpty(info.getSmsNumber())
|
|
|
&& StringUtils.isNotEmpty(info.getMaterialLabel())
|
|
|
&& StringUtils.isNotEmpty(info.getNameFindCompliance())
|
|
|
@@ -453,6 +470,7 @@ public class SpecialExaminationContrller extends JeecgController<SmsCheckCustome
|
|
|
String materialLabel = info.getMaterialLabel();
|
|
|
specialExamination.setMaterialLabel("有".equals(materialLabel) ? 0 : 1);
|
|
|
specialExaminationService.save(specialExamination);
|
|
|
+ saveLogMap.put(info.getSmsNumber(),infoVo);
|
|
|
}
|
|
|
} else {
|
|
|
infoVo.setResult("0");
|
|
|
@@ -524,10 +542,10 @@ public class SpecialExaminationContrller extends JeecgController<SmsCheckCustome
|
|
|
return Result.ok(one);
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/exportXls")
|
|
|
+ /*@RequestMapping(value = "/exportXls")
|
|
|
public ModelAndView exportXlsSpecial(HttpServletRequest request, SmsCheckCustomerSpeciaInfo smsCheckCustomerSpeciaInfo) {
|
|
|
return super.exportXls(request, smsCheckCustomerSpeciaInfo, SmsCheckCustomerSpeciaInfo.class, "特审复开客户信息");
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
/**
|
|
|
* 通过id查询 稽核统计数
|
|
|
@@ -592,4 +610,114 @@ public class SpecialExaminationContrller extends JeecgController<SmsCheckCustome
|
|
|
return Result.OK(dict);
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping(value = "/exportXls")
|
|
|
+ public ModelAndView exportXls(HttpServletRequest request, SmsCheckCustomerInfo smsCheckCustomerInfo) {
|
|
|
+ smsCheckCustomerInfo.setType(3);
|
|
|
+ return exportXls(request, smsCheckCustomerInfo, SpecialExaminationExport.class, "特审复开信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ protected ModelAndView exportXls(HttpServletRequest request, SmsCheckCustomerInfo object, Class<SpecialExaminationExport> clazz, String title) {
|
|
|
+ // Step.1 组装查询条件
|
|
|
+ QueryWrapper<SmsCheckCustomerInfo> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap());
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+
|
|
|
+ // Step.2 获取导出数据
|
|
|
+ List<SmsCheckCustomerInfo> infoList = customerInfoService.list(queryWrapper);
|
|
|
+ // 获取上传资料数据
|
|
|
+ List<SpecialExamination> logList = specialExaminationService.list();
|
|
|
+ Map<String, SpecialExamination> logMap
|
|
|
+ = logList.stream().collect(Collectors.toMap(v->v.getInfoId(), Function.identity(), (o, n) -> o));
|
|
|
+
|
|
|
+ // 获取稽核资料数据
|
|
|
+ List<SmcSpecialCheckLog> dataList = smcSpecialCheckLogService.list();
|
|
|
+ Map<String, SmcSpecialCheckLog> dataMap
|
|
|
+ = dataList.stream().collect(Collectors.toMap(v->v.getInfoId(), Function.identity(), (o, n) -> o));
|
|
|
+
|
|
|
+ List<SpecialExaminationExport> pageList = new ArrayList<>();
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ for (SmsCheckCustomerInfo smsCheckCustomerInfo : infoList) {
|
|
|
+ SpecialExamination specialExamination = logMap.get(smsCheckCustomerInfo.getId());
|
|
|
+ SmcSpecialCheckLog smcSpecialCheckLog = dataMap.get(smsCheckCustomerInfo.getId());
|
|
|
+ SpecialExaminationExport specialExaminationExport = new SpecialExaminationExport();
|
|
|
+ BeanUtil.copyProperties(specialExamination,specialExaminationExport);
|
|
|
+ BeanUtil.copyProperties(smcSpecialCheckLog,specialExaminationExport);
|
|
|
+ BeanUtil.copyProperties(smsCheckCustomerInfo,specialExaminationExport);
|
|
|
+ String shutdownLabel = specialExaminationExport.getShutdownLabel();
|
|
|
+ if (StringUtils.isNotEmpty(shutdownLabel)){
|
|
|
+ String name = "";
|
|
|
+ String[] split = shutdownLabel.split(",");
|
|
|
+ for (String lable:split){
|
|
|
+ if (lable.equals("0")){
|
|
|
+ name = name + " " + "安防停机(高危漫游地)";
|
|
|
+ }
|
|
|
+ if (lable.equals( "1")){
|
|
|
+ name = name + " " + "安防关停(紫名单)";
|
|
|
+ }
|
|
|
+ if (lable.equals("2")){
|
|
|
+ name = name + " " + "安防停机(专班研判)";
|
|
|
+ }
|
|
|
+ if (lable.equals("3")){
|
|
|
+ name = name + " " + "安防停机(可复开)";
|
|
|
+ }
|
|
|
+ if (lable.equals("4")){
|
|
|
+ name = name + " " + "沉默移动卡保护性单停";
|
|
|
+ }
|
|
|
+ if (lable.equals("5")){
|
|
|
+ name = name + " " + "集团一点停复机(单停)";
|
|
|
+ }
|
|
|
+ if (lable.equals("6")){
|
|
|
+ name = name + " " + "大数据保护停机单停 ";
|
|
|
+ }
|
|
|
+ if (lable.equals("7")){
|
|
|
+ name = name + " " + "工信部断卡单停 ";
|
|
|
+ }
|
|
|
+ if (lable.equals("8")){
|
|
|
+ name = name + " " + "实人核验未通过关停(单停)";
|
|
|
+ }
|
|
|
+ if (lable.equals("999")){
|
|
|
+ name = name + " " + "其它 ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ specialExaminationExport.setShutdownLabel(name);
|
|
|
+ }
|
|
|
+ specialExaminationExport.setDataId(smsCheckCustomerInfo.getDataId());
|
|
|
+ //以dataid代替id
|
|
|
+ //smsCheckCustomerDataAndLog.setDataId(smsCheckCustomerInfo.getId());
|
|
|
+ pageList.add(specialExaminationExport);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<SpecialExaminationExport> exportList = null;
|
|
|
+
|
|
|
+ // 过滤选中数据
|
|
|
+ String selections = request.getParameter("selections");
|
|
|
+ if (oConvertUtils.isNotEmpty(selections)) {
|
|
|
+ List<String> selectionList = Arrays.asList(selections.split(","));
|
|
|
+ exportList = pageList.stream().filter(item -> selectionList.contains(getId(item))).collect(Collectors.toList());
|
|
|
+ } else {
|
|
|
+ exportList = pageList;
|
|
|
+ }
|
|
|
+ //exportList = dataToResult(exportList);
|
|
|
+ // Step.3 AutoPoi 导出Excel
|
|
|
+ ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
+ //此处设置的filename无效 ,前端会重更新设置一下
|
|
|
+ mv.addObject(NormalExcelConstants.FILE_NAME, title);
|
|
|
+ mv.addObject(NormalExcelConstants.CLASS, clazz);
|
|
|
+ //update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
|
|
|
+ ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
|
|
|
+ exportParams.setImageBasePath(upLoadPath);
|
|
|
+ //update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
|
|
|
+ mv.addObject(NormalExcelConstants.PARAMS,exportParams);
|
|
|
+ mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
|
|
|
+ return mv;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getId(SpecialExaminationExport item) {
|
|
|
+ try {
|
|
|
+ return PropertyUtils.getProperty(item, "dataId").toString();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|