Browse Source

添加灵活排班,突发事件相关接口

zhongwei
tyty 2 years ago
parent
commit
9dee3b9025
  1. 85
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyEmergencyEntity.java
  2. 9
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyMainEntity.java
  3. 76
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyMainPersonEntity.java
  4. 5
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyMainTemplateEntity.java
  5. 28
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/FlexibleSchedulingVo.java
  6. 86
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/ImsDutyEmergencyVo.java
  7. 8
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/ImsSchedulingVo.java
  8. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyChangeController.java
  9. 19
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java
  10. 41
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java
  11. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyEmergencyMapper.java
  12. 17
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyEmergencyMapper.xml
  13. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyGroupPMapper.java
  14. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyGroupPMapper.xml
  15. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainMapper.java
  16. 111
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainMapper.xml
  17. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainPersonMapper.java
  18. 29
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainPersonMapper.xml
  19. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainTemplateMapper.xml
  20. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/scheduled/ThreadTask.java
  21. 23
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyEmergencyService.java
  22. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyGroupPService.java
  23. 17
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyMainPersonService.java
  24. 13
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyMainService.java
  25. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyRecService.java
  26. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyChangeServiceImpl.java
  27. 102
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyEmergencyServiceImpl.java
  28. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyGroupPServiceImpl.java
  29. 74
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainPersonServiceImpl.java
  30. 613
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
  31. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainTemplateImpl.java
  32. 65
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java
  33. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java
  34. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainStatisticsServiceImpl.java
  35. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PlatformServiceImpl.java

85
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyEmergencyEntity.java

@ -0,0 +1,85 @@
package com.hnac.hzims.operational.duty.entity;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 实体类
*
* @author ty
*/
@Data
@TableName("hz_ims_duty_emergency")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "ImsDutyEmergency对象", description = "突发事件登记")
public class ImsDutyEmergencyEntity extends TenantEntity {
private static final long serialVersionUID = 4259568798118459986L;
/**
* 值班日期
*/
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@ApiModelProperty(value = "值班日期")
private Date dutyTime;
/**
* 班次
*/
@ApiModelProperty(value = "班次")
private Long dutyClass;
/**
* 登记人
*/
@ApiModelProperty(value = "登记人")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long registrant;
/**
* 值班长
*/
@ApiModelProperty(value = "值班长")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long chargePerson;
/**
* 登记时间
*/
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@ApiModelProperty(value = "登记时间")
private Date registerTime;
/**
* 事件主题
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "事件主题")
private String eventTitle;
/**
* 事件内容
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "事件内容")
private String eventInfo;
/**
* 事件方式
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "事件方式")
private String eventType;
}

9
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyMainEntity.java

@ -22,17 +22,22 @@ import java.util.Date;
@Data @Data
@TableName("hz_ims_duty_main") @TableName("hz_ims_duty_main")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "ImsDutyMain对象", description = "值班信息") @ApiModel(value = "ImsDutyMain对象", description = "值班-班组信息")
public class ImsDutyMainEntity extends TenantEntity { public class ImsDutyMainEntity extends TenantEntity {
private static final long serialVersionUID = -1913292438493450113L; private static final long serialVersionUID = -1913292438493450113L;
/**
* 主键ID
*/
@ApiModelProperty(value = "排班计划id")
private Long id;
/** /**
* 值班组id * 值班组id
*/ */
@ApiModelProperty(value = "值班组id") @ApiModelProperty(value = "值班组id")
private Long dutyGroupId; private Long dutyGroupId;
/** /**
* 值班人IDS, ID之间用^隔开 * 值班人IDS, ID之间用^隔开
*/ */

76
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyMainPersonEntity.java

@ -0,0 +1,76 @@
package com.hnac.hzims.operational.duty.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 实体类
*
* @author TY
*/
@Data
@TableName("hz_ims_duty_main_person")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "ImsDutyMainPerson对象", description = "值班-人员信息")
public class ImsDutyMainPersonEntity extends TenantEntity {
private static final long serialVersionUID = -1913292438493450113L;
/**
* 值班组id
*/
@ApiModelProperty(value = "值班组id")
private Long dutyGroupId;
/**
* 值班人ID
*/
@ApiModelProperty(value = "值班人ID")
private Long dutyPerson;
/**
* 值班负责人ID
*/
@ApiModelProperty(value = "值班负责人ID")
private Long dutyChargePerson;
/**
* 值班日期
*/
@DateTimeFormat(pattern = DateUtil.PATTERN_DATE)
@JsonFormat(pattern = DateUtil.PATTERN_DATE)
@ApiModelProperty(value = "值班日期")
private Date dutyDate;
/**
* 班次ID
*/
@ApiModelProperty(value = "班次ID")
private Long classId;
/**
* 班次名称
*/
@TableField(exist=false)
@ApiModelProperty(value = "班次名称")
private String className;
/**
* 值班-班组ID
*/
@ApiModelProperty(value = "值班-班组ID")
private Long dutyMainId;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
}

5
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyMainTemplateEntity.java

@ -30,6 +30,9 @@ public class ImsDutyMainTemplateEntity extends TenantEntity {
private Integer dutyNum; private Integer dutyNum;
@ApiModelProperty("班次类型ID") @ApiModelProperty("班次类型ID")
private Long dutyClassTypeId; private Long dutyClassTypeId;
@ApiModelProperty("灵活排班人员IDs")
private String flexible;
@ApiModelProperty("排班类型")//1:班组,2:灵活排班
private Integer type;
} }

28
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/FlexibleSchedulingVo.java

@ -0,0 +1,28 @@
package com.hnac.hzims.operational.duty.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class FlexibleSchedulingVo {
/**
* 值班组长ID
*/
@JsonSerialize(nullsUsing = NullSerializer.class)
@ApiModelProperty("值班组长ID")
private String chargeId;
/**
* 人员IDs
*/
@JsonSerialize(nullsUsing = NullSerializer.class)
@ApiModelProperty("人员ID")
private List<String> personIds;
}

86
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/ImsDutyEmergencyVo.java

@ -0,0 +1,86 @@
package com.hnac.hzims.operational.duty.vo;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
/**
* 实体类
*
* @author ty
*/
@Data
public class ImsDutyEmergencyVo extends TenantEntity {
private static final long serialVersionUID = 4259568798118459986L;
/**
* 值班开始日期
*/
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@ApiModelProperty(value = "值班开始日期")
private Date dutyStartTime;
/**
* 值班结束日期
*/
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@ApiModelProperty(value = "值班结束日期")
private Date dutyEndTime;
/**
* 班次
*/
@ApiModelProperty(value = "班次")
private List<Long> dutyClass;
/**
* 登记人
*/
@ApiModelProperty(value = "登记人")
@JsonSerialize(nullsUsing = NullSerializer.class)
private List<Long> registrant;
/**
* 值班长
*/
@ApiModelProperty(value = "值班长")
@JsonSerialize(nullsUsing = NullSerializer.class)
private List<Long> chargePerson;
/**
* 登记时间
*/
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@ApiModelProperty(value = "登记时间")
private Date registerTime;
/**
* 事件主题
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "事件主题")
private String eventTitle;
/**
* 事件内容
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "事件内容")
private String eventInfo;
/**
* 事件方式
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "事件方式")
private String eventType;
}

8
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/ImsSchedulingVo.java

@ -6,6 +6,7 @@ import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List;
import java.util.Map; import java.util.Map;
@Data @Data
@ -68,10 +69,15 @@ public class ImsSchedulingVo extends ImsDutyMainEntity {
private String templateName; private String templateName;
@ApiModelProperty("排班类型: 1、轮询 2 、周期") @ApiModelProperty("排班类型: 1、轮询 2 、周期")
private Integer schedulingType; private Integer schedulingType;
@ApiModelProperty("人员类型: 1、班组 2 、人员")
private Integer personType;
@ApiModelProperty("是否保存为模版,true 是,false 否") @ApiModelProperty("是否保存为模版,true 是,false 否")
private Boolean template; private Boolean template;
@ApiModelProperty("班次类型ID") @ApiModelProperty("班次类型ID")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Long dutyClassTypeId; private Long dutyClassTypeId;
@ApiModelProperty("灵活人员排班-轮询")
private Map<String, List<String>> rosters;
@ApiModelProperty("灵活人员排班-周期")
private Map<String, List<FlexibleSchedulingVo>> flexible;
} }

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyChangeController.java

@ -50,9 +50,9 @@ public class ImsDutyChangeController extends BladeController {
ImsDutyChangeEntity detail = imsDutyService.getOne(Condition.getQueryWrapper(changeEntity)); ImsDutyChangeEntity detail = imsDutyService.getOne(Condition.getQueryWrapper(changeEntity));
ImsDutyChangeVO vo = ImsDutyChangeWrapper.build().entityVO(detail); ImsDutyChangeVO vo = ImsDutyChangeWrapper.build().entityVO(detail);
imsDutyService.setUserNmae(vo); imsDutyService.setUserNmae(vo);
ImsSchedulingVo imsSchedulingVo1 = imsDutyMainService.getByIdOne(detail.getAcceptDutyId()); ImsSchedulingVo imsSchedulingVo1 = imsDutyMainService.getByIdOneV2(detail.getAcceptDutyId());
vo.setAcceptDutyMainVo(imsSchedulingVo1 == null ? null : imsSchedulingVo1); vo.setAcceptDutyMainVo(imsSchedulingVo1 == null ? null : imsSchedulingVo1);
ImsSchedulingVo imsSchedulingVo = imsDutyMainService.getByIdOne(detail.getApplyDutyId()); ImsSchedulingVo imsSchedulingVo = imsDutyMainService.getByIdOneV2(detail.getApplyDutyId());
vo.setApplyDutyMainVo(imsSchedulingVo == null ? null : imsSchedulingVo); vo.setApplyDutyMainVo(imsSchedulingVo == null ? null : imsSchedulingVo);
return R.data(vo); return R.data(vo);
} }

19
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java

@ -87,7 +87,7 @@ public class ImsDutyMainController extends BladeController {
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids") @ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return imsDutyMainService.delete(Func.toLongList(ids)); return imsDutyMainService.deleteV2(Func.toLongList(ids));
} }
/** /**
@ -100,7 +100,7 @@ public class ImsDutyMainController extends BladeController {
if (null == imsSchedulingVo.getCreateDept()) { if (null == imsSchedulingVo.getCreateDept()) {
imsSchedulingVo.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); imsSchedulingVo.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
} }
return imsDutyMainService.getScheduling(imsSchedulingVo); return imsDutyMainService.getSchedulingV2(imsSchedulingVo);
} }
/** /**
@ -115,7 +115,7 @@ public class ImsDutyMainController extends BladeController {
if (null == deptId) { if (null == deptId) {
deptId = Long.valueOf(AuthUtil.getDeptId()); deptId = Long.valueOf(AuthUtil.getDeptId());
} }
return imsDutyMainService.getSchedulingList(year, month, deptId); return imsDutyMainService.getSchedulingListV2(year, month, deptId);
} }
/** /**
@ -125,7 +125,7 @@ public class ImsDutyMainController extends BladeController {
@ApiOperationSupport(order = 9) @ApiOperationSupport(order = 9)
@ApiOperation(value = "根据值班id查询人员", notes = "传id") @ApiOperation(value = "根据值班id查询人员", notes = "传id")
public R person(@ApiParam(value = "值班Id", required = true) @RequestParam Long id) { public R person(@ApiParam(value = "值班Id", required = true) @RequestParam Long id) {
return imsDutyMainService.getMainIdByPerson(id); return imsDutyMainService.getMainIdByPersonV2(id);
} }
/** /**
@ -146,10 +146,19 @@ public class ImsDutyMainController extends BladeController {
*/ */
@GetMapping("/getHomePageDutyInfo") @GetMapping("/getHomePageDutyInfo")
@ApiOperationSupport(order = 9) @ApiOperationSupport(order = 9)
@ApiOperation(value = "获取首页值班数据", notes = "") @ApiOperation(value = "获取首页值班数据", notes = "传id")
public R<List<HomePageDutyMainInfoVo>> getHomePageDutyInfo(Long deptId) { public R<List<HomePageDutyMainInfoVo>> getHomePageDutyInfo(Long deptId) {
return R.data(imsDutyMainService.getHomePageDutyInfo(deptId)); return R.data(imsDutyMainService.getHomePageDutyInfo(deptId));
} }
/**
* 返回对应部门所有人员
*/
@GetMapping("/getAllPersonInfo")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "返回对应部门所有人员", notes = "")
public R getAllPersonInfo(Long deptId) {
return R.data(imsDutyMainService.getAllPersonInfo(deptId));
}
} }

41
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java

@ -2,9 +2,12 @@ package com.hnac.hzims.operational.duty.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.duty.entity.ImsDutyEmergencyEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity;
import com.hnac.hzims.operational.duty.service.IImsDutyEmergencyService;
import com.hnac.hzims.operational.duty.service.IImsDutyRecService; import com.hnac.hzims.operational.duty.service.IImsDutyRecService;
import com.hnac.hzims.operational.duty.vo.ImsDutyEmergencyVo;
import com.hnac.hzims.operational.duty.vo.ImsDutyRecVO; import com.hnac.hzims.operational.duty.vo.ImsDutyRecVO;
import com.hnac.hzinfo.inspect.plan.vo.PlanVO; import com.hnac.hzinfo.inspect.plan.vo.PlanVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -21,6 +24,7 @@ import org.springblade.core.tool.utils.Func;
import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.entity.BladeFlow;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
@ -36,6 +40,8 @@ import javax.validation.Valid;
public class ImsDutyRecController extends BladeController { public class ImsDutyRecController extends BladeController {
private final IImsDutyRecService imsDutyRecService; private final IImsDutyRecService imsDutyRecService;
@Resource
private IImsDutyEmergencyService iImsDutyEmergencyService;
/** /**
* 详情 * 详情
@ -94,9 +100,6 @@ public class ImsDutyRecController extends BladeController {
} }
/** /**
* 删除 代码自定义代号 * 删除 代码自定义代号
*/ */
@ -214,10 +217,34 @@ public class ImsDutyRecController extends BladeController {
} }
/**
* 新增突发事件记录
*/
@PostMapping("/addEmergency")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增突发事件", notes = "传入imsDutyEmergencyEntity")
public R addEmergency(@Valid @RequestBody ImsDutyEmergencyEntity imsDutyEmergencyEntity) {
return iImsDutyEmergencyService.saveEntity(imsDutyEmergencyEntity);
}
/**
* 删除突发事件记录
*/
@PostMapping("/deleteEmergency")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "删除突发事件记录", notes = "传入imsDutyEmergencyEntity")
public R deleteEmergency( @RequestBody ImsDutyEmergencyEntity imsDutyEmergencyEntity) {
//TODO 是否要加权限控制
return iImsDutyEmergencyService.deleteEntity(imsDutyEmergencyEntity);
}
/**
* 查询突发事件记录
*/
@PostMapping("/queryEmergency")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "查询突发事件记录", notes = "传入imsDutyEmergencyEntity")
public R queryEmergency(@RequestBody ImsDutyEmergencyVo imsDutyEmergencyVo,Query query) {
return iImsDutyEmergencyService.queryEntity(imsDutyEmergencyVo,query);
}
} }

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyEmergencyMapper.java

@ -0,0 +1,15 @@
package com.hnac.hzims.operational.duty.mapper;
import com.hnac.hzims.operational.duty.entity.ImsDutyEmergencyEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* Mapper 接口
*
* @author Chill
*/
public interface ImsDutyEmergencyMapper extends UserDataScopeBaseMapper<ImsDutyEmergencyEntity> {
}

17
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyEmergencyMapper.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.operational.duty.mapper.ImsDutyEmergencyMapper">
<!-- 通用查询映射结果 -->
<resultMap id="ims_duty_recResultMap" type="com.hnac.hzims.operational.duty.entity.ImsDutyEmergencyEntity">
<result column="ID" property="id"/>
<result column="DUTY_TIME" property="dutyTime"/>
<result column="DUTY_CLASS" property="dutyClass"/>
<result column="REGISTRANT" property="registrant"/>
<result column="CHARGE_PERSON" property="chargePerson"/>
<result column="REGISTER_TIME" property="registerTime"/>
<result column="EVENT_TITLE" property="eventTitle"/>
<result column="EVENT_INFO" property="eventInfo"/>
<result column="EVENT_TYPE" property="eventType"/>
</resultMap>
</mapper>

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyGroupPMapper.java

@ -29,6 +29,8 @@ public interface ImsDutyGroupPMapper extends BaseMapper<ImsDutyGroupPEntity> {
*/ */
List<ImsDutyGroupPEntity> selectByGroupId(Long groupId); List<ImsDutyGroupPEntity> selectByGroupId(Long groupId);
List<ImsDutyGroupPEntity> selectByGroupIds(List<Long> groupId);
void deleteBatch(List<Long> list); void deleteBatch(List<Long> list);
void insertBatchPersonnel(List<ImsDutyGroupPEntity> list); void insertBatchPersonnel(List<ImsDutyGroupPEntity> list);

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyGroupPMapper.xml

@ -29,6 +29,15 @@
from hz_ims_duty_group_p from hz_ims_duty_group_p
where group_id = #{groupId,jdbcType=BIGINT} where group_id = #{groupId,jdbcType=BIGINT}
</select> </select>
<select id="selectByGroupIds" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from hz_ims_duty_group_p
where group_id in
<foreach collection="groupId" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="selectPersonIsExist" resultType="java.lang.Integer" parameterType="com.hnac.hzims.operational.duty.entity.ImsDutyGroupPEntity"> <select id="selectPersonIsExist" resultType="java.lang.Integer" parameterType="com.hnac.hzims.operational.duty.entity.ImsDutyGroupPEntity">
select IFNULL(count(*),0) from hz_ims_duty_group_p where PERSON_ID = #{personId} select IFNULL(count(*),0) from hz_ims_duty_group_p where PERSON_ID = #{personId}
</select> </select>

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainMapper.java

@ -34,6 +34,7 @@ public interface ImsDutyMainMapper extends UserDataScopeBaseMapper<ImsDutyMainEn
ImsSchedulingVo selectByIdOne(Long id,Long preDutyId); ImsSchedulingVo selectByIdOne(Long id,Long preDutyId);
ImsSchedulingVo selectByIdOneV2(Long id,Long preDutyId);
ImsSchedulingVo selectByPreDutyIdOne(Long preDutyId); ImsSchedulingVo selectByPreDutyIdOne(Long preDutyId);
@ -52,15 +53,23 @@ public interface ImsDutyMainMapper extends UserDataScopeBaseMapper<ImsDutyMainEn
List<ImsDutyMainMergeVo> selectDutyMainByDept(List<Long> list); List<ImsDutyMainMergeVo> selectDutyMainByDept(List<Long> list);
List<ImsDutyMainMergeVo> selectDutyMainByDeptV2(List<Long> list);
List<ImsDutyGroupGenerationVo> selectSchedulingVoByDateList(@Param("startDate") String startDate, @Param("endDate") String endDate); List<ImsDutyGroupGenerationVo> selectSchedulingVoByDateList(@Param("startDate") String startDate, @Param("endDate") String endDate);
@UserDataAuth @UserDataAuth
List<DutyMainInfoVo> selectDutyMainInfoVo(@Param("deptId") Long deptId); List<DutyMainInfoVo> selectDutyMainInfoVo(@Param("deptId") Long deptId);
@UserDataAuth
List<DutyMainInfoVo> selectDutyMainInfoVoV2(@Param("deptId") Long deptId);
DutyMainInfoVo selectDutyMainInfoSign(Long preDutyId); DutyMainInfoVo selectDutyMainInfoSign(Long preDutyId);
DutyMainInfoVo selectDutyMainInfoSignV2(Long preDutyId);
DutyMainInfoVo queryDutyInfo(Long dutyId); DutyMainInfoVo queryDutyInfo(Long dutyId);
DutyMainInfoVo queryDutyInfoV2(Long dutyId);
List<DutyInfoVo> getDutyData(@Param("list") List<Long> deptIdList); List<DutyInfoVo> getDutyData(@Param("list") List<Long> deptIdList);
List<DutyInfoVo> getDutyDataV2(@Param("list") List<Long> deptIdList);
List<ImsSchedulingVo> selectByDateListV2(@Param(value = "date")String date,@Param(value = "deptId") Long deptId);
} }

111
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainMapper.xml

@ -76,6 +76,33 @@
</if> </if>
ORDER BY DM.ID ORDER BY DM.ID
</select> </select>
<select id="selectByDateListV2" resultType="com.hnac.hzims.operational.duty.vo.ImsSchedulingVo">
SELECT
DM.ID AS id,
DM.DUTY_GROUP_ID AS groupId,
DM.CLASS_ID AS classId,
DM.PRE_DUTY_ID AS preDutyId,
DM.DUTY_PERSON_IDS AS dutyPersonIds,
DM.status ,
DM.DUTY_DATE AS dutyDate,
CONCAT(CASE WHEN DM.`CLASS_ID` = 0 THEN '休息' ELSE DC.CLASS_NAME END,'-') AS name,
DC.START_TIME AS startTime,
DC.END_TIME AS endTime,
DM.CREATE_USER,
DM.CREATE_DEPT
FROM
hz_ims_duty_main DM
LEFT JOIN hz_ims_duty_class DC
ON DM.CLASS_ID = DC.ID
WHERE DM.IS_DELETED = 0
<if test="date != null">
AND DM.DUTY_DATE like CONCAT('%',#{date},'%')
</if>
<if test="deptId != null">
and DM.CREATE_DEPT = #{deptId}
</if>
ORDER BY DM.ID
</select>
<select id="selectByDateListAll" resultType="com.hnac.hzims.operational.duty.vo.ImsSchedulingVo"> <select id="selectByDateListAll" resultType="com.hnac.hzims.operational.duty.vo.ImsSchedulingVo">
SELECT SELECT
DM.*, DM.*,
@ -97,7 +124,6 @@
</if> </if>
</select> </select>
<select id="selectByIdOne" resultType="com.hnac.hzims.operational.duty.vo.ImsSchedulingVo"> <select id="selectByIdOne" resultType="com.hnac.hzims.operational.duty.vo.ImsSchedulingVo">
SELECT SELECT
DM.*, DM.*,
@ -120,6 +146,24 @@
</if> </if>
limit 1 limit 1
</select> </select>
<select id="selectByIdOneV2" resultType="com.hnac.hzims.operational.duty.vo.ImsSchedulingVo">
SELECT
DM.*,
DC.CLASS_NAME AS className,
DC.`START_TIME` AS startTime,
DC.`END_TIME` AS endTime,
FROM hz_ims_duty_main DM
LEFT JOIN hz_ims_duty_class DC
ON DM.CLASS_ID = DC.ID
WHERE DM.is_deleted = 0
<if test="id != null and id != ''">
and DM.ID = #{id}
</if>
<if test="preDutyId != null and preDutyId != ''">
and DM.PRE_DUTY_ID = #{preDutyId}
</if>
limit 1
</select>
<select id="selectByPreDutyIdOne" resultType="com.hnac.hzims.operational.duty.vo.ImsSchedulingVo"> <select id="selectByPreDutyIdOne" resultType="com.hnac.hzims.operational.duty.vo.ImsSchedulingVo">
SELECT SELECT
DM.*, DM.*,
@ -188,6 +232,26 @@
#{item} #{item}
</foreach> </foreach>
</select> </select>
<select id="selectDutyMainByDeptV2" resultType="com.hnac.hzims.operational.duty.vo.ImsDutyMainMergeVo">
SELECT
DM.`ID` AS dutyId,
DM.`CLASS_ID` AS classId,
DM.`DUTY_GROUP_ID` AS groupId,
DC.CLASS_NAME AS className,
DM.`CREATE_DEPT` AS deptId,
DM.STATUS,
IFNULL(DM.`PRE_DUTY_ID`,0) AS preDutyId
FROM
hz_ims_duty_main DM
LEFT JOIN hz_ims_duty_class DC
ON DM.CLASS_ID = DC.ID
WHERE DM.is_deleted = 0
and (DM.STATUS = 0 OR DM.STATUS = 1)
and DM.`CREATE_DEPT` IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="selectSchedulingVoByDateList" resultType="com.hnac.hzims.operational.duty.vo.ImsDutyGroupGenerationVo"> <select id="selectSchedulingVoByDateList" resultType="com.hnac.hzims.operational.duty.vo.ImsDutyGroupGenerationVo">
SELECT DM.*, SELECT DM.*,
DC.CLASS_NAME AS className, DC.CLASS_NAME AS className,
@ -204,6 +268,7 @@
AND DM.DUTY_DATE &gt;= #{startDate} AND DM.DUTY_DATE &gt;= #{startDate}
AND DM.DUTY_DATE &lt;= #{endDate} AND DM.DUTY_DATE &lt;= #{endDate}
</select> </select>
<select id="selectDutyMainInfoVo" resultType="com.hnac.hzims.operational.duty.vo.DutyMainInfoVo"> <select id="selectDutyMainInfoVo" resultType="com.hnac.hzims.operational.duty.vo.DutyMainInfoVo">
SELECT DM.*, DC.`CLASS_NAME`, DG.`GROUP_NAME`, DG.`MANAGER_ID`, DC.`START_TIME`, DC.`END_TIME` SELECT DM.*, DC.`CLASS_NAME`, DG.`GROUP_NAME`, DG.`MANAGER_ID`, DC.`START_TIME`, DC.`END_TIME`
FROM hz_ims_duty_main DM FROM hz_ims_duty_main DM
@ -217,6 +282,17 @@
and DM.CREATE_DEPT = #{deptId} and DM.CREATE_DEPT = #{deptId}
</if> </if>
</select> </select>
<select id="selectDutyMainInfoVoV2" resultType="com.hnac.hzims.operational.duty.vo.DutyMainInfoVo">
SELECT DM.*, DC.`CLASS_NAME`,DC.`START_TIME`, DC.`END_TIME`
FROM hz_ims_duty_main DM
JOIN hz_ims_duty_class DC
ON DM.`CLASS_ID` = DC.`ID`
WHERE DM.`STATUS` = '1'
AND DG.MANAGER_ID IS NOT NULL
<if test="deptId != null">
and DM.CREATE_DEPT = #{deptId}
</if>
</select>
<select id="selectDutyMainInfoSign" resultType="com.hnac.hzims.operational.duty.vo.DutyMainInfoVo"> <select id="selectDutyMainInfoSign" resultType="com.hnac.hzims.operational.duty.vo.DutyMainInfoVo">
SELECT DM.*, DC.`CLASS_NAME`, DG.`GROUP_NAME`, DG.`MANAGER_ID` as managerId, DC.`START_TIME`, DC.`END_TIME` SELECT DM.*, DC.`CLASS_NAME`, DG.`GROUP_NAME`, DG.`MANAGER_ID` as managerId, DC.`START_TIME`, DC.`END_TIME`
FROM hz_ims_duty_main DM FROM hz_ims_duty_main DM
@ -229,7 +305,16 @@
order by DM.duty_date desc order by DM.duty_date desc
limit 1; limit 1;
</select> </select>
<select id="selectDutyMainInfoSignV2" resultType="com.hnac.hzims.operational.duty.vo.DutyMainInfoVo">
SELECT DM.*, DC.`CLASS_NAME` as managerId, DC.`START_TIME`, DC.`END_TIME`
FROM hz_ims_duty_main DM
JOIN hz_ims_duty_class DC
ON DM.`CLASS_ID` = DC.`ID`
WHERE DG.MANAGER_ID IS NOT NULL
AND DM.PRE_DUTY_ID = #{preDutyId}
order by DM.duty_date desc
limit 1;
</select>
<select id="getDutyData" resultType="com.hnac.hzims.operational.duty.vo.DutyInfoVo"> <select id="getDutyData" resultType="com.hnac.hzims.operational.duty.vo.DutyInfoVo">
SELECT DG.ID GROUP_ID,DG.GROUP_NAME,DC.CLASS_NAME, DG.MANAGER_ID, DC.START_TIME, DC.END_TIME,DM.DUTY_DATE DATE_TIME,DM.ID,DM.PRE_DUTY_ID,DM.CREATE_DEPT SELECT DG.ID GROUP_ID,DG.GROUP_NAME,DC.CLASS_NAME, DG.MANAGER_ID, DC.START_TIME, DC.END_TIME,DM.DUTY_DATE DATE_TIME,DM.ID,DM.PRE_DUTY_ID,DM.CREATE_DEPT
FROM hz_ims_duty_main DM FROM hz_ims_duty_main DM
@ -244,6 +329,17 @@
#{item} #{item}
</foreach> </foreach>
</select> </select>
<select id="getDutyDataV2" resultType="com.hnac.hzims.operational.duty.vo.DutyInfoVo">
SELECT DC.CLASS_NAME, DC.START_TIME, DC.END_TIME,DM.DUTY_DATE DATE_TIME,DM.ID,DM.PRE_DUTY_ID,DM.CREATE_DEPT
FROM hz_ims_duty_main DM
JOIN hz_ims_duty_class DC
ON DM.CLASS_ID = DC.ID
WHERE DM.STATUS = '1'
AND DM.CREATE_DEPT IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="queryDutyInfo" resultType="com.hnac.hzims.operational.duty.vo.DutyMainInfoVo"> <select id="queryDutyInfo" resultType="com.hnac.hzims.operational.duty.vo.DutyMainInfoVo">
SELECT DM.DUTY_DATE DATE_TIME, DC.`CLASS_NAME`, DG.`GROUP_NAME`, DG.`MANAGER_ID` as managerId, DC.`START_TIME`, DC.`END_TIME` SELECT DM.DUTY_DATE DATE_TIME, DC.`CLASS_NAME`, DG.`GROUP_NAME`, DG.`MANAGER_ID` as managerId, DC.`START_TIME`, DC.`END_TIME`
@ -257,5 +353,14 @@
order by DM.duty_date desc order by DM.duty_date desc
limit 1; limit 1;
</select> </select>
<select id="queryDutyInfoV2" resultType="com.hnac.hzims.operational.duty.vo.DutyMainInfoVo">
SELECT DM.DUTY_DATE DATE_TIME, DC.`CLASS_NAME`, DC.`START_TIME`, DC.`END_TIME`
FROM hz_ims_duty_main DM
JOIN hz_ims_duty_class DC
ON DM.`CLASS_ID` = DC.`ID`
WHERE DG.MANAGER_ID IS NOT NULL
AND DM.ID = #{dutyId}
order by DM.duty_date desc
limit 1;
</select>
</mapper> </mapper>

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainPersonMapper.java

@ -0,0 +1,14 @@
package com.hnac.hzims.operational.duty.mapper;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainPersonEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* Mapper 接口
*
* @author ty
*/
public interface ImsDutyMainPersonMapper extends UserDataScopeBaseMapper<ImsDutyMainPersonEntity> {
}

29
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainPersonMapper.xml

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.operational.duty.mapper.ImsDutyMainPersonMapper">
<resultMap id="BaseResultMap" type="com.hnac.hzims.operational.duty.entity.ImsDutyMainPersonEntity">
<id column="ID" property="id" jdbcType="BIGINT"/>
<result column="TENANT_ID" property="tenantId" jdbcType="VARCHAR"/>
<result column="DUTY_PERSON" property="dutyPerson" jdbcType="LONGVARCHAR"/>
<result column="DUTY_CHARGE_PERSON" property="dutyChargePerson" jdbcType="LONGVARCHAR"/>
<result column="DUTY_DATE" property="dutyDate" jdbcType="DATE"/>
<result column="CLASS_ID" property="classId" jdbcType="BIGINT"/>
<result column="DUTY_GROUP_ID" property="dutyGroupId" jdbcType="BIGINT"/>
<result column="CLASS_NAME" property="className" jdbcType="VARCHAR"/>
<result column="STATUS" property="status" jdbcType="TINYINT"/>
<result column="REMARK" property="remark" jdbcType="LONGVARCHAR"/>
<result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP"/>
<result column="UPDATE_TIME" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="CREATE_USER" property="createUser" jdbcType="BIGINT"/>
<result column="UPDATE_USER" property="updateUser" jdbcType="BIGINT"/>
<result column="IS_DELETED" property="isDeleted" jdbcType="TINYINT"/>
<result column="CREATE_DEPT" property="createDept" jdbcType="BIGINT"/>
</resultMap>
<sql id="Base_Column_List">
ID
, TENANT_ID, DUTY_PERSON_IDS, DUTY_DATE, CLASS_ID, STATUS,
REMARK,CREATE_TIME, UPDATE_TIME, CREATE_USER, UPDATE_USER, IS_DELETED,CREATE_DEPT
</sql>
</mapper>

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainTemplateMapper.xml

@ -10,6 +10,8 @@
<result column="DUTY_CLASS_TYPE_ID" property="dutyClassTypeId" jdbcType="BIGINT"/> <result column="DUTY_CLASS_TYPE_ID" property="dutyClassTypeId" jdbcType="BIGINT"/>
<result column="DUTY_NUM" property="dutyNum" jdbcType="INTEGER"/> <result column="DUTY_NUM" property="dutyNum" jdbcType="INTEGER"/>
<result column="STATUS" property="status" jdbcType="TINYINT"/> <result column="STATUS" property="status" jdbcType="TINYINT"/>
<result column="FLEXIBLE" property="flexible" jdbcType="VARCHAR"/>
<result column="TYPE" property="type" jdbcType="TINYINT"/>
<result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP"/> <result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP"/>
<result column="UPDATE_TIME" property="updateTime" jdbcType="TIMESTAMP"/> <result column="UPDATE_TIME" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="CREATE_USER" property="createUser" jdbcType="BIGINT"/> <result column="CREATE_USER" property="createUser" jdbcType="BIGINT"/>
@ -19,8 +21,9 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
ID, TENANT_ID, TEMPLATE_NAME, DUTY_ORDER_IDS , DUTY_ARR_IDS, DUTY_CLASS_TYPE_ID, ID
DUTY_NUM, STATUS, CREATE_TIME, UPDATE_TIME, CREATE_USER, UPDATE_USER, IS_DELETED, , TENANT_ID, TEMPLATE_NAME, DUTY_ORDER_IDS , DUTY_ARR_IDS, DUTY_CLASS_TYPE_ID,
DUTY_NUM, STATUS, FLEXIBLE,TYPE,CREATE_TIME, UPDATE_TIME, CREATE_USER, UPDATE_USER, IS_DELETED,
CREATE_DEPT CREATE_DEPT
</sql> </sql>

32
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/scheduled/ThreadTask.java

@ -3,6 +3,8 @@ package com.hnac.hzims.operational.duty.scheduled;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.monitor.utils.DateUtils; import com.hnac.hzims.monitor.utils.DateUtils;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainPersonEntity;
import com.hnac.hzims.operational.duty.service.IImsDutyMainPersonService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService; import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenancePlanService; import com.hnac.hzims.operational.maintenance.service.IOperMaintenancePlanService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -21,6 +23,8 @@ public class ThreadTask {
@Autowired @Autowired
private IImsDutyMainService iImsDutyMainService; private IImsDutyMainService iImsDutyMainService;
@Autowired
private IImsDutyMainPersonService iImsDutyMainPersonService;
@Autowired @Autowired
private IOperMaintenancePlanService operMaintenancePlanService; private IOperMaintenancePlanService operMaintenancePlanService;
@ -42,7 +46,21 @@ public class ThreadTask {
log.error(e.getMessage(), e.toString()); log.error(e.getMessage(), e.toString());
} }
} }
public static void dutyTask(List<ImsDutyMainEntity> list, List<ImsDutyMainPersonEntity> personEntityList, String date, String proDutyMainId, Long dept, Long classTypeId) {
try {
Runnable runnable = new Runnable() {
@Override
public void run() {
//异步任务
saveBaschTask(list,personEntityList,date,proDutyMainId,dept,classTypeId);
}
};
Thread thread = new Thread(runnable);
thread.start();
} catch (Exception e) {
log.error(e.getMessage(), e.toString());
}
}
// 声明对象 // 声明对象
public static ThreadTask threadTask; public static ThreadTask threadTask;
@ -60,7 +78,19 @@ public class ThreadTask {
*/ */
private static void saveBaschTask(List<ImsDutyMainEntity> list,String date,String proDutyMainId,Long dept,Long classTypeId) { private static void saveBaschTask(List<ImsDutyMainEntity> list,String date,String proDutyMainId,Long dept,Long classTypeId) {
threadTask.iImsDutyMainService.doSaveBasch(list); threadTask.iImsDutyMainService.doSaveBasch(list);
ImsDutyMainEntity entity = new ImsDutyMainEntity();
entity.setPreDutyId(Long.valueOf(proDutyMainId));
String subDate = DateUtils.dayStringDate(date, 1, true);
threadTask.iImsDutyMainService.update(entity, new LambdaQueryWrapper<ImsDutyMainEntity>() {{
eq(ImsDutyMainEntity::getDutyDate, subDate).eq(ImsDutyMainEntity::getCreateDept, dept).orderByAsc(ImsDutyMainEntity::getId).last(" LIMIT 1");
}});
threadTask.operMaintenancePlanService.compensateClassTypeTask(classTypeId.toString());
}
private static void saveBaschTask(List<ImsDutyMainEntity> list,List<ImsDutyMainPersonEntity> personEntityList,String date,String proDutyMainId,Long dept,Long classTypeId) {
threadTask.iImsDutyMainService.doSaveBasch(list);
threadTask.iImsDutyMainPersonService.doSaveBasch(personEntityList);
ImsDutyMainEntity entity = new ImsDutyMainEntity(); ImsDutyMainEntity entity = new ImsDutyMainEntity();
entity.setPreDutyId(Long.valueOf(proDutyMainId)); entity.setPreDutyId(Long.valueOf(proDutyMainId));
String subDate = DateUtils.dayStringDate(date, 1, true); String subDate = DateUtils.dayStringDate(date, 1, true);

23
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyEmergencyService.java

@ -0,0 +1,23 @@
package com.hnac.hzims.operational.duty.service;
import com.hnac.hzims.operational.duty.entity.ImsDutyEmergencyEntity;
import com.hnac.hzims.operational.duty.vo.ImsDutyEmergencyVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
/**
* 服务类
*
* @author Chill
*/
public interface IImsDutyEmergencyService extends BaseService<ImsDutyEmergencyEntity> {
R saveEntity(ImsDutyEmergencyEntity imsDutyEmergencyEntity);
R deleteEntity(ImsDutyEmergencyEntity imsDutyEmergencyEntity);
R queryEntity(ImsDutyEmergencyVo imsDutyEmergencyVo, Query query);
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyGroupPService.java

@ -24,7 +24,7 @@ public interface IImsDutyGroupPService extends IService<ImsDutyGroupPEntity> {
* @return * @return
*/ */
List<ImsDutyGroupPEntity> selectByGroupId(Long groupId); List<ImsDutyGroupPEntity> selectByGroupId(Long groupId);
List<ImsDutyGroupPEntity> selectByGroupIds(List<Long> groupId);
/** /**
* 批量删除 * 批量删除
* @param ids * @param ids

17
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyMainPersonService.java

@ -0,0 +1,17 @@
package com.hnac.hzims.operational.duty.service;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainPersonEntity;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
* 服务类
*
* @author Chill
*/
public interface IImsDutyMainPersonService extends BaseService<ImsDutyMainPersonEntity> {
void doSaveBasch(List<ImsDutyMainPersonEntity> list);
}

13
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyMainService.java

@ -34,6 +34,7 @@ public interface IImsDutyMainService extends BaseService<ImsDutyMainEntity> {
* @return * @return
*/ */
R delete(List<Long> ids); R delete(List<Long> ids);
R deleteV2(List<Long> ids);
/** /**
@ -45,6 +46,8 @@ public interface IImsDutyMainService extends BaseService<ImsDutyMainEntity> {
R getByDateListAll(String dutyDate, Long personId); R getByDateListAll(String dutyDate, Long personId);
ImsSchedulingVo getByIdOne(Long id); ImsSchedulingVo getByIdOne(Long id);
ImsSchedulingVo getByIdOneV2(Long id);
ImsSchedulingVo getByIdOneV2(Long id, Long preDutyId);
ImsDutyMainEntity getMainEntity(Long id); ImsDutyMainEntity getMainEntity(Long id);
@ -55,12 +58,16 @@ public interface IImsDutyMainService extends BaseService<ImsDutyMainEntity> {
*/ */
R getScheduling(ImsSchedulingVo imsSchedulingVo); R getScheduling(ImsSchedulingVo imsSchedulingVo);
R getSchedulingV2(ImsSchedulingVo imsSchedulingVo);
R getSchedulingList(int year, int month, Long deptId); R getSchedulingList(int year, int month, Long deptId);
R getSchedulingListV2(int year, int month, Long deptId);
R getMainIdByPerson(Long id); R getMainIdByPerson(Long id);
R getMainIdByPersonV2(Long id);
ImsSchedulingVo getTheManinGroup(); ImsSchedulingVo getTheManinGroup();
/** /**
@ -82,6 +89,8 @@ public interface IImsDutyMainService extends BaseService<ImsDutyMainEntity> {
List<ImsDutyMainMergeVo> getDutyMainByDept(List<Long> list); List<ImsDutyMainMergeVo> getDutyMainByDept(List<Long> list);
List<ImsDutyMainMergeVo> getDutyMainByDeptV2(List<Long> list);
void doSaveBasch(List<ImsDutyMainEntity> list); void doSaveBasch(List<ImsDutyMainEntity> list);
@ -118,12 +127,14 @@ public interface IImsDutyMainService extends BaseService<ImsDutyMainEntity> {
* 获取当班 * 获取当班
*/ */
List<DutyMainInfoVo> getDutyData(Long deptId); List<DutyMainInfoVo> getDutyData(Long deptId);
List<DutyMainInfoVo> getDutyDataV2(Long deptId);
/** /**
* 获取当班 * 获取当班
*/ */
DutyMainInfoVo getNextDutyData(Long parentId); DutyMainInfoVo getNextDutyData(Long parentId);
DutyMainInfoVo getNextDutyDataV2(Long parentId);
/** /**
* 获取区域值班 * 获取区域值班
@ -131,4 +142,6 @@ public interface IImsDutyMainService extends BaseService<ImsDutyMainEntity> {
* @return * @return
*/ */
List<DutyInfoVo> getDutyData(List<Long> deptIdList); List<DutyInfoVo> getDutyData(List<Long> deptIdList);
R getAllPersonInfo(Long deptId);
} }

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyRecService.java

@ -53,6 +53,7 @@ public interface IImsDutyRecService extends BaseService<ImsDutyRecEntity> {
IPage<ImsDutyRecVO> getRecVoPage(IPage<ImsDutyRecEntity> page, ImsDutyRecVO vo); IPage<ImsDutyRecVO> getRecVoPage(IPage<ImsDutyRecEntity> page, ImsDutyRecVO vo);
R<ImsDutyRecVO> getTheManinGroupRec(Long deptId); R<ImsDutyRecVO> getTheManinGroupRec(Long deptId);
// R<ImsDutyRecVO> getTheManinGroupRecV2(Long deptId);
/** /**
* 获取签到二维码 * 获取签到二维码

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyChangeServiceImpl.java

@ -124,9 +124,9 @@ public class ImsDutyChangeServiceImpl extends BaseServiceImpl<ImsDutyChangeMappe
vo.setUpdateUserName(UserCache.getUser(detail.getUpdateUser()).getName()); vo.setUpdateUserName(UserCache.getUser(detail.getUpdateUser()).getName());
vo.setAcceptPersonName(UserCache.getUser(detail.getAcceptPersonId()).getName()); vo.setAcceptPersonName(UserCache.getUser(detail.getAcceptPersonId()).getName());
vo.setApplyPersonName(UserCache.getUser(detail.getApplyPersonId()).getName()); vo.setApplyPersonName(UserCache.getUser(detail.getApplyPersonId()).getName());
ImsSchedulingVo imsSchedulingVo1 = dutyMainService.getByIdOne(detail.getAcceptDutyId()); ImsSchedulingVo imsSchedulingVo1 = dutyMainService.getByIdOneV2(detail.getAcceptDutyId());
vo.setAcceptDutyMainVo(imsSchedulingVo1 == null ? null : imsSchedulingVo1); vo.setAcceptDutyMainVo(imsSchedulingVo1 == null ? null : imsSchedulingVo1);
ImsSchedulingVo imsSchedulingVo = dutyMainService.getByIdOne(detail.getApplyDutyId()); ImsSchedulingVo imsSchedulingVo = dutyMainService.getByIdOneV2(detail.getApplyDutyId());
vo.setApplyDutyMainVo(imsSchedulingVo == null ? null : imsSchedulingVo); vo.setApplyDutyMainVo(imsSchedulingVo == null ? null : imsSchedulingVo);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());

102
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyEmergencyServiceImpl.java

@ -0,0 +1,102 @@
package com.hnac.hzims.operational.duty.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.duty.entity.*;
import com.hnac.hzims.operational.duty.enume.DutyMainStatus;
import com.hnac.hzims.operational.duty.mapper.ImsDutyEmergencyMapper;
import com.hnac.hzims.operational.duty.mapper.ImsDutyMainMapper;
import com.hnac.hzims.operational.duty.service.*;
import com.hnac.hzims.operational.duty.vo.*;
import lombok.extern.slf4j.Slf4j;
import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 服务实现类
*
* @author ty
*/
@Slf4j
@Service
public class ImsDutyEmergencyServiceImpl extends BaseServiceImpl<ImsDutyEmergencyMapper, ImsDutyEmergencyEntity> implements IImsDutyEmergencyService {
@Resource
private ImsDutyMainMapper imsDutyMainMapper;
@Override
public R saveEntity(ImsDutyEmergencyEntity imsDutyEmergencyEntity) {
ImsDutyMainEntity entity = imsDutyMainMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
eq(ImsDutyMainEntity::getStatus, DutyMainStatus.EXEC.getVal());
eq(ImsDutyMainEntity::getCreateDept, imsDutyEmergencyEntity.getCreateDept());
like(ImsDutyMainEntity::getDutyPersonIds, AuthUtil.getUserId()).last(" limit 1");
}});
if (ObjectUtil.isEmpty(entity)) {
return R.success("您当前未值班");
}
this.saveOrUpdate(imsDutyEmergencyEntity);
return R.success("保存成功");
}
@Override
public R deleteEntity(ImsDutyEmergencyEntity imsDutyEmergencyEntity) {
this.removeById(imsDutyEmergencyEntity.getId());
return R.success("删除成功");
}
@Override
public R queryEntity(ImsDutyEmergencyVo imsDutyEmergencyVo, Query query) {
QueryWrapper<ImsDutyEmergencyEntity> queryWrapper = getQueryWrapper(imsDutyEmergencyVo);
IPage<ImsDutyEmergencyEntity> imsDutyEmergencyEntityIPage = baseMapper.selectPage(Condition.getPage(query), queryWrapper);
return R.data(imsDutyEmergencyEntityIPage);
}
private QueryWrapper<ImsDutyEmergencyEntity> getQueryWrapper(ImsDutyEmergencyVo imsDutyEmergencyVo) {
QueryWrapper<ImsDutyEmergencyEntity> queryWrapper = new QueryWrapper();
if (ObjectUtils.isNotEmpty(imsDutyEmergencyVo.getId())) {
queryWrapper.lambda().in(ImsDutyEmergencyEntity::getId, imsDutyEmergencyVo.getId());
}
if (ObjectUtils.isNotEmpty(imsDutyEmergencyVo.getDutyStartTime())) {
queryWrapper.lambda().ge(ImsDutyEmergencyEntity::getDutyTime, imsDutyEmergencyVo.getDutyStartTime());
}
if (ObjectUtils.isNotEmpty(imsDutyEmergencyVo.getDutyEndTime())) {
queryWrapper.lambda().le(ImsDutyEmergencyEntity::getDutyTime, imsDutyEmergencyVo.getDutyEndTime());
}
if (CollectionUtils.isNotEmpty(imsDutyEmergencyVo.getDutyClass())) {
queryWrapper.lambda().in(ImsDutyEmergencyEntity::getDutyClass, imsDutyEmergencyVo.getDutyClass());
}
if (CollectionUtils.isNotEmpty(imsDutyEmergencyVo.getChargePerson())) {
queryWrapper.lambda().in(ImsDutyEmergencyEntity::getChargePerson, imsDutyEmergencyVo.getChargePerson());
}
if (CollectionUtils.isNotEmpty(imsDutyEmergencyVo.getRegistrant())) {
queryWrapper.lambda().in(ImsDutyEmergencyEntity::getRegistrant, imsDutyEmergencyVo.getRegistrant());
}
if (CollectionUtils.isNotEmpty(imsDutyEmergencyVo.getRegistrant())) {
queryWrapper.lambda().in(ImsDutyEmergencyEntity::getRegistrant, imsDutyEmergencyVo.getRegistrant());
}
if (StringUtils.isNotEmpty(imsDutyEmergencyVo.getEventTitle())) {
queryWrapper.lambda().like(ImsDutyEmergencyEntity::getEventTitle, imsDutyEmergencyVo.getEventTitle());
}
if (StringUtils.isNotEmpty(imsDutyEmergencyVo.getEventInfo())) {
queryWrapper.lambda().like(ImsDutyEmergencyEntity::getEventInfo, imsDutyEmergencyVo.getEventInfo());
}
if (StringUtils.isNotEmpty(imsDutyEmergencyVo.getEventType())) {
queryWrapper.lambda().like(ImsDutyEmergencyEntity::getEventType, imsDutyEmergencyVo.getEventType());
}
return queryWrapper;
}
}

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyGroupPServiceImpl.java

@ -36,7 +36,10 @@ public class ImsDutyGroupPServiceImpl extends ServiceImpl<ImsDutyGroupPMapper, I
public List<ImsDutyGroupPEntity> selectByGroupId(Long groupId) { public List<ImsDutyGroupPEntity> selectByGroupId(Long groupId) {
return this.baseMapper.selectByGroupId(groupId); return this.baseMapper.selectByGroupId(groupId);
} }
@Override
public List<ImsDutyGroupPEntity> selectByGroupIds(List<Long> groupId) {
return this.baseMapper.selectByGroupIds(groupId);
}
@Override @Override
public void deleteBatch(List<Long> ids) { public void deleteBatch(List<Long> ids) {
this.baseMapper.deleteBatch(ids); this.baseMapper.deleteBatch(ids);

74
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainPersonServiceImpl.java

@ -0,0 +1,74 @@
package com.hnac.hzims.operational.duty.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.hnac.hzims.monitor.utils.DateUtils;
import com.hnac.hzims.operational.defect.constants.DefectConstant;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.mapper.OperPhenomenonMapper;
import com.hnac.hzims.operational.duty.entity.*;
import com.hnac.hzims.operational.duty.enume.DutyRecStatus;
import com.hnac.hzims.operational.duty.enume.JoinStatus;
import com.hnac.hzims.operational.duty.mapper.*;
import com.hnac.hzims.operational.duty.scheduled.ThreadTask;
import com.hnac.hzims.operational.duty.service.IImsDutyGroupPService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainPersonService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainTemplateService;
import com.hnac.hzims.operational.duty.vo.*;
import com.hnac.hzims.operational.main.vo.DutyPersonalReportVO;
import com.hnac.hzims.operational.report.vo.DutyReportVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.sql.Time;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* 服务实现类
*
* @author Chill
*/
@Service
@Slf4j
public class ImsDutyMainPersonServiceImpl extends BaseServiceImpl<ImsDutyMainPersonMapper, ImsDutyMainPersonEntity> implements IImsDutyMainPersonService {
@Autowired
private ImsDutyGroupPMapper imsDutyGroupPMapper;
@Autowired
private IImsDutyMainTemplateService iImsDutyMainTemplateService;
@Autowired
private ImsDutyGroupMapper dutyGroupMapper;
@Autowired
private OperPhenomenonMapper operPhenomenonMapper;
@Autowired
private ImsDutyRecMapper imsDutyRecMapper;
@Autowired
private IImsDutyGroupPService imsDutyGroupPService;
@Autowired
private DutyGroupGeneratingCapacityMapper groupGeneratingCapacityMapper;
@Override
public void doSaveBasch(List<ImsDutyMainPersonEntity> list) {
this.saveBatch(list);
}
}

613
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java

@ -15,6 +15,7 @@ import com.hnac.hzims.operational.duty.enume.JoinStatus;
import com.hnac.hzims.operational.duty.mapper.*; import com.hnac.hzims.operational.duty.mapper.*;
import com.hnac.hzims.operational.duty.scheduled.ThreadTask; import com.hnac.hzims.operational.duty.scheduled.ThreadTask;
import com.hnac.hzims.operational.duty.service.IImsDutyGroupPService; import com.hnac.hzims.operational.duty.service.IImsDutyGroupPService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainPersonService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService; import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainTemplateService; import com.hnac.hzims.operational.duty.service.IImsDutyMainTemplateService;
import com.hnac.hzims.operational.duty.vo.*; import com.hnac.hzims.operational.duty.vo.*;
@ -28,8 +29,11 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*; import org.springblade.core.tool.utils.*;
import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import java.sql.Time; import java.sql.Time;
import java.text.DateFormat; import java.text.DateFormat;
@ -58,11 +62,18 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
@Autowired @Autowired
private OperPhenomenonMapper operPhenomenonMapper; private OperPhenomenonMapper operPhenomenonMapper;
@Autowired @Autowired
private ImsDutyMainPersonMapper imsDutyMainPersonMapper;
@Autowired
private IImsDutyMainPersonService iImsDutyMainPersonService;
@Autowired
private ImsDutyRecMapper imsDutyRecMapper; private ImsDutyRecMapper imsDutyRecMapper;
@Autowired @Autowired
private IImsDutyGroupPService imsDutyGroupPService; private IImsDutyGroupPService imsDutyGroupPService;
@Autowired @Autowired
private DutyGroupGeneratingCapacityMapper groupGeneratingCapacityMapper; private DutyGroupGeneratingCapacityMapper groupGeneratingCapacityMapper;
@Autowired
private IUserClient userClient;
@Override @Override
public R saveOrUpdateImsDutyMain(ImsDutyMainEntity imsDutyMain) { public R saveOrUpdateImsDutyMain(ImsDutyMainEntity imsDutyMain) {
@ -110,6 +121,26 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public R deleteV2(List<Long> ids) {
if (ids.size() == 0) {
return R.fail("ids不能为空");
}
//状态为待值班的才可以删除
for (int i = 0; i < ids.size(); i++) {
ImsDutyMainEntity imsDutyMainEntity = this.getById(ids.get(i));
if (imsDutyMainEntity.getStatus() != JoinStatus.DUTY_WAIT.getStatus()) {
return R.fail("状态为待值班的才可以删除");
}
}
List<ImsDutyMainPersonEntity> personEntityList = imsDutyMainPersonMapper.selectList(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
in(ImsDutyMainPersonEntity::getDutyMainId, ids);
}});
List<Long> collect = personEntityList.stream().map(s -> s.getId()).collect(Collectors.toList());
return R.status(this.deleteLogic(ids) && iImsDutyMainPersonService.deleteLogic(collect));
}
@Override
public R getByDateListAll(String dutyDate, Long personId) { public R getByDateListAll(String dutyDate, Long personId) {
return R.data(this.baseMapper.selectByDateListAll(dutyDate, personId)); return R.data(this.baseMapper.selectByDateListAll(dutyDate, personId));
} }
@ -121,6 +152,42 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
} }
@Override @Override
public ImsSchedulingVo getByIdOneV2(Long id) {
ImsSchedulingVo imsSchedulingVo = this.baseMapper.selectByIdOneV2(id, null);
if (null == imsSchedulingVo.getGroupId()) {
imsSchedulingVo.setGroupName("临时班组");
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, id);
}});
imsSchedulingVo.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson());
} else {
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(imsSchedulingVo.getGroupId());
imsSchedulingVo.setGroupName(imsDutyGroupEntity.getGroupName());
imsSchedulingVo.setGroupId(imsDutyGroupEntity.getId());
imsSchedulingVo.setManagerId(imsDutyGroupEntity.getManagerId());
}
return imsSchedulingVo;
}
@Override
public ImsSchedulingVo getByIdOneV2(Long id, Long preDutyId) {
ImsSchedulingVo imsSchedulingVo = this.baseMapper.selectByIdOneV2(id, preDutyId);
if (null == imsSchedulingVo.getGroupId()) {
imsSchedulingVo.setGroupName("临时班组");
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, id);
}});
imsSchedulingVo.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson());
} else {
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(imsSchedulingVo.getGroupId());
imsSchedulingVo.setGroupName(imsDutyGroupEntity.getGroupName());
imsSchedulingVo.setGroupId(imsDutyGroupEntity.getId());
imsSchedulingVo.setManagerId(imsDutyGroupEntity.getManagerId());
}
return imsSchedulingVo;
}
@Override
public ImsDutyMainEntity getMainEntity(Long id) { public ImsDutyMainEntity getMainEntity(Long id) {
return this.baseMapper.selectMainByIdOne(id); return this.baseMapper.selectMainByIdOne(id);
} }
@ -133,6 +200,8 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
*/ */
@Override @Override
public R getScheduling(ImsSchedulingVo imsSchedulingVo) { public R getScheduling(ImsSchedulingVo imsSchedulingVo) {
if (null == imsSchedulingVo.getSchedulingType()) { if (null == imsSchedulingVo.getSchedulingType()) {
imsSchedulingVo.setSchedulingType(1); imsSchedulingVo.setSchedulingType(1);
} }
@ -144,6 +213,324 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
} }
@Override
@Transactional(rollbackFor = Exception.class)
public R getSchedulingV2(ImsSchedulingVo imsSchedulingVo) {
//判断是否符合排班规则。
String[] start = imsSchedulingVo.getStartDate().split("-");
String[] end = imsSchedulingVo.getEndDate().split("-");
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH) + 1;//获取月份
int day = cal.get(Calendar.DAY_OF_MONTH);
String date1 = getDate(year, month, day);
String date2 = DateUtils.dayStringDate(date1, 1, true);
if (!imsSchedulingVo.getStartDate().equals(date2)) {
String minusOnedDay = DateUtils.dayStringDate(imsSchedulingVo.getStartDate(), 1, false);
log.info("--------------Auth:" + AuthUtil.getDeptId() + "--------createDept:" + imsSchedulingVo.getCreateDept());
List<ImsDutyMainEntity> imsDutyMainEntities = this.baseMapper.selectByDateAndDept(minusOnedDay, imsSchedulingVo.getCreateDept());
if (CollectionUtil.isEmpty(imsDutyMainEntities)) {
return R.fail("所选日期之前存在未排班情况,请重新选择日期区间!");
}
}
List<String> dates = getTwoPeriodsAll(Integer.valueOf(start[0]), Integer.valueOf(start[1]), Integer.valueOf(start[2]), Integer.valueOf(end[0]), Integer.valueOf(end[1]), Integer.valueOf(end[2]));
if (Integer.valueOf(start[0]) < year) {
return R.fail("年份必须大于或等于当前年份!");
}
if (Integer.valueOf(start[0]) == year && Integer.valueOf(start[1]) < month) {
return R.fail("时间必须大于或等于当前时间");
}
List<ImsDutyMainEntity> imsDutyMainEntities2 = this.baseMapper.selectList(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
ge(ImsDutyMainEntity::getDutyDate, imsSchedulingVo.getStartDate());
le(ImsDutyMainEntity::getDutyDate, imsSchedulingVo.getEndDate());
eq(ImsDutyMainEntity::getCreateDept, imsSchedulingVo.getCreateDept());
}});
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities = imsDutyMainPersonMapper.selectList(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
ge(ImsDutyMainPersonEntity::getDutyDate, imsSchedulingVo.getStartDate());
le(ImsDutyMainPersonEntity::getDutyDate, imsSchedulingVo.getEndDate());
eq(ImsDutyMainPersonEntity::getCreateDept, imsSchedulingVo.getCreateDept());
}});
if (CollectionUtil.isNotEmpty(imsDutyMainPersonEntities) || CollectionUtil.isNotEmpty(imsDutyMainEntities2)) {
if (imsSchedulingVo.isCompose() == false) {
//如果有排班记录且无需排序,则返回
return R.data(1);
} else {
if (CollectionUtil.isNotEmpty(dates)) {
//重新修改已有的排版,先删除,在添加
this.baseMapper.delete(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
eq(ImsDutyMainEntity::getCreateDept, imsSchedulingVo.getCreateDept());
in(ImsDutyMainEntity::getDutyDate, dates);
}});
imsDutyMainPersonMapper.delete(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
in(ImsDutyMainPersonEntity::getDutyDate, dates);
eq(ImsDutyMainPersonEntity::getCreateDept, imsSchedulingVo.getCreateDept());
}});
}
}
}
String subDayDate = DateUtils.dayDate(DateUtil.parse(imsSchedulingVo.getStartDate(), DateUtil.PATTERN_DATE), -1, DateUtil.PATTERN_DATE);
ImsDutyMainEntity imsDutyMainEntity1 = this.baseMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
eq(ImsDutyMainEntity::getDutyDate, subDayDate);
eq(ImsDutyMainEntity::getCreateDept, imsSchedulingVo.getCreateDept());
ne(ImsDutyMainEntity::getStatus, "-1");
orderByDesc(ImsDutyMainEntity::getId).last("LIMIT 1");
}});
if (null == imsSchedulingVo.getSchedulingType()) {
imsSchedulingVo.setSchedulingType(1);
}
//符合条件后根据周期、轮询排班方式保存
if (1 == imsSchedulingVo.getSchedulingType()) {
return pollSchedulingV2(imsSchedulingVo, dates, imsDutyMainEntity1);
}
return cycleSchedulingTowV2(imsSchedulingVo, dates, imsDutyMainEntity1);
}
/**
* 轮询排班
*
* @param imsSchedulingVo
* @param dates
* @param imsDutyMainEntity1
* @return
*/
private R pollSchedulingV2(ImsSchedulingVo imsSchedulingVo, List<String> dates, ImsDutyMainEntity imsDutyMainEntity1) {
String[] groupIdsSplit;
int dutyNum;
//轮询排班分为:班组还是灵活;如果是2.灵活人员排班,则不需要查数据库,直接存对应信息
if (2 == imsSchedulingVo.getPersonType()) {
Map<String, List<String>> rosters = imsSchedulingVo.getRosters();
groupIdsSplit = rosters.keySet().toArray(new String[0]);
dutyNum = groupIdsSplit.length;
} else {
groupIdsSplit = imsSchedulingVo.getGroupIds().split("\\^");
String[] groupNamesSplit = imsSchedulingVo.getGroupNames().split("\\^");
dutyNum = groupNamesSplit.length;
}
String[] classIdsSplit = imsSchedulingVo.getClassIds().split("\\^");
String[] classNamesSplit = imsSchedulingVo.getClassNames().split("\\^");
int classNum = classNamesSplit.length;
int allClass = 0;
List<ImsDutyMainEntity> imsDutyMainEntityList = new ArrayList<>();
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntityList = new ArrayList<>();
String proDutyMainId = "";
for (int i = 1; i <= dates.size(); i++) {
String date = dates.get(i - 1);
for (int j = 1; j <= classNum; j++) {
//总排班数加1
allClass++;
int temp, tempSub = 0;
temp = allClass % dutyNum;
//班组下标,确定取哪个班组
tempSub = temp - 1;
//如果整除,取最后一个班组
if (temp == 0) {
tempSub = dutyNum - 1;
}
ImsDutyMainEntity imsDutyMainEntity = new ImsDutyMainEntity();
imsDutyMainEntity.setClassId(Long.valueOf(classIdsSplit[j - 1]));
imsDutyMainEntity.setClassName(classNamesSplit[j - 1]);
imsDutyMainEntity.setDutyDate(DateUtil.parse(date, DateUtil.PATTERN_DATE));
imsDutyMainEntity.setStatus(0);
imsDutyMainEntity.setCreateTime(new Date());
if (Func.isBlank(proDutyMainId)) {
if (ObjectUtil.isNotEmpty(imsDutyMainEntity1)) {
proDutyMainId = imsDutyMainEntity1.getId().toString();
}
imsDutyMainEntity.setPreDutyId(Long.valueOf(proDutyMainId));
}
imsDutyMainEntity.setCreateDept(imsSchedulingVo.getCreateDept());
List<Long> collect;
Long managerId;
if (2 == imsSchedulingVo.getPersonType()) {
List<String> idList = imsSchedulingVo.getRosters().get(groupIdsSplit[tempSub]);
collect = idList.stream().map(s -> Long.valueOf(s)).collect(Collectors.toList());
managerId = Long.valueOf(groupIdsSplit[tempSub]);
} else {
String groupId = groupIdsSplit[tempSub];
imsDutyMainEntity.setDutyGroupId(Long.valueOf(groupIdsSplit[tempSub]));
//查询预备排班的班组人员,为空,则失败
List<Long> longList = Arrays.asList(imsSchedulingVo.getGroupIds().split("\\^"))
.parallelStream()
.map(a -> Long.parseLong(a.trim()))
.collect(Collectors.toList());
List<ImsDutyGroupPEntity> list = imsDutyGroupPService.selectByGroupIds(longList);
collect = list.stream().filter(iter -> iter.getGroupId().toString().equals(groupId)).map(iter ->
iter.getPersonId()).collect(Collectors.toList());
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(groupId);
if (ObjectUtil.isNotEmpty(imsDutyGroupEntity) && ObjectUtil.isNotEmpty(imsDutyGroupEntity.getManagerId())) {
managerId = imsDutyGroupEntity.getManagerId();
} else {
return R.fail("该班组没有值班组组长");
}
}
String ids = StringUtils.join(collect, "^");
imsDutyMainEntity.setDutyPersonIds(ids);
Long id = IdWorker.getId();
imsDutyMainEntity.setId(id);
imsDutyMainEntity.setCreateUser(AuthUtil.getUserId());
imsDutyMainEntity.setUpdateUser(AuthUtil.getUserId());
imsDutyMainEntity.setTenantId(AuthUtil.getTenantId());
if (ObjectUtil.isNotEmpty(imsDutyMainEntity1)) {
proDutyMainId = imsDutyMainEntity1.getId().toString();
}
imsDutyMainEntity.setPreDutyId(Long.valueOf(proDutyMainId));
imsDutyMainEntityList.add(imsDutyMainEntity);
proDutyMainId = id == null ? "" : imsDutyMainEntity.getId() + "";
//值班人员表同步保存一份
copyPersonByDutyMain(imsSchedulingVo, managerId, imsDutyMainPersonEntityList, imsDutyMainEntity, collect);
}
}
ThreadTask.dutyTask(imsDutyMainEntityList, imsDutyMainPersonEntityList, imsSchedulingVo.getEndDate(), proDutyMainId, imsSchedulingVo.getCreateDept(), imsSchedulingVo.getDutyClassTypeId());
return R.success("操作成功,系统正在排班中,请稍后查看");
}
private static void copyPersonByDutyMain(ImsSchedulingVo imsSchedulingVo, Long managerId, List<ImsDutyMainPersonEntity> imsDutyMainPersonEntityList, ImsDutyMainEntity imsDutyMainEntity, List<Long> collect) {
//每个人员对应一条排班-人员计划
for (Long personId : collect) {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = new ImsDutyMainPersonEntity();
imsDutyMainPersonEntity.setClassId(imsDutyMainEntity.getClassId());
imsDutyMainPersonEntity.setCreateDept(imsDutyMainEntity.getCreateDept());
imsDutyMainPersonEntity.setClassName(imsDutyMainEntity.getClassName());
imsDutyMainPersonEntity.setDutyDate(imsDutyMainEntity.getDutyDate());
imsDutyMainPersonEntity.setStatus(imsDutyMainEntity.getStatus());
imsDutyMainPersonEntity.setCreateTime(imsDutyMainEntity.getCreateTime());
imsDutyMainPersonEntity.setDutyMainId(imsDutyMainEntity.getId());
imsDutyMainPersonEntity.setCreateUser(imsDutyMainEntity.getCreateUser());
imsDutyMainPersonEntity.setUpdateUser(imsDutyMainEntity.getUpdateUser());
imsDutyMainPersonEntity.setTenantId(imsDutyMainEntity.getTenantId());
imsDutyMainPersonEntity.setDutyPerson(personId);
long id1 = IdWorker.getId(imsDutyMainPersonEntity);
imsDutyMainPersonEntity.setId(id1);
if (2 == imsSchedulingVo.getPersonType()) {
imsDutyMainPersonEntity.setDutyChargePerson(imsSchedulingVo.getManagerId());
} else {
imsDutyMainPersonEntity.setDutyChargePerson(managerId);
}
imsDutyMainPersonEntityList.add(imsDutyMainPersonEntity);
}
}
/**
* 周期排班
*
* @param imsSchedulingVo
* @param dates
* @param imsDutyMainEntity1
* @return
*/
private R cycleSchedulingTowV2(ImsSchedulingVo imsSchedulingVo, List<String> dates, ImsDutyMainEntity imsDutyMainEntity1) {
if (imsSchedulingVo.getTemplate()) {
if (!doSaveTemplate(imsSchedulingVo)) {
return R.fail("模版名称已存在");
}
}
List<ImsDutyMainEntity> imsDutyMainEntityList = new ArrayList<>();
List<ImsDutyMainPersonEntity> personEntityList = new ArrayList<>();
String proDutyMainId = "";
String[] dutyArrIds = imsSchedulingVo.getDutyArrIds();
for (int i = 1; i <= dates.size(); i++) {
String date = dates.get(i - 1);
for (int j = 1; j <= dutyArrIds.length; j++) {
String classId = dutyArrIds[j - 1];
//按值班周期的天数取模
int temp = i % imsSchedulingVo.getDutyNum();
//值班下标
int tempSub = temp - 1;
//如果整除,取最后一个值班
if (temp == 0) {
tempSub = imsSchedulingVo.getDutyNum() - 1;
}
String groupId;
String[] split;
if (imsSchedulingVo.getPersonType() == 1) {
//获取对应班组的值班班次
groupId = imsSchedulingVo.getDutyOrderIds().get(classId)[tempSub];
}else {
//灵活排班,无实际作用,只是为了groupId能够初始化
groupId ="";
}
//人员IDS
String personIds = "";
if ("0".equals(classId)) {
//班组排班比灵活排班,多保存一部分没有排到班的信息
if (imsSchedulingVo.getPersonType() == 1) {
split = groupId.split(",");
if (ObjectUtil.isNotEmpty(split)) {
for (String dutyGroupId : split) {
//查询班组信息
List<ImsDutyGroupPEntity> list = imsDutyGroupPService.selectByGroupIds(Arrays.asList(Long.valueOf(dutyGroupId)));
List<Long> collectPerson = list.stream().filter(iter -> iter.getGroupId().toString().equals(dutyGroupId)).map(iter -> iter.getPersonId()).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(collectPerson)) {
personIds = StringUtils.join(collectPerson, "^");
}
if (StringUtil.isNotBlank(dutyGroupId)) {
ImsDutyMainEntity imsDutyMainEntity = new ImsDutyMainEntity();
setMainEntity(imsDutyMainEntity, classId, Long.valueOf(dutyGroupId), date);
imsDutyMainEntity.setStatus(-1);
imsDutyMainEntity.setDutyPersonIds(personIds);
imsDutyMainEntity.setCreateDept(imsSchedulingVo.getCreateDept());
Long id = IdWorker.getId();
imsDutyMainEntity.setId(id);
imsDutyMainEntity.setCreateUser(AuthUtil.getUserId());
imsDutyMainEntity.setUpdateUser(AuthUtil.getUserId());
imsDutyMainEntity.setTenantId(AuthUtil.getTenantId());
imsDutyMainEntityList.add(imsDutyMainEntity);
}
}
}
}
} else {
ImsDutyMainEntity imsDutyMainEntity = new ImsDutyMainEntity();
//人员ID
List<Long> collectPerson;
//负责人ID
Long managerId = 0l;
if (imsSchedulingVo.getPersonType() == 1) {
//查询班组信息
List<ImsDutyGroupPEntity> list = imsDutyGroupPService.selectByGroupIds(Arrays.asList(Long.valueOf(groupId)));
collectPerson = list.stream().filter(iter -> iter.getGroupId().toString().equals(groupId)).map(iter -> iter.getPersonId()).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(collectPerson)) {
personIds = StringUtils.join(collectPerson, "^");
}
imsDutyMainEntity.setDutyGroupId(Long.valueOf(groupId));
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(groupId);
if (ObjectUtil.isNotEmpty(imsDutyGroupEntity) && ObjectUtil.isNotEmpty(imsDutyGroupEntity.getManagerId())) {
managerId = imsDutyGroupEntity.getManagerId();
}
} else {
//灵活排版没有班组信息
FlexibleSchedulingVo flexibleSchedulingVo = imsSchedulingVo.getFlexible().get(classId).get(tempSub);
collectPerson = flexibleSchedulingVo.getPersonIds().stream().map(s -> Long.valueOf(s)).collect(Collectors.toList());
personIds = StringUtils.join(collectPerson, "^");
managerId = Long.valueOf(flexibleSchedulingVo.getChargeId());
}
setMainEntity(imsDutyMainEntity, classId, date);
if (Func.isBlank(proDutyMainId)) {
if (ObjectUtil.isNotEmpty(imsDutyMainEntity1)) {
proDutyMainId = imsDutyMainEntity1.getId().toString();
}
imsDutyMainEntity.setPreDutyId(Long.valueOf(proDutyMainId));
}
if (StringUtil.isNotBlank(personIds)) {
imsDutyMainEntity.setDutyPersonIds(personIds);
}
imsDutyMainEntity.setCreateDept(imsSchedulingVo.getCreateDept());
Long id = IdWorker.getId(imsDutyMainEntity);
imsDutyMainEntity.setId(id);
imsDutyMainEntity.setCreateUser(AuthUtil.getUserId());
imsDutyMainEntity.setUpdateUser(AuthUtil.getUserId());
imsDutyMainEntity.setTenantId(AuthUtil.getTenantId());
imsDutyMainEntityList.add(imsDutyMainEntity);
proDutyMainId = id == null ? "" : imsDutyMainEntity.getId().toString();
//同步保存到排班计划-人员表
copyPersonByDutyMain(imsSchedulingVo, managerId, personEntityList, imsDutyMainEntity, collectPerson);
}
}
}
ThreadTask.dutyTask(imsDutyMainEntityList, personEntityList, imsSchedulingVo.getEndDate(), proDutyMainId, imsSchedulingVo.getCreateDept(), imsSchedulingVo.getDutyClassTypeId());
return R.success("操作成功,系统正在排班中,请稍后查看");
}
private R pollScheduling(ImsSchedulingVo imsSchedulingVo) { private R pollScheduling(ImsSchedulingVo imsSchedulingVo) {
String[] start = imsSchedulingVo.getStartDate().split("-"); String[] start = imsSchedulingVo.getStartDate().split("-");
@ -347,6 +734,60 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
return R.data(new TreeMap<>(map)); return R.data(new TreeMap<>(map));
} }
/**
* 查询已排班记录
*
* @param year
* @param month
* @param deptId
* @return
*/
@Override
public R getSchedulingListV2(int year, int month, Long deptId) {
String yearAndMonth = "";
if (month < 10) {
yearAndMonth = year + "-0" + month;
} else {
yearAndMonth = year + "-" + month;
}
List<ImsSchedulingVo> imsSchedulingVos = this.baseMapper.selectByDateListV2(yearAndMonth, deptId);
if (CollectionUtil.isEmpty(imsSchedulingVos)) {
return R.success("该月未排班");
}
int days = getDaysByYearMonth(year, month);
Map<String, List<ImsSchedulingVo>> map = new HashMap();
for (int i = 1; i <= days; i++) {
String date = getDate(year, month, i);
List<ImsSchedulingVo> collect = imsSchedulingVos.stream().filter(o -> DateUtil.format(o.getDutyDate(), DateUtil.PATTERN_DATE).equals(date)).sorted(Comparator.comparing(ImsSchedulingVo::getId)).collect(Collectors.toList());
collect = collect.stream().map(s -> {
//灵活排班把班组名称拼接成人员名称
if (s.getGroupId() == null) {
String[] split = s.getDutyPersonIds().split("\\^");
if (null != split && split.length > 0) {
for (int j = 0; j < split.length; j++) {
User user = UserCache.getUser(Long.valueOf(split[j]));
if (ObjectUtil.isNotEmpty(user)) {
if (j == split.length - 1) {
s.setName(s.getName() + user.getName());
} else {
s.setName(s.getName() + user.getName() + "、");
}
}
}
}
} else {
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(s.getGroupId());
s.setName(s.getName() + imsDutyGroupEntity.getGroupName());
}
return s;
}).sorted(Comparator.comparing(ImsSchedulingVo::getId)).collect(Collectors.toList());
map.put(date, collect);
}
return R.data(new TreeMap<>(map));
}
/* @Override /* @Override
public R getSchedulingList(int year, int month,Long deptId) { public R getSchedulingList(int year, int month,Long deptId) {
if (month < 10) { if (month < 10) {
@ -397,6 +838,50 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
return R.data(list); return R.data(list);
} }
@Override
public R getMainIdByPersonV2(Long id) {
List<ImsDutyMainVO> list = new ArrayList<>();
ImsDutyMainEntity imsDutyMainEntity = this.baseMapper.selectById(id);
if (ObjectUtils.isEmpty(imsDutyMainEntity) || StringUtil.isBlank(imsDutyMainEntity.getDutyPersonIds())) {
return R.data("");
}
String ids = imsDutyMainEntity.getDutyPersonIds();
String[] split = ids.split("\\^");
if (null != split && split.length > 0) {
for (String s : split) {
ImsDutyMainVO vo = new ImsDutyMainVO();
User user = UserCache.getUser(Long.valueOf(s));
if (ObjectUtil.isNotEmpty(user)) {
vo.setUserId(s);
if (ObjectUtil.isNotEmpty(user)) {
vo.setUserName(user.getName());
}
vo.setId(id);
list.add(vo);
}
}
}
Long managerId;
if (null != (imsDutyMainEntity.getDutyGroupId())) {
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(imsDutyMainEntity.getDutyGroupId());
managerId = imsDutyGroupEntity.getManagerId();
} else {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, imsDutyMainEntity.getId());
last("limit 1;");
}});
managerId = imsDutyMainPersonEntity.getDutyChargePerson();
}
list = list.stream().map(s -> {
if (s.getUserId().equals(managerId.toString())) {
s.setUserName(s.getUserName() + "(值班组组长)");
}
return s;
}).collect(Collectors.toList());
return R.data(list);
}
/** /**
* 获取当前值班班组 主页任务统计 * 获取当前值班班组 主页任务统计
* *
@ -408,7 +893,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
eq("STATUS", 1).last("limit 1"); eq("STATUS", 1).last("limit 1");
}}); }});
return this.baseMapper.selectByIdOne(entity.getId(), null); return this.baseMapper.selectByIdOneV2(entity.getId(), null);
} }
@ -420,16 +905,24 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
private boolean doSaveTemplate(ImsSchedulingVo vo) { private boolean doSaveTemplate(ImsSchedulingVo vo) {
List<ImsDutyMainTemplateEntity> list = iImsDutyMainTemplateService.list(new LambdaQueryWrapper<ImsDutyMainTemplateEntity>() {{ List<ImsDutyMainTemplateEntity> list = iImsDutyMainTemplateService.list(new LambdaQueryWrapper<ImsDutyMainTemplateEntity>() {{
eq(ImsDutyMainTemplateEntity::getTemplateName, vo.getTemplateName()); eq(ImsDutyMainTemplateEntity::getTemplateName, vo.getTemplateName());
eq(ImsDutyMainTemplateEntity::getType, vo.getPersonType());
}}); }});
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
return false; return false;
} }
ImsDutyMainTemplateEntity entity = new ImsDutyMainTemplateEntity(); ImsDutyMainTemplateEntity entity = new ImsDutyMainTemplateEntity();
if (1 == vo.getPersonType()) {
String dutyOrderIds = JSONObject.toJSONString(vo.getDutyOrderIds(), SerializerFeature.WriteMapNullValue); String dutyOrderIds = JSONObject.toJSONString(vo.getDutyOrderIds(), SerializerFeature.WriteMapNullValue);
entity.setDutyOrderIds(dutyOrderIds);
entity.setType(1);
} else {
String flexible = JSONObject.toJSONString(vo.getFlexible(), SerializerFeature.WriteMapNullValue);
entity.setFlexible(flexible);
entity.setType(2);
}
String dutyArrIds = JSONObject.toJSONString(vo.getDutyArrIds(), SerializerFeature.WriteMapNullValue); String dutyArrIds = JSONObject.toJSONString(vo.getDutyArrIds(), SerializerFeature.WriteMapNullValue);
entity.setDutyNum(vo.getDutyNum()); entity.setDutyNum(vo.getDutyNum());
entity.setTemplateName(vo.getTemplateName()); entity.setTemplateName(vo.getTemplateName());
entity.setDutyOrderIds(dutyOrderIds);
entity.setDutyArrIds(dutyArrIds); entity.setDutyArrIds(dutyArrIds);
entity.setDutyClassTypeId(vo.getDutyClassTypeId()); entity.setDutyClassTypeId(vo.getDutyClassTypeId());
entity.setCreateDept(vo.getCreateDept()); entity.setCreateDept(vo.getCreateDept());
@ -513,7 +1006,27 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
@Override @Override
public List<ImsDutyMainMergeVo> getDutyMainByDept(List<Long> list) { public List<ImsDutyMainMergeVo> getDutyMainByDept(List<Long> list) {
return this.baseMapper.selectDutyMainByDept(list); return getDutyMainByDeptV2(list);
}
@Override
public List<ImsDutyMainMergeVo> getDutyMainByDeptV2(List<Long> list) {
List<ImsDutyMainMergeVo> imsDutyMainMergeVos = this.baseMapper.selectDutyMainByDeptV2(list);
imsDutyMainMergeVos = imsDutyMainMergeVos.stream().map(s -> {
if (null == s.getGroupId()) {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, s.getDutyId());
}});
s.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson());
} else {
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(s.getGroupId());
s.setGroupName(imsDutyGroupEntity.getGroupName());
s.setGroupId(imsDutyGroupEntity.getId());
s.setManagerId(imsDutyGroupEntity.getManagerId());
}
return s;
}).collect(Collectors.toList());
return imsDutyMainMergeVos;
} }
@Override @Override
@ -553,11 +1066,11 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
return this.baseMapper.selectSchedulingVoByDateList(startDate, endDate); return this.baseMapper.selectSchedulingVoByDateList(startDate, endDate);
} }
@Override @Override
public List<HomePageDutyMainInfoVo> getHomePageDutyInfo(Long deptId) { public List<HomePageDutyMainInfoVo> getHomePageDutyInfo(Long deptId) {
List<HomePageDutyMainInfoVo> list = new ArrayList<>(); List<HomePageDutyMainInfoVo> list = new ArrayList<>();
List<DutyMainInfoVo> dutyMainInfoVos = this.baseMapper.selectDutyMainInfoVo(deptId); List<DutyMainInfoVo> dutyMainInfoVos = getDutyDataV2(deptId);
if (CollectionUtil.isNotEmpty(dutyMainInfoVos)) { if (CollectionUtil.isNotEmpty(dutyMainInfoVos)) {
for (DutyMainInfoVo dutyMainInfoVo : dutyMainInfoVos) { for (DutyMainInfoVo dutyMainInfoVo : dutyMainInfoVos) {
HomePageDutyMainInfoVo vo = new HomePageDutyMainInfoVo(); HomePageDutyMainInfoVo vo = new HomePageDutyMainInfoVo();
@ -591,7 +1104,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
dutyMainInfoVo.setGeneratingCapacity(generatingCapacity); dutyMainInfoVo.setGeneratingCapacity(generatingCapacity);
} }
vo.setHeadInfo(dutyMainInfoVo); vo.setHeadInfo(dutyMainInfoVo);
DutyMainInfoVo corryVo = this.baseMapper.selectDutyMainInfoSign(dutyMainInfoVo.getId()); DutyMainInfoVo corryVo = getNextDutyDataV2(dutyMainInfoVo.getId());
if (ObjectUtil.isNotEmpty(corryVo) && Func.isNotBlank(corryVo.getDutyPersonIds())) { if (ObjectUtil.isNotEmpty(corryVo) && Func.isNotBlank(corryVo.getDutyPersonIds())) {
List<AuditVo> auditVoList = new ArrayList<>(); List<AuditVo> auditVoList = new ArrayList<>();
for (String personId : corryVo.getDutyPersonIds().split("\\^")) { for (String personId : corryVo.getDutyPersonIds().split("\\^")) {
@ -619,7 +1132,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
@Override @Override
public List<DutyMainInfoVo> getDutyDurationDate() { public List<DutyMainInfoVo> getDutyDurationDate() {
//获取当班信息 //获取当班信息
List<DutyMainInfoVo> dutyList = this.baseMapper.selectDutyMainInfoVo(null); List<DutyMainInfoVo> dutyList = getDutyDataV2(null);
dutyList.forEach(dutyVO -> { dutyList.forEach(dutyVO -> {
Time startTime = dutyVO.getStartTime(); Time startTime = dutyVO.getStartTime();
Time endTime = dutyVO.getEndTime(); Time endTime = dutyVO.getEndTime();
@ -639,6 +1152,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
/** /**
* 查询排班数据 * 查询排班数据
*
* @param deptIdList * @param deptIdList
* @return * @return
*/ */
@ -648,10 +1162,24 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
return null; return null;
} }
// 查询区域当前值班 // 查询区域当前值班
List<DutyInfoVo> dutyInfoVoList = this.baseMapper.getDutyData(deptIdList); List<DutyInfoVo> dutyInfoVoList = this.baseMapper.getDutyDataV2(deptIdList);
if (CollectionUtil.isEmpty(dutyInfoVoList)) { if (CollectionUtil.isEmpty(dutyInfoVoList)) {
return null; return null;
} }
//修改数据结构后:分灵活排班和班组排班拿负责人
dutyInfoVoList = dutyInfoVoList.stream().map(s -> {
if (null == s.getGroupId()) {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, s.getId());
}});
s.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson().toString());
} else {
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(s.getGroupId());
s.setGroupName(imsDutyGroupEntity.getGroupName());
s.setManagerId(imsDutyGroupEntity.getManagerId().toString());
}
return s;
}).collect(Collectors.toList());
dutyInfoVoList.forEach(item -> { dutyInfoVoList.forEach(item -> {
// 负责人 // 负责人
User user = UserCache.getUser(Long.valueOf(item.getManagerId())); User user = UserCache.getUser(Long.valueOf(item.getManagerId()));
@ -673,14 +1201,32 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
return dutyInfoVoList; return dutyInfoVoList;
} }
@Override
public R getAllPersonInfo(Long deptId) {
R<List<User>> allUserList = userClient.userListByDeptId(deptId);
return allUserList;
}
/** /**
* 获取上一班组 * 获取上一班组
*
* @param item * @param item
* @return * @return
*/ */
private NextDutyInfoVo getUpDutyInfo(DutyInfoVo item) { private NextDutyInfoVo getUpDutyInfo(DutyInfoVo item) {
DutyMainInfoVo dutyMainInfoVo = this.baseMapper.queryDutyInfo(item.getPreDutyId()); DutyMainInfoVo dutyMainInfoVo = this.baseMapper.queryDutyInfoV2(item.getPreDutyId());
if (null == dutyMainInfoVo.getGroupName()) {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainInfoVo.getId());
}});
dutyMainInfoVo.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson().toString());
} else {
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(dutyMainInfoVo.getDutyGroupId());
dutyMainInfoVo.setGroupName(imsDutyGroupEntity.getGroupName());
dutyMainInfoVo.setDutyGroupId(imsDutyGroupEntity.getId());
dutyMainInfoVo.setManagerId(imsDutyGroupEntity.getManagerId().toString());
}
if (ObjectUtil.isEmpty(dutyMainInfoVo)) { if (ObjectUtil.isEmpty(dutyMainInfoVo)) {
return null; return null;
} }
@ -704,11 +1250,12 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
/** /**
* 获取下一班组 * 获取下一班组
*
* @param item * @param item
* @return * @return
*/ */
private NextDutyInfoVo getNextDutyInfo(DutyInfoVo item) { private NextDutyInfoVo getNextDutyInfo(DutyInfoVo item) {
DutyMainInfoVo dutyMainInfoVo = this.baseMapper.selectDutyMainInfoSign(item.getId()); DutyMainInfoVo dutyMainInfoVo = getNextDutyDataV2(item.getId());
if (ObjectUtil.isEmpty(dutyMainInfoVo)) { if (ObjectUtil.isEmpty(dutyMainInfoVo)) {
return null; return null;
} }
@ -802,7 +1349,6 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
List<ImsDutyMainEntity> imsDutyMainEntityList = new ArrayList<>(); List<ImsDutyMainEntity> imsDutyMainEntityList = new ArrayList<>();
String proDutyMainId = ""; String proDutyMainId = "";
//排班 //排班
for (int i = 1; i <= dates.size(); i++) { for (int i = 1; i <= dates.size(); i++) {
@ -893,6 +1439,12 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
imsDutyMainEntity.setCreateTime(new Date()); imsDutyMainEntity.setCreateTime(new Date());
} }
public void setMainEntity(ImsDutyMainEntity imsDutyMainEntity, String classId, String date) {
imsDutyMainEntity.setDutyDate(DateUtil.parse(date, DateUtil.PATTERN_DATE));
imsDutyMainEntity.setClassId(Long.valueOf(classId));
imsDutyMainEntity.setStatus(0);
imsDutyMainEntity.setCreateTime(new Date());
}
/** /**
* 根据 获取对应的月份 天数 * 根据 获取对应的月份 天数
@ -909,11 +1461,32 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
/** /**
* 获取当班 * 获取当班
*
* @return * @return
*/ */
@Override @Override
public List<DutyMainInfoVo> getDutyData(Long deptId) { public List<DutyMainInfoVo> getDutyData(Long deptId) {
return this.baseMapper.selectDutyMainInfoVo(deptId); return getDutyDataV2(deptId);
}
@Override
public List<DutyMainInfoVo> getDutyDataV2(Long deptId) {
List<DutyMainInfoVo> dutyMainInfoVos = this.baseMapper.selectDutyMainInfoVoV2(deptId);
dutyMainInfoVos = dutyMainInfoVos.stream().map(s -> {
if (null == s.getGroupName()) {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, s.getId());
}});
s.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson().toString());
} else {
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(s.getDutyGroupId());
s.setGroupName(imsDutyGroupEntity.getGroupName());
s.setDutyGroupId(imsDutyGroupEntity.getId());
s.setManagerId(imsDutyGroupEntity.getManagerId().toString());
}
return s;
}).collect(Collectors.toList());
return dutyMainInfoVos;
} }
@Override @Override
@ -921,4 +1494,20 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
return this.baseMapper.selectDutyMainInfoSign(parentId); return this.baseMapper.selectDutyMainInfoSign(parentId);
} }
@Override
public DutyMainInfoVo getNextDutyDataV2(Long parentId) {
DutyMainInfoVo dutyMainInfoVo = this.baseMapper.selectDutyMainInfoSignV2(parentId);
if (null == dutyMainInfoVo.getGroupName()) {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainInfoVo.getId());
}});
dutyMainInfoVo.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson().toString());
} else {
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(dutyMainInfoVo.getDutyGroupId());
dutyMainInfoVo.setGroupName(imsDutyGroupEntity.getGroupName());
dutyMainInfoVo.setDutyGroupId(imsDutyGroupEntity.getId());
dutyMainInfoVo.setManagerId(imsDutyGroupEntity.getManagerId().toString());
}
return dutyMainInfoVo;
}
} }

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainTemplateImpl.java

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainTemplateEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyMainTemplateEntity;
import com.hnac.hzims.operational.duty.mapper.ImsDutyMainTemplateMapper; import com.hnac.hzims.operational.duty.mapper.ImsDutyMainTemplateMapper;
import com.hnac.hzims.operational.duty.service.IImsDutyMainTemplateService; import com.hnac.hzims.operational.duty.service.IImsDutyMainTemplateService;
import com.hnac.hzims.operational.duty.vo.FlexibleSchedulingVo;
import com.hnac.hzims.operational.duty.vo.ImsSchedulingVo; import com.hnac.hzims.operational.duty.vo.ImsSchedulingVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
@ -27,6 +28,7 @@ public class ImsDutyMainTemplateImpl extends BaseServiceImpl<ImsDutyMainTemplate
List<ImsDutyMainTemplateEntity> list = this.list(new LambdaQueryWrapper<ImsDutyMainTemplateEntity>() {{ List<ImsDutyMainTemplateEntity> list = this.list(new LambdaQueryWrapper<ImsDutyMainTemplateEntity>() {{
if (null != entity.getCreateDept()) { if (null != entity.getCreateDept()) {
eq(ImsDutyMainTemplateEntity::getCreateDept, entity.getCreateDept()); eq(ImsDutyMainTemplateEntity::getCreateDept, entity.getCreateDept());
eq(ImsDutyMainTemplateEntity::getType, entity.getType());
} }
}}); }});
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
@ -34,11 +36,17 @@ public class ImsDutyMainTemplateImpl extends BaseServiceImpl<ImsDutyMainTemplate
ImsSchedulingVo vo = new ImsSchedulingVo(); ImsSchedulingVo vo = new ImsSchedulingVo();
String[] dutyArrIds = JSONObject.parseObject(imsDutyMainTemplateEntity.getDutyArrIds(), new TypeReference<String[]>() { String[] dutyArrIds = JSONObject.parseObject(imsDutyMainTemplateEntity.getDutyArrIds(), new TypeReference<String[]>() {
}); });
if (1==entity.getType()) {
HashMap<String, String[]> dutyOrderIds = JSONObject.parseObject(imsDutyMainTemplateEntity.getDutyOrderIds(), new TypeReference<HashMap<String, String[]>>() { HashMap<String, String[]> dutyOrderIds = JSONObject.parseObject(imsDutyMainTemplateEntity.getDutyOrderIds(), new TypeReference<HashMap<String, String[]>>() {
}); });
vo.setDutyArrIds(dutyArrIds);
vo.setDutyOrderIds(dutyOrderIds); vo.setDutyOrderIds(dutyOrderIds);
}else {
HashMap<String, List<FlexibleSchedulingVo>> map = JSONObject.parseObject(imsDutyMainTemplateEntity.getFlexible(), new TypeReference<HashMap<String, List<FlexibleSchedulingVo>>>() {
});
vo.setFlexible(map);
}
vo.setPersonType(imsDutyMainTemplateEntity.getType());
vo.setDutyArrIds(dutyArrIds);
vo.setDutyNum(imsDutyMainTemplateEntity.getDutyNum()); vo.setDutyNum(imsDutyMainTemplateEntity.getDutyNum());
vo.setTemplateName(imsDutyMainTemplateEntity.getTemplateName()); vo.setTemplateName(imsDutyMainTemplateEntity.getTemplateName());
vo.setId(imsDutyMainTemplateEntity.getId()); vo.setId(imsDutyMainTemplateEntity.getId());

65
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java

@ -75,6 +75,8 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
@Autowired @Autowired
private IImsDutyGroupService imsDutyGroupService; private IImsDutyGroupService imsDutyGroupService;
@Autowired @Autowired
private ImsDutyMainServiceImpl imsDutyMainServiceImpl;
@Autowired
private IStationService stationService; private IStationService stationService;
@Autowired @Autowired
private IMessagePushClient messagePushClient; private IMessagePushClient messagePushClient;
@ -255,13 +257,13 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
*/ */
@Override @Override
public ImsDutyRecVO getDdetail(ImsDutyRecVO vo) { public ImsDutyRecVO getDdetail(ImsDutyRecVO vo) {
ImsSchedulingVo imsSchedulingVo1 = imsDutyMainService.getByIdOne(vo.getDutyId()); ImsSchedulingVo imsSchedulingVo1 = imsDutyMainService.getByIdOneV2(vo.getDutyId());
vo.setHeadDutyMainVo(imsSchedulingVo1); vo.setHeadDutyMainVo(imsSchedulingVo1);
ImsDutyMainEntity imsDutyMainEntity = imsDutyMainMapper.selectOne(new QueryWrapper<ImsDutyMainEntity>() {{ ImsDutyMainEntity imsDutyMainEntity = imsDutyMainMapper.selectOne(new QueryWrapper<ImsDutyMainEntity>() {{
eq("PRE_DUTY_ID", vo.getDutyId()); eq("PRE_DUTY_ID", vo.getDutyId());
}}); }});
if (ObjectUtil.isNotEmpty(imsDutyMainEntity)) { if (ObjectUtil.isNotEmpty(imsDutyMainEntity)) {
ImsSchedulingVo imsSchedulingVo = imsDutyMainService.getByIdOne(imsDutyMainEntity.getId()); ImsSchedulingVo imsSchedulingVo = imsDutyMainService.getByIdOneV2(imsDutyMainEntity.getId());
vo.setCarryDutyMainVo(imsSchedulingVo); vo.setCarryDutyMainVo(imsSchedulingVo);
} }
return vo; return vo;
@ -294,7 +296,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
return imsDutyRecVOIPage; return imsDutyRecVOIPage;
} }
for (ImsDutyRecVO imsDutyRecVO : records) { for (ImsDutyRecVO imsDutyRecVO : records) {
ImsSchedulingVo imsSchedulingVo = imsDutyMainMapper.selectByIdOne(imsDutyRecVO.getDutyId(), null); ImsSchedulingVo imsSchedulingVo = imsDutyMainMapper.selectByIdOneV2(imsDutyRecVO.getDutyId(), null);
imsDutyRecVO.setCarryDutyMainVo(imsDutyMainMapper.selectByPreDutyIdOne(Optional.ofNullable(imsSchedulingVo).map(ImsSchedulingVo::getId).orElse(null))); imsDutyRecVO.setCarryDutyMainVo(imsDutyMainMapper.selectByPreDutyIdOne(Optional.ofNullable(imsSchedulingVo).map(ImsSchedulingVo::getId).orElse(null)));
if (ObjectUtil.isEmpty(imsDutyRecVO)) { if (ObjectUtil.isEmpty(imsDutyRecVO)) {
continue; continue;
@ -350,11 +352,11 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
if (ObjectUtil.isNotEmpty(dutyRecEntity)) { if (ObjectUtil.isNotEmpty(dutyRecEntity)) {
vo.setInspectTaskId(dutyRecEntity.getInspectTaskId()); vo.setInspectTaskId(dutyRecEntity.getInspectTaskId());
} }
ImsSchedulingVo imsSchedulingVo = imsDutyMainMapper.selectByIdOne(entity.getId(), null);//交班人 ImsSchedulingVo imsSchedulingVo = imsDutyMainServiceImpl.getByIdOneV2(entity.getId(), null);//交班人
if (null != imsSchedulingVo.getManagerId()) { if (null != imsSchedulingVo.getManagerId()) {
imsSchedulingVo.setUserName(userClient.userInfoById(imsSchedulingVo.getManagerId()).getData().getName()); imsSchedulingVo.setUserName(userClient.userInfoById(imsSchedulingVo.getManagerId()).getData().getName());
} }
ImsSchedulingVo imsSchedulingVo1 = imsDutyMainMapper.selectByIdOne(null, entity.getId()); ImsSchedulingVo imsSchedulingVo1 = imsDutyMainServiceImpl.getByIdOneV2(null, entity.getId());
if (null != imsSchedulingVo1.getManagerId()) { if (null != imsSchedulingVo1.getManagerId()) {
imsSchedulingVo1.setUserName(userClient.userInfoById(imsSchedulingVo1.getManagerId()).getData().getName()); imsSchedulingVo1.setUserName(userClient.userInfoById(imsSchedulingVo1.getManagerId()).getData().getName());
} }
@ -362,7 +364,57 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
vo.setCarryDutyMainVo(imsSchedulingVo1); vo.setCarryDutyMainVo(imsSchedulingVo1);
return R.data(vo); return R.data(vo);
} }
// /**
// * 获取当前值班班组 -- 交接班
// *
// * @return
// */
// @Override
// public R<ImsDutyRecVO> getTheManinGroupRecV2(Long deptId) {
// ImsDutyRecVO vo = new ImsDutyRecVO();
//
// ImsDutyMainEntity entity = imsDutyMainMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
// eq(ImsDutyMainEntity::getStatus, DutyMainStatus.EXEC.getVal());
// eq(ImsDutyMainEntity::getCreateDept, deptId);
// like(ImsDutyMainEntity::getDutyPersonIds, AuthUtil.getUserId()).last(" limit 1");
// }});
// if (ObjectUtil.isEmpty(entity)) {
// return R.success("您当前未值班");
// }
//
// ImsDutyGroupEntity groupEntity = imsDutyGroupService.getOne(new LambdaQueryWrapper<ImsDutyGroupEntity>() {{
// eq(ImsDutyGroupEntity::getId, entity.getDutyGroupId());
// eq(ImsDutyGroupEntity::getManagerId, AuthUtil.getUserId());
// }});
// if (ObjectUtil.isEmpty(groupEntity)) {
// return R.success("您不是该班组负责人,不可交班!");
// }
//
// ImsDutyRecEntity recEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<ImsDutyRecEntity>() {{
// eq(ImsDutyRecEntity::getDutyId, entity.getId());
// }});
// if (ObjectUtil.isNotEmpty(recEntity)) {
// return R.success("您已提交交班申请");
// }
//
// ImsDutyRecEntity dutyRecEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<ImsDutyRecEntity>() {{
// eq(ImsDutyRecEntity::getDutyId, entity.getPreDutyId());
// }});
// if (ObjectUtil.isNotEmpty(dutyRecEntity)) {
// vo.setInspectTaskId(dutyRecEntity.getInspectTaskId());
// }
// ImsSchedulingVo imsSchedulingVo = imsDutyMainMapper.selectByIdOneV2(entity.getId(), null);//交班人
// if (null != imsSchedulingVo.getManagerId()) {
// imsSchedulingVo.setUserName(userClient.userInfoById(imsSchedulingVo.getManagerId()).getData().getName());
// }
// ImsSchedulingVo imsSchedulingVo1 = imsDutyMainMapper.selectByIdOneV2(null, entity.getId());
// if (null != imsSchedulingVo1.getManagerId()) {
// imsSchedulingVo1.setUserName(userClient.userInfoById(imsSchedulingVo1.getManagerId()).getData().getName());
// }
// vo.setHeadDutyMainVo(imsSchedulingVo);
// vo.setCarryDutyMainVo(imsSchedulingVo1);
// return R.data(vo);
// }
/** /**
* 获取签到二维码 * 获取签到二维码
* *
@ -570,7 +622,6 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
if (ObjectUtil.isNotEmpty(mainEntity)) { if (ObjectUtil.isNotEmpty(mainEntity)) {
List<ImsDutyMainEntity> list = imsDutyMainService.list(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ List<ImsDutyMainEntity> list = imsDutyMainService.list(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
ge(ImsDutyMainEntity::getDutyDate, mainEntity.getDutyDate()); ge(ImsDutyMainEntity::getDutyDate, mainEntity.getDutyDate());
le(ImsDutyMainEntity::getDutyDate, entity.getDutyDate()); le(ImsDutyMainEntity::getDutyDate, entity.getDutyDate());

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java

@ -485,7 +485,7 @@ public class AppHomeServiceImpl implements IAppHomeService {
@Override @Override
public List<AppDutyVo> getDutyData(Long deptId) { public List<AppDutyVo> getDutyData(Long deptId) {
// 获取当班列表数据 // 获取当班列表数据
List<DutyMainInfoVo> list = this.dutyMainService.getDutyData(deptId); List<DutyMainInfoVo> list = this.dutyMainService.getDutyDataV2(deptId);
if(CollectionUtil.isEmpty(list)){ if(CollectionUtil.isEmpty(list)){
return null; return null;
} }
@ -573,7 +573,7 @@ public class AppHomeServiceImpl implements IAppHomeService {
* @param id * @param id
*/ */
private void getNextDuty(AppDutyVo item, Long id) { private void getNextDuty(AppDutyVo item, Long id) {
DutyMainInfoVo nextDuty = this.dutyMainService.getNextDutyData(id); DutyMainInfoVo nextDuty = this.dutyMainService.getNextDutyDataV2(id);
if(ObjectUtil.isEmpty(nextDuty)){ if(ObjectUtil.isEmpty(nextDuty)){
return; return;
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainStatisticsServiceImpl.java

@ -79,7 +79,7 @@ public class MainStatisticsServiceImpl implements IMainStatisticsService {
} }
} }
else{ else{
imsDutyMainEntity = iImsDutyMainService.getByIdOne(mainDutyId); imsDutyMainEntity = iImsDutyMainService.getByIdOneV2(mainDutyId);
} }
//完善值班统计属性 //完善值班统计属性
DutyStatisticsVO dutyStatisticsVo = new DutyStatisticsVO(); DutyStatisticsVO dutyStatisticsVo = new DutyStatisticsVO();

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PlatformServiceImpl.java

@ -319,7 +319,7 @@ public class PlatformServiceImpl implements IPlatformService {
//根据站点数据获取所有机构ID //根据站点数据获取所有机构ID
List<Long> deptList = imsDeptEntityList.stream().map(ImsDeptEntity::getId).collect(Collectors.toList()); List<Long> deptList = imsDeptEntityList.stream().map(ImsDeptEntity::getId).collect(Collectors.toList());
//根据机构ID获取值班数据 //根据机构ID获取值班数据
List<ImsDutyMainMergeVo> dutyMainByDept = dutyMainService.getDutyMainByDept(deptList); List<ImsDutyMainMergeVo> dutyMainByDept = dutyMainService.getDutyMainByDeptV2(deptList);
Map<Long, List<ImsDutyMainMergeVo>> collect = dutyMainByDept.stream().collect(Collectors.groupingBy(ImsDutyMainMergeVo::getDutyId)); Map<Long, List<ImsDutyMainMergeVo>> collect = dutyMainByDept.stream().collect(Collectors.groupingBy(ImsDutyMainMergeVo::getDutyId));
Map<Long, List<ImsDutyMainMergeVo>> preDytuMap = dutyMainByDept.stream().collect(Collectors.groupingBy(ImsDutyMainMergeVo::getPreDutyId)); Map<Long, List<ImsDutyMainMergeVo>> preDytuMap = dutyMainByDept.stream().collect(Collectors.groupingBy(ImsDutyMainMergeVo::getPreDutyId));
Map<Long, List<ImsDutyMainMergeVo>> beOnDutyMap = dutyMainByDept.stream().filter(o -> o.getStatus() == 1).collect(Collectors.groupingBy(ImsDutyMainMergeVo::getDutyId)); Map<Long, List<ImsDutyMainMergeVo>> beOnDutyMap = dutyMainByDept.stream().filter(o -> o.getStatus() == 1).collect(Collectors.groupingBy(ImsDutyMainMergeVo::getDutyId));

Loading…
Cancel
Save