Browse Source

工单处理功能提交

user5 8 months ago
parent
commit
8f98e7f39c
17 changed files with 328 additions and 107 deletions
  1. 66 38
      jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/garbageClearance/controller/LookOverController.java
  2. 6 0
      jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/garbageClearance/domain/LookOver.java
  3. 2 0
      jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/garbageClearance/mapper/LookOverMapper.java
  4. 12 1
      jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/garbageClearance/mapper/xml/LookOverMapper.xml
  5. 27 2
      jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/garbageClearance/service/LookOverService.java
  6. 63 51
      jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/wdt/disposeRubbish/controller/DisposeRubbishController.java
  7. 6 0
      jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/wdt/disposeRubbish/domain/DisposeRubbish.java
  8. 2 8
      jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/wdt/disposeRubbish/mapper/DisposeRubbishMapper.java
  9. 12 2
      jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/wdt/disposeRubbish/mapper/xml/DisposeRubbishMapper.xml
  10. 25 4
      jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/wdt/disposeRubbish/service/DisposeRubbishService.java
  11. 13 0
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/OfficeService.java
  12. 11 0
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/dto/UserDTO.java
  13. 28 0
      jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/extension/controller/FlowCopyController.java
  14. 16 0
      jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/extension/service/dto/FlowCopyDTO.java
  15. 16 0
      jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/common/handler/ExtUserTaskActivityBehavior.java
  16. 20 0
      jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/listener/MyExecutionListener.java
  17. 3 1
      jeeplus-plugins/jeeplus-notify/src/main/java/com/jeeplus/notify/mapper/xml/NotifyMapper.xml

+ 66 - 38
jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/garbageClearance/controller/LookOverController.java

@@ -51,6 +51,8 @@ public class LookOverController {
     @Autowired
     private NotifyService notifyService;
 
+    private static final byte[] SYN_BYTE = new byte[0];
+
     /**
      * 查询巡视工单
      *
@@ -72,49 +74,64 @@ public class LookOverController {
     @ApiOperation(value = "保存巡视信息")
     @PostMapping("save")
     public  ResponseEntity <String> save(@Valid @RequestBody LookOver lookOver) {
-        //新增或编辑表单保存
-        String lookOverId = SnowFlake.getId();
-        UserDTO userDTO = UserUtils.getCurrentUserDTO();
-        lookOver.setId(lookOverId);
+        synchronized (SYN_BYTE) {
+            //新增或编辑表单保存
+            UserDTO userDTO = UserUtils.getCurrentUserDTO();
 
-        if (StringUtils.isNotBlank(lookOver.getNo())) {
-            // 剔除掉XJ-J 只保留纯数字
-            // 使用正则表达式替换掉所有非数字字符
-            String pureNumber = lookOver.getNo().replaceAll("\\D+", "");
-            lookOver.setNo(pureNumber);
-        }
-
-        if (null != lookOver.getFileList1() && lookOver.getFileList1().size() > 0 ) {
-            // 进行附件保存操作,保存到work_attachment 表中
-            for (WorkAttachmentInfo attachment : lookOver.getFileList1()) {
-                // 生成id
-                String detailId = SnowFlake.getId();
-                attachment.setId(detailId);
-                attachment.setAttachmentId(lookOverId);
-                attachment.setCreateTime(new Date());
-                attachment.setUpdateTime(new Date());
-                attachment.setDelFlag(0);
-                attachment.setAttachmentFlag("before");
-                ossService.insertWorkAttachmentInfo(attachment,userDTO);
+            if (StringUtils.isBlank(lookOver.getId())) {
+                LookOver noLookOver = overService.selectOne();
+                if (null != noLookOver) {
+                    lookOver.setYear(noLookOver.getYear());
+                    Integer number = noLookOver.getNumber() + 1;
+                    lookOver.setNumber(number);
+                    // 将年份和流水号拼接成 4 位数字的格式,不足 4 位补 0
+                    String formattedNo = number < 10000 ? String.format("%d%04d", noLookOver.getYear(), number) : String.format("%d%d", noLookOver.getYear(), number);
+                    lookOver.setNo(formattedNo);
+                }else{
+                    Calendar calendar = Calendar.getInstance();
+                    int year = calendar.get(Calendar.YEAR);
+                    lookOver.setYear(year);
+                    Integer number = 1;
+                    lookOver.setNumber(number);
+                    // 将年份和流水号拼接成 4 位数字的格式,不足 4 位补 0
+                    String formattedNo = String.format("%d%04d", year, number);
+                    lookOver.setNo(formattedNo);
+                }
             }
-        }
 
-        // 发送通知给 当前用户人所在 村庄的 村庄负责人(村支书)
-        UserDTO dto = overService.getUserInfoByOffId(userDTO.getOfficeDTO().getId());
+            lookOver.setStatus("1");
+            overService.saveOrUpdate(lookOver);
+
+            if (null != lookOver.getFileList1() && lookOver.getFileList1().size() > 0) {
+                // 进行附件保存操作,保存到work_attachment 表中
+                for (WorkAttachmentInfo attachment : lookOver.getFileList1()) {
+                    // 生成id
+                    String detailId = SnowFlake.getId();
+                    attachment.setId(detailId);
+                    attachment.setAttachmentId(lookOver.getId());
+                    attachment.setCreateTime(new Date());
+                    attachment.setUpdateTime(new Date());
+                    attachment.setDelFlag(0);
+                    attachment.setAttachmentFlag("before");
+                    ossService.insertWorkAttachmentInfo(attachment, userDTO);
+                }
+            }
 
-        NotifyDTO notifyDTO = new NotifyDTO();
-        notifyDTO.setContent(lookOver.getRemarks());
-        notifyDTO.setNotifyRecordIds(dto.getId());
-        notifyDTO.setStatus("1");
-        notifyDTO.setType("2");
-        notifyDTO.setTitle("垃圾清运通知");
-        notifyDTO.setLookOverId(lookOverId);
+            // 发送通知给 当前用户人所在 村庄的 村庄负责人(村支书)
+            UserDTO user = UserUtils.get(lookOver.getClearUserId());
+            UserDTO dto = overService.getUserInfoByOffId(user.getOfficeDTO().getId());
 
-        notifyService.saveOrUpdate ( notifyDTO );
+            NotifyDTO notifyDTO = new NotifyDTO();
+            notifyDTO.setContent(lookOver.getRemarks());
+            notifyDTO.setNotifyRecordIds(dto.getId());
+            notifyDTO.setStatus("1");
+            notifyDTO.setType("2");
+            notifyDTO.setTitle("垃圾清运通知");
+            notifyDTO.setLookOverId(lookOver.getId());
 
-        lookOver.setStatus("1");
-        overService.saveOrUpdate (lookOver);
-        return ResponseEntity.ok ( "保存成功" );
+            notifyService.saveOrUpdate(notifyDTO);
+            return ResponseEntity.ok("保存成功");
+        }
     }
 
     /**
@@ -239,12 +256,23 @@ public class LookOverController {
     @ApiLog("根据组织ID获取角色为村负责人的用户信息")
     @ApiOperation(value = "根据组织ID获取角色为村负责人的用户信息")
     @GetMapping("getUserInfoByOffId")
-    public ResponseEntity<UserDTO> getUserInfo( String officeId ) {
+    public ResponseEntity<UserDTO> getUserInfoByOffId( String officeId ) {
         UserDTO userDTO = overService.getUserInfoByOffId(officeId);
         return ResponseEntity.ok( userDTO );
     }
 
     /**
+     * 根据组织ID获取角色为村负责人的用户信息
+     */
+    @ApiLog("根据组织ID获取角色为村负责人的用户信息")
+    @ApiOperation(value = "根据组织ID获取角色为村负责人的用户信息")
+    @GetMapping("getOfficeOnHamlet")
+    public ResponseEntity<List <UserDTO>> getOfficeOnHamlet( ) {
+        List <UserDTO> list = overService.getOfficeOnHamlet ( );
+        return ResponseEntity.ok( list );
+    }
+
+    /**
      * 查询未处理巡视单
      * @param lookOver
      * @param page

+ 6 - 0
jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/garbageClearance/domain/LookOver.java

@@ -55,6 +55,12 @@ public class LookOver extends BaseEntity implements Serializable {
     @ApiModelProperty("处理单位名称")
     private String processingUnitName;
 
+    @ApiModelProperty("处理年份")
+    private Integer year;
+
+    @ApiModelProperty("处理编号")
+    private Integer number;
+
     //附件信息
     @TableField(exist = false)
     List<WorkAttachmentInfo> fileList1;

+ 2 - 0
jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/garbageClearance/mapper/LookOverMapper.java

@@ -28,6 +28,8 @@ public interface LookOverMapper extends BaseMapper<LookOver> {
 
     UserDTO getUserInfoByOffId(@Param("officeId") String officeId);
 
+    List<UserDTO> getOfficeOnHamlet();
+
     /**
      * 根据id获取巡视工单信息
      * @param id

+ 12 - 1
jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/garbageClearance/mapper/xml/LookOverMapper.xml

@@ -8,6 +8,13 @@
         left join sys_role sr on sur.role_id = sr.id
         where su.office_id = #{officeId} and sr.name = '村负责人'
     </select>
+    <select id="getOfficeOnHamlet" resultType="com.jeeplus.sys.service.dto.UserDTO">
+        select su.id, su.name, so.id as "officeId", so.name as "officeName", su.mobile from sys_user su
+        left join sys_office so on su.office_id = so.id
+        left join sys_user_role sur on su.id = sur.user_id
+        left join sys_role sr on sur.role_id = sr.id
+        where sr.name = '村负责人'
+    </select>
 
     <select id="findPage" resultType="com.jeeplus.test.garbageClearance.domain.LookOver">
         SELECT
@@ -21,7 +28,9 @@
         a.no,
         a.processing_unit,
         a.`urls`,
-        a.`status`
+        a.`status`,
+        a.`year`,
+        a.`number`
         FROM
         garbage_clearance_look_over a
         ${ew.customSqlSegment}
@@ -40,6 +49,8 @@
         a.processing_unit,
         a.`urls`,
         a.`status`,
+        a.`year`,
+        a.`number`,
         so.name as processingUnitName, su.name as clearUserName, su.mobile as clearUserMobile
         from garbage_clearance_look_over a
         left join sys_office so on a.processing_unit = so.id

+ 27 - 2
jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/garbageClearance/service/LookOverService.java

@@ -28,6 +28,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Calendar;
 import java.util.List;
 
 import java.util.List;
@@ -48,9 +49,12 @@ public class LookOverService extends ServiceImpl<LookOverMapper, LookOver> {
     public String getMaxNo() {
         // 创建查询条件构造器
         QueryWrapper<LookOver> queryWrapper = new QueryWrapper<>();
-
+        Calendar calendar = Calendar.getInstance();
+        int year = calendar.get(Calendar.YEAR);
+        queryWrapper.in("year",year);
         // 按no字段降序排列
-        queryWrapper.select("MAX(no) as no");
+        queryWrapper.orderByDesc("number");
+        queryWrapper.last("limit 1");
 
         // 只获取第一条记录
         LookOver lookOver = baseMapper.selectOne(queryWrapper);
@@ -59,10 +63,31 @@ public class LookOverService extends ServiceImpl<LookOverMapper, LookOver> {
         return lookOver != null ? lookOver.getNo() : null;
     }
 
+    public LookOver selectOne() {
+        // 创建查询条件构造器
+        QueryWrapper<LookOver> queryWrapper = new QueryWrapper<>();
+        Calendar calendar = Calendar.getInstance();
+        int year = calendar.get(Calendar.YEAR);
+        queryWrapper.in("year",year);
+        // 按no字段降序排列
+        queryWrapper.orderByDesc("number");
+        queryWrapper.last("limit 1");
+
+        // 只获取第一条记录
+        LookOver lookOver = baseMapper.selectOne(queryWrapper);
+
+        // 返回最大的no值
+        return lookOver;
+    }
+
     public UserDTO getUserInfoByOffId(String officeId) {
         return baseMapper.getUserInfoByOffId(officeId);
     }
 
+    public List<UserDTO> getOfficeOnHamlet() {
+        return baseMapper.getOfficeOnHamlet();
+    }
+
     /**
      * 根据id获取巡视工单信息
      * @param id

+ 63 - 51
jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/wdt/disposeRubbish/controller/DisposeRubbishController.java

@@ -1,22 +1,16 @@
 package com.jeeplus.test.wdt.disposeRubbish.controller;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jeeplus.aop.logging.annotation.ApiLog;
 import com.jeeplus.common.utils.ResponseUtil;
-import com.jeeplus.notify.service.NotifyService;
-import com.jeeplus.notify.service.dto.NotifyDTO;
 import com.jeeplus.sys.service.OfficeService;
 import com.jeeplus.sys.service.dto.OfficeDTO;
 import com.jeeplus.sys.service.dto.UserDTO;
 import com.jeeplus.sys.utils.StringUtils;
 import com.jeeplus.sys.utils.UserUtils;
 import com.jeeplus.test.garbageClearance.domain.LookOver;
-import com.jeeplus.test.garbageClearance.service.DTO.LookOverDTO;
 import com.jeeplus.test.garbageClearance.service.LookOverService;
 import com.jeeplus.test.garbageClearance.utils.SnowFlake;
 import com.jeeplus.test.oss.domain.WorkAttachment;
-import com.jeeplus.test.oss.domain.WorkAttachmentInfo;
 import com.jeeplus.test.oss.service.OssService;
 import com.jeeplus.test.wdt.disposeRubbish.domain.DisposeRubbish;
 import com.jeeplus.test.wdt.disposeRubbish.service.DisposeRubbishService;
@@ -27,9 +21,7 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
 
 /**
  * 清运处理
@@ -51,8 +43,7 @@ public class DisposeRubbishController {
     @Autowired
     private OssService ossService;
 
-    @Autowired
-    private NotifyService notifyService;
+    private static final byte[] SYN_BYTE = new byte[0];
 
     /**
      * 查询巡视工单
@@ -71,15 +62,18 @@ public class DisposeRubbishController {
     /**
      * 查询巡视工单
      *
-     * @param id
+     * @param procInsIds
      * @return
      */
     @GetMapping("getByProcInsId")
-    public ResponseEntity getByProcInsId(String procInsId) {
+    public ResponseEntity getByProcInsId(String procInsIds) {
+        // 转换为数组
+        String[] array = procInsIds.split(",");
+        // 再转换为集合(ArrayList)
+        List<String> procInsIdList = Arrays.asList(array);
         // 还需要处理单位  清运专员  联系方式  及  附件信息
-        DisposeRubbish post = disposeRubbishService.getByProcInsId ( procInsId );
-
-        return ResponseEntity.ok ( post );
+        List<DisposeRubbish> getByProcInsId = disposeRubbishService.getByProcInsId ( procInsIdList );
+        return ResponseEntity.ok ( getByProcInsId );
     }
 
     /**
@@ -89,48 +83,66 @@ public class DisposeRubbishController {
     @ApiOperation(value = "保存巡视信息")
     @PostMapping("save")
     public  ResponseEntity <String> save(@Valid @RequestBody DisposeRubbish disposeRubbish) {
-        //新增或编辑表单保存
-        if (StringUtils.isNotBlank(disposeRubbish.getNo())) {
-            // 剔除掉XJ-J 只保留纯数字
-            // 使用正则表达式替换掉所有非数字字符
-            String pureNumber = disposeRubbish.getNo().replaceAll("\\D+", "");
-            disposeRubbish.setNo(pureNumber);
-        }
-        if(disposeRubbish.getProgramIds().size()>0){
-            String programIds = String.join(",", disposeRubbish.getProgramId());
-            disposeRubbish.setProgramId(programIds);
-        }
+        synchronized (SYN_BYTE) {
+            //新增或编辑表单保存
+            if (StringUtils.isBlank(disposeRubbish.getId())) {
+
+                // 获取第一条记录
+                DisposeRubbish noDisposeRubbish = disposeRubbishService.selectOne();
+                if (null != noDisposeRubbish) {
+                    disposeRubbish.setYear(noDisposeRubbish.getYear());
+                    Integer number = noDisposeRubbish.getNumber() + 1;
+                    disposeRubbish.setNumber(number);
+                    // 将年份和流水号拼接成 4 位数字的格式,不足 4 位补 0
+                    String formattedNo = number < 10000 ? String.format("%d%04d", noDisposeRubbish.getYear(), number) : String.format("%d%d", noDisposeRubbish.getYear(), number);
+                    disposeRubbish.setNo(formattedNo);
+                }else{
+                    Calendar calendar = Calendar.getInstance();
+                    int year = calendar.get(Calendar.YEAR);
+                    disposeRubbish.setYear(year);
+                    Integer number = 1;
+                    disposeRubbish.setNumber(number);
+                    // 将年份和流水号拼接成 4 位数字的格式,不足 4 位补 0
+                    String formattedNo = String.format("%d%04d", year, number);
+                    disposeRubbish.setNo(formattedNo);
+                }
+            }
+            if (disposeRubbish.getProgramIds().size() > 0) {
+                String programIds = String.join(",", disposeRubbish.getProgramId());
+                disposeRubbish.setProgramId(programIds);
+            }
 
 
-        disposeRubbishService.saveOrUpdate (disposeRubbish);
+            disposeRubbishService.saveOrUpdate(disposeRubbish);
 
 
-        //对过磅数据进行处理
-        if (null != disposeRubbish.getFileList4() && disposeRubbish.getFileList4().size() > 0 ) {
-            UserDTO userDTO = UserUtils.getCurrentUserDTO();
-            // 进行附件保存操作,保存到work_attachment 表中
-            for (WorkAttachment attachment : disposeRubbish.getFileList4()) {
-                // 生成id
-                String detailId = SnowFlake.getId();
-                attachment.setId(detailId);
-                attachment.setAttachmentId(disposeRubbish.getId());
-                attachment.setCreateTime(new Date());
-                attachment.setUpdateTime(new Date());
-                attachment.setDelFlag(0);
-                attachment.setAttachmentFlag("weigh");
-                ossService.insertWorkAttachment(attachment,userDTO);
+            //对过磅数据进行处理
+            if (null != disposeRubbish.getFileList4() && disposeRubbish.getFileList4().size() > 0 ) {
+                UserDTO userDTO = UserUtils.getCurrentUserDTO();
+                // 进行附件保存操作,保存到work_attachment 表中
+                for (WorkAttachment attachment : disposeRubbish.getFileList4()) {
+                    // 生成id
+                    String detailId = SnowFlake.getId();
+                    attachment.setId(detailId);
+                    attachment.setAttachmentId(disposeRubbish.getId());
+                    attachment.setCreateTime(new Date());
+                    attachment.setUpdateTime(new Date());
+                    attachment.setDelFlag(0);
+                    attachment.setAttachmentFlag("weigh");
+                    ossService.insertWorkAttachment(attachment,userDTO);
+                }
             }
-        }
 
-        for (String workOverId : disposeRubbish.getProgramIds()) {
-            LookOver lookOver = overService.getById(workOverId);
-            //处理巡查单的状态信息,将巡查单的status调整为处理中
-            if("2".equals(disposeRubbish.getStatus()) || "5".equals(disposeRubbish.getStatus())){
-                lookOver.setStatus(disposeRubbish.getStatus());
-            }else{
-                lookOver.setStatus("1");
+            for (String workOverId : disposeRubbish.getProgramIds()) {
+                LookOver lookOver = overService.getById(workOverId);
+                //处理巡查单的状态信息,将巡查单的status调整为处理中
+                if("2".equals(disposeRubbish.getStatus()) || "5".equals(disposeRubbish.getStatus())){
+                    lookOver.setStatus(disposeRubbish.getStatus());
+                }else{
+                    lookOver.setStatus("1");
+                }
+                overService.updateStatus(lookOver);
             }
-            overService.updateStatus(lookOver);
         }
         return ResponseUtil.newInstance ( ).add("businessTable", "dispose_rubbish").add("businessId", disposeRubbish.getId()).ok ("保存成功");
     }

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

@@ -77,6 +77,12 @@ public class DisposeRubbish extends BaseEntity implements Serializable {
     @ApiModelProperty("补贴(元)")
     private String subsidy;
 
+    @ApiModelProperty("处理年份")
+    private Integer year;
+
+    @ApiModelProperty("处理编号")
+    private Integer number;
+
     //清理前照片
     @TableField(exist = false)
     List<WorkAttachment> fileList1;

+ 2 - 8
jeeplus-modules/jeeplus-test/src/main/java/com/jeeplus/test/wdt/disposeRubbish/mapper/DisposeRubbishMapper.java

@@ -1,13 +1,7 @@
 package com.jeeplus.test.wdt.disposeRubbish.mapper;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.Constants;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jeeplus.sys.service.dto.UserDTO;
-import com.jeeplus.test.garbageClearance.domain.LookOver;
-import com.jeeplus.test.garbageClearance.service.DTO.LookOverDTO;
 import com.jeeplus.test.oss.domain.WorkAttachmentInfo;
 import com.jeeplus.test.wdt.disposeRubbish.domain.DisposeRubbish;
 import org.apache.ibatis.annotations.Param;
@@ -27,10 +21,10 @@ public interface DisposeRubbishMapper extends BaseMapper<DisposeRubbish> {
 
     /**
      * 根据id获取巡视工单信息
-     * @param procInsId
+     * @param procInsIdList
      * @return
      */
-    DisposeRubbish getByProcInsId(@Param("procInsId") String procInsId);
+    List<DisposeRubbish> getByProcInsId(@Param("procInsIdList") List<String> procInsIdList);
 
     //查出附件信息
     List<WorkAttachmentInfo> getByAttachmentId(String id);

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

@@ -29,6 +29,8 @@
         a.weight,
         a.transport_mileage,
         a.subsidy,
+        a.year,
+        a.number,
         so.name as processingUnitName,
         su.name as clearUserName,
         su.mobile as clearUserMobile
@@ -57,9 +59,17 @@
         a.proc_ins_id,
         a.weight,
         a.transport_mileage,
-        a.subsidy
+        a.subsidy,
+        a.year,
+        a.number
         from dispose_rubbish a
-        where a.proc_ins_id = #{procInsId} and a.del_flag = 0
+        <where>
+            a.proc_ins_id in
+            <foreach collection="procInsIdList" item="procInsId" index="index" open="(" close=")" separator=",">
+                #{procInsId}
+            </foreach>
+            and a.del_flag = 0
+        </where>
     </select>
     <select id="getByAttachmentId" resultType="com.jeeplus.test.oss.domain.WorkAttachmentInfo">
         SELECT

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

@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Arrays;
+import java.util.Calendar;
 import java.util.List;
 
 /**
@@ -36,9 +37,12 @@ public class DisposeRubbishService extends ServiceImpl<DisposeRubbishMapper, Dis
     public String getMaxNo() {
         // 创建查询条件构造器
         QueryWrapper<DisposeRubbish> queryWrapper = new QueryWrapper<>();
-
+        Calendar calendar = Calendar.getInstance();
+        int year = calendar.get(Calendar.YEAR);
+        queryWrapper.in("year",year);
         // 按no字段降序排列
-        queryWrapper.select("MAX(no) as no");
+        queryWrapper.orderByDesc("number");
+        queryWrapper.last("limit 1");
 
         // 只获取第一条记录
         DisposeRubbish disposeRubbish = baseMapper.selectOne(queryWrapper);
@@ -47,6 +51,23 @@ public class DisposeRubbishService extends ServiceImpl<DisposeRubbishMapper, Dis
         return disposeRubbish != null ? disposeRubbish.getNo() : null;
     }
 
+    public DisposeRubbish selectOne() {
+        // 创建查询条件构造器
+        QueryWrapper<DisposeRubbish> queryWrapper = new QueryWrapper<>();
+        Calendar calendar = Calendar.getInstance();
+        int year = calendar.get(Calendar.YEAR);
+        queryWrapper.in("year",year);
+        // 按no字段降序排列
+        queryWrapper.orderByDesc("number");
+        queryWrapper.last("limit 1");
+
+        // 只获取第一条记录
+        DisposeRubbish disposeRubbish = baseMapper.selectOne(queryWrapper);
+
+        // 返回最大的no值
+        return disposeRubbish;
+    }
+
     public UserDTO getUserInfoByOffId(String officeId) {
         return baseMapper.getUserInfoByOffId(officeId);
     }
@@ -92,8 +113,8 @@ public class DisposeRubbishService extends ServiceImpl<DisposeRubbishMapper, Dis
      * @param procInsId
      * @return
      */
-    public DisposeRubbish getByProcInsId(String procInsId) {
-        return baseMapper.getByProcInsId(procInsId);
+    public List<DisposeRubbish> getByProcInsId(List<String> procInsIdList) {
+        return baseMapper.getByProcInsId(procInsIdList);
     }
 
 }

+ 13 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/OfficeService.java

@@ -44,6 +44,19 @@ public class OfficeService extends TreeService <OfficeMapper, Office> {
         return baseMapper.findList ( queryWrapper );
     }
 
+    /**
+     * 获取列表
+     *
+     * @return
+     */
+    public List <OfficeDTO> getOfficeOnHamlet() {
+        QueryWrapper queryWrapper = new QueryWrapper ( );
+        queryWrapper.eq ( "a.del_flag", 0 );
+        queryWrapper.eq ( "a.type", 4 );
+        queryWrapper.orderByAsc ( "a.sort" );
+        return baseMapper.findList ( queryWrapper );
+    }
+
     public List <OfficeDTO> getRootTree(String parentId, List <OfficeDTO> list, String extId, String type, String showAll) {
         List <OfficeDTO> offices = Lists.newArrayList ( );
         parentId = StrUtil.isEmpty ( parentId ) ? OfficeDTO.getRootId ( ) : parentId;

+ 11 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/dto/UserDTO.java

@@ -6,6 +6,7 @@ package com.jeeplus.sys.service.dto;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.google.common.collect.Lists;
 import com.jeeplus.core.excel.annotation.ExcelDictProperty;
@@ -66,6 +67,16 @@ public class UserDTO extends BaseDTO {
     private String name;
 
 
+    @TableField(exist = false)
+    @ApiModelProperty("部门Id")
+    private String officeId;
+
+
+    @TableField(exist = false)
+    @ApiModelProperty("部门名称")
+    private String officeName;
+
+
     /**
      * 工号
      */

+ 28 - 0
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/extension/controller/FlowCopyController.java

@@ -15,6 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * 流程抄送Controller
  *
@@ -39,6 +43,30 @@ public class FlowCopyController {
     public ResponseEntity list(FlowCopyDTO flowCopyDTO, Page <FlowCopyDTO> page) throws Exception {
         QueryWrapper <FlowCopyDTO> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( flowCopyDTO, FlowCopyDTO.class );
         IPage <FlowCopyDTO> result = flowCopyService.findPage ( page, queryWrapper );
+        List<FlowCopyDTO> records = page.getRecords();
+        for (FlowCopyDTO record : records) {
+            Map vars = new HashMap();
+            String title = record.getProcInsName();
+            vars.put("title",title);
+            // 查找 "发起了" 的位置
+            int startIndex = title.indexOf("在");
+            // 查找 "[垃圾处理流程]" 的位置
+            int endIndex = title.indexOf("发起了");
+
+            // 确保找到了两个子字符串
+            if (startIndex != -1 && endIndex != -1) {
+                // 截取两个子字符串之间的部分
+                String startDateStr = title.substring(startIndex+2, endIndex).trim();
+
+                vars.put("startDate",startDateStr);
+            } else {
+                System.out.println("无法找到指定的子字符串");
+            }
+            record.setVars(vars);
+            record.setProcessDefinitionId(record.getProcDefId());
+            record.setProcessInstanceId(record.getProcInsId());
+            record.setName(record.getProcInsName());
+        }
         return ResponseEntity.ok ( result );
     }
 

+ 16 - 0
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/extension/service/dto/FlowCopyDTO.java

@@ -9,6 +9,8 @@ import com.jeeplus.core.service.dto.BaseDTO;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.util.Map;
+
 /**
  * 流程抄送Entity
  *
@@ -35,10 +37,22 @@ public class FlowCopyDTO extends BaseDTO {
      */
     private String procInsId;
     /**
+     * 流程定义id
+     */
+    private String processDefinitionId;
+    /**
+     * 流程实例id
+     */
+    private String processInstanceId;
+    /**
      * 流程标题
      */
     private String procDefName;
     /**
+     * 流程标题
+     */
+    private String name;
+    /**
      * 实例标题
      */
     @Query
@@ -48,6 +62,8 @@ public class FlowCopyDTO extends BaseDTO {
      */
     private String taskName;
 
+    private Map vars;
+
     public FlowCopyDTO() {
         super ( );
     }

+ 16 - 0
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/common/handler/ExtUserTaskActivityBehavior.java

@@ -3,6 +3,7 @@ package com.jeeplus.flowable.common.handler;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.spring.SpringUtil;
 import com.google.common.collect.Lists;
+import com.jeeplus.common.redis.RedisUtils;
 import com.jeeplus.extension.domain.TaskDefExtension;
 import com.jeeplus.extension.service.TaskDefExtensionService;
 import com.jeeplus.extension.service.dto.FlowAssigneeDTO;
@@ -24,9 +25,12 @@ import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
 import org.flowable.task.api.history.HistoricTaskInstance;
 import org.flowable.task.service.TaskService;
 import org.flowable.task.service.impl.persistence.entity.TaskEntity;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 
+import java.io.IOException;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 
 @Slf4j
 public class ExtUserTaskActivityBehavior extends UserTaskActivityBehavior {
@@ -132,6 +136,18 @@ public class ExtUserTaskActivityBehavior extends UserTaskActivityBehavior {
                             System.out.println(sql);
                             List<Map<String, Object>> maps = SpringUtil.getBean(JdbcTemplate.class).queryForList(sql);
                             for (Map<String, Object> map : maps) {
+                                /*try {
+                                    //获取下一步处理人的手机号
+                                    String mobile = map.get("mobile").toString();
+                                    //根据手机号进行发送短信
+                                    //生成四位随机验证码
+                                    String randomCode = String.valueOf((int) (Math.random() * 9000 + 1000));
+                                    //发送短信通知
+                                    UserUtils.sendRandomCodes(mobile,randomCode);
+                                }catch (IOException e){
+                                    e.getMessage();
+                                }*/
+                                //将下一节点审核人进行存储在集合里
                                 candidateUserIds.add(map.get ("id").toString ());
                             }
                         }

+ 20 - 0
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/listener/MyExecutionListener.java

@@ -1,5 +1,9 @@
 package com.jeeplus.flowable.listener;
 
+import cn.hutool.extra.spring.SpringUtil;
+import com.jeeplus.extension.domain.FlowCopy;
+import com.jeeplus.extension.service.FlowCopyService;
+import com.jeeplus.sys.utils.StringUtils;
 import org.flowable.engine.delegate.DelegateExecution;
 import org.flowable.engine.delegate.ExecutionListener;
 import org.springframework.stereotype.Component;
@@ -13,6 +17,22 @@ public class MyExecutionListener implements ExecutionListener {
 
         if ( "start".equals ( eventName ) ) {
             System.out.println ( "start=========" );
+
+            if(null != delegateExecution.getVariables() && StringUtils.isNotBlank(delegateExecution.getVariables().get("title").toString())){
+                String title = delegateExecution.getVariables().get("title").toString();
+                if(title.contains("垃圾处理流程")){
+                    String applyUserId = delegateExecution.getVariables().get("applyUserId").toString();
+
+                    FlowCopy flowCopy = new FlowCopy();
+                    flowCopy.setProcDefId(delegateExecution.getProcessDefinitionId());
+                    flowCopy.setProcInsName(title);
+                    flowCopy.setProcInsId(delegateExecution.getProcessInstanceId());
+                    flowCopy.setUserId(applyUserId);
+                    //将项目信息进行抄送
+                    SpringUtil.getBean(FlowCopyService.class).save(flowCopy);
+
+                }
+            }
         } else if ( "end".equals ( eventName ) ) {
             System.out.println ( "end=========" );
         } else if ( "take".equals ( eventName ) ) {//连线监听

+ 3 - 1
jeeplus-plugins/jeeplus-notify/src/main/java/com/jeeplus/notify/mapper/xml/NotifyMapper.xml

@@ -19,7 +19,8 @@
         b.read_num AS "readNum",
         b.un_read_num AS "unReadNum",
         u.name AS "createBy.name",
-        u.photo AS "createBy.photo"
+        u.photo AS "createBy.photo",
+        so.name as "createBy.officeDTO.name"
 
     </sql>
 
@@ -33,6 +34,7 @@
         ) b ON b.notify_id = a.id
 
         JOIN sys_user u ON u.id = a.create_by_id
+        left join sys_office so on u.office_id = so.id
     </sql>
 
     <select id="getById" resultType="com.jeeplus.notify.service.dto.NotifyDTO">