1.自定义报表,模板选择修改

2.自定义报告调度,更具部门绑定来选择监测点
3.技术监督附件代码更新
This commit is contained in:
wr
2023-09-14 19:14:08 +08:00
parent b701132711
commit 3aa0dc8eeb
24 changed files with 235 additions and 205 deletions

View File

@@ -1,14 +1,20 @@
package com.njcn.process.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.SupvAlarmParam;
import com.njcn.process.pojo.param.SupvFileParam;
import com.njcn.process.pojo.po.SupvAlarm;
import com.njcn.process.pojo.po.SupvFile;
import com.njcn.process.service.ISupvFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
@@ -18,6 +24,7 @@ import com.njcn.web.controller.BaseController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* <p>
@@ -50,6 +57,16 @@ public class SupvFileController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("list")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询附件信息集合")
@ApiImplicitParam(name = "param",value = "请求体",required = true)
public HttpResult<List<SupvFile>> pageAlarm(@RequestBody SupvFileParam param){
String methodDescribe = getMethodDescribe("pageAlarm");
List<SupvFile> supvFiles = iSupvFileService.listFile(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, supvFiles, methodDescribe);
}
@PostMapping("detail")
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DOWNLOAD)
@ApiOperation("监督计划问题附件下载")

View File

@@ -89,7 +89,7 @@ public class SupvPushGwController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("推送附件接口")
@ApiImplicitParam(name = "busIds",value = "请求体",required = true)
public HttpResult<String> pushFile(@RequestBody List<String> busIds) throws IOException {
public HttpResult<String> pushFile(@RequestBody List<String> busIds) {
String methodDescribe = getMethodDescribe("pushFile");
String s = supvPushGwService.pushFile(busIds);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);

View File

@@ -2,7 +2,11 @@ package com.njcn.process.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.process.pojo.param.SupvFileParam;
import com.njcn.process.pojo.po.SupvFile;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
@@ -14,5 +18,5 @@ import com.njcn.process.pojo.po.SupvFile;
*/
public interface SupvFileMapper extends BaseMapper<SupvFile> {
SupvFile selectFile(String ids);
List<SupvFile> selectFile(@Param("param") SupvFileParam param);
}

View File

@@ -2,4 +2,26 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.process.mapper.SupvFileMapper">
<select id="selectFile" resultType="com.njcn.process.pojo.po.SupvFile">
select
sp.work_plan_name busiName,
sf.*
from
supv_file sf
INNER JOIN supv_plan sp on sp.plan_Id= sf.busi_Id
<where>
<if test="param!=null and param.ids != null and param.ids.size > 0">
AND busi_Id IN
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
<if test="param!=null and param.type != null ">
AND sf.type = #{param.type}
</if>
<if test="param!=null and param.attachmentType != null and param.attachmentType != ''">
AND sf.attachment_Type &lt;= #{param.attachmentType}
</if>
</where>
</select>
</mapper>

View File

@@ -2,10 +2,12 @@ package com.njcn.process.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.process.pojo.param.SupvFileParam;
import com.njcn.process.pojo.po.SupvFile;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* <p>
@@ -24,6 +26,7 @@ public interface ISupvFileService extends IService<SupvFile> {
*/
boolean planUpload(MultipartFile file,String planId, Integer type,String attachmentType,String uploadTime);
List<SupvFile> listFile(SupvFileParam param);
String detail(HttpServletResponse response,String busId,Integer type,String attachmentType);

View File

@@ -31,7 +31,7 @@ public interface SupvPushGwService {
* @author cdf
* @date 2023/6/28
*/
String pushFile(List<String> busIds) throws IOException;
String pushFile(List<String> busIds) ;
/**

View File

@@ -3,6 +3,7 @@ package com.njcn.process.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -10,6 +11,7 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.oss.constant.OssPath;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.process.mapper.SupvFileMapper;
import com.njcn.process.pojo.param.SupvFileParam;
import com.njcn.process.pojo.po.SupvFile;
import com.njcn.process.pojo.po.SupvPlan;
import com.njcn.process.pojo.po.SupvProblem;
@@ -67,16 +69,23 @@ public class SupvFileServiceImpl extends ServiceImpl<SupvFileMapper, SupvFile> i
if(Objects.nonNull(supvFile)){
fileStorageUtil.deleteFile(supvFile.getFileUrl());
supvFilePO.setUuid(supvFile.getUuid());
supvFilePO.setIsUploadHead(supvFile.getIsUploadHead());
fly= this.updateById(supvFilePO);
updateTime(type,planId,uploadTime,attachmentType,supvFile.getUuid());
// updateTime(type,planId,uploadTime,attachmentType,supvFile.getUuid());
}else{
supvFilePO.setCreateTime(LocalDateTime.now());
supvFilePO.setIsUploadHead(0);
fly= this.save(supvFilePO);
updateTime(type,planId,uploadTime,attachmentType,null);
// updateTime(type,planId,uploadTime,attachmentType,null);
}
return fly;
}
@Override
public List<SupvFile> listFile(SupvFileParam param) {
return this.baseMapper.selectFile(param);
}
@Override
public String detail(HttpServletResponse response,String busId, Integer type,String attachmentType) {
SupvFile supvFile = this.getOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,busId).eq(SupvFile::getType,type).eq(SupvFile::getAttachmentType,attachmentType));

View File

@@ -70,7 +70,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
private final SupvProblemMapper supvProblemMapper;
private final SupvFileMapper supvFileMapper;
private final ISupvFileService supvFileService;
private final SupvReportMMapper supvReportMMapper;
@@ -91,7 +91,9 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
@Value("${gw.url}")
private String gwUrl;
@Value("${gw.code}")
private String code;
@Override
public String pushPlan(List<String> planIds) {
@@ -227,7 +229,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
List<PlanVO> planVOS = BeanUtil.copyToList(supvPlanList, PlanVO.class);
SendParam param = new SendParam();
param.setStats(planVOS);
param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
param.setProvinceId(code);
String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT);
log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督工作计划数据接口数据:" + s + "结束----");
Map<String, String> send = send(param, getUrl(1), "pqPlanCreate");
@@ -288,7 +290,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
if (mapRe.containsKey(supvProblem.getRectificationMeasure())) {
supvProblem.setRectificationMeasure(String.format("%02d", mapRe.get(supvProblem.getRectificationMeasure()).getAlgoDescribe()));
}
supvProblem.setProvinceId("13B9B47F1E483324E05338297A0A0595");
supvProblem.setProvinceId(code);
}
if (supvProblemList.size() > 100) {
@@ -301,7 +303,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
SendParam param = new SendParam();
param.setStats(list);
param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
param.setProvinceId(code);
String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT);
log.info(Thread.currentThread().getName() + "获取返回体 删除电能质量技术监督工作计划接口数据:" + s + "结束----");
Map<String, String> send;
@@ -340,11 +342,11 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
}
@Override
public String pushFile(List<String> busIds) throws IOException {
public String pushFile(List<String> busIds) {
StringBuilder stringBuilder = new StringBuilder();
LambdaQueryWrapper<SupvFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(SupvFile::getBusiId, busIds);
List<SupvFile> supvFiles = supvFileMapper.selectList(lambdaQueryWrapper);
List<SupvFile> supvFiles = supvFileService.list(lambdaQueryWrapper);
if (supvFiles.size() > 100) {
throw new BusinessException("一次最多上送100条数据");
}
@@ -356,7 +358,6 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
DictData dictData ;
//TODO 调用上送接口
for (int i = 0; i < supvFiles.size(); i++) {
if(mapFile.containsKey(supvFiles.get(i).getAttachmentType())){
dictData = mapFile.get(supvFiles.get(i).getAttachmentType());
supvFiles.get(i).setAttachmentType(dictData.getValue());
@@ -364,9 +365,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
stringBuilder.append("" + i + "次操作失败: 请检查上送附件类型是否正确");
continue;
}
// Map<String, String> sendFile = sendFile(getUrl(4), supvFiles.get(i));
Map<String, String> sendFile = new HashMap<>();
Map<String, String> sendFile = sendFile(getUrl(4), supvFiles.get(i));
log.info(Thread.currentThread().getName() + "获取返回体 总部提供附件接收接口,省公司调用此接口,完成附件上报响应结果:" + sendFile + "结束----");
if (sendFile.containsKey("succeed")) {
String succeed = sendFile.get("succeed");
@@ -376,6 +375,10 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
Map map = JSON.parseObject(succeed, Map.class);
String status = map.get("status").toString();
if ("000000".equals(status)) {
supvFileService.update(new LambdaUpdateWrapper<SupvFile>()
.eq(SupvFile::getUuid,supvFiles.get(i).getUuid())
.set(SupvFile::getIsUploadHead,1)
);
String result = map.get("result").toString();
Map mapCount = JSON.parseObject(result, Map.class);
String count = mapCount.get("count").toString();
@@ -403,7 +406,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
//TODO 调用上送接口
SendParam param = new SendParam();
param.setStats(supvReportMList);
param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
param.setProvinceId(code);
String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT);
log.info(Thread.currentThread().getName() + "获取返回体 取消电能质量技术监督工作计划接口数据:" + s + "结束----");
Map<String, String> send = send(param, getUrl(5), "pqMonthReportCreate");
@@ -454,7 +457,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
//TODO
SendParam param = new SendParam();
param.setStats(supvPlanList);
param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
param.setProvinceId(code);
String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT);
log.info(Thread.currentThread().getName() + "获取返回体 删除电能质量技术监督工作计划接口数据:" + s + "结束----");
Map<String, String> send = send(param, getUrl(6), "pqPlanDelete");
@@ -504,7 +507,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
List<PlanHisVO> list = BeanUtil.copyToList(supvPlanHis, PlanHisVO.class);
SendParam param = new SendParam();
param.setStats(list);
param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
param.setProvinceId(code);
String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT);
log.info(Thread.currentThread().getName() + "获取返回体 预告警单数据接口:" + s + "结束----");
Map<String, String> send = send(param, getUrl(7), "pqPlanCreateHis");
@@ -568,7 +571,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
List<AlarmVO> list = BeanUtil.copyToList(supvAlarms, AlarmVO.class);
SendParam param = new SendParam();
param.setStats(list);
param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
param.setProvinceId(code);
String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT);
log.info(Thread.currentThread().getName() + "获取返回体 工作计划变更历史数据接口:" + s + "结束----");
Map<String, String> send = send(param, getUrl(8), "pqAlarmCreate");
@@ -609,7 +612,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
List<AlarmBackVO> list = BeanUtil.copyToList(supvAlarmBacks, AlarmBackVO.class);
SendParam param = new SendParam();
param.setStats(list);
param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
param.setProvinceId(code);
String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT);
log.info(Thread.currentThread().getName() + "获取返回体 工作计划变更历史数据接口:" + s + "结束----");
Map<String, String> send = send(param, getUrl(9), "pqAlarmBackCreate");
@@ -709,7 +712,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
return token;
}
public Map<String, String> sendFile(String url, SupvFile supvFile) throws IOException {
public Map<String, String> sendFile(String url, SupvFile supvFile) {
String path = supvFile.getFileUrl();
if (StrUtil.isBlank(path)) {
throw new BusinessException("获取文件上传路径为空!请检查原始路径是否存在");
@@ -752,7 +755,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
// 设置form请求参数
builder.putParamsMap("uuid", supvFile.getFileUrl())
.putParamsMap("attachmentName", supvFile.getAttachmentName())
.putParamsMap("provinceId", "13B9B47F1E483324E05338297A0A0595")
.putParamsMap("provinceId", code)
.putParamsMap("attachmentType", supvFile.getAttachmentType())
.putParamsMap("busiId", supvFile.getBusiId())
.putParamsMap("uploaderName", supvFile.getUploaderName())