Bläddra i källkod

工单处理功能提交

user5 7 månader sedan
förälder
incheckning
ac754b2712

+ 40 - 0
jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/wdt/disposeRubbish/controller/DisposeRubbishController.java

@@ -113,6 +113,9 @@ public class DisposeRubbishController {
                 disposeRubbish.setProgramId(programIds);
             }
 
+            if("5".equals(disposeRubbish.getStatus())){
+                disposeRubbish.setAuditPassDate(new Date());
+            }
 
             disposeRubbishService.saveOrUpdate(disposeRubbish);
 
@@ -233,4 +236,41 @@ public class DisposeRubbishController {
         List<WorkAttachment> workAttachmentList = disposeRubbishService.getByWorkOverId ( programIdList );
         return ResponseEntity.ok ( workAttachmentList );
     }
+
+
+
+    /**
+     * 根据officeId查询详情汇总
+     */
+    @ApiLog("根据officeId查询详情汇总")
+    @ApiOperation(value = "根据officeId查询详情汇总")
+    @GetMapping("getDetailCollectByOfficeId")
+    public ResponseEntity<List<DisposeRubbish>> getDetailCollectByOfficeId(String officeId) {
+        List <DisposeRubbish> list = disposeRubbishService.getDetailCollectByOfficeId ( officeId );
+
+
+        return ResponseEntity.ok ( list );
+    }
+
+    /**
+     * 根据officeId和年月时间查询详情汇总
+     */
+    @ApiLog("根据officeId和年月时间查询详情汇总")
+    @ApiOperation(value = "根据officeId和年月时间查询详情汇总")
+    @GetMapping("getDetailCollectByOfficeIdAndMonth")
+    public ResponseEntity<List<DisposeRubbish>> getDetailCollectByOfficeIdAndMonth(String officeId,String yearMonth) {
+        List <DisposeRubbish> list = disposeRubbishService.getDetailCollectByOfficeIdAndMonth ( officeId,yearMonth );
+        return ResponseEntity.ok ( list );
+    }
+
+    /**
+     * 根据编号查询巡视工单
+     * @param no
+     * @return
+     */
+    @GetMapping("getByNo")
+    public ResponseEntity getByNo(String no) {
+        DisposeRubbish post = disposeRubbishService.getByNo ( no );
+        return ResponseEntity.ok ( post );
+    }
 }

+ 17 - 0
jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/wdt/disposeRubbish/domain/DisposeRubbish.java

@@ -10,6 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -83,6 +84,9 @@ public class DisposeRubbish extends BaseEntity implements Serializable {
     @ApiModelProperty("处理编号")
     private Integer number;
 
+    @ApiModelProperty("审核通过时间")
+    private Date auditPassDate;
+
     //清理前照片
     @TableField(exist = false)
     List<WorkAttachment> fileList1;
@@ -102,4 +106,17 @@ public class DisposeRubbish extends BaseEntity implements Serializable {
     //关联的巡查单据
     @TableField(exist = false)
     List<WorkOverNo> workOverNoList;
+
+
+    //时间展示参数
+    @TableField(exist = false)
+    private String createDateStr;
+
+    //时间展示参数
+    @TableField(exist = false)
+    private String auditPassDateStr;
+
+    //展示数量参数
+    @TableField(exist = false)
+    private Integer count;
 }

+ 16 - 0
jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/wdt/disposeRubbish/mapper/DisposeRubbishMapper.java

@@ -28,4 +28,20 @@ public interface DisposeRubbishMapper extends BaseMapper<DisposeRubbish> {
 
     //查出附件信息
     List<WorkAttachmentInfo> getByAttachmentId(String id);
+
+    //查出附件信息
+    List<String> getAllYearMonthByOfficeId(String officeId);
+
+    //查出附件信息
+    List<DisposeRubbish> getDisposeRubbishAllYearMonthByOfficeId(String officeId);
+
+    //查出附件信息
+    List<DisposeRubbish> getDetailCollectByOfficeIdAndMonth(@Param("officeId")String officeId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    /**
+     * 根据id获取巡视工单信息
+     * @param no
+     * @return
+     */
+    DisposeRubbish getByNo(@Param("no") String no);
 }

+ 145 - 1
jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/wdt/disposeRubbish/mapper/xml/DisposeRubbishMapper.xml

@@ -31,6 +31,7 @@
         a.subsidy,
         a.year,
         a.number,
+        a.audit_pass_date,
         so.name as processingUnitName,
         su.name as clearUserName,
         su.mobile as clearUserMobile
@@ -61,7 +62,8 @@
         a.transport_mileage,
         a.subsidy,
         a.year,
-        a.number
+        a.number,
+        a.audit_pass_date
         from dispose_rubbish a
         <where>
             a.proc_ins_id in
@@ -83,4 +85,146 @@
 			del_flag = 0
 			AND attachment_id = #{id}
     </select>
+
+    <select id="getAllYearMonthByOfficeId" resultType="java.lang.String">
+        SELECT
+            DATE_FORMAT(a.audit_pass_date, '%Y-%m') AS createDateStr
+		FROM
+			dispose_rubbish a
+        left join sys_user su on su.id = a.create_by_id and su.del_flag = 0
+		WHERE
+			a.del_flag = 0
+			AND su.office_id = #{officeId}
+
+        GROUP BY
+            createDateStr
+        ORDER BY
+            createDateStr desc;
+    </select>
+
+
+
+    <select id="getDisposeRubbishAllYearMonthByOfficeId" resultType="com.jeeplus.test.wdt.disposeRubbish.domain.DisposeRubbish">
+        select
+        a.id,
+        a.create_by_id,
+        a.create_time,
+        DATE_FORMAT(a.create_time, '%Y-%m') AS createDateStr,
+        a.update_by_id,
+        a.update_time,
+        a.del_flag,
+        a.remarks,
+        a.no,
+        a.processing_unit,
+        a.status,
+        a.clear_user_id,
+        a.dispose_type,
+        a.rubbish_station,
+        a.program_id,
+        a.proc_ins_id,
+        a.weight,
+        a.transport_mileage,
+        a.subsidy,
+        a.year,
+        a.number,
+        DATE_FORMAT(a.audit_pass_date, '%Y-%m') AS auditPassDateStr
+        from dispose_rubbish a
+        left join sys_user su on su.id = a.create_by_id and su.del_flag = 0
+        <where>
+            a.del_flag = 0
+            AND su.office_id = #{officeId}
+        </where>
+    </select>
+
+
+
+    <select id="getDetailCollectByOfficeIdAndMonth" resultType="com.jeeplus.test.wdt.disposeRubbish.domain.DisposeRubbish">
+        select
+        a.id,
+        a.create_by_id,
+        a.create_time,
+        DATE_FORMAT(a.create_time, '%Y-%m') AS createDateStr,
+        a.update_by_id,
+        a.update_time,
+        a.del_flag,
+        a.remarks,
+        a.no,
+        a.processing_unit,
+        (
+        CASE
+        WHEN a.status = 1 THEN
+        "暂存"
+        WHEN a.status = 2 THEN
+        "处理中"
+        WHEN a.status = 3 THEN
+        "撤回"
+        WHEN a.status = 4 THEN
+        "驳回"
+        WHEN a.status = 5 THEN
+        "已处理"
+        END
+        ) AS status,
+
+        a.clear_user_id,
+        (
+        CASE
+        WHEN a.dispose_type = 1 THEN
+        "转运调剂处理"
+        WHEN a.dispose_type = 2 THEN
+        "自行处理"
+        END
+        ) AS dispose_type,
+
+        a.rubbish_station,
+        a.program_id,
+        a.proc_ins_id,
+        a.weight,
+        a.transport_mileage,
+        a.subsidy,
+        a.year,
+        a.number,
+        DATE_FORMAT(a.audit_pass_date, '%Y-%m-%s') AS auditPassDateStr
+        from dispose_rubbish a
+        left join sys_user su on su.id = a.create_by_id and su.del_flag = 0
+        <where>
+            a.del_flag = 0
+            AND su.office_id = #{officeId}
+            and a.audit_pass_date between #{startDate} and #{endDate}
+        </where>
+    </select>
+
+
+    <select id="getByNo" resultType="com.jeeplus.test.wdt.disposeRubbish.domain.DisposeRubbish">
+        select
+        a.id,
+        a.create_by_id,
+        a.create_time,
+        a.update_by_id,
+        a.update_time,
+        a.del_flag,
+        a.remarks,
+        a.no,
+        a.processing_unit,
+        a.status,
+        a.clear_user_id,
+        a.dispose_type,
+        a.rubbish_station,
+        a.program_id,
+        a.proc_ins_id,
+        a.weight,
+        a.transport_mileage,
+        a.subsidy,
+        a.year,
+        a.number,
+        a.audit_pass_date,
+        so.name as processingUnitName,
+        su.name as clearUserName,
+        su.mobile as clearUserMobile
+        from dispose_rubbish a
+        left join sys_office so on a.processing_unit = so.id
+        left join sys_user su on a.clear_user_id = su.id
+        where a.no = #{no} and a.del_flag = 0
+        order by update_time desc
+        limit 1
+    </select>
 </mapper>

+ 146 - 4
jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/wdt/disposeRubbish/service/DisposeRubbishService.java

@@ -12,14 +12,16 @@ import com.jeeplus.test.oss.service.OssService;
 import com.jeeplus.test.wdt.disposeRubbish.domain.DisposeRubbish;
 import com.jeeplus.test.wdt.disposeRubbish.domain.WorkOverNo;
 import com.jeeplus.test.wdt.disposeRubbish.mapper.DisposeRubbishMapper;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.List;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.YearMonth;
+import java.util.*;
 
 /**
  * @author: 徐滕
@@ -111,7 +113,7 @@ public class DisposeRubbishService extends ServiceImpl<DisposeRubbishMapper, Dis
     }
     /**
      * 根据id获取巡视工单信息
-     * @param procInsId
+     * @param procInsIdList
      * @return
      */
     public List<DisposeRubbish> getByProcInsId(List<String> procInsIdList) {
@@ -129,4 +131,144 @@ public class DisposeRubbishService extends ServiceImpl<DisposeRubbishMapper, Dis
         return fileList1;
     }
 
+    /**
+     * 根据id获取巡视工单信息
+     * @param officeId
+     * @return
+     */
+    public List<DisposeRubbish> getDetailCollectByOfficeId(String officeId) {
+        // 根据部门id查询所有年-月 信息汇总
+        List<String> allYearMonthByOfficeIdList = baseMapper.getAllYearMonthByOfficeId(officeId);
+        // 根据部门id查询所有工单信息
+        List<DisposeRubbish> allYearMonthByOfficeIdDisposeRubbishList = baseMapper.getDisposeRubbishAllYearMonthByOfficeId(officeId);
+        //根据发起年月对工单信息进行分组处理
+        Map<String, List<DisposeRubbish>> temporaryListMap = dataMessageDispose(allYearMonthByOfficeIdDisposeRubbishList);
+        //遍历该部门所有的年月信息,将年月信息和分组信息进行比对,并将分组信息进行汇总返回
+        List<DisposeRubbish> dataList = Lists.newArrayList();
+        for (String yearMonth : allYearMonthByOfficeIdList) {
+            for (String key : temporaryListMap.keySet()) {
+                if(StringUtils.isNotBlank(yearMonth) && yearMonth.equals(key)){
+                    List<DisposeRubbish> mapList = temporaryListMap.get(key);
+                    DisposeRubbish data = new DisposeRubbish();
+                    data.setCreateDateStr(yearMonth);
+                    data.setCount(mapList.size());
+                    BigDecimal weightB = new BigDecimal(0);
+                    BigDecimal subsidyB = new BigDecimal(0);
+                    for (DisposeRubbish info : mapList) {
+                        if(StringUtils.isNotBlank(info.getWeight())){
+                            weightB = weightB.add(new BigDecimal(info.getWeight()));
+                        }
+                        if(StringUtils.isNotBlank(info.getSubsidy())){
+                            subsidyB = subsidyB.add(new BigDecimal(info.getSubsidy()));
+                        }
+                    }
+                    weightB = weightB.setScale(2, RoundingMode.HALF_UP);
+                    subsidyB = subsidyB.setScale(2, RoundingMode.HALF_UP);
+                    data.setWeight(weightB.toString());
+                    data.setSubsidy(subsidyB.toString());
+
+                    dataList.add(data);
+                }
+            }
+        }
+
+        if(dataList.size()>0){
+            DisposeRubbish data = new DisposeRubbish();
+
+            BigDecimal weightB = new BigDecimal(0);
+            BigDecimal subsidyB = new BigDecimal(0);
+            int count = 0;
+            for (DisposeRubbish info : dataList) {
+                count += info.getCount();
+                if(StringUtils.isNotBlank(info.getWeight())){
+                    weightB = weightB.add(new BigDecimal(info.getWeight()));
+                }
+                if(StringUtils.isNotBlank(info.getSubsidy())){
+                    subsidyB = subsidyB.add(new BigDecimal(info.getSubsidy()));
+                }
+            }
+            data.setCreateDateStr("汇总");
+            data.setCount(count);
+            weightB = weightB.setScale(2, RoundingMode.HALF_UP);
+            subsidyB = subsidyB.setScale(2, RoundingMode.HALF_UP);
+            data.setWeight(weightB.toString());
+            data.setSubsidy(subsidyB.toString());
+            dataList.add(data);
+        }
+
+        //遍历查询出来的数据,对数据进行汇总处理
+        System.out.println();
+
+        return dataList;
+    }
+    /**
+     * 分组
+     * @param list
+     * @return
+     */
+    private Map<String, List<DisposeRubbish>> dataMessageDispose(List<DisposeRubbish> list) {
+        Map<String, List<DisposeRubbish>> infoMap = new HashMap<>();
+        if (CollectionUtils.isNotEmpty(list)) {
+            // 分组
+            for (DisposeRubbish vo : list) {
+                List<DisposeRubbish> tempList = infoMap.get(vo.getAuditPassDateStr());
+                /*如果取不到数据,那么直接new一个空的ArrayList**/
+                if (tempList == null) {
+                    tempList = new ArrayList<>();
+                    tempList.add(vo);
+                    infoMap.put(vo.getAuditPassDateStr(), tempList);
+                }
+                else {
+                    /*某个vo之前已经存放过了,则直接追加数据到原来的List里**/
+                    tempList.add(vo);
+                }
+            }
+        }
+        return infoMap;
+    }
+
+
+    /**
+     * 根据id和年月获取巡视工单信息
+     * @param officeId
+     * @param yearMonth
+     * @return
+     */
+    public List<DisposeRubbish> getDetailCollectByOfficeIdAndMonth(String officeId,String yearMonth) {
+        // 将年月时间进行处理
+        String startOfMonth = "";
+        String endOfMonth = "";
+        if(StringUtils.isNotBlank(yearMonth) && yearMonth.contains("-")){
+            startOfMonth = yearMonth + "-01 00:00:00";
+            // 使用 YearMonth 获取给定年月的最后一天
+            YearMonth endyearMonth = YearMonth.parse(yearMonth);
+            int lastDay = endyearMonth.lengthOfMonth(); // 当月的最后一天
+            // 拼接上月份的最后一天并精确到时分秒
+            endOfMonth = endyearMonth + "-" + lastDay + " 23:59:59";
+        }
+        //遍历该部门所有的年月信息,将年月信息和分组信息进行比对,并将分组信息进行汇总返回
+        List<DisposeRubbish> dataList = Lists.newArrayList();
+        if(StringUtils.isNotBlank(officeId) && StringUtils.isNotBlank(startOfMonth) && StringUtils.isNotBlank(endOfMonth)){
+
+            // 根据部门id和起始时间查询所有工单信息
+             dataList = baseMapper.getDetailCollectByOfficeIdAndMonth(officeId,startOfMonth,endOfMonth);
+        }
+
+
+        return dataList;
+    }
+
+
+    /**
+     * 根据id获取巡视工单信息
+     * @param no
+     * @return
+     */
+    public DisposeRubbish getByNo(String no) {
+        if (StringUtils.isNotBlank(no)){
+            return baseMapper.getByNo(no);
+        }
+        return null;
+    }
+
 }

+ 15 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/controller/OfficeController.java

@@ -3,15 +3,20 @@
  */
 package com.jeeplus.sys.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.common.collect.Lists;
 import com.jeeplus.aop.demo.annotation.DemoMode;
 import com.jeeplus.aop.logging.annotation.ApiLog;
 import com.jeeplus.core.dto.DragNode;
+import com.jeeplus.core.query.QueryWrapperGenerator;
 import com.jeeplus.sys.constant.CommonConstants;
 import com.jeeplus.sys.domain.Office;
 import com.jeeplus.sys.service.OfficeService;
 import com.jeeplus.sys.service.dto.OfficeDTO;
 import com.jeeplus.sys.service.mapstruct.OfficeWrapper;
+import com.jeeplus.sys.utils.UserUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -118,4 +123,14 @@ public class OfficeController {
     }
 
 
+    /**
+     * 通告列表数据
+     */
+    @GetMapping("villageLevelList")
+    public ResponseEntity villageLevelList() {
+        List<OfficeDTO> result = officeService.getOfficeOnHamlet ();
+        return ResponseEntity.ok ( result );
+    }
+
+
 }

+ 53 - 0
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/controller/FlowableTaskController.java

@@ -36,6 +36,8 @@ import org.flowable.engine.HistoryService;
 import org.flowable.engine.RepositoryService;
 import org.flowable.engine.RuntimeService;
 import org.flowable.engine.TaskService;
+import org.flowable.engine.history.HistoricProcessInstance;
+import org.flowable.engine.repository.ProcessDefinition;
 import org.flowable.engine.runtime.ProcessInstance;
 import org.flowable.task.api.Task;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -84,6 +86,8 @@ public class FlowableTaskController {
     private MailService mailService;
     @Autowired
     private FlowableModelService flowableModelService;
+    @Autowired
+    private RepositoryService repositoryService;
 
 
     @GetMapping("todo")
@@ -164,6 +168,55 @@ public class FlowableTaskController {
         return ResponseEntity.ok ( historicTaskList );
     }
 
+    /**
+     * 获取任务流转历史列表
+     */
+    @GetMapping("getProcessDefinitionIdByInstanceId")
+    public ProcessInstance getProcessDefinitionIdByInstanceId(String procInsId) {
+        // 通过 processInstanceId 获取 ProcessInstance
+        // 先通过 RuntimeService 查询正在运行的流程实例
+        ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
+                .processInstanceId(procInsId)
+                .singleResult();
+        if (processInstance != null) {
+            return processInstance;
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * 获取任务流转历史列表
+     */
+    @GetMapping("getHistoryProcessDefinitionIdByInstanceId")
+    public HistoricProcessInstance getHistoryProcessDefinitionIdByInstanceId(String procInsId) {
+        // 通过 processInstanceId 获取 ProcessInstance
+        HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
+                .processInstanceId(procInsId)
+                .singleResult();
+        if (historicProcessInstance != null) {
+            return historicProcessInstance;
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * 获取任务流转历史列表
+     */
+    @GetMapping("getProcessNameByInstanceId")
+    public String getProcessNameByInstanceId(String procInsId) {
+        // 通过 processDefinitionId 获取流程定义信息
+        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+                .processDefinitionId(procInsId)
+                .singleResult();
+        if (processDefinition != null) {
+            return processDefinition.getName();
+        } else {
+            return "";
+        }
+    }
+
 
     /**
      * 获取流程表单

+ 2 - 1
jeeplus-web/src/main/resources/application-production.yml

@@ -84,9 +84,10 @@ spring:
   #  redis的配置
   redis:
     host: localhost
-    port: 6379
+    port: 6380
     expireTime: 3600000 #单位秒
     database: 3
+    password: Xg20240914!
   mvc.servlet.load-on-startup: 1
   jmx:
     enabled: false