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. 25
      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. 9
      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 = "操作票") @ApiModelProperty(value = "操作票")
private String ticketId; 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) @JsonSerialize(nullsUsing = NullSerializer.class)
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "处理人") @ApiModelProperty(value = "处理人")
private Long flowHandler; private String flowHandler;
} }

25
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.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; 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.IOperAppearanceService;
import com.hnac.hzims.operational.defect.service.IOperDefectService; import com.hnac.hzims.operational.defect.service.IOperDefectService;
import com.hnac.hzims.operational.defect.service.IOperDefectStatisticsService; 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.entity.RepairEntity;
import com.hnac.hzims.ticket.repair.fegin.IRepairClient; import com.hnac.hzims.ticket.repair.fegin.IRepairClient;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -166,7 +168,8 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
String processName = "[" + userName + "] 发起 " + "【" + sourceName + "】缺陷处理流程" + "——>" + entity.getDefectCode(); String processName = "[" + userName + "] 发起 " + "【" + sourceName + "】缺陷处理流程" + "——>" + entity.getDefectCode();
// 开启新的缺陷流程 // 开启新的缺陷流程
String businessKey = FlowUtil.getBusinessKey("hzims_oper_phenomenon", "" + entity.getId()); 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); R<BladeFlow> result = processClient.startProcessInstanceContainNameByKey(TreatMethodConstant.DEFECT_CHECK, businessKey, processName, variable);
// 流程开启失败 // 流程开启失败
if (!result.isSuccess()) { if (!result.isSuccess()) {
@ -253,15 +256,15 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
try { 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) { } catch (Exception e) {
log.info("消息转换失败"); log.info("消息转换失败");
return R.fail("消息转换失败"); return R.fail("消息转换失败");
} }
//设置当前环节+当前环节处理人
if (processWorkFlowResponse.getTaskId() != null || processWorkFlowResponse.getUserId() != null) { if (processWorkFlowResponse.getTaskId() != null || processWorkFlowResponse.getUserId() != null) {
operPhenomenonEntity.setCurrentOperator(processWorkFlowResponse.getNextStepOperator()); operPhenomenonEntity.setCurrentOperator(processWorkFlowResponse.getTaskName());
operPhenomenonEntity.setCurrentLinkHandler(processWorkFlowResponse.getProcessDefinitionKey()); operPhenomenonEntity.setCurrentLinkHandler(processWorkFlowResponse.getNextStepOperator());
} }
//缺陷记录 //缺陷记录
OperDefectStatisticsEntity statisticsEntity = statisticsService.getOne(new LambdaUpdateWrapper<OperDefectStatisticsEntity>() {{ OperDefectStatisticsEntity statisticsEntity = statisticsService.getOne(new LambdaUpdateWrapper<OperDefectStatisticsEntity>() {{
@ -271,7 +274,17 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
OperAppearanceEntity appearanceEntity = operAppearanceService.getOne(new LambdaUpdateWrapper<OperAppearanceEntity>() {{ OperAppearanceEntity appearanceEntity = operAppearanceService.getOne(new LambdaUpdateWrapper<OperAppearanceEntity>() {{
eq(OperAppearanceEntity::getDefectCode, operPhenomenonEntity.getDefectCode()); 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(); OperDefectEntity operDefectEntity = new OperDefectEntity();
BeanUtil.copy(operPhenomenonEntity, operDefectEntity); BeanUtil.copy(operPhenomenonEntity, operDefectEntity);
operDefectEntity.setProcessInstanceId(operPhenomenonEntity.getHandleTaskId().toString()); 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.mapper.OperAppearanceMapper;
import com.hnac.hzims.operational.defect.service.IOperAppearanceService; import com.hnac.hzims.operational.defect.service.IOperAppearanceService;
import com.hnac.hzims.operational.defect.vo.OperAppearanceVO; 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.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
@ -23,7 +22,7 @@ public class OperAppearanceServiceImpl extends BaseServiceImpl<OperAppearanceMap
@Override @Override
public LambdaQueryWrapper<OperAppearanceEntity> getQueryWrapper(OperAppearanceVO operAppearanceVO) { public LambdaQueryWrapper<OperAppearanceEntity> getQueryWrapper(OperAppearanceVO operAppearanceVO) {
LambdaQueryWrapper<OperAppearanceEntity> queryWrapper = Condition.getQueryWrapper(new OperAppearanceEntity(), operAppearanceVO); LambdaQueryWrapper<OperAppearanceEntity> queryWrapper = Condition.getQueryWrapper(new OperAppearanceEntity(), operAppearanceVO);
if (ObjectUtils.isEmpty(operAppearanceVO)) { if (Func.isNotEmpty(operAppearanceVO)) {
if (StringUtil.isNotBlank(operAppearanceVO.getDefectCode())) { if (StringUtil.isNotBlank(operAppearanceVO.getDefectCode())) {
queryWrapper.eq(OperAppearanceEntity::getId, operAppearanceVO.getDefectCode()); queryWrapper.eq(OperAppearanceEntity::getId, operAppearanceVO.getDefectCode());
} }
@ -42,6 +41,9 @@ public class OperAppearanceServiceImpl extends BaseServiceImpl<OperAppearanceMap
if (Func.isNotEmpty(operAppearanceVO.getName())) { if (Func.isNotEmpty(operAppearanceVO.getName())) {
queryWrapper.like(OperAppearanceEntity::getName, operAppearanceVO.getName()); queryWrapper.like(OperAppearanceEntity::getName, operAppearanceVO.getName());
} }
if (Func.isNotEmpty(operAppearanceVO.getFaultName())) {
queryWrapper.like(OperAppearanceEntity::getFaultName, operAppearanceVO.getFaultName());
}
if (Func.isNotEmpty(operAppearanceVO.getDiscriminator())) { if (Func.isNotEmpty(operAppearanceVO.getDiscriminator())) {
queryWrapper.eq(OperAppearanceEntity::getDiscriminator, 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 @Override
public LambdaQueryWrapper<OperDefectEntity> getQueryWrapper(OperDefectVO defectVO) { public LambdaQueryWrapper<OperDefectEntity> getQueryWrapper(OperDefectVO defectVO) {
LambdaQueryWrapper<OperDefectEntity> queryWrapper = Condition.getQueryWrapper(new OperDefectEntity(), defectVO); LambdaQueryWrapper<OperDefectEntity> queryWrapper = Condition.getQueryWrapper(new OperDefectEntity(), defectVO);
if (ObjectUtils.isEmpty(defectVO)) { if (Func.isNotEmpty(defectVO)) {
if (defectVO.getActStartTime() != null) { if (defectVO.getActStartTime() != null) {
queryWrapper.ge(OperDefectEntity::getActStartTime, defectVO.getActStartTime()); queryWrapper.ge(OperDefectEntity::getActStartTime, defectVO.getActStartTime());
} }
@ -153,7 +153,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
queryWrapper.eq(OperDefectEntity::getDiagnosisId, defectVO.getDiagnosisId()); queryWrapper.eq(OperDefectEntity::getDiagnosisId, defectVO.getDiagnosisId());
} }
if (Func.isNotEmpty(defectVO.getConclusionPeople())) { if (Func.isNotEmpty(defectVO.getConclusionPeople())) {
queryWrapper.like(OperDefectEntity::getConclusionPeople, defectVO.getConclusionPeople()); queryWrapper.eq(OperDefectEntity::getConclusionPeople, defectVO.getConclusionPeople());
} }
if (Func.isNotEmpty(defectVO.getExistDefectId())) { if (Func.isNotEmpty(defectVO.getExistDefectId())) {
queryWrapper.eq(OperDefectEntity::getExistDefectId, defectVO.getExistDefectId()); queryWrapper.eq(OperDefectEntity::getExistDefectId, defectVO.getExistDefectId());

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

@ -40,6 +40,7 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS
@Override @Override
public LambdaQueryWrapper<OperDefectStatisticsEntity> getQueryWrapper(OperDefectStatisticsVO statistics) { public LambdaQueryWrapper<OperDefectStatisticsEntity> getQueryWrapper(OperDefectStatisticsVO statistics) {
LambdaQueryWrapper<OperDefectStatisticsEntity> queryWrapper = Condition.getQueryWrapper(new OperDefectStatisticsEntity(),statistics); LambdaQueryWrapper<OperDefectStatisticsEntity> queryWrapper = Condition.getQueryWrapper(new OperDefectStatisticsEntity(),statistics);
if(Func.isNotEmpty(statistics)) {
if (statistics.getActStartTime() != null) { if (statistics.getActStartTime() != null) {
queryWrapper.ge(OperDefectStatisticsEntity::getActStartTime, statistics.getActStartTime()); queryWrapper.ge(OperDefectStatisticsEntity::getActStartTime, statistics.getActStartTime());
} }
@ -55,6 +56,9 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS
if (statistics.getConclusion() != null) { if (statistics.getConclusion() != null) {
queryWrapper.like(OperDefectStatisticsEntity::getConclusion, statistics.getConclusion()); queryWrapper.like(OperDefectStatisticsEntity::getConclusion, statistics.getConclusion());
} }
if (statistics.getName() != null) {
queryWrapper.like(OperDefectStatisticsEntity::getName, statistics.getName());
}
if (statistics.getConclusionTime() != null) { if (statistics.getConclusionTime() != null) {
queryWrapper.le(OperDefectStatisticsEntity::getConclusionTime, statistics.getConclusionTime()); queryWrapper.le(OperDefectStatisticsEntity::getConclusionTime, statistics.getConclusionTime());
} }
@ -67,6 +71,9 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS
if (Func.isNotEmpty(statistics.getCreateEndTime())) { if (Func.isNotEmpty(statistics.getCreateEndTime())) {
queryWrapper.ge(OperDefectStatisticsEntity::getCreateTime, statistics.getCreateEndTime()); queryWrapper.ge(OperDefectStatisticsEntity::getCreateTime, statistics.getCreateEndTime());
} }
if (statistics.getIsDefect() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getIsDefect, statistics.getIsDefect());
}
if (statistics.getEmCode() != null) { if (statistics.getEmCode() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getEmCode, statistics.getEmCode()); queryWrapper.eq(OperDefectStatisticsEntity::getEmCode, statistics.getEmCode());
} }
@ -82,6 +89,8 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS
if (statistics.getCreateDept() != null) { if (statistics.getCreateDept() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getCreateDept, statistics.getCreateDept()); queryWrapper.eq(OperDefectStatisticsEntity::getCreateDept, statistics.getCreateDept());
} }
}
queryWrapper.orderByDesc(OperDefectStatisticsEntity::getCreateTime); queryWrapper.orderByDesc(OperDefectStatisticsEntity::getCreateTime);
return queryWrapper; 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