Browse Source

fix: 调整抚慰金呈报的模板

master
wxc 4 months ago
parent
commit
2d870aa749
  1. 9
      pom.xml
  2. 11
      src/main/java/com/biutag/supervision/controller/FileController.java
  3. 1
      src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaint12337Controller.java
  4. 5
      src/main/java/com/biutag/supervision/controller/supervise/SuperviseReportController.java
  5. 4
      src/main/java/com/biutag/supervision/pojo/dto/DataPetition12337Dto.java
  6. 2
      src/main/java/com/biutag/supervision/pojo/entity/RpcApply.java
  7. 10
      src/main/java/com/biutag/supervision/pojo/vo/ExportNegativeVo.java
  8. 12
      src/main/java/com/biutag/supervision/pojo/vo/RpcApplyVo.java
  9. 3
      src/main/java/com/biutag/supervision/pojo/vo/SuperviseReportVo.java
  10. 3
      src/main/java/com/biutag/supervision/service/RpcApplyApproveService.java
  11. 4
      src/main/java/com/biutag/supervision/service/RpcApplyService.java
  12. 79
      src/main/java/com/biutag/supervision/service/RpcComfortPacksService.java
  13. 7
      src/main/java/com/biutag/supervision/service/SuperviseReportFileService.java
  14. 15
      src/main/java/com/biutag/supervision/service/SuperviseReportService.java
  15. 11
      src/main/java/com/biutag/supervision/util/WordUtil.java
  16. 4
      src/main/resources/mapper/NegativeCointersignMapper.xml
  17. 5
      src/main/resources/mapper/RpcApplyMapper.xml
  18. 3
      src/main/resources/static/templates/5、民警维权抚慰申请表.doc
  19. 1922
      src/main/resources/static/templates/ftl/2、维权抚慰登记表.xml
  20. 2752
      src/main/resources/static/templates/ftl/3、抚慰金申报批处理表.xml
  21. 2218
      src/main/resources/static/templates/ftl/4、抚慰金申请发放明细表.xml
  22. 3379
      src/main/resources/static/templates/ftl/5、民警维权抚慰申请表.xml
  23. 41
      src/test/java/com/biutag/supervision/StrUtil.java

9
pom.xml

@ -101,8 +101,7 @@
<artifactId>gbase-jdbc</artifactId> <artifactId>gbase-jdbc</artifactId>
<scope>system</scope> <scope>system</scope>
<version>8.3.81.53-build55.2.1-bin</version> <version>8.3.81.53-build55.2.1-bin</version>
<systemPath>${project.basedir}/src/main/resources/lib/gbase-connector-java-8.3.81.53-build52.8-bin.jar <systemPath>${project.basedir}/src/main/resources/lib/gbase-connector-java-8.3.81.53-build52.8-bin.jar</systemPath>
</systemPath>
</dependency> </dependency>
<!-- dm数据库 JDBC驱动 --> <!-- dm数据库 JDBC驱动 -->
@ -230,6 +229,12 @@
<version>3.0.1</version> <version>3.0.1</version>
</dependency> </dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.17.2</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

11
src/main/java/com/biutag/supervision/controller/FileController.java

@ -3,6 +3,7 @@ package com.biutag.supervision.controller;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.biutag.supervision.mapper.FileBase64Mapper; import com.biutag.supervision.mapper.FileBase64Mapper;
import com.biutag.supervision.pojo.Result; import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.dto.FileBase64Dto; import com.biutag.supervision.pojo.dto.FileBase64Dto;
@ -11,6 +12,7 @@ import com.biutag.supervision.pojo.vo.FileVo;
import com.biutag.supervision.service.FileService; import com.biutag.supervision.service.FileService;
import com.biutag.supervision.util.ImgUtils; import com.biutag.supervision.util.ImgUtils;
import com.biutag.supervision.util.WordUtil; import com.biutag.supervision.util.WordUtil;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -88,4 +90,13 @@ public class FileController {
return Result.success(base64); return Result.success(base64);
} }
@Operation(summary = "附件转HTMl(word)")
@ResponseBody
@GetMapping("convertHtml/**")
public Result<JSONObject> convertHtml(HttpServletRequest request) {
String requestURI = request.getRequestURI();
InputStream is = fileService.download(requestURI.substring("/file/convertHtml/".length()));
return Result.success(JSONObject.of("html", WordUtil.convertHtml(is)));
}
} }

1
src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaint12337Controller.java

@ -93,6 +93,7 @@ public class DataPetitionComplaint12337Controller {
List<SupDepart> departs = departService.list(new LambdaUpdateWrapper<SupDepart>().eq(SupDepart::getShortName, data.getReviewOrg())); List<SupDepart> departs = departService.list(new LambdaUpdateWrapper<SupDepart>().eq(SupDepart::getShortName, data.getReviewOrg()));
if (departs.size() == 1) { if (departs.size() == 1) {
data.setDepartId(departs.get(0).getId()); data.setDepartId(departs.get(0).getId());
data.setDepartName(departs.get(0).getShortName());
} }
} }
list.add(data); list.add(data);

5
src/main/java/com/biutag/supervision/controller/supervise/SuperviseReportController.java

@ -35,6 +35,11 @@ public class SuperviseReportController {
return Result.success(service.page(queryParam)); return Result.success(service.page(queryParam));
} }
@GetMapping("detail/{id}")
Result<SuperviseReportVo> get(@PathVariable String id){
return Result.success(service.get(id));
}
@GetMapping("subQueryPage") @GetMapping("subQueryPage")
Result<Page<SuperviseReportVo>> subQueryPage(SuperviseReportQueryParam queryParam){ Result<Page<SuperviseReportVo>> subQueryPage(SuperviseReportQueryParam queryParam){
return Result.success(service.page(queryParam)); return Result.success(service.page(queryParam));

4
src/main/java/com/biutag/supervision/pojo/dto/DataPetition12337Dto.java

@ -8,7 +8,6 @@ import jakarta.validation.constraints.NotNull;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
/** /**
@ -560,4 +559,7 @@ public class DataPetition12337Dto {
@NotBlank(message = "核查办理单位不能为空") @NotBlank(message = "核查办理单位不能为空")
private String departId; private String departId;
@ExcelIgnore
private String departName;
} }

2
src/main/java/com/biutag/supervision/pojo/entity/RpcApply.java

@ -116,4 +116,6 @@ public class RpcApply {
// 数据来源 // 数据来源
private String source; private String source;
private String crtUser;
} }

10
src/main/java/com/biutag/supervision/pojo/vo/ExportNegativeVo.java

@ -1,7 +1,6 @@
package com.biutag.supervision.pojo.vo; package com.biutag.supervision.pojo.vo;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -25,15 +24,16 @@ public class ExportNegativeVo {
private String caseNumber; private String caseNumber;
// 问题发生时间 // 问题发生时间
@ExcelProperty({"问题基本信息","问题发生时间"}) @ExcelProperty(value = {"问题基本信息","问题发生时间"}, format = "yyyy-MM-dd HH:mm")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime happenTime; private LocalDateTime happenTime;
// 问题发现时间 // 问题发现时间
@ExcelProperty({"问题基本信息","问题发现时间"}) @ExcelProperty(value = {"问题基本信息","问题发现时间"}, format = "yyyy-MM-dd HH:mm")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime discoveryTime; private LocalDateTime discoveryTime;
@ExcelProperty(value = {"问题基本信息","问题录入时间"}, format = "yyyy-MM-dd")
private LocalDateTime crtTime;
// 问题来源 // 问题来源
@ExcelProperty({"问题基本信息","问题来源"}) @ExcelProperty({"问题基本信息","问题来源"})
private String problemSources; private String problemSources;

12
src/main/java/com/biutag/supervision/pojo/vo/RpcApplyVo.java

@ -1,5 +1,6 @@
package com.biutag.supervision.pojo.vo; package com.biutag.supervision.pojo.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -27,23 +28,34 @@ public class RpcApplyVo {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm")
private LocalDateTime happenTime; private LocalDateTime happenTime;
private String happenTimeStr;
// 部门id // 部门id
private String departId; private String departId;
// 部门 // 部门
private String departName; private String departName;
private String departFullName;
private String applicantEmpName; private String applicantEmpName;
private String applicantEmpNo; private String applicantEmpNo;
private String idCode;
// 人员类型
private String personType;
// 开户行 // 开户行
private String bankCard; private String bankCard;
// 支行信息 // 支行信息
private String bankBranch; private String bankBranch;
private String bankCardAccount;
private String rpcStatus; private String rpcStatus;
private String approver; private String approver;

3
src/main/java/com/biutag/supervision/pojo/vo/SuperviseReportVo.java

@ -1,7 +1,7 @@
package com.biutag.supervision.pojo.vo; package com.biutag.supervision.pojo.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.biutag.supervision.pojo.entity.SuperviseReportFile; import com.biutag.supervision.pojo.entity.SuperviseReportFile;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -17,6 +17,7 @@ public class SuperviseReportVo {
//督察报告 //督察报告
private String reportName; private String reportName;
//创建人 //创建人
@JsonFormat(pattern = "yyyy-MM-dd")
private Date crtTime; private Date crtTime;
//创建单位 //创建单位
private String crtDepart; private String crtDepart;

3
src/main/java/com/biutag/supervision/service/RpcApplyApproveService.java

@ -1,5 +1,6 @@
package com.biutag.supervision.service; package com.biutag.supervision.service;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.mapper.RpcApplyApproveMapper; import com.biutag.supervision.mapper.RpcApplyApproveMapper;
@ -19,7 +20,7 @@ public class RpcApplyApproveService extends ServiceImpl<RpcApplyApproveMapper, R
RpcApplyApproveVo approveVo1 = new RpcApplyApproveVo(); RpcApplyApproveVo approveVo1 = new RpcApplyApproveVo();
approveVo1.setActionName("申请抚慰"); approveVo1.setActionName("申请抚慰");
approveVo1.setReturnFlag(false); approveVo1.setReturnFlag(false);
approveVo1.setHandleName(rpcApply.getDepartName() + " " + rpcApply.getApplicantEmpName()); approveVo1.setHandleName(rpcApply.getDepartName() + " " + (StrUtil.isNotBlank(rpcApply.getCrtUser())? rpcApply.getCrtUser() : ""));
approveVo1.setCreateTime(rpcApply.getCrtTime()); approveVo1.setCreateTime(rpcApply.getCrtTime());
List<RpcApplyApprove> list = list(new LambdaQueryWrapper<RpcApplyApprove>().eq(RpcApplyApprove::getRpcId, rpcApply.getRpcId()).orderByDesc(RpcApplyApprove::getCreateTime)); List<RpcApplyApprove> list = list(new LambdaQueryWrapper<RpcApplyApprove>().eq(RpcApplyApprove::getRpcId, rpcApply.getRpcId()).orderByDesc(RpcApplyApprove::getCreateTime));
RpcApplyApproveVo approveVo2 = new RpcApplyApproveVo(); RpcApplyApproveVo approveVo2 = new RpcApplyApproveVo();

4
src/main/java/com/biutag/supervision/service/RpcApplyService.java

@ -109,12 +109,14 @@ public class RpcApplyService extends ServiceImpl<RpcApplyMapper, RpcApply> {
} }
rpcApply.setRpcStatus(ComfortStatus.approval.name()); rpcApply.setRpcStatus(ComfortStatus.approval.name());
rpcApply.setStep(2); rpcApply.setStep(2);
UserAuth user = UserContextHolder.getCurrentUser();
rpcApply.setCrtUser(user.getNickName());
save(rpcApply); save(rpcApply);
// 已办 // 已办
RpcApplyWork done = new RpcApplyWork(); RpcApplyWork done = new RpcApplyWork();
done.setRpcId(rpcApply.getRpcId()); done.setRpcId(rpcApply.getRpcId());
done.setStatus(WorkStatusEnum.done.name()); done.setStatus(WorkStatusEnum.done.name());
done.setHandleIdCode(UserContextHolder.getCurrentUser().getUserName()); done.setHandleIdCode(user.getUserName());
done.setCreateTime(LocalDateTime.now()); done.setCreateTime(LocalDateTime.now());
done.setStep(1); done.setStep(1);
rpcApplyWorkService.save(done); rpcApplyWorkService.save(done);

79
src/main/java/com/biutag/supervision/service/RpcComfortPacksService.java

@ -5,15 +5,19 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ZipUtil; import cn.hutool.core.util.ZipUtil;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.constants.enums.ComfortStatus; import com.biutag.supervision.constants.enums.ComfortStatus;
import com.biutag.supervision.constants.enums.PersonTypeEnum;
import com.biutag.supervision.mapper.RpcComfortPacksMapper; import com.biutag.supervision.mapper.RpcComfortPacksMapper;
import com.biutag.supervision.pojo.dto.ComfortPacksDto; import com.biutag.supervision.pojo.dto.ComfortPacksDto;
import com.biutag.supervision.pojo.entity.RpcComfortPacks; import com.biutag.supervision.pojo.entity.RpcComfortPacks;
import com.biutag.supervision.pojo.entity.RpcRightPerson; import com.biutag.supervision.pojo.entity.RpcRightPerson;
import com.biutag.supervision.pojo.entity.SupPolice;
import com.biutag.supervision.pojo.vo.RpcApplyVo; import com.biutag.supervision.pojo.vo.RpcApplyVo;
import com.biutag.supervision.pojo.vo.RpcComfortPacksVo; import com.biutag.supervision.pojo.vo.RpcComfortPacksVo;
import com.biutag.supervision.util.Arrays; import com.biutag.supervision.util.Arrays;
@ -24,10 +28,13 @@ import freemarker.template.Version;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -40,9 +47,10 @@ public class RpcComfortPacksService extends ServiceImpl<RpcComfortPacksMapper, R
private final RpcPacksComfortService rpcPacksComfortService; private final RpcPacksComfortService rpcPacksComfortService;
private final RpcRightPersonService rpcRightPersonService; private final RpcRightPersonService rpcRightPersonService;
private final FileService fileService; private final FileService fileService;
private final SupPoliceService policeService;
private final Template template1; private final Template template1;
private final Template template2; private final Template template2;
@ -53,11 +61,12 @@ public class RpcComfortPacksService extends ServiceImpl<RpcComfortPacksMapper, R
private final Template template5; private final Template template5;
public RpcComfortPacksService(RpcApplyService rpcApplyService, RpcPacksComfortService rpcPacksComfortService, RpcRightPersonService rpcRightPersonService, FileService fileService) throws IOException { public RpcComfortPacksService(RpcApplyService rpcApplyService, RpcPacksComfortService rpcPacksComfortService, RpcRightPersonService rpcRightPersonService, FileService fileService, SupPoliceService policeService) throws IOException {
this.rpcApplyService = rpcApplyService; this.rpcApplyService = rpcApplyService;
this.rpcPacksComfortService = rpcPacksComfortService; this.rpcPacksComfortService = rpcPacksComfortService;
this.rpcRightPersonService = rpcRightPersonService; this.rpcRightPersonService = rpcRightPersonService;
this.fileService = fileService; this.fileService = fileService;
this.policeService = policeService;
// //
Configuration configuration = new Configuration(new Version("2.3.28")); Configuration configuration = new Configuration(new Version("2.3.28"));
configuration.setDefaultEncoding("UTF-8"); configuration.setDefaultEncoding("UTF-8");
@ -65,10 +74,10 @@ public class RpcComfortPacksService extends ServiceImpl<RpcComfortPacksMapper, R
// 设置FreeMarker生成Word文档所需要的模板的路径 // 设置FreeMarker生成Word文档所需要的模板的路径
configuration.setClassLoaderForTemplateLoading(RpcComfortPacksService.class.getClassLoader(), ""); configuration.setClassLoaderForTemplateLoading(RpcComfortPacksService.class.getClassLoader(), "");
this.template1 = configuration.getTemplate("static/templates/ftl/1、抚慰金审批签呈.xml", "UTF-8"); this.template1 = configuration.getTemplate("static/templates/ftl/1、抚慰金审批签呈.xml", "UTF-8");
this.template2 = configuration.getTemplate("static/templates/ftl/2、维权抚慰登记表.xml", "UTF-8"); this.template2 = configuration.getTemplate("static/templates/ftl/2、抚慰金申报批处理表.xml", "UTF-8");
this.template3 = configuration.getTemplate("static/templates/ftl/3、抚慰金申报批处理表.xml", "UTF-8"); this.template3 = configuration.getTemplate("static/templates/ftl/3、维权抚慰登记表.xml", "UTF-8");
this.template4 = configuration.getTemplate("static/templates/ftl/、抚慰金申请发放明细表.xml", "UTF-8"); this.template4 = configuration.getTemplate("static/templates/ftl/4、抚慰金申请发放明细表.xml", "UTF-8");
this.template5 = configuration.getTemplate("static/templates/ftl/、民警维权抚慰申请表.xml", "UTF-8"); this.template5 = configuration.getTemplate("static/templates/ftl/5、民警维权抚慰申请表.xml", "UTF-8");
} }
@ -95,6 +104,13 @@ public class RpcComfortPacksService extends ServiceImpl<RpcComfortPacksMapper, R
}); });
save(rpcComfortPacks); save(rpcComfortPacks);
rpcPacksComfortService.saveBatch(rpcComfortPacks.getId(), rpcIds); rpcPacksComfortService.saveBatch(rpcComfortPacks.getId(), rpcIds);
List<SupPolice> polices = policeService.list(new LambdaQueryWrapper<SupPolice>().in(SupPolice::getEmpNo, comfortPacksDto.getComforts().stream().map(RpcApplyVo::getApplicantEmpNo).toList()));
comfortPacksDto.getComforts().forEach(item -> {
String personType = polices.stream().filter(p -> p.getEmpNo().equals(item.getApplicantEmpNo())).findFirst().map(SupPolice::getPersonType).orElse("");
item.setPersonType(StrUtil.isNotBlank(personType) ? PersonTypeEnum.getLabel(personType) : "");
item.setHappenTimeStr(item.getHappenTime().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")));
});
// 生成呈报文件 // 生成呈报文件
genReports(rpcComfortPacks, comfortPacksDto.getComforts()); genReports(rpcComfortPacks, comfortPacksDto.getComforts());
return true; return true;
@ -105,36 +121,65 @@ public class RpcComfortPacksService extends ServiceImpl<RpcComfortPacksMapper, R
comforts.forEach(item -> { comforts.forEach(item -> {
item.setSexName(item.getSex() == 0 ? "男" : item.getSex() == 1 ?"女" : ""); item.setSexName(item.getSex() == 0 ? "男" : item.getSex() == 1 ?"女" : "");
}); });
String rightsPersons = rpcRightPersonService.listByCouncil().stream().map(RpcRightPerson::getEmpName).collect(Collectors.joining(" ")); //String rightsPersons = rpcRightPersonService.listByCouncil().stream().map(RpcRightPerson::getEmpName).collect(Collectors.joining(" "));
List<LocalDate> applyDates = comforts.stream().map(RpcApplyVo::getApplyDate).sorted().toList();
String applyMonth;
String applyDate;
List<String> distinctDates = applyDates.stream().map(item -> item.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"))).distinct().toList();
LocalDate beginDate = applyDates.get(0);
LocalDate endDate = applyDates.get(applyDates.size() - 1);
// 同一日
if (distinctDates.size() == 1) {
applyMonth = beginDate.format(DateTimeFormatter.ofPattern("yyyy年MM月"));
applyDate = distinctDates.get(0);
} else {
// 同一年
if (beginDate.getYear() == endDate.getYear()) {
// 同一月
if (beginDate.getMonth() == endDate.getMonth()) {
applyMonth = beginDate.format(DateTimeFormatter.ofPattern("yyyy年MM月"));
applyDate = distinctDates.get(0) + "至" + endDate.format(DateTimeFormatter.ofPattern("dd日"));
} else {
applyMonth = beginDate.format(DateTimeFormatter.ofPattern("yyyy年MM月")) + "至" + endDate.format(DateTimeFormatter.ofPattern("MM月"));
applyDate = distinctDates.get(0) + "至" + endDate.format(DateTimeFormatter.ofPattern("MM月dd日"));
}
} else {
applyMonth = beginDate.format(DateTimeFormatter.ofPattern("yyyy年MM月")) + "至" + endDate.format(DateTimeFormatter.ofPattern("yyyy年MM月"));
applyDate = distinctDates.get(0) + "至" + endDate.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
}
}
// 1、抚慰金审批签呈 // 1、抚慰金审批签呈
String reportMoneyChinese = NumberChineseFormatter.format(rpcComfortPacks.getReportMoney(), true) + "元整";
JSONObject data1 = new JSONObject() JSONObject data1 = new JSONObject()
.fluentPut("monthDate", DateUtil.format(new Date(), "yyyy年MM月")) .fluentPut("applyMonth", applyMonth)
.fluentPut("applyDate", applyDate)
.fluentPut("policeName", comforts.get(0).getApplicantEmpName()) .fluentPut("policeName", comforts.get(0).getApplicantEmpName())
.fluentPut("reportNum", rpcComfortPacks.getReportNum()) .fluentPut("reportNum", rpcComfortPacks.getReportNum())
.fluentPut("reportMoney", rpcComfortPacks.getReportMoney()) .fluentPut("reportMoney", rpcComfortPacks.getReportMoney())
.fluentPut("reportMoneyChinese", NumberChineseFormatter.format(rpcComfortPacks.getReportMoney(), true)) .fluentPut("reportMoneyChinese", reportMoneyChinese)
.fluentPut("rightsPersons", rightsPersons)
.fluentPut("date", DateUtil.format(new Date(), "yyyy年MM月dd日")); .fluentPut("date", DateUtil.format(new Date(), "yyyy年MM月dd日"));
ByteArrayOutputStream os1 = new ByteArrayOutputStream(); ByteArrayOutputStream os1 = new ByteArrayOutputStream();
template1.process(data1, new BufferedWriter(new OutputStreamWriter(os1, StandardCharsets.UTF_8))); template1.process(data1, new BufferedWriter(new OutputStreamWriter(os1, StandardCharsets.UTF_8)));
// 2、维权抚慰登记表 // 2、抚慰金申报批处理
JSONObject data2 = new JSONObject() JSONObject data2 = new JSONObject()
.fluentPut("rpcApplys", comforts); .fluentPut("rpcApplys", comforts)
.fluentPut("reportMoney", rpcComfortPacks.getReportMoney())
.fluentPut("reportMoneyChinese", reportMoneyChinese);
ByteArrayOutputStream os2 = new ByteArrayOutputStream(); ByteArrayOutputStream os2 = new ByteArrayOutputStream();
template2.process(data2, new BufferedWriter(new OutputStreamWriter(os2, StandardCharsets.UTF_8))); template2.process(data2, new BufferedWriter(new OutputStreamWriter(os2, StandardCharsets.UTF_8)));
// 3、抚慰金申报批处理表 // 3、维权抚慰登记表.xml
JSONObject data3 = new JSONObject() JSONObject data3 = new JSONObject()
.fluentPut("rpcApplys", comforts) .fluentPut("rpcApplys", comforts)
.fluentPut("reportMoney", rpcComfortPacks.getReportMoney()) .fluentPut("applyMonth", applyMonth);
.fluentPut("reportMoneyChinese", NumberChineseFormatter.format(rpcComfortPacks.getReportMoney(), true));
ByteArrayOutputStream os3 = new ByteArrayOutputStream(); ByteArrayOutputStream os3 = new ByteArrayOutputStream();
template3.process(data3, new BufferedWriter(new OutputStreamWriter(os3, StandardCharsets.UTF_8))); template3.process(data3, new BufferedWriter(new OutputStreamWriter(os3, StandardCharsets.UTF_8)));
// 、抚慰金申请发放明细表.xml // 4、抚慰金申请发放明细表.xml
JSONObject data4 = new JSONObject() JSONObject data4 = new JSONObject()
.fluentPut("rpcApplys", comforts) .fluentPut("rpcApplys", comforts)
.fluentPut("applyMonth", applyMonth)
.fluentPut("reportMoney", rpcComfortPacks.getReportMoney()); .fluentPut("reportMoney", rpcComfortPacks.getReportMoney());
ByteArrayOutputStream os4 = new ByteArrayOutputStream(); ByteArrayOutputStream os4 = new ByteArrayOutputStream();
template4.process(data4, new BufferedWriter(new OutputStreamWriter(os4, StandardCharsets.UTF_8))); template4.process(data4, new BufferedWriter(new OutputStreamWriter(os4, StandardCharsets.UTF_8)));
@ -146,7 +191,7 @@ public class RpcComfortPacksService extends ServiceImpl<RpcComfortPacksMapper, R
template5.process(data5, new BufferedWriter(new OutputStreamWriter(os5, StandardCharsets.UTF_8))); template5.process(data5, new BufferedWriter(new OutputStreamWriter(os5, StandardCharsets.UTF_8)));
ByteArrayOutputStream zipOs = new ByteArrayOutputStream(); ByteArrayOutputStream zipOs = new ByteArrayOutputStream();
ZipUtil.zip(zipOs, Arrays.array("1、抚慰金审批签呈.doc", "2、维权抚慰登记表.doc", "3、抚慰金申报批处理表.doc", "4、抚慰金申请发放明细表.doc", "5、民警维权抚慰申请表.doc"), ZipUtil.zip(zipOs, Arrays.array("1、抚慰金审批签呈.doc", "2、抚慰金申报批处理表.doc", "3、维权抚慰登记表.doc", "4、抚慰金申请发放明细表.doc", "5、民警维权抚慰申请表.doc"),
Arrays.array(IoUtil.toStream(os1), IoUtil.toStream(os2), IoUtil.toStream(os3), IoUtil.toStream(os4), IoUtil.toStream(os5))); Arrays.array(IoUtil.toStream(os1), IoUtil.toStream(os2), IoUtil.toStream(os3), IoUtil.toStream(os4), IoUtil.toStream(os5)));
// 上传 // 上传
ByteArrayInputStream zipIs = IoUtil.toStream(zipOs); ByteArrayInputStream zipIs = IoUtil.toStream(zipOs);

7
src/main/java/com/biutag/supervision/service/SuperviseReportFileService.java

@ -1,10 +1,17 @@
package com.biutag.supervision.service; package com.biutag.supervision.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.mapper.SuperviseReportFileMapper; import com.biutag.supervision.mapper.SuperviseReportFileMapper;
import com.biutag.supervision.pojo.entity.SuperviseReportFile; import com.biutag.supervision.pojo.entity.SuperviseReportFile;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
@Service @Service
public class SuperviseReportFileService extends ServiceImpl<SuperviseReportFileMapper, SuperviseReportFile> { public class SuperviseReportFileService extends ServiceImpl<SuperviseReportFileMapper, SuperviseReportFile> {
public List<SuperviseReportFile> list(String superviseId) {
return list(new LambdaQueryWrapper<SuperviseReportFile>().eq(SuperviseReportFile::getSuperviseId, superviseId));
}
} }

15
src/main/java/com/biutag/supervision/service/SuperviseReportService.java

@ -4,7 +4,6 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -16,14 +15,11 @@ import com.biutag.supervision.constants.enums.SuperviseReportTypeEnum;
import com.biutag.supervision.mapper.SuperviseReportMapper; import com.biutag.supervision.mapper.SuperviseReportMapper;
import com.biutag.supervision.pojo.entity.*; import com.biutag.supervision.pojo.entity.*;
import com.biutag.supervision.pojo.model.UserAuth; import com.biutag.supervision.pojo.model.UserAuth;
import com.biutag.supervision.pojo.param.SamplingQueryParam;
import com.biutag.supervision.pojo.param.SuperviseReportQueryParam; import com.biutag.supervision.pojo.param.SuperviseReportQueryParam;
import com.biutag.supervision.pojo.vo.SamplingVo;
import com.biutag.supervision.pojo.vo.SuperviseReportVo; import com.biutag.supervision.pojo.vo.SuperviseReportVo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
@ -71,7 +67,7 @@ public class SuperviseReportService extends ServiceImpl<SuperviseReportMapper, S
Page<SuperviseReportVo> page= baseMapper.queryPage(Page.of(queryParam.getCurrent(), queryParam.getSize()), queryWrapper); Page<SuperviseReportVo> page= baseMapper.queryPage(Page.of(queryParam.getCurrent(), queryParam.getSize()), queryWrapper);
page.getRecords().forEach(s->{ page.getRecords().forEach(s->{
List<SuperviseReportFile> files= superviseReportFileService.list(new LambdaQueryWrapper<SuperviseReportFile>().eq(SuperviseReportFile::getSuperviseId,s.getId())); List<SuperviseReportFile> files= superviseReportFileService.list(s.getId());
if(CollectionUtil.isNotEmpty(files)){ if(CollectionUtil.isNotEmpty(files)){
s.setFiles(files); s.setFiles(files);
} }
@ -125,7 +121,7 @@ public class SuperviseReportService extends ServiceImpl<SuperviseReportMapper, S
SuperviseReportDepart reportDepart = new SuperviseReportDepart(); SuperviseReportDepart reportDepart = new SuperviseReportDepart();
reportDepart.setDepartId(d.getId()); reportDepart.setDepartId(d.getId());
reportDepart.setDepartName(d.getShortName()); reportDepart.setDepartName(d.getShortName());
reportDepart.setSuperviseId(vo.getId()); reportDepart.setSuperviseId(report.getId());
return reportDepart; return reportDepart;
}).toList(); }).toList();
superviseReportDepartService.saveBatch(list); superviseReportDepartService.saveBatch(list);
@ -167,4 +163,11 @@ public class SuperviseReportService extends ServiceImpl<SuperviseReportMapper, S
} }
public SuperviseReportVo get(String id){
SuperviseReportVo reportVo = new SuperviseReportVo();
BeanUtil.copyProperties(getById(id), reportVo);
reportVo.setFiles(superviseReportFileService.list(id));
return reportVo;
}
} }

11
src/main/java/com/biutag/supervision/util/WordUtil.java

@ -4,6 +4,7 @@ import com.aspose.words.Document;
import com.aspose.words.License; import com.aspose.words.License;
import com.aspose.words.SaveFormat; import com.aspose.words.SaveFormat;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jsoup.Jsoup;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -23,6 +24,16 @@ public class WordUtil {
} }
} }
public static String convertHtml(InputStream is) {
getLicense();
try {
Document doc = new Document(is);
return Jsoup.parse(doc.toString(SaveFormat.HTML)).getElementsByTag("body").html();
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
public static boolean getLicense() { public static boolean getLicense() {
try (InputStream is = WordUtil.class.getResourceAsStream("/license/words.license.xml")){ try (InputStream is = WordUtil.class.getResourceAsStream("/license/words.license.xml")){
License aposeLic = new License(); License aposeLic = new License();

4
src/main/resources/mapper/NegativeCointersignMapper.xml

@ -9,8 +9,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
DISTINCT n.* DISTINCT n.*
FROM FROM
negative n negative n
left join negative_countersign c on n.id = c.negative_id right join negative_countersign c on n.id = c.negative_id
left join negative_countersign_apply a on n.id = a.negative_id right join negative_countersign_apply a on n.id = a.negative_id
${ew.getCustomSqlSegment} ${ew.getCustomSqlSegment}
</select> </select>

5
src/main/resources/mapper/RpcApplyMapper.xml

@ -6,11 +6,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryPage" resultType="com.biutag.supervision.pojo.vo.RpcApplyVo"> <select id="queryPage" resultType="com.biutag.supervision.pojo.vo.RpcApplyVo">
SELECT SELECT
a.*, p.*, ap.injury_severity, ap.injury_severity_name a.*, p.*, ap.injury_severity, ap.injury_severity_name,
CASE WHEN d.level = 3 THEN CONCAT(d1.short_name, d.short_name) ELSE d.short_name END depart_full_name
FROM FROM
rpc_apply a rpc_apply a
LEFT JOIN rpc_person p ON a.rpc_id = p.rpc_id LEFT JOIN rpc_person p ON a.rpc_id = p.rpc_id
LEFT JOIN rpc_apply_person ap ON a.rpc_id = ap.rpc_id LEFT JOIN rpc_apply_person ap ON a.rpc_id = ap.rpc_id
LEFT JOIN sup_depart d ON a.depart_id = d.id
LEFT JOIN sup_depart d1 ON d.pid = d1.id
${ew.getCustomSqlSegment} ${ew.getCustomSqlSegment}
</select> </select>

3
src/main/resources/static/templates/5、民警维权抚慰申请表.doc

File diff suppressed because one or more lines are too long

1922
src/main/resources/static/templates/ftl/2、维权抚慰登记表.xml

File diff suppressed because it is too large Load Diff

2752
src/main/resources/static/templates/ftl/3、抚慰金申报批处理表.xml

File diff suppressed because it is too large Load Diff

2218
src/main/resources/static/templates/ftl/4、抚慰金申请发放明细表.xml

File diff suppressed because it is too large Load Diff

3379
src/main/resources/static/templates/ftl/5、民警维权抚慰申请表.xml

File diff suppressed because it is too large Load Diff

41
src/test/java/com/biutag/supervision/StrUtil.java

@ -16,7 +16,9 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -99,7 +101,44 @@ public class StrUtil {
@Test @Test
public void template3() throws FileNotFoundException { public void template3() throws FileNotFoundException {
System.out.println(LocalDateTime.now().minusMinutes(240)); LocalDate localDate = LocalDate.of(2025, 9, 16);
LocalDate now = LocalDate.now();
List<LocalDate> applyDates = List.of(LocalDate.of(2024, 1, 1), now, localDate).stream().sorted().toList();
String applyMonth;
String applyDate;
List<String> distinctDates = applyDates.stream().map(item -> item.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"))).distinct().toList();
LocalDate beginDate = applyDates.get(0);
LocalDate endDate = applyDates.get(applyDates.size() - 1);
// 同一日
if (distinctDates.size() == 1) {
applyMonth = beginDate.format(DateTimeFormatter.ofPattern("yyyy年MM月"));
applyDate = distinctDates.get(0);
} else {
// 同一年
if (beginDate.getYear() == endDate.getYear()) {
// 同一月
if (beginDate.getMonth() == endDate.getMonth()) {
applyMonth = beginDate.format(DateTimeFormatter.ofPattern("yyyy年MM月"));
applyDate = distinctDates.get(0) + "至" + endDate.format(DateTimeFormatter.ofPattern("dd日"));
} else {
applyMonth = beginDate.format(DateTimeFormatter.ofPattern("yyyy年MM月")) + "至" + endDate.format(DateTimeFormatter.ofPattern("MM月"));
applyDate = distinctDates.get(0) + "至" + endDate.format(DateTimeFormatter.ofPattern("MM月dd日"));
}
} else {
applyMonth = beginDate.format(DateTimeFormatter.ofPattern("yyyy年MM月")) + "至" + endDate.format(DateTimeFormatter.ofPattern("yyyy年MM月"));
applyDate = distinctDates.get(0) + "至" + endDate.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
}
}
System.out.println(applyMonth);
System.out.println(applyDate);
}
@Test
public void template4() {
String s = "123";
System.out.println(String.format(" %s", s));
} }
} }

Loading…
Cancel
Save