|
@@ -11,6 +11,7 @@ import com.platform.dao.dto.upms.SysUserDTO;
|
|
|
import com.platform.dao.entity.customize.CustomFieldTemplateData;
|
|
|
import com.platform.dao.entity.repair.RepairApplicationForm;
|
|
|
import com.platform.dao.entity.sb.SbInfo;
|
|
|
+import com.platform.dao.entity.upms.SysConfig;
|
|
|
import com.platform.dao.entity.upms.SysUser;
|
|
|
import com.platform.dao.enums.*;
|
|
|
import com.platform.dao.mapper.customize.CustomFieldTemplateDataMapper;
|
|
@@ -21,13 +22,16 @@ import com.platform.dao.util.MessageTemplateUtil;
|
|
|
import com.platform.dao.vo.SysUserVO;
|
|
|
import com.platform.service.part.PartInfoService;
|
|
|
import com.platform.service.repair.strategy.AbstractRepairBaseStrategy;
|
|
|
+import com.platform.service.upms.SysConfigService;
|
|
|
import com.platform.service.util.SendMessageUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import tk.mybatis.mapper.weekend.Weekend;
|
|
|
import tk.mybatis.mapper.weekend.WeekendCriteria;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.time.DayOfWeek;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.temporal.TemporalField;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -52,6 +56,8 @@ public class LongYanRepairStrategy extends AbstractRepairBaseStrategy {
|
|
|
private SbPositionMapper sbPositionMapper;
|
|
|
@Resource
|
|
|
private SysUserDeptMapper sysUserDeptMapper;
|
|
|
+ @Resource
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -91,20 +97,46 @@ public class LongYanRepairStrategy extends AbstractRepairBaseStrategy {
|
|
|
// 给相关的工程师推送信息
|
|
|
sendMessageToRepairManger(form,sysUserVOList,CommonConstants.CALL_REPAIR_NOTICE);
|
|
|
// 给该部门班组长推送信息
|
|
|
- List<SysUserVO> banzuzhangs = getRepairMangers(repairDeptId,null,SysRoleCodeEnum.Maintenance_Leader.name());
|
|
|
+ /*List<SysUserVO> banzuzhangs = getRepairMangers(repairDeptId,null,SysRoleCodeEnum.Maintenance_Leader.name());
|
|
|
if(banzuzhangs != null && banzuzhangs.size() > 0){
|
|
|
sendMessageToRepairManger(form,banzuzhangs,CommonConstants.CALL_REPAIR_NOTICE);
|
|
|
- }
|
|
|
- // 给二十四小时人员发送信息
|
|
|
- String everyWhereUsers = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_TWENTY_FOUR_USER.name());
|
|
|
- if(StringUtils.isNotBlank(everyWhereUsers)){
|
|
|
- sendMessageToRepairManger(form,getUserVOs(everyWhereUsers.trim()),CommonConstants.CALL_REPAIR_NOTICE);
|
|
|
+ }*/
|
|
|
+ // 给值班人员发送消息
|
|
|
+ if(isSendMessage()){
|
|
|
+ String everyWhereUsers = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.REPAIR_TWENTY_FOUR_USER.name());
|
|
|
+ if(StringUtils.isNotBlank(everyWhereUsers)){
|
|
|
+ sendMessageToRepairManger(form,getUserVOs(everyWhereUsers.trim()),CommonConstants.CALL_REPAIR_NOTICE);
|
|
|
+ }
|
|
|
}
|
|
|
// 生产票证数据
|
|
|
generateTicketData(form);
|
|
|
return form;
|
|
|
}
|
|
|
|
|
|
+ private boolean isSendMessage(){
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ // 今天是否是节假日
|
|
|
+ SysConfig config = sysConfigService.getByCode(SysConfigEnum.REPAIR_HOLIDAY.name());
|
|
|
+ String content = "[]";
|
|
|
+ if(config != null){
|
|
|
+ content = config.getContent();
|
|
|
+ }
|
|
|
+ if(content.contains(DateUtils.dateToString(now,DateUtils.PATTERN_YMD))){
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
+ int dayOfWeek = now.getDayOfWeek().getValue();
|
|
|
+ if(dayOfWeek == 6 || dayOfWeek == 7){
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
+ LocalDateTime startTime = LocalDateTime.of(now.getYear(),now.getMonthValue(),now.getDayOfMonth(),18,00,00);
|
|
|
+ LocalDateTime second = now.plusDays(1);
|
|
|
+ LocalDateTime endTime = LocalDateTime.of(second.getYear(),second.getMonthValue(),second.getDayOfMonth(),8,00,00);
|
|
|
+ if(now.isAfter(startTime) && now.isBefore(endTime)){
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
+ return Boolean.FALSE;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 生成维修票证数据
|
|
|
* @param form
|
|
@@ -174,12 +206,14 @@ public class LongYanRepairStrategy extends AbstractRepairBaseStrategy {
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
- Map<String,String> maps = new HashMap<>();
|
|
|
- maps.put("13410011001","12121,2323,2323");
|
|
|
- maps.put("13410011002","12121,2323,2323");
|
|
|
- System.out.println(JsonUtils.objectToJson(maps));
|
|
|
- Map<String,String> covertMap = JsonUtils.jsonToMap("{\"13410011002\":\"12121,2323,2323\",\"13410011001\":\"12121,2323,2323\"}");
|
|
|
- System.out.println(covertMap.get("13410011001"));
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ LocalDateTime startTime = LocalDateTime.of(now.getYear(),now.getMonthValue(),now.getDayOfMonth(),18,00,00);
|
|
|
+ LocalDateTime second = now.plusDays(1);
|
|
|
+ LocalDateTime endTime = LocalDateTime.of(second.getYear(),second.getMonthValue(),second.getDayOfMonth(),8,00,00);
|
|
|
+ System.out.println(startTime);
|
|
|
+ System.out.println(endTime);
|
|
|
+ System.out.println(now.isAfter(startTime));
|
|
|
+ System.out.println(now.isBefore(endTime));
|
|
|
}
|
|
|
|
|
|
/**
|