瀏覽代碼

导出和列表中增加流程名称

dzx 1 年之前
父節點
當前提交
4cc8f1a744

+ 1 - 1
src/main/java/com/xjrsoft/module/ledger/controller/WfSubscriptionController.java

@@ -79,7 +79,7 @@ public class WfSubscriptionController {
 
     @PostMapping("/export-query")
     @ApiOperation(value = "导出")
-    public ResponseEntity<byte[]> exportData(@Valid @RequestBody WfSubscriptionPageDto dto, @RequestParam(defaultValue = "false") Boolean isTemplate) {
+    public ResponseEntity<byte[]> exportData(@Valid @RequestBody WfSubscriptionPageDto dto) {
         List<WfSubscriptionExcelVo> customerList = wfSubscriptionService.getList(dto);
         ByteArrayOutputStream bot = new ByteArrayOutputStream();
         EasyExcel.write(bot, WfSubscriptionExcelVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(customerList);

+ 1 - 1
src/main/java/com/xjrsoft/module/ledger/mapper/WfSubscriptionMapper.java

@@ -39,5 +39,5 @@ public interface WfSubscriptionMapper extends MPJBaseMapper<WfSubscription> {
     /**
      * 列表查询
      */
-    List<WfSubscriptionExcelVo> getList(@Param("dto") WfSubscriptionPageDto dto);
+    List<WfSubscription> getList(@Param("dto") WfSubscriptionPageDto dto);
 }

+ 36 - 2
src/main/java/com/xjrsoft/module/ledger/service/impl/WfSubscriptionServiceImpl.java

@@ -30,7 +30,10 @@ import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.stream.Collectors;
 
@@ -115,9 +118,20 @@ public class WfSubscriptionServiceImpl extends MPJBaseServiceImpl<WfSubscription
     @Override
     public Page<WfSubscriptionPageVo> getPage(Page<WfSubscriptionPageVo> page, WfSubscriptionPageDto dto) {
         Page<WfSubscriptionPageVo> voPage = wfSubscriptionMapper.getPage(page, dto);
+        List<WfSubscriptionList> wfSubscriptionList = wfSubscriptionListMapper.selectList(
+                new QueryWrapper<WfSubscriptionList>().lambda().orderByAsc(WfSubscriptionList::getId)
+        );
+        Map<Long, String> flowMap = new HashMap<>();
+        for (WfSubscriptionList subscriptionList : wfSubscriptionList) {
+            if(flowMap.containsKey(subscriptionList.getParentId())){
+                continue;
+            }
+            flowMap.put(subscriptionList.getParentId(), subscriptionList.getNameOfThePurchasedItem());
+        }
         for (WfSubscriptionPageVo record : voPage.getRecords()) {
             List<File> list = fileService.list(Wrappers.lambdaQuery(File.class).eq(File::getFolderId, record.getFolderId()));
             record.setFileInfos(list);
+            record.setFlowName(flowMap.get(Long.valueOf(record.getId())));
         }
         return voPage;
     }
@@ -125,6 +139,10 @@ public class WfSubscriptionServiceImpl extends MPJBaseServiceImpl<WfSubscription
     @Override
     public WfSubscriptionListInfoVo getSubscriptionList(Long id) {
         WfSubscriptionListInfoVo info = wfSubscriptionMapper.getInfoById(id);
+
+        List<File> list = fileService.list(Wrappers.lambdaQuery(File.class).eq(File::getFolderId, info.getFolderId()));
+        info.setFileInfos(list);
+
         List<WfSubscriptionList> subscriptionListList = wfSubscriptionListMapper.selectList(
             new QueryWrapper<WfSubscriptionList>().lambda().eq(WfSubscriptionList::getParentId, id)
         );
@@ -143,7 +161,6 @@ public class WfSubscriptionServiceImpl extends MPJBaseServiceImpl<WfSubscription
             info.setProcessId(relations.get(0).getProcessId());
         }
 
-
         //查询最后一个节点的taskId
         List<WorkflowExtra> taskList = workflowExtraMapper.selectList(
             new QueryWrapper<WorkflowExtra>().lambda()
@@ -159,6 +176,23 @@ public class WfSubscriptionServiceImpl extends MPJBaseServiceImpl<WfSubscription
 
     @Override
     public List<WfSubscriptionExcelVo> getList(WfSubscriptionPageDto dto) {
-        return wfSubscriptionMapper.getList(dto);
+        List<WfSubscriptionList> wfSubscriptionList = wfSubscriptionListMapper.selectList(
+                new QueryWrapper<WfSubscriptionList>().lambda().orderByAsc(WfSubscriptionList::getId)
+        );
+        Map<Long, String> flowMap = new HashMap<>();
+        for (WfSubscriptionList subscriptionList : wfSubscriptionList) {
+            if(flowMap.containsKey(subscriptionList.getParentId())){
+                continue;
+            }
+            flowMap.put(subscriptionList.getParentId(), subscriptionList.getNameOfThePurchasedItem());
+        }
+        List<WfSubscription> list = wfSubscriptionMapper.getList(dto);
+        List<WfSubscriptionExcelVo> result = new ArrayList<>();
+        for (WfSubscription record : list) {
+            WfSubscriptionExcelVo excelVo = BeanUtil.toBean(record, WfSubscriptionExcelVo.class);
+            excelVo.setFlowName(flowMap.get(record.getId()));
+            result.add(excelVo);
+        }
+        return result;
     }
 }

+ 3 - 3
src/main/java/com/xjrsoft/module/ledger/vo/WfSubscriptionExcelVo.java

@@ -22,9 +22,9 @@ public class WfSubscriptionExcelVo {
     * 
     */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("主键编号")
-    @ApiModelProperty("主键编号")
-    private String id;
+    @ExcelProperty("流程名称")
+    @ApiModelProperty("流程名称")
+    private String flowName;
     /**
     * 申请部门
     */

+ 5 - 0
src/main/java/com/xjrsoft/module/ledger/vo/WfSubscriptionPageVo.java

@@ -62,4 +62,9 @@ public class WfSubscriptionPageVo {
     @ApiModelProperty("编号")
     private String number;
 
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("流程名称")
+    @ApiModelProperty("流程名称")
+    private String flowName;
+
 }

+ 2 - 2
src/main/resources/mapper/ledger/WfSubscriptionMapper.xml

@@ -12,7 +12,7 @@
             and t2.id = #{dto.orgId}
         </if>
         <if test="dto.startDate != null and dto.startDate != '' and dto.endDate != null and dto.endDate != ''">
-            and t2.shen_qing_ri_qi4752 between #{dto.startDate} and #{dto.endDate}
+            and t1.shen_qing_ri_qi4752 between #{dto.startDate} and #{dto.endDate}
         </if>
         <if test="dto.userName != null and dto.userName != ''">
             and t3.name like concat('%', #{dto.userName}, '%')
@@ -29,7 +29,7 @@
             and t2.id = #{dto.orgId}
         </if>
         <if test="dto.startDate != null and dto.startDate != '' and dto.endDate != null and dto.endDate != ''">
-            and t2.shen_qing_ri_qi4752 between #{dto.startDate} and #{dto.endDate}
+            and t1.shen_qing_ri_qi4752 between #{dto.startDate} and #{dto.endDate}
         </if>
         <if test="dto.userName != null and dto.userName != ''">
             and t3.name like concat('%', #{dto.userName}, '%')