Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 11 months ago
parent
commit
badaa43e63
  1. 39
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/entity/BusinessEarlyEntity.java
  2. 17
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/feign/BusinessEarlyClientFallback.java
  3. 25
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/feign/IBusinessEarlyClient.java
  4. 20
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/vo/BusinessEarlyVo.java
  5. 23
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java
  6. 110
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyLogEntity.java
  7. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyRecEntity.java
  8. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/ImsDutyRecVO.java
  9. 2
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java
  10. 20
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/ITicketInfoClient.java
  11. 10
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClientFallback.java
  12. 5
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/AlarmApplication.java
  13. 41
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/early/controller/BusinessEarlyController.java
  14. 33
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/early/feign/BusinessEarlyClient.java
  15. 11
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/early/mapper/BusinessEarlyMapper.java
  16. 6
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/early/mapper/BusinessEarlyMapper.xml
  17. 15
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/early/service/BusinessEarlyService.java
  18. 25
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/early/service/impl/BusinessEarlyServiceImpl.java
  19. 1
      hzims-service/hzims-alarm/src/test/java/com/hnac/hzims/alarm/MiddleApplicationTests.java
  20. 4
      hzims-service/operational/pom.xml
  21. 91
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java
  22. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyLogMapper.java
  23. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyLogMapper.xml
  24. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyLogService.java
  25. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyRecService.java
  26. 179
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyLogServiceImpl.java
  27. 199
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java
  28. BIN
      hzims-service/operational/src/main/resources/template/dutyLogTemplate.docx
  29. 34
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClient.java

39
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/entity/BusinessEarlyEntity.java

@ -0,0 +1,39 @@
package com.hnac.hzims.business.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import javax.validation.constraints.NotNull;
/**
* @author ysj
*/
@Data
@TableName("hzims_business_early")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "业务预警", description = "业务预警对象")
public class BusinessEarlyEntity extends TenantEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("任务ID")
@NotNull
private Long taskId;
@ApiModelProperty("业务类型 :0 - 固定资产 1 - 日常维护 2 - 安全工器- 具 3 - 巡检 4 - 检修 5 - 缺陷 6 - 值班")
@NotNull
private Integer businessType;
@ApiModelProperty("预警内容")
@NotNull
private String content;
@ApiModelProperty("机构Id")
private Long deptId;
}

17
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/feign/BusinessEarlyClientFallback.java

@ -0,0 +1,17 @@
package com.hnac.hzims.business.feign;
import com.hnac.hzims.business.entity.BusinessEarlyEntity;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Component;
/**
* @author hx
*/
@Component
public class BusinessEarlyClientFallback implements IBusinessEarlyClient {
@Override
public R<Boolean> save(BusinessEarlyEntity entity) {
return R.status(false);
}
}

25
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/feign/IBusinessEarlyClient.java

@ -0,0 +1,25 @@
package com.hnac.hzims.business.feign;
import com.hnac.hzims.alarm.config.constants.AlarmConstants;
import com.hnac.hzims.business.entity.BusinessEarlyEntity;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* @author ysj
*/
@FeignClient(
value = AlarmConstants.APP_NAME,
fallback = BusinessEarlyClientFallback.class
)
public interface IBusinessEarlyClient {
String API_PREFIX = "/feign/businessEarly";
String BUSINESS_EARLY_SAVE = API_PREFIX + "/save";
@PostMapping(BUSINESS_EARLY_SAVE)
R<Boolean> save(@RequestBody BusinessEarlyEntity entity);
}

20
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/vo/BusinessEarlyVo.java

@ -0,0 +1,20 @@
package com.hnac.hzims.business.vo;
import com.hnac.hzims.business.entity.BusinessEarlyEntity;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author ysj
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "告警对象", description = "各告警数据源保存对象")
public class BusinessEarlyVo extends BusinessEarlyEntity {
private static final long serialVersionUID = 1L;
}

23
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java

@ -373,6 +373,27 @@ public class OperationalConstants {
this.name = name;
}
}
public enum DutyLogLevel {
/**
* 水电站
*/
importLevel("1", "重要"),
/**
* 风电
*/
generalLevel("2", "一般"),
ordinaryLevel("3", "普通");
/**
* 泵站
*/
@Getter
private String val;
@Getter
private String name;
private DutyLogLevel(String val, String name) {
this.val = val;
this.name = name;
}
}
}

110
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyLogEntity.java

@ -0,0 +1,110 @@
package com.hnac.hzims.operational.duty.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable;
/**
* 实体类
*
* @author Chill
*/
@Data
@TableName("hz_ims_duty_log")
@ApiModel(value = "ImsDutyLog对象", description = "值班日志")
@EqualsAndHashCode(callSuper = true)
public class ImsDutyLogEntity extends TenantEntity implements Serializable{
private static final long serialVersionUID = -2877981299088576156L;
/**
* 值班ID
*/
@ApiModelProperty(value = "值班ID")
private Long dutyId;
/**
* 日期
*/
@ApiModelProperty(value = "日期")
private String time;
/**
* 值班时间
*/
private String dutyTime;
/**
* 班类
*/
@ApiModelProperty(value = "班类")
private String classType;
/**
* 已执行操作票
*/
private String operationFinish="0";
/**
* 未执行操作票
*/
private String operationUnFinish="0";
/**
* 作废操作票
*/
private String operationCancel="0";
/**
* 执行中工作票
*/
private String workDoing="0";
/**
* 未执行工作票
*/
private String workUnFinish="0";
/**
* 终结工作票
*/
private String workFinish="0";
/**
* 作废工作票
*/
private String workCancel="0";
/**
* 交班值班长
*/
private String handMaster;
/**
* 交班值班员
*/
private String handNumber;
/**
* 交班时间
*/
private String handTime;
/**
* 接班值班长
*/
private String carryMaster;
/**
* 接班值班员
*/
private String carryNumber;
/**
* 接班时间
*/
private String carryTime;
/**
* 交接班会照片
*/
private String dutyPic;
/**
* 值班情况
*/
private String dutyStatus;
/**
* 上级通知及注意事项
*/
private String notice;
}

4
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyRecEntity.java

@ -1,6 +1,7 @@
package com.hnac.hzims.operational.duty.entity;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@ -102,5 +103,8 @@ public class ImsDutyRecEntity extends TenantEntity {
@QueryField(condition = SqlCondition.LIKE)
private String dealChain;
@ApiModelProperty(value = "值班日志")
@TableField(exist=false)
private ImsDutyLogEntity imsDutyLogEntity;
}

4
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/ImsDutyRecVO.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.duty.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import com.hnac.hzims.operational.duty.entity.ImsDutyLogEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
@ -42,4 +43,7 @@ public class ImsDutyRecVO extends ImsDutyRecEntity {
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "值班日志")
private ImsDutyLogEntity imsDutyLogEntity;
}

2
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java

@ -499,5 +499,7 @@ public class WorkTicketInfoEntity extends TenantEntity implements Serializable {
@ApiModelProperty("是否线下 : 1-线下,0-线上")
private Boolean isOffline;
@ApiModelProperty
private Integer implementStatus;
}

20
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/ITicketInfoClient.java

@ -33,6 +33,8 @@ public interface ITicketInfoClient {
String GET_TICKET_PASS_BY_IDS = API_PREFIX + "/getTicketPassByIds";
String GET_WORK_TICKET_TRANSFER = API_PREFIX + "/getWorkTicketTransfer";
String GET_WORK_TICKET_STATISTIC = API_PREFIX + "/getWorkTicketStatistic";
String GET_WORK_TICKET_INFO = API_PREFIX + "/getWorkTicketInfo";
String GET_OPERATE_TICKET_INFO = API_PREFIX + "/getOperateTicketInfo";
String GET_OPERATE_TICKET_STATISTIC = API_PREFIX + "/getOperateTicketStatistic";
String GET_OPERATE_WORK_STATISTIC = API_PREFIX + "/getOperateWorkStatistic";
String GET_WORK_TICKET_CHECK = API_PREFIX + "/getWorkTicketCheck";
@ -90,6 +92,24 @@ public interface ITicketInfoClient {
@PostMapping(GET_WORK_TICKET_STATISTIC)
R<WorkTicketStatisticVO> getWorkTicketStatistic(@RequestBody Map<String,Object> params);
/**
* 根据时间和机构获取对应工作票
* @param params startDate endDate deptList
* @return
*/
@PostMapping(GET_WORK_TICKET_INFO)
R<List<WorkTicketInfoEntity>> getWorkTicketInfo(@RequestBody Map<String,Object> params);
/**
* 根据时间和机构获取对应操作票
* @param params startDate endDate deptList
* @return
*/
@PostMapping(GET_OPERATE_TICKET_INFO)
R<List<StandardTicketInfoEntity>> getOperateTicketInfo(@RequestBody Map<String,Object> params);
/**
* 获取首页操作票统计结果
* @return

10
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClientFallback.java

@ -51,6 +51,16 @@ public class TicketInfoClientFallback implements ITicketInfoClient {
}
@Override
public R<List<WorkTicketInfoEntity>> getWorkTicketInfo(Map<String, Object> params) {
return R.fail("查询失败!");
}
@Override
public R<List<StandardTicketInfoEntity>> getOperateTicketInfo(Map<String, Object> params) {
return R.fail("查询失败!");
}
@Override
public R<Integer> getOperateTicketStatistic(Map<String, Object> paramMap) {
return null;
}

5
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/AlarmApplication.java → hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/AlarmApplication.java

@ -1,4 +1,4 @@
package com.hnac.hzims.alarm;
package com.hnac.hzims;
import com.hnac.hzims.alarm.config.constants.AlarmConstants;
import org.mybatis.spring.annotation.MapperScan;
@ -17,9 +17,10 @@ import javax.annotation.Resource;
@EnableBladeFeign
@SpringCloudApplication
@MapperScan("com.hnac.hzims.**.mapper.**")
@ComponentScan(basePackages = {"com.hnac.hzims.alarm.*"})
@ComponentScan(basePackages = {"com.hnac.hzims.alarm.*","com.hnac.hzims.business.*"})
@Resource
public class AlarmApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
BladeApplication.run(AlarmConstants.APP_NAME, AlarmApplication.class, args);
}

41
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/early/controller/BusinessEarlyController.java

@ -0,0 +1,41 @@
package com.hnac.hzims.business.early.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.business.early.service.BusinessEarlyService;
import com.hnac.hzims.business.entity.BusinessEarlyEntity;
import com.hnac.hzims.business.vo.BusinessEarlyVo;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.operational.access.vo.ConstructionVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ysj
*/
@Api(tags = {"业务预警"})
@RestController
@AllArgsConstructor
@RequestMapping("/business/early")
public class BusinessEarlyController extends BladeController {
private final BusinessEarlyService businessEarlyService;
@GetMapping("/list")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "分页查询")
public R<IPage<BusinessEarlyVo>> list(BusinessEarlyVo early, Query query) {
return R.data(businessEarlyService.pageCondition(Condition.getPage(query), early));
}
}

33
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/early/feign/BusinessEarlyClient.java

@ -0,0 +1,33 @@
package com.hnac.hzims.business.early.feign;
import com.hnac.hzims.business.early.service.BusinessEarlyService;
import com.hnac.hzims.business.entity.BusinessEarlyEntity;
import com.hnac.hzims.business.feign.IBusinessEarlyClient;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ysj
*/
@RestController
@Slf4j
@RequiredArgsConstructor
public class BusinessEarlyClient implements IBusinessEarlyClient {
private final BusinessEarlyService businessEarlyService;
/**
* 业务预警信息保存
* @param entity
* @return
*/
@Override
@PostMapping(BUSINESS_EARLY_SAVE)
public R<Boolean> save(@RequestBody BusinessEarlyEntity entity) {
return R.status(businessEarlyService.save(entity));
}
}

11
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/early/mapper/BusinessEarlyMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.business.early.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.business.entity.BusinessEarlyEntity;
/**
* @author ysj
*/
public interface BusinessEarlyMapper extends BaseMapper<BusinessEarlyEntity> {
}

6
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/early/mapper/BusinessEarlyMapper.xml

@ -0,0 +1,6 @@
<?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.business.early.mapper.BusinessEarlyMapper">
</mapper>

15
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/early/service/BusinessEarlyService.java

@ -0,0 +1,15 @@
package com.hnac.hzims.business.early.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.business.entity.BusinessEarlyEntity;
import com.hnac.hzims.business.vo.BusinessEarlyVo;
import com.hnac.hzims.operational.access.vo.ConstructionVo;
import org.springblade.core.mp.base.BaseService;
/**
* @author ysj
*/
public interface BusinessEarlyService extends BaseService<BusinessEarlyEntity> {
IPage<BusinessEarlyVo> pageCondition(IPage<BusinessEarlyVo> page, BusinessEarlyVo early);
}

25
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/early/service/impl/BusinessEarlyServiceImpl.java

@ -0,0 +1,25 @@
package com.hnac.hzims.business.early.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.business.early.mapper.BusinessEarlyMapper;
import com.hnac.hzims.business.early.service.BusinessEarlyService;
import com.hnac.hzims.business.entity.BusinessEarlyEntity;
import com.hnac.hzims.business.vo.BusinessEarlyVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author ysj
*/
@AllArgsConstructor
@Service
@Slf4j
public class BusinessEarlyServiceImpl extends BaseServiceImpl<BusinessEarlyMapper, BusinessEarlyEntity> implements BusinessEarlyService {
@Override
public IPage<BusinessEarlyVo> pageCondition(IPage<BusinessEarlyVo> page, BusinessEarlyVo early) {
return null;
}
}

1
hzims-service/hzims-alarm/src/test/java/com/hnac/hzims/alarm/MiddleApplicationTests.java

@ -1,5 +1,6 @@
package com.hnac.hzims.alarm;
import com.hnac.hzims.AlarmApplication;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

4
hzims-service/operational/pom.xml

@ -106,12 +106,12 @@
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
<version>3.2.0</version>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-annotation</artifactId>
<version>3.2.0</version>
<version>4.4.0</version>
</dependency>
<!-- 由于poi使用的poi-ooxml-schemas是ooxml-schemas的精简版,所以在was服务器上导出Excel可能会报错-->

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

@ -1,17 +1,17 @@
package com.hnac.hzims.operational.duty.controller;
import cn.afterturn.easypoi.word.WordExportUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.operational.duty.dto.ImsDutyRecDTO;
import com.hnac.hzims.operational.duty.entity.AnalyseExample;
import com.hnac.hzims.operational.duty.entity.ImsDutyEmergencyEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity;
import com.hnac.hzims.operational.duty.entity.*;
import com.hnac.hzims.operational.duty.service.IImsAnalyseExampleService;
import com.hnac.hzims.operational.duty.service.IImsDutyEmergencyService;
import com.hnac.hzims.operational.duty.service.IImsDutyLogService;
import com.hnac.hzims.operational.duty.service.IImsDutyRecService;
import com.hnac.hzims.operational.duty.vo.ImsDutyEmergencyVo;
import com.hnac.hzims.operational.duty.vo.ImsDutyRecVO;
@ -21,7 +21,10 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
@ -32,8 +35,11 @@ import org.springblade.flow.core.entity.BladeFlow;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.net.URLEncoder;
import java.util.HashMap;
/**
@ -45,13 +51,16 @@ import javax.validation.Valid;
@AllArgsConstructor
@RequestMapping("/imsDutyRec")
@Api(value = "值班交接controller", tags = "值班交接相关操作(交接班管理)")
@Slf4j
public class ImsDutyRecController extends BladeController {
private final IImsDutyRecService imsDutyRecService;
@Resource
private IImsDutyRecService imsDutyRecService;
@Resource
private IImsDutyEmergencyService iImsDutyEmergencyService;
@Resource
private IImsAnalyseExampleService iImsAnalyseExampleService;
@Resource
private IImsDutyLogService imsDutyLogService;
/**
* 详情
@ -147,7 +156,6 @@ public class ImsDutyRecController extends BladeController {
if(null == deptId){
deptId = Long.valueOf(AuthUtil.getDeptId());
}
return imsDutyRecService.getTheManinGroupRec(deptId);
}
@ -335,8 +343,77 @@ public class ImsDutyRecController extends BladeController {
public R changeShift(@Valid @RequestBody ImsDutyRecDTO imsDutyRecDTO) {
return R.status(imsDutyRecService.changeShift(imsDutyRecDTO));
}
// /**
// * 查询交接班值班日志
// */
// @GetMapping("/getDutyLog")
// @ApiOperationSupport(order = 1)
// @ApiOperation(value = "查询交接班值班日志", notes = "传入imsDutyRec")
// public R<ImsDutyLogEntity> getDutyLog(ImsDutyLogEntity imsDutyLogEntity) {
// R<ImsDutyLogEntity> res=imsDutyLogService.getDutyLog(imsDutyLogEntity);
// return res;
// }
/**
* 新增交接班值班日志
*/
@GetMapping("/saveDutyLog")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "新增交接班值班日志", notes = "传入imsDutyRec")
public R<ImsDutyRecVO> saveDutyLog(@RequestBody ImsDutyLogEntity imsDutyLogEntity) {
boolean b = imsDutyLogService.saveOrUpdate(imsDutyLogEntity);
if (b){
return R.success("保存成功");
}else {
return R.fail("保存失败");
}
}
/**
* 查询值班日志列表-分页
*/
@GetMapping("/queryDutyLogList")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "查询值班日志列表-分页", notes = "传入imsDutyRec")
public R<IPage<ImsDutyLogEntity>> queryDutyLogList(ImsDutyLogEntity imsDutyLogEntity, Query query) {
IPage<ImsDutyLogEntity> page = imsDutyLogService.page(Condition.getPage(query), Condition.getQueryWrapper(imsDutyLogEntity));
return R.data(page);
}
/**
* 导出交接班值班日志
*/
@GetMapping("/exportDutyLog")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "导出交接班值班日志", notes = "传入imsDutyRec")
public void exportDutyLog(HttpServletResponse response, @ApiParam(value = "當前排班Id", required = true) String dutyId){
HashMap<String, Object> map = new HashMap<>();
imsDutyLogService.exportDutyLog(dutyId,map);
String dutyTime ="";
if (StringUtils.isNotBlank(map.get("dutyTime").toString())) {
dutyTime = map.get("dutyTime").toString();
}
// 下载导出
String filename = dutyTime+"值班日志";
// 设置头信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
ServletOutputStream outputStream = null;
try {
//设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".docx", "UTF-8"));
//创建一个输出流
outputStream = response.getOutputStream();
XWPFDocument xwpfDocument = WordExportUtil.exportWord07("template/dutyLogTemplate.docx", map);
//写入数据
xwpfDocument.write(outputStream);
// 关闭
outputStream.close();
xwpfDocument.close();
} catch (Exception e) {
e.printStackTrace();
log.error("转换对象失败!");
}
}
}

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

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

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyLogMapper.xml

@ -0,0 +1,4 @@
<?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.ImsDutyLogMapper">
</mapper>

16
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyLogService.java

@ -0,0 +1,16 @@
package com.hnac.hzims.operational.duty.service;
import com.hnac.hzims.operational.duty.entity.ImsDutyLogEntity;
import org.springblade.core.mp.base.BaseService;
import java.util.HashMap;
/**
* 服务类
*
* @author Chill
*/
public interface IImsDutyLogService extends BaseService<ImsDutyLogEntity> {
void exportDutyLog(String dutyId, HashMap<String, Object> map);
}

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

@ -5,6 +5,7 @@ import com.hnac.hzims.operational.duty.dto.ChangeShiftsReqDTO;
import com.hnac.hzims.operational.duty.dto.ChangeShiftsRspDTO;
import com.hnac.hzims.operational.duty.dto.ImsDutyRecDTO;
import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyLogEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity;
import com.hnac.hzims.operational.duty.vo.ImsDutyRecVO;
@ -135,4 +136,6 @@ public interface IImsDutyRecService extends BaseService<ImsDutyRecEntity> {
* @return
*/
Boolean dealDutyRecFlow(ImsDutyRecDTO recDTO);
R<ImsDutyLogEntity> getDutyLog(ImsDutyLogEntity imsDutyLogEntity);
}

179
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyLogServiceImpl.java

@ -0,0 +1,179 @@
package com.hnac.hzims.operational.duty.service.impl;
import cn.afterturn.easypoi.entity.ImageEntity;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.duty.entity.*;
import com.hnac.hzims.operational.duty.mapper.ImsDutyLogMapper;
import com.hnac.hzims.operational.duty.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;
/**
* 服务实现类
*
* @author Chill
*/
@Slf4j
@Service
public class ImsDutyLogServiceImpl extends BaseServiceImpl<ImsDutyLogMapper, ImsDutyLogEntity> implements IImsDutyLogService {
@Override
public void exportDutyLog(String dutyId, HashMap<String, Object> map) {
ImsDutyLogEntity res = this.baseMapper.selectOne(new LambdaQueryWrapper<ImsDutyLogEntity>() {{
eq(ImsDutyLogEntity::getDutyId, dutyId)
.last(" limit 1");}});
// ImsDutyLogEntity res=new ImsDutyLogEntity();
if (Func.isNotEmpty(res)){
map.put("time",res.getTime());
map.put("dutyTime",res.getDutyTime());
map.put("classType",res.getClassType());
String dutyStatus = res.getDutyStatus();
if (StringUtils.isNotBlank(dutyStatus)){
List<HashMap<String, String>> dutyStatusList = JSONObject.parseObject(dutyStatus,
new TypeReference< List<HashMap<String, String>>>() {
});
for (HashMap<String, String> stringStringHashMap : dutyStatusList) {
for (OperationalConstants.DutyLogLevel value : OperationalConstants.DutyLogLevel.values()) {
if (value.getVal().equals(stringStringHashMap.get("level"))){
stringStringHashMap.replace("level",value.getName());
}
}
}
map.put("dutyStatus",dutyStatusList);
}else {
ArrayList<HashMap<String, String>> dutyStatusList = new ArrayList<>();
HashMap<String, String> temp = new HashMap<>();
temp.put("name", "");
temp.put("status","");
temp.put("level", "");
dutyStatusList.add(temp);
map.put("dutyStatus",dutyStatusList);
}
map.put("operationFinish",res.getOperationFinish());
map.put("operationUnFinish",res.getOperationUnFinish());
map.put("operationCancel",res.getOperationCancel());
map.put("workDoing",res.getWorkDoing());
map.put("workUnFinish",res.getWorkUnFinish());
map.put("workFinish",res.getWorkFinish());
map.put("workCancel",res.getWorkCancel());
String notice = res.getNotice();
if (StringUtils.isNotBlank(notice)){
List<HashMap<String, String>> noticeItemList = JSONObject.parseObject(notice,
new TypeReference< List<HashMap<String, String>>>() {
});
for (HashMap<String, String> stringStringHashMap : noticeItemList) {
for (OperationalConstants.DutyLogLevel value : OperationalConstants.DutyLogLevel.values()) {
if (value.getVal().equals(stringStringHashMap.get("level"))){
stringStringHashMap.replace("level",value.getName());
}
}
}
map.put("notice",noticeItemList);
}else {
ArrayList<HashMap<String, String>> noticeItemList = new ArrayList<>(2);
HashMap<String, String> temp = new HashMap<>();
temp.put("item", "");
temp.put("level","");
noticeItemList.add(temp);
map.put("notice",noticeItemList);
}
map.put("handMaster",res.getHandMaster());
map.put("handNumber",res.getHandNumber());
map.put("handTime",res.getHandTime());
map.put("carryMaster",res.getCarryMaster());
map.put("carryNumber",res.getCarryNumber());
map.put("carryTime",res.getCarryTime());
map.put("carryMaster",res.getCarryMaster());
List<ImageEntity> imageEntityList = new ArrayList<>();
if (StringUtils.isNotBlank(res.getDutyPic())) {
String[] dutyPicSplit = res.getDutyPic().split(",");
for (String string : dutyPicSplit) {
ImageEntity imageEntity = new ImageEntity(imgToByte("/template/img" + downloadFileByUrl(string, "/template/img")), 225, 163);
imageEntity.setUrl(string);
imageEntityList.add(imageEntity);
}
map.put("dutyPic",imageEntityList);
}
}
}
private byte[] imgToByte(String tempImgPath) {
File file = new File(tempImgPath);
byte[] buffer = null;
try {
FileInputStream fis = new FileInputStream(file);
ByteArrayOutputStream bos = new ByteArrayOutputStream(1000);
byte[] b = new byte[1000];
int n;
while ((n = fis.read(b)) != -1) {
bos.write(b, 0, n);
}
fis.close();
bos.close();
buffer = bos.toByteArray();
} catch (IOException e) {
log.error(e.getMessage());
}
//删除临时文件
file.delete();
return buffer;
}
private String downloadFileByUrl(String fileUrl, String downloadFileDir){
URL url = null;
String fileName = null;
try {
url = new URL(fileUrl);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setConnectTimeout(5000);
connection.setReadTimeout(5000);
connection.connect();
int responseCode = connection.getResponseCode();
if (responseCode == 200) {
InputStream inputStream = connection.getInputStream();
int lastSlashIndex = fileUrl.lastIndexOf("/");
if (lastSlashIndex > 0){
fileName = fileUrl.substring(lastSlashIndex+1);
String filePath = downloadFileDir + fileName;
File file = new File(filePath);
if (file.exists()){
file.delete();
}
OutputStream outputStream = new FileOutputStream(file);
// 将文件流拷贝到本地处理
IOUtils.copy(inputStream, outputStream);
}else {
throw new ServiceException("下载文件路径异常:" + downloadFileDir);
}
}
} catch (Exception e) {
throw new ServiceException("文件图片下载失败!");
}
return fileName;
}
}

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

@ -34,6 +34,10 @@ import com.hnac.hzims.operational.duty.vo.ImsRecVo;
import com.hnac.hzims.operational.duty.vo.ImsSchedulingVo;
import com.hnac.hzims.operational.duty.wrapper.ImsDutyRecWrapper;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.ticket.allTicket.dto.TicketStatisticDTO;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.feign.ITicketInfoClient;
import com.hnac.hzinfo.inspect.plan.PlanContants;
import com.hnac.hzinfo.inspect.plan.feign.IInspectPlanClient;
import com.hnac.hzinfo.inspect.plan.vo.PlanVO;
@ -49,6 +53,7 @@ import org.springblade.flow.core.entity.BladeFlow;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.utils.TaskUtil;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Autowired;
@ -57,6 +62,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.sql.Time;
import java.text.SimpleDateFormat;
@ -65,6 +71,8 @@ import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import static org.springblade.core.tool.utils.DateUtil.PATTERN_DATETIME;
/**
* 服务实现类
@ -74,12 +82,15 @@ import java.util.stream.Collectors;
@Slf4j
@Service
public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, ImsDutyRecEntity> implements IImsDutyRecService {
@Resource
private ITicketInfoClient ticketInfoClient;
@Autowired
private ImsDutyMainMapper imsDutyMainMapper;
@Autowired
private IImsDutyMainService imsDutyMainService;
@Autowired
private IImsDutyLogService imsDutyLogService;
@Autowired
private IImsDutyClassService imsDutyClassService;
@Autowired
private IImsDutyGroupService imsDutyGroupService;
@ -228,7 +239,11 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
if (Func.isEmpty(recEntity.getId())) {
save(recEntity);
}
ImsDutyLogEntity imsDutyLogEntity = recDTO.getImsDutyLogEntity();
imsDutyLogEntity.setHandTime(DateUtil.format(new Date(),PATTERN_DATETIME));
imsDutyLogService.save(imsDutyLogEntity);
// 开启值班交接班流程
recEntity.setQrCodeContent(System.currentTimeMillis() + "");
BladeFlow bladeFlow = this.startDutyRecProcess(recEntity, managerId);
recEntity.setProcessInstanceId(bladeFlow.getProcessInstanceId());
return updateById(recEntity);
@ -327,7 +342,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
userName = userR.getData().getName();
log.info("--------------------------req2:" + req, groupEntityManagerId, userName, date);
}
String format = DateUtil.format(date, DateUtil.PATTERN_DATETIME);
String format = DateUtil.format(date, PATTERN_DATETIME);
/*remondingCarry(req, OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(),
groupEntity.getManagerId(), userName, null,
format, groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());*/
@ -381,7 +396,6 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
updateMain(recEntity.getDutyId());
recEntity.setStatus(DutyRecStatus.ACCEPT.getVal());
recEntity.setAcceptTime(new Date());
recEntity.setQrCodeContent(System.currentTimeMillis() + "");
this.updateById(recEntity);
}
} else {
@ -457,6 +471,11 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
if (result.isSuccess() && ObjectUtil.isNotEmpty(result.getData())) {
imsDutyRecVO.setStationName(result.getData());
}
Long dutyId = imsDutyRecVO.getDutyId();
ImsDutyLogEntity dutyLogEntity = imsDutyLogService.getOne(new LambdaQueryWrapper<ImsDutyLogEntity>() {{
eq(ImsDutyLogEntity::getDutyId, dutyId);
}});
imsDutyRecVO.setImsDutyLogEntity(dutyLogEntity);
}
imsDutyRecVOIPage.setRecords(records);
return imsDutyRecVOIPage;
@ -505,7 +524,13 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
if (ObjectUtil.isNotEmpty(recEntity)) {
return R.success("您已提交交班申请");
}
ImsDutyLogEntity imsDutyLogEntity=new ImsDutyLogEntity();
imsDutyLogEntity.setDutyId(entity.getId());
R<ImsDutyLogEntity> dutyLog = this.getDutyLog(imsDutyLogEntity);
if(dutyLog.isSuccess()&&ObjectUtil.isNotEmpty(dutyLog.getData())){
ImsDutyLogEntity data = dutyLog.getData();
vo.setImsDutyLogEntity(data);
}
ImsDutyRecEntity dutyRecEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<ImsDutyRecEntity>() {{
eq(ImsDutyRecEntity::getDutyId, entity.getPreDutyId());
}});
@ -824,12 +849,17 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
entity.setId(id);
entity.setDutyDate(DateUtil.parse(date, DateUtil.PATTERN_DATE));
String format1 = DateUtil.format(new Date(), DateUtil.PATTERN_DATE);
Date dutyDate = entity.getDutyDate();
Date parse = DateUtil.parse(format1, DateUtil.PATTERN_DATE);
ImsDutyMainEntity mainEntityById = imsDutyMainService.getById(id);
ImsDutyClassEntity classEntity = imsDutyClassService.getOne(new LambdaQueryWrapper<ImsDutyClassEntity>() {{
eq(ImsDutyClassEntity::getId, mainEntityById.getClassId());
last("limit 1");
}});
String dutyTime = DateUtil.format(mainEntityById.getDutyDate(), DateUtil.PATTERN_DATE) + " " +DateUtil.format(classEntity.getStartTime(), DateUtil.PATTERN_TIME);
Date dutyDate = DateUtil.parse(dutyTime, PATTERN_DATETIME);
if (dutyDate.getTime() > parse.getTime()) {
return R.fail("值班时间不能大于当前时间");
return R.fail("指定的值班开始时间不能晚于当前时间");
}
ImsDutyMainEntity mainEntityById = imsDutyMainService.getById(id);
//获取当前值班
ImsDutyMainEntity mainEntity = imsDutyMainService.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
@ -998,7 +1028,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
format = DateUtil.format(dutyMainEntity.getDutyDate(), DateUtil.PATTERN_DATE) + " " + time;
strDate = format;
Date parse = DateUtil.parse(format, DateUtil.PATTERN_DATETIME);
Date parse = DateUtil.parse(format, PATTERN_DATETIME);
ImsDutyMainEntity imsDutyMainServiceOne1 = imsDutyMainService.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
@ -1019,7 +1049,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
preTime = dutyClassEntity.getStartTime() + "";
}
preDate = DateUtil.format(imsDutyMainServiceOne1.getDutyDate(), DateUtil.PATTERN_DATE) + " " + preTime;
Date preParse = DateUtil.parse(preDate, DateUtil.PATTERN_DATETIME);
Date preParse = DateUtil.parse(preDate, PATTERN_DATETIME);
if (preParse.getTime() > parse.getTime()) {
bool = true;
strDate = calculateDutyDate(parse);
@ -1051,7 +1081,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
if (preBool) {
Date preParse = DateUtil.parse(preDate, DateUtil.PATTERN_DATETIME);
Date preParse = DateUtil.parse(preDate, PATTERN_DATETIME);
if (preParse.getTime() > parse.getTime()) {
strDate = calculateDutyDate(parse);
}
@ -1085,7 +1115,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
c.setTime(date);
c.add(Calendar.DAY_OF_MONTH, 1);
date = c.getTime();
return DateUtil.format(date, DateUtil.PATTERN_DATETIME);
return DateUtil.format(date, PATTERN_DATETIME);
}
/**
@ -1309,9 +1339,9 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
entity.setId(imsDutyRecTestVo.getId());
entity.setCreateUser(imsDutyRecTestVo.getManagerId());
String startTime = imsDutyRecTestVo.getDutyDate() + " " + imsDutyRecTestVo.getEndTime();
entity.setExecTime(DateUtil.parse(startTime, DateUtil.PATTERN_DATETIME));
String endTime = minutlDateTest(DateUtil.parse(startTime, DateUtil.PATTERN_DATETIME), 10);
entity.setAcceptTime(DateUtil.parse(endTime, DateUtil.PATTERN_DATETIME));
entity.setExecTime(DateUtil.parse(startTime, PATTERN_DATETIME));
String endTime = minutlDateTest(DateUtil.parse(startTime, PATTERN_DATETIME), 10);
entity.setAcceptTime(DateUtil.parse(endTime, PATTERN_DATETIME));
this.baseMapper.updateById(entity);
}
@ -1385,7 +1415,12 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
// 交接班接班信息填充
recDTO.setStatus(DutyRecStatus.ACCEPT.getVal());
recDTO.setAcceptTime(new Date());
recDTO.setQrCodeContent(System.currentTimeMillis() + "");
ImsDutyLogEntity imsDutyLogEntity = recDTO.getImsDutyLogEntity();
imsDutyLogService.update(Wrappers.<ImsDutyLogEntity>lambdaUpdate()
.set(ImsDutyLogEntity::getCarryTime, DateUtil.format(new Date(), PATTERN_DATETIME))
.eq(ImsDutyLogEntity::getDutyId,imsDutyLogEntity.getDutyId())
);
log.info("更新值班日志");
}
ImsDutyRecEntity dutyRec = BeanUtil.copy(recDTO, ImsDutyRecEntity.class);
// 更新交班值班
@ -1464,4 +1499,138 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
}
return null;
}
@Override
public R<ImsDutyLogEntity> getDutyLog(ImsDutyLogEntity imsDutyLogEntity) {
String deptId = AuthUtil.getUser().getDeptId();
if (com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNotEmpty(imsDutyLogEntity)&& com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNotEmpty(imsDutyLogEntity.getDutyId())) {
ImsDutyLogEntity res = imsDutyLogService.getOne(new LambdaQueryWrapper<ImsDutyLogEntity>() {{
eq(ImsDutyLogEntity::getDutyId, imsDutyLogEntity.getDutyId())
.last(" limit 1");}});
if (Func.isNotEmpty(res)){
return R.data(res);
}
}
ImsDutyMainEntity mainEntity = imsDutyMainMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
eq(ImsDutyMainEntity::getId, imsDutyLogEntity.getDutyId())
.last(" limit 1");
}});
if (cn.hutool.core.util.ObjectUtil.isEmpty(mainEntity)) {
return R.success("您当前未值班");
}
Long mainId = mainEntity.getId();
ImsDutyMainEntity carryEntity = imsDutyMainMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
eq(ImsDutyMainEntity::getPreDutyId, mainId)
.last(" limit 1");
}});
if (cn.hutool.core.util.ObjectUtil.isEmpty(carryEntity)) {
return R.success("没有接班计划,请到排班计划进行排班");
}
ImsDutyLogEntity dutyLogEntity=new ImsDutyLogEntity();
dutyLogEntity.setDutyId(mainId);
//值班-交接班基本信息
dutyLogEntity.setTime(DateUtil.format(new Date(), "yyyy-MM-dd"));
ImsDutyClassEntity classEntity = imsDutyClassService.getById(mainEntity.getClassId());
dutyLogEntity.setClassType(classEntity.getClassName());
String startTime = DateUtil.format(mainEntity.getDutyDate(), "yyyy-MM-dd") + " " +DateUtil.format(classEntity.getStartTime(), "HH:mm:ss");
String endTime = DateUtil.format(carryEntity.getDutyDate(), "yyyy-MM-dd")+ " " + DateUtil.format(classEntity.getEndTime(), "HH:mm:ss");
String dutyTime = startTime + "至" +endTime;
dutyLogEntity.setDutyTime(dutyTime);
ImsDutyRecEntity rec = this.getOne(Wrappers.<ImsDutyRecEntity>lambdaQuery()
.eq(ImsDutyRecEntity::getDutyId, mainId)
.last("limit 1;"));
dutyLogEntity.setHandMaster(getManagerName(mainEntity));
dutyLogEntity.setHandNumber(getManagerNumber(mainEntity));
dutyLogEntity.setCarryMaster(getManagerName(carryEntity));
dutyLogEntity.setCarryNumber(getManagerNumber(carryEntity));
if (ObjectUtil.isNotEmpty(rec)) {
dutyLogEntity.setHandTime(DateUtil.format(rec.getExecTime(), "yyyy-MM-dd HH:mm:ss"));
dutyLogEntity.setCarryTime(DateUtil.format(rec.getAcceptTime(), "yyyy-MM-dd HH:mm:ss"));
}
//工作票
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("startDate", startTime);
paramMap.put("endDate", endTime);
paramMap.put("deptList", deptId);
R<List<WorkTicketInfoEntity>> workTicketInfo = ticketInfoClient.getWorkTicketInfo(paramMap);
if(workTicketInfo.isSuccess()&& cn.hutool.core.util.ObjectUtil.isNotEmpty(workTicketInfo.getData())){
List<WorkTicketInfoEntity> ticketInfoData = workTicketInfo.getData();
// 工作票终结数量
Integer ticketInfoCompleteNum = ticketInfoData.stream().filter(item -> "结束".equals(item.getFlowTaskName()))
.collect(Collectors.toList()).size();
dutyLogEntity.setWorkFinish(ticketInfoCompleteNum.toString());
//工作票作废
List<WorkTicketInfoEntity> invalidList = ticketInfoData.stream().filter(item -> "废票".equals(item.getFlowTaskName()))
.collect(Collectors.toList());
dutyLogEntity.setWorkCancel(String.valueOf(invalidList.size()));
Integer i=0;
//工作票未执行数量
List<WorkTicketInfoEntity> unExecutedList = ticketInfoData.stream()
.filter(item -> i.equals(item.getImplementStatus()))
.collect(Collectors.toList());
dutyLogEntity.setWorkUnFinish(String.valueOf(unExecutedList.size()));
// 工作票执行数量
Integer ticketInfoStartNum = ticketInfoData.size() - ticketInfoCompleteNum-ticketInfoCompleteNum-invalidList.size()-unExecutedList.size();
dutyLogEntity.setWorkDoing(ticketInfoStartNum.toString());
}
R<List<StandardTicketInfoEntity>> operateTicketInfo = ticketInfoClient.getOperateTicketInfo(paramMap);
if(operateTicketInfo.isSuccess()&& cn.hutool.core.util.ObjectUtil.isNotEmpty(operateTicketInfo.getData())){
List<StandardTicketInfoEntity> operateTicketInfoData = operateTicketInfo.getData();
Integer finishSize = operateTicketInfoData.stream().filter(item -> "结束".equals(item.getFlowTaskName()))
.collect(Collectors.toList()).size();
dutyLogEntity.setOperationFinish(finishSize.toString());
Integer invalidSize= operateTicketInfoData.stream().filter(item -> "废票".equals(item.getFlowTaskName()))
.collect(Collectors.toList()).size();
dutyLogEntity.setOperationCancel(invalidSize.toString());
Integer doingNum = operateTicketInfoData.size() - finishSize - invalidSize;
dutyLogEntity.setOperationUnFinish(doingNum.toString());
}
TicketStatisticDTO ticketStatisticDTO=new TicketStatisticDTO();
ticketStatisticDTO.setStartDate(DateUtil.format(classEntity.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
ticketStatisticDTO.setEndDate(DateUtil.format(classEntity.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
ticketStatisticDTO.setDeptIds(deptId);
return R.data(dutyLogEntity);
}
private String getManagerName(ImsDutyMainEntity mainEntity) {
String managerName="";
if (cn.hutool.core.util.ObjectUtil.isNotEmpty(mainEntity.getDutyGroupId())){
Long dutyGroupId = mainEntity.getDutyGroupId();
ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(dutyGroupId);
User manager = UserCache.getUser(groupEntity.getManagerId());
if (cn.hutool.core.util.ObjectUtil.isNotEmpty(manager)){
managerName=manager.getName();
}
}else {
ImsDutyMainPersonEntity dutyMainPerson = imsDutyMainPersonService.getOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, mainEntity.getId())
.last(" limit 1");
}});
User manager = UserCache.getUser(dutyMainPerson.getDutyChargePerson());
if (cn.hutool.core.util.ObjectUtil.isNotEmpty(manager)){
managerName=manager.getName();
}
}
return managerName;
}
private String getManagerNumber(ImsDutyMainEntity mainEntity) {
String handNumber="";
String[] split = mainEntity.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 (org.springblade.core.tool.utils.ObjectUtil.isNotEmpty(user)) {
if (j == split.length - 1) {
handNumber= handNumber + user.getName();
} else {
handNumber= handNumber + user.getName()+ "、";
}
}
}
}
return handNumber;
}
}

BIN
hzims-service/operational/src/main/resources/template/dutyLogTemplate.docx

Binary file not shown.

34
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClient.java

@ -183,6 +183,40 @@ public class TicketInfoClient implements ITicketInfoClient {
return R.data(workTicketStatisticVO);
}
@Override
@PostMapping("/getWorkTicketInfo")
public R<List<WorkTicketInfoEntity>> getWorkTicketInfo(@RequestBody Map<String, Object> params) {
String startDate = (String) params.get("startDate");
String endDate = (String) params.get("endDate");
List<Long> deptList = (List<Long>) params.get("deptList");
log.info("查询工作票");
List<WorkTicketInfoEntity> infoList = infoService.list(new LambdaQueryWrapper<WorkTicketInfoEntity>() {{
ge(WorkTicketInfoEntity::getPlanStartTime, startDate);
le(WorkTicketInfoEntity::getPlanStartTime, endDate);
in(WorkTicketInfoEntity::getCreateDept, deptList);
}});
return R.data(infoList);
}
/**
* 获取首页操作票统计结果
*
* @param params
* @return
*/
@Override
@PostMapping("/getOperateTicketInfo")
public R<List<StandardTicketInfoEntity>> getOperateTicketInfo(@RequestBody Map<String, Object> params) {
String startDate = (String) params.get("startDate");
String endDate = (String) params.get("endDate");
List<Long> deptList = (List<Long>) params.get("deptList");
List<StandardTicketInfoEntity> standardTicketList = standardService.list(new LambdaQueryWrapper<StandardTicketInfoEntity>() {{
ge(StandardTicketInfoEntity::getStartTime, startDate);
le(StandardTicketInfoEntity::getStartTime, endDate);
in(StandardTicketInfoEntity::getCreateDept, deptList);
}});
return R.data(standardTicketList);
}
/**
* 获取首页操作票统计结果
*

Loading…
Cancel
Save