Browse Source

提交消缺相关代码

zhongwei
tyty 1 year ago
parent
commit
24aaa7424d
  1. 11
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectStatisticsEntity.java
  2. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java
  3. 27
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java
  4. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperAppearanceServiceImpl.java
  5. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java
  6. 91
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java
  7. 28
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/TimeUtils.java

11
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectStatisticsEntity.java

@ -297,4 +297,15 @@ public class OperDefectStatisticsEntity extends TenantEntity {
*/
@ApiModelProperty(value = "操作票")
private String ticketId;
/**
* 流程实例ID
*/
@ApiModelProperty(value = "流程实例")
private String checkProcessInstanceId;
/**
* 处理状态已处理1未处理0默认0
*/
@QueryField(condition = SqlCondition.EQUAL)
@ApiModelProperty(value = "处理状态:已处理1,未处理0,默认0")
private String handleStatus;
}

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java

@ -395,5 +395,5 @@ public class OperPhenomenonEntity extends TenantEntity {
@JsonSerialize(nullsUsing = NullSerializer.class)
@TableField(exist = false)
@ApiModelProperty(value = "处理人")
private Long flowHandler;
private String flowHandler;
}

27
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.defect.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
@ -27,6 +28,7 @@ import com.hnac.hzims.operational.defect.service.IDefectCheckService;
import com.hnac.hzims.operational.defect.service.IOperAppearanceService;
import com.hnac.hzims.operational.defect.service.IOperDefectService;
import com.hnac.hzims.operational.defect.service.IOperDefectStatisticsService;
import com.hnac.hzims.operational.util.TimeUtils;
import com.hnac.hzims.ticket.repair.entity.RepairEntity;
import com.hnac.hzims.ticket.repair.fegin.IRepairClient;
import lombok.RequiredArgsConstructor;
@ -166,7 +168,8 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
String processName = "[" + userName + "] 发起 " + "【" + sourceName + "】缺陷处理流程" + "——>" + entity.getDefectCode();
// 开启新的缺陷流程
String businessKey = FlowUtil.getBusinessKey("hzims_oper_phenomenon", "" + entity.getId());
Map<String, Object> variable = entityToMap(entity);
Map<String, Object> variable = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(entity,DateUtil.PATTERN_DATETIME), Map.class);
// variables.put("creator", TaskUtil.getTaskUser(String.valueOf(AuthUtil.getUserId())));
R<BladeFlow> result = processClient.startProcessInstanceContainNameByKey(TreatMethodConstant.DEFECT_CHECK, businessKey, processName, variable);
// 流程开启失败
if (!result.isSuccess()) {
@ -251,17 +254,17 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
OperPhenomenonEntity operPhenomenonEntity;
try {
Map<String, Object> variables =(Map<String, Object>) processWorkFlowResponse.getVariables();
Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables();
//现象缺陷全表更新
operPhenomenonEntity = mapToEntity(OperPhenomenonEntity.class, variables);
operPhenomenonEntity= JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference<OperPhenomenonEntity>(){});
} catch (Exception e) {
log.info("消息转换失败");
return R.fail("消息转换失败");
}
//设置当前环节+当前环节处理人
if (processWorkFlowResponse.getTaskId() != null || processWorkFlowResponse.getUserId() != null) {
operPhenomenonEntity.setCurrentOperator(processWorkFlowResponse.getNextStepOperator());
operPhenomenonEntity.setCurrentLinkHandler(processWorkFlowResponse.getProcessDefinitionKey());
operPhenomenonEntity.setCurrentOperator(processWorkFlowResponse.getTaskName());
operPhenomenonEntity.setCurrentLinkHandler(processWorkFlowResponse.getNextStepOperator());
}
//缺陷记录
OperDefectStatisticsEntity statisticsEntity = statisticsService.getOne(new LambdaUpdateWrapper<OperDefectStatisticsEntity>() {{
@ -271,7 +274,17 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
OperAppearanceEntity appearanceEntity = operAppearanceService.getOne(new LambdaUpdateWrapper<OperAppearanceEntity>() {{
eq(OperAppearanceEntity::getDefectCode, operPhenomenonEntity.getDefectCode());
}});
if (ObjectUtil.isNotEmpty(operPhenomenonEntity.getIsWarehousing()) && "1".equals(operPhenomenonEntity.getIsWarehousing())) {
//计算工时
if(ObjectUtils.isNotEmpty(operPhenomenonEntity.getActStartTime())&&ObjectUtils.isNotEmpty(operPhenomenonEntity.getActEndTime())){
Long differTime = TimeUtils.getDifferTime(operPhenomenonEntity.getActStartTime(), operPhenomenonEntity.getActEndTime());
operPhenomenonEntity.setCheckHours(differTime.intValue());
}
if(ObjectUtils.isNotEmpty(operPhenomenonEntity.getPlanStartTime())&&ObjectUtils.isNotEmpty(operPhenomenonEntity.getPlanEndTime())){
Long differTime = TimeUtils.getDifferTime(operPhenomenonEntity.getPlanStartTime(), operPhenomenonEntity.getPlanEndTime());
operPhenomenonEntity.setPlanHours(differTime.intValue());
}
//缺陷库记录
if (ObjectUtil.isNotEmpty(operPhenomenonEntity.getIsWarehousing()) && 1==(operPhenomenonEntity.getIsWarehousing())) {
OperDefectEntity operDefectEntity = new OperDefectEntity();
BeanUtil.copy(operPhenomenonEntity, operDefectEntity);
operDefectEntity.setProcessInstanceId(operPhenomenonEntity.getHandleTaskId().toString());

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperAppearanceServiceImpl.java

@ -5,7 +5,6 @@ import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity;
import com.hnac.hzims.operational.defect.mapper.OperAppearanceMapper;
import com.hnac.hzims.operational.defect.service.IOperAppearanceService;
import com.hnac.hzims.operational.defect.vo.OperAppearanceVO;
import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.utils.Func;
@ -23,7 +22,7 @@ public class OperAppearanceServiceImpl extends BaseServiceImpl<OperAppearanceMap
@Override
public LambdaQueryWrapper<OperAppearanceEntity> getQueryWrapper(OperAppearanceVO operAppearanceVO) {
LambdaQueryWrapper<OperAppearanceEntity> queryWrapper = Condition.getQueryWrapper(new OperAppearanceEntity(), operAppearanceVO);
if (ObjectUtils.isEmpty(operAppearanceVO)) {
if (Func.isNotEmpty(operAppearanceVO)) {
if (StringUtil.isNotBlank(operAppearanceVO.getDefectCode())) {
queryWrapper.eq(OperAppearanceEntity::getId, operAppearanceVO.getDefectCode());
}
@ -42,6 +41,9 @@ public class OperAppearanceServiceImpl extends BaseServiceImpl<OperAppearanceMap
if (Func.isNotEmpty(operAppearanceVO.getName())) {
queryWrapper.like(OperAppearanceEntity::getName, operAppearanceVO.getName());
}
if (Func.isNotEmpty(operAppearanceVO.getFaultName())) {
queryWrapper.like(OperAppearanceEntity::getFaultName, operAppearanceVO.getFaultName());
}
if (Func.isNotEmpty(operAppearanceVO.getDiscriminator())) {
queryWrapper.eq(OperAppearanceEntity::getDiscriminator, operAppearanceVO.getDiscriminator());
}

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

@ -121,7 +121,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
@Override
public LambdaQueryWrapper<OperDefectEntity> getQueryWrapper(OperDefectVO defectVO) {
LambdaQueryWrapper<OperDefectEntity> queryWrapper = Condition.getQueryWrapper(new OperDefectEntity(), defectVO);
if (ObjectUtils.isEmpty(defectVO)) {
if (Func.isNotEmpty(defectVO)) {
if (defectVO.getActStartTime() != null) {
queryWrapper.ge(OperDefectEntity::getActStartTime, defectVO.getActStartTime());
}
@ -153,7 +153,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
queryWrapper.eq(OperDefectEntity::getDiagnosisId, defectVO.getDiagnosisId());
}
if (Func.isNotEmpty(defectVO.getConclusionPeople())) {
queryWrapper.like(OperDefectEntity::getConclusionPeople, defectVO.getConclusionPeople());
queryWrapper.eq(OperDefectEntity::getConclusionPeople, defectVO.getConclusionPeople());
}
if (Func.isNotEmpty(defectVO.getExistDefectId())) {
queryWrapper.eq(OperDefectEntity::getExistDefectId, defectVO.getExistDefectId());

91
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java

@ -40,47 +40,56 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS
@Override
public LambdaQueryWrapper<OperDefectStatisticsEntity> getQueryWrapper(OperDefectStatisticsVO statistics) {
LambdaQueryWrapper<OperDefectStatisticsEntity> queryWrapper = Condition.getQueryWrapper(new OperDefectStatisticsEntity(),statistics);
if(statistics.getActStartTime()!=null){
queryWrapper.ge(OperDefectStatisticsEntity::getActStartTime,statistics.getActStartTime());
}
if(statistics.getActEndTime()!=null){
queryWrapper.le(OperDefectStatisticsEntity::getActStartTime,statistics.getActEndTime());
}
if (statistics.getDefectLevel() != null) {
queryWrapper.like(OperDefectStatisticsEntity::getDefectLevel, statistics.getDefectLevel());
}
if (statistics.getDisposer() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getDisposer, statistics.getDisposer());
}
if (statistics.getConclusion() != null) {
queryWrapper.like(OperDefectStatisticsEntity::getConclusion, statistics.getConclusion());
}
if (statistics.getConclusionTime() != null) {
queryWrapper.le(OperDefectStatisticsEntity::getConclusionTime, statistics.getConclusionTime());
}
if (Func.isNotEmpty(statistics.getConclusionEndTime())) {
queryWrapper.ge(OperDefectStatisticsEntity::getConclusionTime, statistics.getConclusionEndTime());
}
if (statistics.getCreateTime() != null) {
queryWrapper.le(OperDefectStatisticsEntity::getCreateTime, statistics.getCreateTime());
}
if (Func.isNotEmpty(statistics.getCreateEndTime())) {
queryWrapper.ge(OperDefectStatisticsEntity::getCreateTime, statistics.getCreateEndTime());
}
if (statistics.getEmCode() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getEmCode, statistics.getEmCode());
}
if (statistics.getIsWarehousing() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getIsWarehousing, statistics.getIsWarehousing());
}
if (statistics.getSourceCode() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getSourceCode, statistics.getSourceCode());
}
if (statistics.getConclusionPeople() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getConclusionPeople, statistics.getConclusionPeople());
}
if (statistics.getCreateDept() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getCreateDept, statistics.getCreateDept());
if(Func.isNotEmpty(statistics)) {
if (statistics.getActStartTime() != null) {
queryWrapper.ge(OperDefectStatisticsEntity::getActStartTime, statistics.getActStartTime());
}
if (statistics.getActEndTime() != null) {
queryWrapper.le(OperDefectStatisticsEntity::getActStartTime, statistics.getActEndTime());
}
if (statistics.getDefectLevel() != null) {
queryWrapper.like(OperDefectStatisticsEntity::getDefectLevel, statistics.getDefectLevel());
}
if (statistics.getDisposer() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getDisposer, statistics.getDisposer());
}
if (statistics.getConclusion() != null) {
queryWrapper.like(OperDefectStatisticsEntity::getConclusion, statistics.getConclusion());
}
if (statistics.getName() != null) {
queryWrapper.like(OperDefectStatisticsEntity::getName, statistics.getName());
}
if (statistics.getConclusionTime() != null) {
queryWrapper.le(OperDefectStatisticsEntity::getConclusionTime, statistics.getConclusionTime());
}
if (Func.isNotEmpty(statistics.getConclusionEndTime())) {
queryWrapper.ge(OperDefectStatisticsEntity::getConclusionTime, statistics.getConclusionEndTime());
}
if (statistics.getCreateTime() != null) {
queryWrapper.le(OperDefectStatisticsEntity::getCreateTime, statistics.getCreateTime());
}
if (Func.isNotEmpty(statistics.getCreateEndTime())) {
queryWrapper.ge(OperDefectStatisticsEntity::getCreateTime, statistics.getCreateEndTime());
}
if (statistics.getIsDefect() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getIsDefect, statistics.getIsDefect());
}
if (statistics.getEmCode() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getEmCode, statistics.getEmCode());
}
if (statistics.getIsWarehousing() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getIsWarehousing, statistics.getIsWarehousing());
}
if (statistics.getSourceCode() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getSourceCode, statistics.getSourceCode());
}
if (statistics.getConclusionPeople() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getConclusionPeople, statistics.getConclusionPeople());
}
if (statistics.getCreateDept() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getCreateDept, statistics.getCreateDept());
}
}
queryWrapper.orderByDesc(OperDefectStatisticsEntity::getCreateTime);
return queryWrapper;

28
hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/TimeUtils.java

@ -0,0 +1,28 @@
package com.hnac.hzims.operational.util;
import java.math.BigDecimal;
import java.util.Date;
public class TimeUtils {
private static int sheet1NowRow, sheet2NowRow;
/**
* 相差时数
* @author ty
* @param endDate
* @param nowDate
* @return
*/
public static Long getDifferTime(Date endDate, Date nowDate) {
// long nd = 1000 * 24 * 60 * 60L;
long nh = 1000 * 60 * 60L;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
BigDecimal s=BigDecimal.valueOf(diff).divide(BigDecimal.valueOf(diff)).setScale(0, BigDecimal.ROUND_HALF_UP);
Long hour=s.longValue();
return hour;
}
}
Loading…
Cancel
Save