From 37628315a1a94704fe4b8a6fa30da8292775a6f6 Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Mon, 31 Jul 2023 18:20:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=80=E6=9C=AF=E7=9B=91=E7=9D=A3=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/njcn/process/pojo/po/SupvPlan.java | 5 +- .../com/njcn/process/pojo/po/SupvProblem.java | 11 +- .../controller/SupvPushGwController.java | 48 ++- .../process/service/SupvPushGwService.java | 10 +- .../service/impl/SupvProblemServiceImpl.java | 10 +- .../service/impl/SupvPushGwServiceImpl.java | 324 ++++++++++++------ .../service/impl/SupvReportMServiceImpl.java | 13 +- 7 files changed, 283 insertions(+), 138 deletions(-) diff --git a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvPlan.java b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvPlan.java index 0f2801430..b108cc4cf 100644 --- a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvPlan.java +++ b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvPlan.java @@ -1,9 +1,6 @@ package com.njcn.process.pojo.po; -import com.baomidou.mybatisplus.annotation.FieldStrategy; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; import com.njcn.db.bo.BaseEntity; diff --git a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvProblem.java b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvProblem.java index 8ca710b65..b6a421e20 100644 --- a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvProblem.java +++ b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvProblem.java @@ -15,6 +15,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; +import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; @@ -64,14 +65,15 @@ public class SupvProblem extends BaseEntity { /** * 整改时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd") @TableField(updateStrategy = FieldStrategy.IGNORED) - private LocalDate rectificationTime; + private LocalDateTime rectificationTime; /** * 计划整改时间 */ - private LocalDate planRectificationTime; + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime planRectificationTime; /** * 是否发布预告警 @@ -154,6 +156,9 @@ public class SupvProblem extends BaseEntity { @ApiModelProperty(name = "attachmentNameTwo",value = "佐证材料") private String attachmentNameTwo; + /** + * 问题发现时间 + */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime discoveryTime; diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/controller/SupvPushGwController.java b/pqs-process/process-boot/src/main/java/com/njcn/process/controller/SupvPushGwController.java index e2ba3be6a..0007120d5 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/controller/SupvPushGwController.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/controller/SupvPushGwController.java @@ -1,19 +1,16 @@ package com.njcn.process.controller; import com.njcn.common.pojo.annotation.OperateInfo; -import com.njcn.common.pojo.constant.OperateType; import com.njcn.common.pojo.enums.common.LogEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.utils.HttpResultUtil; -import com.njcn.process.pojo.param.SupvPlanParam; import com.njcn.process.service.SupvPushGwService; import com.njcn.web.controller.BaseController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -45,10 +42,10 @@ public class SupvPushGwController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @ApiOperation("推送技术监督工作计划") @ApiImplicitParam(name = "planIds",value = "请求体",required = true) - public HttpResult pushPlan(@RequestBody List planIds){ + public HttpResult pushPlan(@RequestBody List planIds){ String methodDescribe = getMethodDescribe("pushPlan"); - supvPushGwService.pushPlan(planIds); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + String s = supvPushGwService.pushPlan(planIds); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe); } /** @@ -60,14 +57,27 @@ public class SupvPushGwController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @ApiOperation("推送技术监督实施问题") @ApiImplicitParam(name = "problemIds",value = "请求体",required = true) - public HttpResult pushQuestion(@RequestBody List problemIds){ + public HttpResult pushQuestion(@RequestBody List problemIds){ String methodDescribe = getMethodDescribe("pushQuestion"); - supvPushGwService.pushQuestion(problemIds); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + String s = supvPushGwService.pushQuestion(problemIds,0); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe); } - + /** + * 实施问题整改数据接口 + * @author cdf + * @date 2023/6/28 + */ + @PostMapping("pushQuestionUpdate") + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @ApiOperation("实施问题整改数据") + @ApiImplicitParam(name = "problemIds",value = "请求体",required = true) + public HttpResult pushQuestionUpdate(@RequestBody List problemIds){ + String methodDescribe = getMethodDescribe("pushQuestionUpdate"); + String s = supvPushGwService.pushQuestion(problemIds,1); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe); + } /** @@ -79,10 +89,10 @@ public class SupvPushGwController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @ApiOperation("推送附件接口") @ApiImplicitParam(name = "busIds",value = "请求体",required = true) - public HttpResult pushFile(@RequestBody List busIds) throws IOException { + public HttpResult pushFile(@RequestBody List busIds) throws IOException { String methodDescribe = getMethodDescribe("pushFile"); - supvPushGwService.pushFile(busIds); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + String s = supvPushGwService.pushFile(busIds); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe); } @@ -95,10 +105,10 @@ public class SupvPushGwController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @ApiOperation("推送技术监督月报统计数据接口") @ApiImplicitParam(name = "monthReportId",value = "请求体",required = true) - public HttpResult pushMonthReportStatistic(@RequestBody List monthReportId){ + public HttpResult pushMonthReportStatistic(@RequestBody List monthReportId){ String methodDescribe = getMethodDescribe("pushMonthReportStatistic"); - supvPushGwService.pushMonthReportStatistic(monthReportId); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + String s = supvPushGwService.pushMonthReportStatistic(monthReportId); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe); } /** @@ -110,9 +120,9 @@ public class SupvPushGwController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @ApiOperation("取消电能质量技术监督工作计划接口") @ApiImplicitParam(name = "planIds",value = "请求体",required = true) - public HttpResult delPushPlan(@RequestBody List planIds){ + public HttpResult delPushPlan(@RequestBody List planIds){ String methodDescribe = getMethodDescribe("delPushPlan"); - supvPushGwService.deletePlan(planIds); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + String s = supvPushGwService.deletePlan(planIds); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe); } } diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/service/SupvPushGwService.java b/pqs-process/process-boot/src/main/java/com/njcn/process/service/SupvPushGwService.java index bb063c8e5..5ffb80fba 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/service/SupvPushGwService.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/service/SupvPushGwService.java @@ -16,14 +16,14 @@ public interface SupvPushGwService { * @author cdf * @date 2023/6/28 */ - boolean pushPlan(List planIds); + String pushPlan(List planIds); /** * * @author cdf * @date 2023/6/28 */ - boolean pushQuestion(List problemIds); + String pushQuestion(List problemIds,Integer type); /** @@ -31,7 +31,7 @@ public interface SupvPushGwService { * @author cdf * @date 2023/6/28 */ - boolean pushFile(List busIds) throws IOException; + String pushFile(List busIds) throws IOException; /** @@ -39,7 +39,7 @@ public interface SupvPushGwService { * @author cdf * @date 2023/6/28 */ - boolean pushMonthReportStatistic(List monthReportId); + String pushMonthReportStatistic(List monthReportId); /** @@ -47,5 +47,5 @@ public interface SupvPushGwService { * @author cdf * @date 2023/6/28 */ - boolean deletePlan(List planIds); + String deletePlan(List planIds); } diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvProblemServiceImpl.java b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvProblemServiceImpl.java index 7bb8bdc02..f8a9ceca0 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvProblemServiceImpl.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvProblemServiceImpl.java @@ -3,6 +3,8 @@ package com.njcn.process.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -56,9 +58,9 @@ public class SupvProblemServiceImpl extends ServiceImpl planIds) { + public String pushPlan(List planIds) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.in(SupvPlan::getPlanId, planIds); List supvPlanList = supvPlanMapper.selectList(lambdaQueryWrapper); if (CollUtil.isEmpty(supvPlanList)) { - return false; + return "为查询数据,请查询数据是否存在!"; } List deptList = deptFeignClient.allDeptList().getData(); Map mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity())); @@ -102,7 +103,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { List supvVoltageDicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData(); Map mapVoltage = supvVoltageDicList.stream().collect(Collectors.toMap(DictData::getId, Function.identity())); - List userIds = supvPlanList.stream().map(SupvPlan::getUpdateBy).distinct().collect(Collectors.toList()); + List userIds = supvPlanList.stream().map(SupvPlan::getCreateBy).distinct().collect(Collectors.toList()); List userList = userFeignClient.getUserByIdList(userIds).getData(); Map map = userList.stream().collect(Collectors.toMap(User::getId, Function.identity())); @@ -202,33 +203,40 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { SendParam param = new SendParam(); param.setStats(supvPlanList); param.setProvinceId("13B9B47F1E483324E05338297A0A0595"); - String s = JSON.toJSONString(param); + String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT); log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督工作计划数据接口数据:" + s + "结束----!"); -// Map send = send(param, getUrl(1), "pqPlanCreate"); -// log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督工作计划数据接口响应结果:" + send + "结束----!"); -// if (send.containsKey("succeed")) { -// String succeed = send.get("succeed"); -// String replace = succeed.replace("\\\"", "\""); -// Map mapData = JSON.parseObject(replace, Map.class); -// String status = mapData.get("status").toString(); -// if ("000000".equals(status)) { -// for (SupvPlan supvPlan : supvPlanList) { -// SupvPlan supvPlanPO = new SupvPlan(); -// supvPlanPO.setPlanId(supvPlan.getPlanId()); -// supvPlanPO.setIsUploadHead(1); -// supvPlanMapper.updateById(supvPlanPO); -// } -// } else { -// return false; -// } -// } else { -// return false; -// } - return true; + Map send = send(param, getUrl(1), "pqPlanCreate"); +// Map send = new HashMap<>(); + log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督工作计划数据接口响应结果:" + send + "结束----!"); + if (send.containsKey("succeed")) { + String succeed = send.get("succeed"); + if(succeed.indexOf("\\\"")!=-1){ + succeed = succeed.replace("\\\"", "\""); + } + Map mapData = JSON.parseObject(succeed, Map.class); + String status = mapData.get("status").toString(); + if ("000000".equals(status)) { + for (SupvPlan supvPlan : supvPlanList) { + SupvPlan supvPlanPO = new SupvPlan(); + supvPlanPO.setPlanId(supvPlan.getPlanId()); + supvPlanPO.setIsUploadHead(1); + supvPlanMapper.updateById(supvPlanPO); + } + String result = mapData.get("result").toString(); + Map mapCount = JSON.parseObject(result, Map.class); + String count = mapCount.get("count").toString(); + return "操作成功:成功数据"+count+"条"; + } else { + String errors = mapData.get("errors").toString(); + return "操作失败:"+status+"_"+errors; + } + } else { + return "出现未知错误"; + } } @Override - public boolean pushQuestion(List problemIds) { + public String pushQuestion(List problemIds,Integer type) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.in(SupvProblem::getProblemId, problemIds); List supvProblemList = supvProblemMapper.selectList(lambdaQueryWrapper); @@ -270,35 +278,49 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { SendParam param = new SendParam(); param.setStats(supvProblemList); param.setProvinceId("13B9B47F1E483324E05338297A0A0595"); - String s = JSON.toJSONString(param); + String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT); log.info(Thread.currentThread().getName() + "获取返回体 删除电能质量技术监督工作计划接口数据:" + s + "结束----!"); -// Map send = send(param, getUrl(2), "pqProblemCreate"); -// Map send2 = send(param, getUrl(3), "pqProblemUpdate"); -// log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督实施问题数据接口响应结果:" + send + "结束----!"); -// log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督实施问题整改数据接口响应结果:" + send2 + "结束----!"); -// if (send.containsKey("succeed")) { -// String succeed = send.get("succeed"); -// String replace = succeed.replace("\\\"", "\""); -// Map map = JSON.parseObject(replace, Map.class); -// String status = map.get("status").toString(); -// if ("000000".equals(status)) { -// for (SupvProblem supvProblem : supvProblemList) { -// SupvProblem supvProblemPO = new SupvProblem(); -// supvProblemPO.setProblemId(supvProblem.getProblemId()); -// supvProblemPO.setIsUploadHead(1); -// supvProblemMapper.updateById(supvProblemPO); -// } -// } else { -// return false; -// } -// } else { -// return false; -// } - return true; + Map send; + if(type==0){ + send = send(param, getUrl(2), "pqProblemCreate"); + log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督实施问题数据接口响应结果:" + send + "结束----!"); + }else{ + System.out.println(1); + send = send(param, getUrl(3), "pqProblemUpdate"); + log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督实施问题整改数据接口响应结果:" + send + "结束----!"); + } +// Map send = new HashMap<>(); + + if (send.containsKey("succeed")) { + String succeed = send.get("succeed"); + if(succeed.indexOf("\\\"")!=-1){ + succeed = succeed.replace("\\\"", "\""); + } + Map map = JSON.parseObject(succeed, Map.class); + String status = map.get("status").toString(); + if ("000000".equals(status)) { + for (SupvProblem supvProblem : supvProblemList) { + SupvProblem supvProblemPO = new SupvProblem(); + supvProblemPO.setProblemId(supvProblem.getProblemId()); + supvProblemPO.setIsUploadHead(1); + supvProblemMapper.updateById(supvProblemPO); + } + String result = map.get("result").toString(); + Map mapCount = JSON.parseObject(result, Map.class); + String count = mapCount.get("count").toString(); + return "操作成功:成功数据"+count+"条"; + } else { + String errors = map.get("errors").toString(); + return "操作失败:"+status+"_"+errors; + } + } else { + return "出现未知错误"; + } } @Override - public boolean pushFile(List busIds) throws IOException { + public String pushFile(List busIds) throws IOException { + StringBuilder stringBuilder=new StringBuilder(); LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.in(SupvFile::getBusiId, busIds); List supvFiles = supvFileMapper.selectList(lambdaQueryWrapper); @@ -309,14 +331,35 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { String s = objects.toString(); log.info(Thread.currentThread().getName() + "获取返回体 推送附件接口:" + s + "结束----!"); //TODO 调用上送接口 -// for (SupvFile supvFile : supvFiles) { -// Map map = postFileUrl(getUrl(4), null, supvFile); -// } - return true; + for (int i = 0; i < supvFiles.size(); i++) { +// Map sendFile = sendFile(getUrl(4), supvFiles.get(i)); + Map sendFile = new HashMap<>(); + log.info(Thread.currentThread().getName() + "获取返回体 总部提供附件接收接口,省公司调用此接口,完成附件上报响应结果:" + sendFile + "结束----!"); + if (sendFile.containsKey("succeed")) { + String succeed = sendFile.get("succeed"); + if(succeed.indexOf("\\\"")!=-1){ + succeed = succeed.replace("\\\"", "\""); + } + Map map = JSON.parseObject(succeed, Map.class); + String status = map.get("status").toString(); + if ("000000".equals(status)) { + String result = map.get("result").toString(); + Map mapCount = JSON.parseObject(result, Map.class); + String count = mapCount.get("count").toString(); + stringBuilder.append( "第"+i+"次操作成功:成功数据"+count+"条"); + } else { + String errors = map.get("errors").toString(); + stringBuilder.append("第"+i+"次操作失败:"+status+"_"+errors); + } + } else { + stringBuilder.append("第"+i+"次出现未知错误"); + } + } + return stringBuilder.toString(); } @Override - public boolean pushMonthReportStatistic(List monthReportId) { + public String pushMonthReportStatistic(List monthReportId) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.in(SupvReportM::getMonthReportId, monthReportId); List supvReportMList = supvReportMMapper.selectList(lambdaQueryWrapper); @@ -328,34 +371,40 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { SendParam param = new SendParam(); param.setStats(supvReportMList); param.setProvinceId("13B9B47F1E483324E05338297A0A0595"); - String s = JSON.toJSONString(param); + String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT); log.info(Thread.currentThread().getName() + "获取返回体 取消电能质量技术监督工作计划接口数据:" + s + "结束----!"); -// Map send = send(param, getUrl(5), "pqMonthReportCreate"); -// log.info(Thread.currentThread().getName() + "获取返回体 取消电能质量技术监督工作计划接口响应结果:" + s + "结束----!"); -// if (send.containsKey("succeed")) { -// String succeed = send.get("succeed"); -// String replace = succeed.replace("\\\"", "\""); -// Map map = JSON.parseObject(replace, Map.class); -// String status = map.get("status").toString(); -// if ("000000".equals(status)) { -// for (SupvReportM supvReportM : supvReportMList) { -// SupvReportM supvReportMPO = new SupvReportM(); -// supvReportMPO.setMonthReportId(supvReportM.getMonthReportId()); -// supvReportMPO.setIsUploadHead(1); -// supvReportMMapper.updateById(supvReportMPO); -// } -// } else { -// return false; -// } -// -// } else { -// return false; -// } - return true; + Map send = send(param, getUrl(5), "pqMonthReportCreate"); +// Map send = new HashMap<>(); + log.info(Thread.currentThread().getName() + "获取返回体 取消电能质量技术监督工作计划接口响应结果:" + s + "结束----!"); + if (send.containsKey("succeed")) { + String succeed = send.get("succeed"); + if(succeed.indexOf("\\\"")!=-1){ + succeed = succeed.replace("\\\"", "\""); + } + Map map = JSON.parseObject(succeed, Map.class); + String status = map.get("status").toString(); + if ("000000".equals(status)) { + for (SupvReportM supvReportM : supvReportMList) { + SupvReportM supvReportMPO = new SupvReportM(); + supvReportMPO.setMonthReportId(supvReportM.getMonthReportId()); + supvReportMPO.setIsUploadHead(1); + supvReportMMapper.updateById(supvReportMPO); + } + String result = map.get("result").toString(); + Map mapCount = JSON.parseObject(result, Map.class); + String count = mapCount.get("count").toString(); + return "操作成功:成功数据"+count+"条"; + } else { + String errors = map.get("errors").toString(); + return "操作失败:"+status+"_"+errors; + } + } else { + return "出现未知错误"; + } } @Override - public boolean deletePlan(List planIds) { + public String deletePlan(List planIds) { //判断是否已经取消上送 LambdaQueryWrapper supvPlanLambdaQueryWrapper = new LambdaQueryWrapper<>(); supvPlanLambdaQueryWrapper.in(SupvPlan::getIsUploadHead, Stream.of(0, 2).collect(Collectors.toList())).in(SupvPlan::getPlanId, planIds); @@ -376,27 +425,34 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { SendParam param = new SendParam(); param.setStats(supvPlanList); param.setProvinceId("13B9B47F1E483324E05338297A0A0595"); - String s = JSON.toJSONString(param); + String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT); log.info(Thread.currentThread().getName() + "获取返回体 删除电能质量技术监督工作计划接口数据:" + s + "结束----!"); -// Map send = send(param, getUrl(6), "pqPlanDelete"); -// log.info(Thread.currentThread().getName() + "获取返回体 删除电能质量技术监督工作计划接口响应结果:" + s + "结束----!"); -// if (send.containsKey("succeed")) { -// String succeed = send.get("succeed"); -// String replace = succeed.replace("\\\"", "\""); -// Map map = JSON.parseObject(replace, Map.class); -// String status = map.get("status").toString(); -// if ("000000".equals(status)) { -// for (SupvPlan supvPlan : supvPlanList) { -// supvPlan.setIsUploadHead(2); -// supvPlanMapper.updateById(supvPlan); -// } -// } else { -// return false; -// } -// } else { -// return false; -// } - return true; + Map send = send(param, getUrl(6), "pqPlanDelete"); +// Map send = new HashMap<>(); + log.info(Thread.currentThread().getName() + "获取返回体 删除电能质量技术监督工作计划接口响应结果:" + s + "结束----!"); + if (send.containsKey("succeed")) { + String succeed = send.get("succeed"); + if(succeed.indexOf("\\\"")!=-1){ + succeed = succeed.replace("\\\"", "\""); + } + Map map = JSON.parseObject(succeed, Map.class); + String status = map.get("status").toString(); + if ("000000".equals(status)) { + for (SupvPlan supvPlan : supvPlanList) { + supvPlan.setIsUploadHead(2); + supvPlanMapper.updateById(supvPlan); + } + String result = map.get("result").toString(); + Map mapCount = JSON.parseObject(result, Map.class); + String countNum = mapCount.get("count").toString(); + return "操作成功:成功数据"+countNum+"条"; + } else { + String errors = map.get("errors").toString(); + return "操作失败:"+status+"_"+errors; + } + } else { + return "出现未知错误"; + } } public static Map send(SendParam param, String url, String serviceName) { @@ -407,7 +463,6 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { } else { String s = JSON.toJSONString(param); log.info(Thread.currentThread().getName() + "1.信息:" + JSON.toJSONString(param)); - log.info(Thread.currentThread().getName() + "2.信息:" + s); cb = new ContentBody(s); } //ContentBody传递,要求使用post方式进行调用 @@ -424,7 +479,6 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { builder.contentBody(cb); String token = LoginToken(); - log.info(Thread.currentThread().getName() + "3.错误信息:" + token); builder.putHeaderParamsMap("x-token", token); builder.putHeaderParamsMap("serviceName", serviceName); //进行调用,返回结果 @@ -461,6 +515,72 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { return token; } + public Map sendFile(String url, SupvFile supvFile) throws IOException { + String path = supvFile.getFileUrl(); + if (StrUtil.isBlank(path)) { + throw new BusinessException("获取文件上传路径为空!请检查原始路径是否存在"); + } + String attachmentName = supvFile.getAttachmentName(); + if (StrUtil.isNotBlank(attachmentName)) { + int i = attachmentName.lastIndexOf("."); + if (i != -1) { + attachmentName = attachmentName.substring(0, i); + } + } else { + throw new BusinessException("不存在文件,文件名称"); + } + + InputStream fileStream = fileStorageUtil.getFileStream(path); + if (ObjectUtil.isNull(fileStream)) { + throw new BusinessException("文件服务器,文件不存在"); + } + + Map map=new LinkedHashMap<>(); + + //ContentBody传递,要求使用post方式进行调用 + //如果需要传递请求参数 可以拼接到请求URL中,或者设置paramsMap参数由SDK内部进行拼接 + HttpParameters.Builder builder = HttpParameters.newBuilder(); + + builder.requestURL("http://25.36.214.86:32234/CSB/WMCenter/powerQuality/file/create") // 设置请求的URL,可以拼接URL请求参数 + .api("zongbuSync") // 设置服务名 + .version("1.0.0") // 设置版本号 + .method("post") // 设置调用方式, 必须为 post + .contentType("application/x-www-form-urlencoded;charset=utf-8") //设置请求content-type + .accessKey("7d4cb2c0afb5468ca56e0654b1a442ef").secretKey("lW2xr6zKjbaqVDOSgQpcGrM6Rg0="); // 设置accessKey 和 设置secretKey + + + String token = LoginToken(); + log.info(Thread.currentThread().getName() + "3.错误信息:"+token); + builder.putHeaderParamsMap("x-token",token); + builder.putHeaderParamsMap("serviceName", "pqFileCreate"); + + String uploadTime = supvFile.getUploadTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + // 设置form请求参数 + builder.putParamsMap("uuid", supvFile.getFileUrl()) + .putParamsMap("attachmentName", supvFile.getAttachmentName()) + .putParamsMap("provinceId", "13B9B47F1E483324E05338297A0A0595") + .putParamsMap("attachmentType", supvFile.getAttachmentType()) + .putParamsMap("busiId", supvFile.getBusiId()) + .putParamsMap("uploaderName", supvFile.getUploaderName()) + .putParamsMap("uploadTime", uploadTime) + .putParamsMap("uploaderId", supvFile.getUploaderId()); + //设置上传文件 + builder.addAttachFile("file", attachmentName,fileStream); + + //进行调用,返回结果 + try { + HttpReturn ret = HttpCaller.invokeReturn(builder.build()); + String responseStr = ret.getResponseStr();//获取响应的文本串 + map.put("succeed",responseStr); + } catch (HttpCallerException e) { + // error process + log.info(Thread.currentThread().getName() + "错误信息:"+e); + map.put("error",e.toString()); + } + return map; + } + + /** * 文件上送提交 * diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvReportMServiceImpl.java b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvReportMServiceImpl.java index 95c087809..27fd35688 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvReportMServiceImpl.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvReportMServiceImpl.java @@ -140,6 +140,11 @@ public class SupvReportMServiceImpl extends MppServiceImpl processPublicDTODianYaListM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null); List processPublicDTODianYaListAll = this.baseMapper.statisticPlanReport(null,null,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null); + //本月问题数量和累计问题数量 + List processPublicDTODianYaGanM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null,null); + List processPublicDTODianYaGanAll = this.baseMapper.statisticQueReport(null,null,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null,null); + List processPublicDTODianYaGanYesM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),"01",null); + List processPublicDTODianYaGanYesAll = this.baseMapper.statisticQueReport(null,null,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),"01",null); List supvReportMBatch = new ArrayList<>(); @@ -203,12 +208,18 @@ public class SupvReportMServiceImpl extends MppServiceImpl