Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 11 months ago
parent
commit
46f70b1f29
  1. 23
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java
  2. 110
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyLogEntity.java
  3. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyRecEntity.java
  4. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/ImsDutyRecVO.java
  5. 2
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java
  6. 20
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/ITicketInfoClient.java
  7. 10
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClientFallback.java
  8. 4
      hzims-service/operational/pom.xml
  9. 91
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java
  10. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyLogMapper.java
  11. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyLogMapper.xml
  12. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyLogService.java
  13. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyRecService.java
  14. 179
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyLogServiceImpl.java
  15. 199
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java
  16. BIN
      hzims-service/operational/src/main/resources/template/dutyLogTemplate.docx
  17. 34
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClient.java

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; 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; package com.hnac.hzims.operational.duty.entity;
import com.baomidou.mybatisplus.annotation.SqlCondition; import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@ -102,5 +103,8 @@ public class ImsDutyRecEntity extends TenantEntity {
@QueryField(condition = SqlCondition.LIKE) @QueryField(condition = SqlCondition.LIKE)
private String dealChain; 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.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer; 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 com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -42,4 +43,7 @@ public class ImsDutyRecVO extends ImsDutyRecEntity {
@ApiModelProperty(value = "站点名称") @ApiModelProperty(value = "站点名称")
private String stationName; 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-线上") @ApiModelProperty("是否线下 : 1-线下,0-线上")
private Boolean isOffline; 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_TICKET_PASS_BY_IDS = API_PREFIX + "/getTicketPassByIds";
String GET_WORK_TICKET_TRANSFER = API_PREFIX + "/getWorkTicketTransfer"; String GET_WORK_TICKET_TRANSFER = API_PREFIX + "/getWorkTicketTransfer";
String GET_WORK_TICKET_STATISTIC = API_PREFIX + "/getWorkTicketStatistic"; 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_TICKET_STATISTIC = API_PREFIX + "/getOperateTicketStatistic";
String GET_OPERATE_WORK_STATISTIC = API_PREFIX + "/getOperateWorkStatistic"; String GET_OPERATE_WORK_STATISTIC = API_PREFIX + "/getOperateWorkStatistic";
String GET_WORK_TICKET_CHECK = API_PREFIX + "/getWorkTicketCheck"; String GET_WORK_TICKET_CHECK = API_PREFIX + "/getWorkTicketCheck";
@ -90,6 +92,24 @@ public interface ITicketInfoClient {
@PostMapping(GET_WORK_TICKET_STATISTIC) @PostMapping(GET_WORK_TICKET_STATISTIC)
R<WorkTicketStatisticVO> getWorkTicketStatistic(@RequestBody Map<String,Object> params); 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 * @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 @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) { public R<Integer> getOperateTicketStatistic(Map<String, Object> paramMap) {
return null; return null;
} }

4
hzims-service/operational/pom.xml

@ -106,12 +106,12 @@
<dependency> <dependency>
<groupId>cn.afterturn</groupId> <groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId> <artifactId>easypoi-base</artifactId>
<version>3.2.0</version> <version>4.4.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.afterturn</groupId> <groupId>cn.afterturn</groupId>
<artifactId>easypoi-annotation</artifactId> <artifactId>easypoi-annotation</artifactId>
<version>3.2.0</version> <version>4.4.0</version>
</dependency> </dependency>
<!-- 由于poi使用的poi-ooxml-schemas是ooxml-schemas的精简版,所以在was服务器上导出Excel可能会报错--> <!-- 由于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; package com.hnac.hzims.operational.duty.controller;
import cn.afterturn.easypoi.word.WordExportUtil;
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.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType; 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.dto.ImsDutyRecDTO;
import com.hnac.hzims.operational.duty.entity.AnalyseExample; import com.hnac.hzims.operational.duty.entity.*;
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.service.IImsAnalyseExampleService; import com.hnac.hzims.operational.duty.service.IImsAnalyseExampleService;
import com.hnac.hzims.operational.duty.service.IImsDutyEmergencyService; 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.service.IImsDutyRecService;
import com.hnac.hzims.operational.duty.vo.ImsDutyEmergencyVo; import com.hnac.hzims.operational.duty.vo.ImsDutyEmergencyVo;
import com.hnac.hzims.operational.duty.vo.ImsDutyRecVO; 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.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; 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.boot.ctrl.BladeController;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil; 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 org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.net.URLEncoder;
import java.util.HashMap;
/** /**
@ -45,13 +51,16 @@ import javax.validation.Valid;
@AllArgsConstructor @AllArgsConstructor
@RequestMapping("/imsDutyRec") @RequestMapping("/imsDutyRec")
@Api(value = "值班交接controller", tags = "值班交接相关操作(交接班管理)") @Api(value = "值班交接controller", tags = "值班交接相关操作(交接班管理)")
@Slf4j
public class ImsDutyRecController extends BladeController { public class ImsDutyRecController extends BladeController {
@Resource
private final IImsDutyRecService imsDutyRecService; private IImsDutyRecService imsDutyRecService;
@Resource @Resource
private IImsDutyEmergencyService iImsDutyEmergencyService; private IImsDutyEmergencyService iImsDutyEmergencyService;
@Resource @Resource
private IImsAnalyseExampleService iImsAnalyseExampleService; private IImsAnalyseExampleService iImsAnalyseExampleService;
@Resource
private IImsDutyLogService imsDutyLogService;
/** /**
* 详情 * 详情
@ -147,7 +156,6 @@ public class ImsDutyRecController extends BladeController {
if(null == deptId){ if(null == deptId){
deptId = Long.valueOf(AuthUtil.getDeptId()); deptId = Long.valueOf(AuthUtil.getDeptId());
} }
return imsDutyRecService.getTheManinGroupRec(deptId); return imsDutyRecService.getTheManinGroupRec(deptId);
} }
@ -335,7 +343,76 @@ public class ImsDutyRecController extends BladeController {
public R changeShift(@Valid @RequestBody ImsDutyRecDTO imsDutyRecDTO) { public R changeShift(@Valid @RequestBody ImsDutyRecDTO imsDutyRecDTO) {
return R.status(imsDutyRecService.changeShift(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.ChangeShiftsRspDTO;
import com.hnac.hzims.operational.duty.dto.ImsDutyRecDTO; import com.hnac.hzims.operational.duty.dto.ImsDutyRecDTO;
import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity; 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.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity;
import com.hnac.hzims.operational.duty.vo.ImsDutyRecVO; import com.hnac.hzims.operational.duty.vo.ImsDutyRecVO;
@ -135,4 +136,6 @@ public interface IImsDutyRecService extends BaseService<ImsDutyRecEntity> {
* @return * @return
*/ */
Boolean dealDutyRecFlow(ImsDutyRecDTO recDTO); 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.vo.ImsSchedulingVo;
import com.hnac.hzims.operational.duty.wrapper.ImsDutyRecWrapper; import com.hnac.hzims.operational.duty.wrapper.ImsDutyRecWrapper;
import com.hnac.hzims.operational.station.service.IStationService; 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.PlanContants;
import com.hnac.hzinfo.inspect.plan.feign.IInspectPlanClient; import com.hnac.hzinfo.inspect.plan.feign.IInspectPlanClient;
import com.hnac.hzinfo.inspect.plan.vo.PlanVO; 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.feign.IFlowClient;
import org.springblade.flow.core.utils.TaskUtil; import org.springblade.flow.core.utils.TaskUtil;
import org.springblade.system.feign.ISysClient; 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.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Autowired; 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.Assert;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Time; import java.sql.Time;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -65,6 +71,8 @@ import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; 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 @Slf4j
@Service @Service
public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, ImsDutyRecEntity> implements IImsDutyRecService { public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, ImsDutyRecEntity> implements IImsDutyRecService {
@Resource
private ITicketInfoClient ticketInfoClient;
@Autowired @Autowired
private ImsDutyMainMapper imsDutyMainMapper; private ImsDutyMainMapper imsDutyMainMapper;
@Autowired @Autowired
private IImsDutyMainService imsDutyMainService; private IImsDutyMainService imsDutyMainService;
@Autowired @Autowired
private IImsDutyLogService imsDutyLogService;
@Autowired
private IImsDutyClassService imsDutyClassService; private IImsDutyClassService imsDutyClassService;
@Autowired @Autowired
private IImsDutyGroupService imsDutyGroupService; private IImsDutyGroupService imsDutyGroupService;
@ -228,7 +239,11 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
if (Func.isEmpty(recEntity.getId())) { if (Func.isEmpty(recEntity.getId())) {
save(recEntity); 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); BladeFlow bladeFlow = this.startDutyRecProcess(recEntity, managerId);
recEntity.setProcessInstanceId(bladeFlow.getProcessInstanceId()); recEntity.setProcessInstanceId(bladeFlow.getProcessInstanceId());
return updateById(recEntity); return updateById(recEntity);
@ -327,7 +342,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
userName = userR.getData().getName(); userName = userR.getData().getName();
log.info("--------------------------req2:" + req, groupEntityManagerId, userName, date); 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(), /*remondingCarry(req, OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(),
groupEntity.getManagerId(), userName, null, groupEntity.getManagerId(), userName, null,
format, groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());*/ format, groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());*/
@ -381,7 +396,6 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
updateMain(recEntity.getDutyId()); updateMain(recEntity.getDutyId());
recEntity.setStatus(DutyRecStatus.ACCEPT.getVal()); recEntity.setStatus(DutyRecStatus.ACCEPT.getVal());
recEntity.setAcceptTime(new Date()); recEntity.setAcceptTime(new Date());
recEntity.setQrCodeContent(System.currentTimeMillis() + "");
this.updateById(recEntity); this.updateById(recEntity);
} }
} else { } else {
@ -457,6 +471,11 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
if (result.isSuccess() && ObjectUtil.isNotEmpty(result.getData())) { if (result.isSuccess() && ObjectUtil.isNotEmpty(result.getData())) {
imsDutyRecVO.setStationName(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); imsDutyRecVOIPage.setRecords(records);
return imsDutyRecVOIPage; return imsDutyRecVOIPage;
@ -505,7 +524,13 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
if (ObjectUtil.isNotEmpty(recEntity)) { if (ObjectUtil.isNotEmpty(recEntity)) {
return R.success("您已提交交班申请"); 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>() {{ ImsDutyRecEntity dutyRecEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<ImsDutyRecEntity>() {{
eq(ImsDutyRecEntity::getDutyId, entity.getPreDutyId()); eq(ImsDutyRecEntity::getDutyId, entity.getPreDutyId());
}}); }});
@ -824,12 +849,17 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
entity.setId(id); entity.setId(id);
entity.setDutyDate(DateUtil.parse(date, DateUtil.PATTERN_DATE)); entity.setDutyDate(DateUtil.parse(date, DateUtil.PATTERN_DATE));
String format1 = DateUtil.format(new 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); 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()) { if (dutyDate.getTime() > parse.getTime()) {
return R.fail("值班时间不能大于当前时间"); return R.fail("指定的值班开始时间不能晚于当前时间");
} }
ImsDutyMainEntity mainEntityById = imsDutyMainService.getById(id);
//获取当前值班 //获取当前值班
ImsDutyMainEntity mainEntity = imsDutyMainService.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ 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; format = DateUtil.format(dutyMainEntity.getDutyDate(), DateUtil.PATTERN_DATE) + " " + time;
strDate = format; strDate = format;
Date parse = DateUtil.parse(format, DateUtil.PATTERN_DATETIME); Date parse = DateUtil.parse(format, PATTERN_DATETIME);
ImsDutyMainEntity imsDutyMainServiceOne1 = imsDutyMainService.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ ImsDutyMainEntity imsDutyMainServiceOne1 = imsDutyMainService.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
@ -1019,7 +1049,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
preTime = dutyClassEntity.getStartTime() + ""; preTime = dutyClassEntity.getStartTime() + "";
} }
preDate = DateUtil.format(imsDutyMainServiceOne1.getDutyDate(), DateUtil.PATTERN_DATE) + " " + preTime; 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()) { if (preParse.getTime() > parse.getTime()) {
bool = true; bool = true;
strDate = calculateDutyDate(parse); strDate = calculateDutyDate(parse);
@ -1051,7 +1081,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
if (preBool) { if (preBool) {
Date preParse = DateUtil.parse(preDate, DateUtil.PATTERN_DATETIME); Date preParse = DateUtil.parse(preDate, PATTERN_DATETIME);
if (preParse.getTime() > parse.getTime()) { if (preParse.getTime() > parse.getTime()) {
strDate = calculateDutyDate(parse); strDate = calculateDutyDate(parse);
} }
@ -1085,7 +1115,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
c.setTime(date); c.setTime(date);
c.add(Calendar.DAY_OF_MONTH, 1); c.add(Calendar.DAY_OF_MONTH, 1);
date = c.getTime(); 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.setId(imsDutyRecTestVo.getId());
entity.setCreateUser(imsDutyRecTestVo.getManagerId()); entity.setCreateUser(imsDutyRecTestVo.getManagerId());
String startTime = imsDutyRecTestVo.getDutyDate() + " " + imsDutyRecTestVo.getEndTime(); String startTime = imsDutyRecTestVo.getDutyDate() + " " + imsDutyRecTestVo.getEndTime();
entity.setExecTime(DateUtil.parse(startTime, DateUtil.PATTERN_DATETIME)); entity.setExecTime(DateUtil.parse(startTime, PATTERN_DATETIME));
String endTime = minutlDateTest(DateUtil.parse(startTime, DateUtil.PATTERN_DATETIME), 10); String endTime = minutlDateTest(DateUtil.parse(startTime, PATTERN_DATETIME), 10);
entity.setAcceptTime(DateUtil.parse(endTime, DateUtil.PATTERN_DATETIME)); entity.setAcceptTime(DateUtil.parse(endTime, PATTERN_DATETIME));
this.baseMapper.updateById(entity); this.baseMapper.updateById(entity);
} }
@ -1385,7 +1415,12 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
// 交接班接班信息填充 // 交接班接班信息填充
recDTO.setStatus(DutyRecStatus.ACCEPT.getVal()); recDTO.setStatus(DutyRecStatus.ACCEPT.getVal());
recDTO.setAcceptTime(new Date()); 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); ImsDutyRecEntity dutyRec = BeanUtil.copy(recDTO, ImsDutyRecEntity.class);
// 更新交班值班 // 更新交班值班
@ -1464,4 +1499,138 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
} }
return null; 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); 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