Pārlūkot izejas kodu

景聚庭-优惠结账-流程调整为通知

huangguoce 3 dienas atpakaļ
vecāks
revīzija
e6d8854dbb

+ 43 - 13
jeeplus-modules/jeeplus-psi-management/src/main/java/com/jeeplus/psimanage/dishManage/service/PsiDishOrderService.java

@@ -61,6 +61,9 @@ public class PsiDishOrderService extends ServiceImpl<PsiDishOrderMapper, PsiDish
     private PsiDishOrderDetailMapper dishOrderDetailMapper;
 
     @Resource
+    private IFlowableApi flowTaskService;
+
+    @Resource
     private PsiDishRoomMapper dishRoomMapper;
 
     private static final ExecutorService ASYNC_POOL = Executors.newFixedThreadPool(5);
@@ -388,24 +391,51 @@ public class PsiDishOrderService extends ServiceImpl<PsiDishOrderMapper, PsiDish
         }
         if("1".equals(update.getSettleType()) || "2".equals(update.getSettleType())){
             ASYNC_POOL.execute(() -> {
+                //-----------------------发起流程--------------------
+                //String settleType = "1".equals(update.getSettleType()) ? "折扣结账" : "优惠结账";
+                ////发起折扣结账至老板待办
+                //Map map = SpringUtil.getBean(IFlowableApi.class).getByNameForFen("景聚庭-折扣结账");
+                //String procDefId = map.get("id")+"";
+                //String procDefKey = map.get("key")+"";
+                //String businessTable = "psi_dish_order";
+                //String businessId = update.getId();
+                //String nowDateFormat = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+                //String title =userDto.getName() +" 在 "+nowDateFormat+" 发起了 ["+info.getRoomName()+"] "+settleType;
+                //RoleDTO roleDTO = SpringUtil.getBean(IRoleApi.class).getRoleDTOByName2("老板");
+                //List<UserDTO> notifiedPartyUsers =SpringUtil.getBean(IUserApi.class).findListByRoleId(roleDTO.getId());
+                //UserDTO assigneeDTO = notifiedPartyUsers.get(0);
+                //String assignee = assigneeDTO.getId();
+                //String recordType = "";
+                //Map<String, String> newMap = pingMap(procDefId, procDefKey, businessTable, businessId, title,assignee, recordType,userDto.getId());
+                //Map<String ,Map<String,String >>  allMap = new HashMap<>();
+                //allMap.put("折扣结账",newMap);
+                //SpringUtil.getBean(IFlowableApi.class).startForFenNew(allMap);
+                //-----------------------发送通知--------------------
                 String settleType = "1".equals(update.getSettleType()) ? "折扣结账" : "优惠结账";
-                //发起折扣结账至老板待办
-                Map map = SpringUtil.getBean(IFlowableApi.class).getByNameForFen("景聚庭-折扣结账");
-                String procDefId = map.get("id")+"";
-                String procDefKey = map.get("key")+"";
-                String businessTable = "psi_dish_order";
-                String businessId = update.getId();
                 String nowDateFormat = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-                String title =userDto.getName() +" 在 "+nowDateFormat+" 发起了 ["+info.getRoomName()+"] "+settleType;
+                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                String day = format.format(new Date());
                 RoleDTO roleDTO = SpringUtil.getBean(IRoleApi.class).getRoleDTOByName2("老板");
                 List<UserDTO> notifiedPartyUsers =SpringUtil.getBean(IUserApi.class).findListByRoleId(roleDTO.getId());
                 UserDTO assigneeDTO = notifiedPartyUsers.get(0);
-                String assignee = assigneeDTO.getId();
-                String recordType = "";
-                Map<String, String> newMap = pingMap(procDefId, procDefKey, businessTable, businessId, title,assignee, recordType,userDto.getId());
-                Map<String ,Map<String,String >>  allMap = new HashMap<>();
-                allMap.put("折扣结账",newMap);
-                SpringUtil.getBean(IFlowableApi.class).startForFenNew(allMap);
+                String title =userDto.getName() +" 在 "+nowDateFormat+" 发起了 ["+info.getRoomName()+"] "+settleType;
+                //获取目前领用流程的taskid,根据procInsId去查taskId
+                String uuid = "";
+                if (null != assigneeDTO) {
+                    uuid = UUID.randomUUID().toString();
+                    //发送通知
+                    Map<String ,String > map = new HashMap<>();
+                    map.put("taskId",uuid);
+                    map.put("title",title);
+                    map.put("defId",update.getId());
+                    map.put("taskName","景聚庭-优惠结账");
+                    map.put("createUser","管理员");
+                    map.put("createTime",day);
+                    map.put("noticeName",assigneeDTO.getLoginName());
+                    map.put("noticeId",assigneeDTO.getId());
+                    map.put("createById",userDto.getId());
+                    flowTaskService.add(map);
+                }
             });
         }
         dishOrderMapper.updateById(update);