Browse Source

年假延时队列问题逻辑修改

yanliming 10 months ago
parent
commit
a1dda2b6b5

+ 1 - 1
common/src/main/java/com/jpsoft/shinestar/modules/business/service/impl/YearRequestForLeaveInfoServiceImpl.java

@@ -195,7 +195,7 @@ public class YearRequestForLeaveInfoServiceImpl implements YearRequestForLeaveIn
 				personInfoService.update(personInfo);
 			}
 			else {
-				//如果出差开始开始时间>当前时间,则延时修改状态
+				//如果年假开始开始时间>当前时间,则延时修改状态
 				long millisecond = DateUtil.betweenMs(now,yearRequestForLeaveInfo.getStartTime());
 
 				log.warn("创建延时队列修改工作状态,id:"+yearRequestForLeaveInfo.getId());

+ 13 - 8
common/src/main/java/com/jpsoft/shinestar/modules/workflow/service/impl/ProcinstServiceImpl.java

@@ -9,14 +9,8 @@ import com.jpsoft.shinestar.config.WxConfig;
 import com.jpsoft.shinestar.modules.base.entity.*;
 import com.jpsoft.shinestar.modules.base.service.*;
 import com.jpsoft.shinestar.modules.business.dto.ExaminePersonDTO;
-import com.jpsoft.shinestar.modules.business.entity.AdjustShift;
-import com.jpsoft.shinestar.modules.business.entity.CarryThingsOutFactory;
-import com.jpsoft.shinestar.modules.business.entity.RequestForLeaveInfo;
-import com.jpsoft.shinestar.modules.business.entity.SupplementWork;
-import com.jpsoft.shinestar.modules.business.service.AdjustShiftService;
-import com.jpsoft.shinestar.modules.business.service.CarryThingsOutFactoryService;
-import com.jpsoft.shinestar.modules.business.service.RequestForLeaveInfoService;
-import com.jpsoft.shinestar.modules.business.service.SupplementWorkService;
+import com.jpsoft.shinestar.modules.business.entity.*;
+import com.jpsoft.shinestar.modules.business.service.*;
 import com.jpsoft.shinestar.modules.common.utils.JwtUtil2;
 import com.jpsoft.shinestar.modules.common.utils.TypeNameUtil;
 import com.jpsoft.shinestar.modules.common.utils.WechatMessageUtil;
@@ -95,6 +89,9 @@ public class ProcinstServiceImpl implements ProcinstService {
 	@Autowired
 	private ProcessTemplateService processTemplateService;
 
+	@Autowired
+	private YearRequestForLeaveInfoService yearRequestForLeaveInfoService;
+
 	@Override
 	public Procinst get(String id) {
 		// TODO Auto-generated method stub
@@ -332,5 +329,13 @@ public class ProcinstServiceImpl implements ProcinstService {
 			customerDiningRecord.setUpdateTime(new Date());
 			customerDiningRecordService.update(customerDiningRecord);
 		}
+
+		//年假
+		if ("11".equals(procinst.getType())) {
+			YearRequestForLeaveInfo yearRequestForLeaveInfo = yearRequestForLeaveInfoService.get(procinst.getBusinessKey());
+			yearRequestForLeaveInfo.setStatus(6);
+			yearRequestForLeaveInfo.setUpdateTime(new Date());
+			yearRequestForLeaveInfoService.update(yearRequestForLeaveInfo);
+		}
 	}
 }

+ 28 - 0
web/src/main/java/com/jpsoft/shinestar/config/RabbitmqConfig.java

@@ -345,4 +345,32 @@ public class RabbitmqConfig {
 
         return queue;
     }
+
+
+
+
+    /**
+     * 测试队列
+     * @return
+     */
+    @Bean
+    public Queue testYearRequestForLeaveQueue() {
+        Queue queue = new Queue("testYearRequestForLeaveQueue", true);
+        return queue;
+    }
+
+    @Bean
+    public CustomExchange testYearRequestForLeaveDelayExchange() {
+        Map<String, Object> args = new HashMap<>();
+        args.put("x-delayed-type", "direct");
+
+        return new CustomExchange("testYearRequestForLeaveDelayExchange", "x-delayed-message",true, false,args);
+    }
+
+    @Bean
+    public Binding testYearRequestForLeaveBinding() {
+        return BindingBuilder.bind(testYearRequestForLeaveQueue())
+                .to(testYearRequestForLeaveDelayExchange())
+                .with("submit").noargs();
+    }
 }

+ 6 - 1
web/src/main/java/com/jpsoft/shinestar/modules/business/controller/WorkScheduleAttendanceController.java

@@ -1888,7 +1888,9 @@ public class WorkScheduleAttendanceController {
             XSSFCell cellTitle15 = rowTitle.createCell(15);
             cellTitle15.setCellValue("年假天数");
             XSSFCell cellTitle16 = rowTitle.createCell(16);
-            cellTitle16.setCellValue("备注");
+            cellTitle16.setCellValue("休息天数");
+            XSSFCell cellTitle17 = rowTitle.createCell(17);
+            cellTitle17.setCellValue("备注");
 
             JSONArray array = requestBody.getJSONArray("data");
 
@@ -1951,6 +1953,9 @@ public class WorkScheduleAttendanceController {
                 row.createCell(colIndex).setCellValue(jsonObject.getString("yearLeaveNum"));
                 colIndex++;
 
+                row.createCell(colIndex).setCellValue(jsonObject.getString("restDays"));
+                colIndex++;
+
                 row.createCell(colIndex).setCellValue(jsonObject.getString("remark"));
                 colIndex++;
 

+ 1 - 1
web/src/main/java/com/jpsoft/shinestar/modules/mobile/controller/AdjustShiftApiController.java

@@ -531,7 +531,7 @@ public class AdjustShiftApiController {
             //年假
             if ("11".equals(procinst.getType())) {
                 YearRequestForLeaveInfo yearRequestForLeaveInfo = yearRequestForLeaveInfoService.get(procinst.getBusinessKey());
-                if (yearRequestForLeaveInfo.getPersonPopedomId().equals(personPopedom.getId()) && yearRequestForLeaveInfo.getStatus().equals("0")) {
+                if (yearRequestForLeaveInfo.getPersonPopedomId().equals(personPopedom.getId()) && yearRequestForLeaveInfo.getStatus() == 0) {
                     ownerSubmit = true;
                 }
             }

+ 24 - 0
web/src/main/java/com/jpsoft/shinestar/mq/listener/TestYearRequestForLeaveListener.java

@@ -0,0 +1,24 @@
+package com.jpsoft.shinestar.mq.listener;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.rabbit.annotation.RabbitHandler;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+@RabbitListener(queues = "testYearRequestForLeaveQueue",concurrency = "10")
+public class TestYearRequestForLeaveListener {
+
+    @RabbitHandler
+    public void process(String id) {
+        try {
+            log.warn("收到年假编号:" + id);
+            System.out.print("收到年假编号:" + id);
+        }
+        catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+        }
+    }
+
+}

+ 11 - 8
web/src/main/java/com/jpsoft/shinestar/mq/listener/YearRequestForLeaveListener.java

@@ -16,7 +16,7 @@ import java.util.Date;
 
 @Slf4j
 @Component
-@RabbitListener(queues = "yearRequestForLeaveQueue",concurrency = "10")
+@RabbitListener(queues = "yearRequestForLeaveQueue", concurrency = "10")
 public class YearRequestForLeaveListener {
 
     @Autowired
@@ -35,31 +35,34 @@ public class YearRequestForLeaveListener {
         try {
             YearRequestForLeaveInfo yearRequestForLeaveInfo = yearRequestForLeaveInfoService.get(id);
 
-            if (yearRequestForLeaveInfo != null && "1".equals(yearRequestForLeaveInfo.getStatus())){
+            if (yearRequestForLeaveInfo != null && yearRequestForLeaveInfo.getStatus() == 1) {
                 PersonPopedom personPopedom = personPopedomService.get(yearRequestForLeaveInfo.getPersonPopedomId());
                 PersonInfo personInfo = personInfoService.get(personPopedom.getPersonId());
 
                 Date now = new Date();
 
+                log.warn("判断是否修改状态:" + id);
+
                 //当前时间是年假期间
-                if (yearRequestForLeaveInfo.getStartTime().compareTo(now) <=0 && yearRequestForLeaveInfo.getEndTime().compareTo(now) >0){
-                    personInfo.setWorkStatus("3");
+                if (yearRequestForLeaveInfo.getStartTime().compareTo(now) <= 0 && yearRequestForLeaveInfo.getEndTime().compareTo(now) > 0) {
+                    personInfo.setWorkStatus("7");
                     personInfo.setUpdateTime(new Date());
                     personInfoService.update(personInfo);
                 }
 
                 //当前时间已结束年假
-                if (yearRequestForLeaveInfo.getEndTime().compareTo(now) <= 0){
+                if (yearRequestForLeaveInfo.getEndTime().compareTo(now) <= 0) {
                     personInfo.setWorkStatus("1");
                     personInfo.setUpdateTime(new Date());
                     personInfoService.update(personInfo);
+
+                    log.warn("判断是否修改为工作状态:" + id);
                 }
             }
 
             log.warn("员工延时更新工作状态完毕");
-        }
-        catch (Exception ex){
-            log.error(ex.getMessage(),ex);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
         }
     }
 }