技术监督代码提交
This commit is contained in:
@@ -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<Object> pushPlan(@RequestBody List<String> planIds){
|
||||
public HttpResult<String> pushPlan(@RequestBody List<String> 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<Object> pushQuestion(@RequestBody List<String> problemIds){
|
||||
public HttpResult<String> pushQuestion(@RequestBody List<String> 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<String> pushQuestionUpdate(@RequestBody List<String> 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<Object> pushFile(@RequestBody List<String> busIds) throws IOException {
|
||||
public HttpResult<String> pushFile(@RequestBody List<String> 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<Object> pushMonthReportStatistic(@RequestBody List<String> monthReportId){
|
||||
public HttpResult<String> pushMonthReportStatistic(@RequestBody List<String> 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<Object> delPushPlan(@RequestBody List<String> planIds){
|
||||
public HttpResult<String> delPushPlan(@RequestBody List<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@ public interface SupvPushGwService {
|
||||
* @author cdf
|
||||
* @date 2023/6/28
|
||||
*/
|
||||
boolean pushPlan(List<String> planIds);
|
||||
String pushPlan(List<String> planIds);
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/6/28
|
||||
*/
|
||||
boolean pushQuestion(List<String> problemIds);
|
||||
String pushQuestion(List<String> problemIds,Integer type);
|
||||
|
||||
|
||||
/**
|
||||
@@ -31,7 +31,7 @@ public interface SupvPushGwService {
|
||||
* @author cdf
|
||||
* @date 2023/6/28
|
||||
*/
|
||||
boolean pushFile(List<String> busIds) throws IOException;
|
||||
String pushFile(List<String> busIds) throws IOException;
|
||||
|
||||
|
||||
/**
|
||||
@@ -39,7 +39,7 @@ public interface SupvPushGwService {
|
||||
* @author cdf
|
||||
* @date 2023/6/28
|
||||
*/
|
||||
boolean pushMonthReportStatistic(List<String> monthReportId);
|
||||
String pushMonthReportStatistic(List<String> monthReportId);
|
||||
|
||||
|
||||
/**
|
||||
@@ -47,5 +47,5 @@ public interface SupvPushGwService {
|
||||
* @author cdf
|
||||
* @date 2023/6/28
|
||||
*/
|
||||
boolean deletePlan(List<String> planIds);
|
||||
String deletePlan(List<String> planIds);
|
||||
}
|
||||
|
||||
@@ -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<SupvProblemMapper, SupvP
|
||||
public boolean addProblem(SupvProblemParam supvProblemParam) {
|
||||
SupvProblem supvProblem = new SupvProblem();
|
||||
BeanUtil.copyProperties(supvProblemParam, supvProblem);
|
||||
supvProblem.setPlanRectificationTime(PubUtils.localDateFormat(supvProblemParam.getPlanRectificationTime()));
|
||||
supvProblem.setPlanRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getPlanRectificationTime()));
|
||||
if(StrUtil.isNotBlank(supvProblemParam.getRectificationTime())) {
|
||||
supvProblem.setRectificationTime(PubUtils.localDateFormat(supvProblemParam.getRectificationTime()));
|
||||
supvProblem.setRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getRectificationTime()));
|
||||
}
|
||||
supvProblem.setIsUploadHead(0);
|
||||
this.save(supvProblem);
|
||||
@@ -69,9 +71,9 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
|
||||
public boolean updateProblem(SupvProblemParam supvProblemParam) {
|
||||
SupvProblem supvProblem = new SupvProblem();
|
||||
BeanUtil.copyProperties(supvProblemParam, supvProblem);
|
||||
supvProblem.setPlanRectificationTime(PubUtils.localDateFormat(supvProblemParam.getPlanRectificationTime()));
|
||||
supvProblem.setPlanRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getPlanRectificationTime()));
|
||||
if(StrUtil.isNotBlank(supvProblemParam.getRectificationTime())) {
|
||||
supvProblem.setRectificationTime(PubUtils.localDateFormat(supvProblemParam.getRectificationTime()));
|
||||
supvProblem.setRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getRectificationTime()));
|
||||
}
|
||||
this.updateById(supvProblem);
|
||||
return true;
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.csb.sdk.*;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
@@ -76,12 +77,12 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
private final UserFeignClient userFeignClient;
|
||||
|
||||
@Override
|
||||
public boolean pushPlan(List<String> planIds) {
|
||||
public String pushPlan(List<String> planIds) {
|
||||
LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(SupvPlan::getPlanId, planIds);
|
||||
List<SupvPlan> supvPlanList = supvPlanMapper.selectList(lambdaQueryWrapper);
|
||||
if (CollUtil.isEmpty(supvPlanList)) {
|
||||
return false;
|
||||
return "为查询数据,请查询数据是否存在!";
|
||||
}
|
||||
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
|
||||
Map<String, PvTerminalTreeVO> mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity()));
|
||||
@@ -102,7 +103,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
List<DictData> supvVoltageDicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||
Map<String, DictData> mapVoltage = supvVoltageDicList.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
|
||||
List<String> userIds = supvPlanList.stream().map(SupvPlan::getUpdateBy).distinct().collect(Collectors.toList());
|
||||
List<String> userIds = supvPlanList.stream().map(SupvPlan::getCreateBy).distinct().collect(Collectors.toList());
|
||||
List<User> userList = userFeignClient.getUserByIdList(userIds).getData();
|
||||
Map<String, User> 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<String, String> 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<String, String> send = send(param, getUrl(1), "pqPlanCreate");
|
||||
// Map<String, String> 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<String> problemIds) {
|
||||
public String pushQuestion(List<String> problemIds,Integer type) {
|
||||
LambdaQueryWrapper<SupvProblem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(SupvProblem::getProblemId, problemIds);
|
||||
List<SupvProblem> 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<String, String> send = send(param, getUrl(2), "pqProblemCreate");
|
||||
// Map<String, String> 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<String, String> 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<String, String> 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<String> busIds) throws IOException {
|
||||
public String pushFile(List<String> busIds) throws IOException {
|
||||
StringBuilder stringBuilder=new StringBuilder();
|
||||
LambdaQueryWrapper<SupvFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(SupvFile::getBusiId, busIds);
|
||||
List<SupvFile> 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<String, String> sendFile = sendFile(getUrl(4), supvFiles.get(i));
|
||||
Map<String, String> 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<String> monthReportId) {
|
||||
public String pushMonthReportStatistic(List<String> monthReportId) {
|
||||
LambdaQueryWrapper<SupvReportM> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(SupvReportM::getMonthReportId, monthReportId);
|
||||
List<SupvReportM> 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<String, String> 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<String, String> send = send(param, getUrl(5), "pqMonthReportCreate");
|
||||
// Map<String, String> 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<String> planIds) {
|
||||
public String deletePlan(List<String> planIds) {
|
||||
//判断是否已经取消上送
|
||||
LambdaQueryWrapper<SupvPlan> 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<String, String> 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<String, String> send = send(param, getUrl(6), "pqPlanDelete");
|
||||
// Map<String, String> 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<String, String> 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<String,String> 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<String,String> 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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 文件上送提交
|
||||
*
|
||||
|
||||
@@ -140,6 +140,11 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
|
||||
//电压
|
||||
List<ProcessPublicDTO> processPublicDTODianYaListM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null);
|
||||
List<ProcessPublicDTO> processPublicDTODianYaListAll = this.baseMapper.statisticPlanReport(null,null,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null);
|
||||
//本月问题数量和累计问题数量
|
||||
List<ProcessPublicDTO> processPublicDTODianYaGanM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null,null);
|
||||
List<ProcessPublicDTO> processPublicDTODianYaGanAll = this.baseMapper.statisticQueReport(null,null,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null,null);
|
||||
List<ProcessPublicDTO> processPublicDTODianYaGanYesM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),"01",null);
|
||||
List<ProcessPublicDTO> processPublicDTODianYaGanYesAll = this.baseMapper.statisticQueReport(null,null,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),"01",null);
|
||||
|
||||
|
||||
List<SupvReportM> supvReportMBatch = new ArrayList<>();
|
||||
@@ -203,12 +208,18 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
|
||||
supvReportM.setSensitiveTotalQuesNum(dealData(childrenDeptList,processPublicDTOQesMingGanAll));
|
||||
|
||||
supvReportM.setSensitiveMonthReformNum(dealData(childrenDeptList,processPublicDTOQesMingGanYesM));
|
||||
supvReportM.setSensitiveTotalReformNum(dealData(childrenDeptList,processPublicDTOQesMingGanYesAll));
|
||||
supvReportM.setSensitiveTotalReformNum(dealData(childrenDeptList,processPublicDTODianYaGanYesAll));
|
||||
|
||||
//电压
|
||||
supvReportM.setPowerMonthPlanNum(dealData(childrenDeptList,processPublicDTODianYaListM));
|
||||
Integer d = dealData(childrenDeptList,processPublicDTODianYaListAll);
|
||||
supvReportM.setPowerMonthConductedNum(d);
|
||||
|
||||
supvReportM.setPowerMonthQuesNum(dealData(childrenDeptList,processPublicDTODianYaGanM));
|
||||
supvReportM.setPowerTotalQuesNum(dealData(childrenDeptList,processPublicDTODianYaGanAll));
|
||||
supvReportM.setPowerMonthReformNum(dealData(childrenDeptList,processPublicDTODianYaGanYesM));
|
||||
supvReportM.setPowerTotalReformNum(dealData(childrenDeptList,processPublicDTODianYaGanAll));
|
||||
|
||||
all+=d;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user