Compare commits

...

2 Commits

  1. 6
      sql/release_202405/wms_202405.sql
  2. 22
      win-module-infra/win-module-infra-api/src/main/java/com/win/module/infra/api/trends/TrendsApi.java
  3. 10
      win-module-infra/win-module-infra-api/src/main/java/com/win/module/infra/api/trends/dto/TrendsCreateReqDTO.java
  4. 26
      win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/api/trends/TrendsApiImpl.java
  5. 6
      win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/controller/trends/vo/TrendsBaseVO.java
  6. 6
      win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/controller/trends/vo/TrendsExcelVO.java
  7. 10
      win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/controller/trends/vo/TrendsExportReqVO.java
  8. 10
      win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/controller/trends/vo/TrendsPageReqVO.java
  9. 10
      win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/controller/trends/vo/TrendsRespVO.java
  10. 17
      win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/dal/dataobject/trends/TrendsDO.java
  11. 10
      win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/mq/message/trends/TrendsMessage.java
  12. 77
      win-module-qms/win-module-qms-biz/src/main/java/com/win/module/qms/service/aql/AqlServiceImpl.java
  13. 81
      win-module-qms/win-module-qms-biz/src/main/java/com/win/module/qms/service/inspectionRequest/InspectionRequestMainServiceImpl.java

6
sql/release_202405/wms_202405.sql

@ -2752,3 +2752,9 @@ ALTER TABLE `job_productreceipt_main` ADD `shift_name` varchar(64) CHARACTER SET
ALTER TABLE `record_productreceipt_main` ADD `team_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '班组名称';
ALTER TABLE `record_productreceipt_main` ADD `shift_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '班次名称';
ALTER TABLE infra_trends ADD `before_content` JSON DEFAULT NULL COMMENT '变更前json';
ALTER TABLE infra_trends ADD `after_content` JSON DEFAULT NULL COMMENT '变更后json';
ALTER TABLE infra_trends_2023 ADD `before_content` JSON DEFAULT NULL COMMENT '变更前json';
ALTER TABLE infra_trends_2023 ADD `after_content` JSON DEFAULT NULL COMMENT '变更后json';
ALTER TABLE infra_trends_2024 ADD `before_content` JSON DEFAULT NULL COMMENT '变更前json';
ALTER TABLE infra_trends_2024 ADD `after_content` JSON DEFAULT NULL COMMENT '变更后json';

22
win-module-infra/win-module-infra-api/src/main/java/com/win/module/infra/api/trends/TrendsApi.java

@ -4,6 +4,28 @@ import com.win.module.infra.enums.TrendsTypeEnum;
public interface TrendsApi {
/**
* 创建动态记录
* @param tableId 表数据id
* @param tableName 表名
* @param beforeContent 变更前json
* @param content 内容
* @param afterContent 变更后json
* @param trendsTypeEnum com.win.module.infra.enums.TrendsTypeEnum枚举
* @param userId 创建人id
*/
void createTrends(Long tableId, String tableName, String beforeContent, String content, String afterContent, TrendsTypeEnum trendsTypeEnum, String userId);
/**
* 创建动态记录
* @param tableId 表数据id
* @param tableName 表名
* @param content 内容
* @param trendsTypeEnum com.win.module.infra.enums.TrendsTypeEnum枚举
* @param userId 创建人id
*/
void createTrends(Long tableId, String tableName, String content, TrendsTypeEnum trendsTypeEnum, String userId);
/**
* 创建动态记录
* @param tableId 表数据id

10
win-module-infra/win-module-infra-api/src/main/java/com/win/module/infra/api/trends/dto/TrendsCreateReqDTO.java

@ -16,9 +16,19 @@ public class TrendsCreateReqDTO {
@NotNull(message = "类型不能为空")
private Integer type;
/**
* 变更前json
*/
private String beforeContent;
@NotNull(message = "内容不能为空")
private String content;
/**
* 变更后json
*/
private String afterContent;
private String creator;
}

26
win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/api/trends/TrendsApiImpl.java

@ -12,8 +12,6 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import static com.win.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
/**
* API 访问日志的 API 实现类
*
@ -33,20 +31,32 @@ public class TrendsApiImpl implements TrendsApi {
private UnifiedMessageApi unifiedMessageApi;
@Override
public void createTrends(Long tableId, String tableName, String content, TrendsTypeEnum trendsTypeEnum) {
public void createTrends(Long tableId, String tableName, String beforeContent, String content, String afterContent, TrendsTypeEnum trendsTypeEnum, String userId) {
TrendsCreateReqDTO createDTO = new TrendsCreateReqDTO();
createDTO.setTableId(tableId);
createDTO.setTableName(tableName);
createDTO.setType(trendsTypeEnum.getType());
createDTO.setBeforeContent(beforeContent);
createDTO.setContent(content);
createDTO.setCreator(getLoginUserId().toString());
// trendsService.createTrends(createDTO);
createDTO.setAfterContent(afterContent);
createDTO.setCreator(userId);
// trendsService.createTrends(createDTO); // 同步插入
TrendsMessage trendsMessage = TrendsConvert.INSTANCE.convertMessage(createDTO);
trendsProducer.sendMessage(trendsMessage);
// unifiedMessageApi.sendMessage(createDTO.getTableName(),createDTO.getType(),createDTO.getTableId());
trendsProducer.sendMessage(trendsMessage); // mq异步插入
unifiedMessageApi.sendMessage(createDTO.getTableName(),createDTO.getType(),createDTO.getTableId()); //消息通知
}
@Override
public void createTrends(Long tableId, String tableName, String content, TrendsTypeEnum trendsTypeEnum, String userId) {
this.createTrends(tableId, tableName, null, content, null, trendsTypeEnum, userId);
}
@Override
public void createTrends(Long tableId, String tableName, String content, TrendsTypeEnum trendsTypeEnum) {
this.createTrends(tableId, tableName, content, trendsTypeEnum, null);
}
@Override
public void createTrendsByTask(Long tableId, String tableName, String content, TrendsTypeEnum trendsTypeEnum, String userId) {
TrendsCreateReqDTO createDTO = new TrendsCreateReqDTO();
@ -59,6 +69,6 @@ public class TrendsApiImpl implements TrendsApi {
TrendsMessage trendsMessage = TrendsConvert.INSTANCE.convertMessage(createDTO);
trendsProducer.sendMessage(trendsMessage);
// unifiedMessageApi.sendMessage(createDTO.getTableName(),createDTO.getType(),createDTO.getTableId());
}
}

6
win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/controller/trends/vo/TrendsBaseVO.java

@ -24,7 +24,13 @@ public class TrendsBaseVO {
@NotNull(message = "类型")
private Integer type;
@Schema(description = "变更前json")
private String beforeContent;
@Schema(description = "内容")
private String content;
@Schema(description = "变更后json")
private String afterContent;
}

6
win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/controller/trends/vo/TrendsExcelVO.java

@ -25,7 +25,13 @@ public class TrendsExcelVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@ExcelProperty("变更前json")
private String beforeContent;
@ExcelProperty("内容")
private String content;
@ExcelProperty("变更后json")
private String afterContent;
}

10
win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/controller/trends/vo/TrendsExportReqVO.java

@ -1,5 +1,6 @@
package com.win.module.infra.controller.trends.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@ -25,4 +26,13 @@ public class TrendsExportReqVO {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@ExcelProperty("变更前json")
private String beforeContent;
@ExcelProperty("内容")
private String content;
@ExcelProperty("变更后json")
private String afterContent;
}

10
win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/controller/trends/vo/TrendsPageReqVO.java

@ -1,5 +1,6 @@
package com.win.module.infra.controller.trends.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.win.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -30,4 +31,13 @@ public class TrendsPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@ExcelProperty("变更前json")
private String beforeContent;
@ExcelProperty("内容")
private String content;
@ExcelProperty("变更后json")
private String afterContent;
}

10
win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/controller/trends/vo/TrendsRespVO.java

@ -1,5 +1,6 @@
package com.win.module.infra.controller.trends.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
@ -22,4 +23,13 @@ public class TrendsRespVO extends TrendsBaseVO {
@Schema(description = "用户头像")
private String avatar;
@ExcelProperty("变更前json")
private String beforeContent;
@ExcelProperty("内容")
private String content;
@ExcelProperty("变更后json")
private String afterContent;
}

17
win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/dal/dataobject/trends/TrendsDO.java

@ -1,12 +1,11 @@
package com.win.module.infra.dal.dataobject.trends;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.win.framework.mybatis.core.dataobject.BaseDO;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.win.framework.mybatis.core.dataobject.BaseDO;
/**
* 动态记录 DO
@ -47,9 +46,17 @@ public class TrendsDO extends BaseDO {
* 删除者ID
*/
private String deleterId;
/**
* 变更前json
*/
private String beforeContent;
/**
* 内容
*/
private String content;
/**
* 变更后json
*/
private String afterContent;
}

10
win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/mq/message/trends/TrendsMessage.java

@ -24,9 +24,19 @@ public class TrendsMessage extends AbstractStreamMessage {
@NotNull(message = "类型不能为空")
private Integer type;
/**
* 变更前json
*/
private String beforeContent;
@NotNull(message = "内容不能为空")
private String content;
/**
* 变更后json
*/
private String afterContent;
private String creator;
@Override

77
win-module-qms/win-module-qms-biz/src/main/java/com/win/module/qms/service/aql/AqlServiceImpl.java

@ -1,31 +1,14 @@
package com.win.module.qms.service.aql;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static com.win.module.qms.enums.ErrorCodeConstants.*;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.Resource;
import com.win.module.infra.api.trends.TrendsApi;
import com.win.module.infra.enums.TrendsTypeEnum;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.validation.annotation.Validated;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.module.infra.api.trends.TrendsApi;
import com.win.module.infra.enums.TrendsTypeEnum;
import com.win.module.qms.controller.aql.vo.*;
import com.win.module.qms.convert.aql.AqlConvert;
import com.win.module.qms.dal.dataobject.aql.AqlDO;
@ -33,9 +16,24 @@ import com.win.module.qms.dal.dataobject.sampleCode.SampleCodeDO;
import com.win.module.qms.dal.mysql.aql.AqlMapper;
import com.win.module.qms.dal.mysql.sampleCode.SampleCodeMapper;
import com.win.module.qms.service.samplingScheme.SamplingSchemeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.validation.annotation.Validated;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ReflectUtil;
import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static com.win.module.qms.enums.ErrorCodeConstants.*;
/**
* aql Service 实现类
@ -61,21 +59,21 @@ public class AqlServiceImpl implements AqlService {
@Transactional
public Long createAql(AqlCreateReqVO createReqVO) {
// 插入
AqlDO aql = AqlConvert.INSTANCE.convert(createReqVO);
aqlMapper.insert(aql);
trendsApi.createTrendsByTask(aql.getId(), "basic_aql", "创建了aql", TrendsTypeEnum.CREATE, getLoginUserId().toString());
AqlDO aqlDO = AqlConvert.INSTANCE.convert(createReqVO);
aqlMapper.insert(aqlDO);
trendsApi.createTrends(aqlDO.getId(), "basic_aql", null, "创建了aql", JSONUtil.toJsonStr(aqlDO), TrendsTypeEnum.CREATE, String.valueOf(getLoginUserId()));
// 返回
return aql.getId();
return aqlDO.getId();
}
@Override
@Transactional
public Integer updateAql(AqlUpdateReqVO updateReqVO) {
// 校验存在
validateAqlExists(updateReqVO.getId());
AqlDO aqlDO = validateAqlExists(updateReqVO.getId());
// 更新
AqlDO updateObj = AqlConvert.INSTANCE.convert(updateReqVO);
trendsApi.createTrendsByTask(updateObj.getId(), "basic_aql", "修改了aql", TrendsTypeEnum.UPDATE, getLoginUserId().toString());
trendsApi.createTrends(updateObj.getId(), "basic_aql", JSONUtil.toJsonStr(aqlDO), "修改了aql", JSONUtil.toJsonStr(updateObj), TrendsTypeEnum.UPDATE, String.valueOf(getLoginUserId()));
return aqlMapper.updateById(updateObj);
}
@ -83,16 +81,18 @@ public class AqlServiceImpl implements AqlService {
@Transactional
public Integer deleteAql(Long id) {
// 校验存在
validateAqlExists(id);
trendsApi.createTrendsByTask(id, "basic_aql", "删除了aql", TrendsTypeEnum.DELETE, getLoginUserId().toString());
AqlDO aqlDO = validateAqlExists(id);
trendsApi.createTrends(id, "basic_aql", JSONUtil.toJsonStr(aqlDO), "删除了aql", null, TrendsTypeEnum.DELETE, String.valueOf(getLoginUserId()));
// 删除
return aqlMapper.deleteById(id);
}
private void validateAqlExists(Long id) {
if (aqlMapper.selectById(id) == null) {
private AqlDO validateAqlExists(Long id) {
AqlDO aqlDO = aqlMapper.selectById(id);
if (aqlDO == null) {
throw exception(AQL_NOT_EXISTS);
}
return aqlDO;
}
@Override
@ -157,10 +157,13 @@ public class AqlServiceImpl implements AqlService {
AqlDO aqlDO = AqlConvert.INSTANCE.convert(item);
aqlDO.setId(obj.getId());
aqlMapper.updateById(aqlDO);
trendsApi.createTrends(aqlDO.getId(), "basic_aql", JSONUtil.toJsonStr(obj), "导入修改了aql", JSONUtil.toJsonStr(aqlDO), TrendsTypeEnum.UPDATE, String.valueOf(getLoginUserId()));
}
}
if (list.isEmpty() && mode != 3) {// 数据库中不存在值且不是覆盖走新增
aqlMapper.insert(AqlConvert.INSTANCE.convert(item));
AqlDO aqlDO = AqlConvert.INSTANCE.convert(item);
aqlMapper.insert(aqlDO);
trendsApi.createTrends(aqlDO.getId(), "basic_aql", null, "导入创建了aql", JSONUtil.toJsonStr(aqlDO), TrendsTypeEnum.CREATE, String.valueOf(getLoginUserId()));
}
}
} catch (Exception e) {
@ -227,7 +230,7 @@ public class AqlServiceImpl implements AqlService {
UpdateWrapper<AqlDO> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("available", "TRUE");
updateWrapper.eq("id", id);
trendsApi.createTrendsByTask(id, "basic_aql", "启用了aql", TrendsTypeEnum.ENABLE, getLoginUserId().toString());
trendsApi.createTrends(id, "basic_aql", "启用了aql", TrendsTypeEnum.ENABLE, String.valueOf(getLoginUserId()));
return aqlMapper.update(null, updateWrapper);
}
@ -237,7 +240,7 @@ public class AqlServiceImpl implements AqlService {
UpdateWrapper<AqlDO> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("available", "FALSE");
updateWrapper.eq("id", id);
trendsApi.createTrendsByTask(id, "basic_aql", "禁用了aql", TrendsTypeEnum.DISABLE, getLoginUserId().toString());
trendsApi.createTrends(id, "basic_aql", "禁用了aql", TrendsTypeEnum.DISABLE, String.valueOf(getLoginUserId()));
return aqlMapper.update(null, updateWrapper);
}

81
win-module-qms/win-module-qms-biz/src/main/java/com/win/module/qms/service/inspectionRequest/InspectionRequestMainServiceImpl.java

@ -1,29 +1,8 @@
package com.win.module.qms.service.inspectionRequest;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static com.win.module.qms.enums.ErrorCodeConstants.*;
import static com.win.module.wms.enums.ErrorCodeConstants.INSPECT_REQUEST_CANNOT_CLOSE;
import static com.win.module.wms.enums.ErrorCodeConstants.PLEASE_DO_NOT_RESUBMIT;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.win.framework.common.exception.ServiceException;
import com.win.framework.common.pojo.CustomConditions;
@ -84,12 +63,30 @@ import com.win.module.system.api.serialnumber.SerialNumberApi;
import com.win.module.system.enums.serialNumber.RuleCodeEnum;
import com.win.module.wms.api.requestsetting.RequestsettingApi;
import com.win.module.wms.api.requestsetting.dto.RequestsettingDto;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.json.JSONUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static com.win.module.qms.enums.ErrorCodeConstants.*;
import static com.win.module.wms.enums.ErrorCodeConstants.INSPECT_REQUEST_CANNOT_CLOSE;
import static com.win.module.wms.enums.ErrorCodeConstants.PLEASE_DO_NOT_RESUBMIT;
/**
* 检验申请 Service 实现类
@ -154,7 +151,7 @@ public class InspectionRequestMainServiceImpl implements InspectionRequestMainSe
validateInspectionRequestMainExists(updateReqVO.getId());
// 更新
InspectionRequestMainDO inspectionRequestMainDO = InspectionRequestMainConvert.INSTANCE.convert(updateReqVO);
trendsApi.createTrendsByTask(inspectionRequestMainDO.getId(), "request_inspection_main", "修改了检验申请", TrendsTypeEnum.UPDATE, getLoginUserId().toString());
trendsApi.createTrends(inspectionRequestMainDO.getId(), "request_inspection_main", "修改了检验申请", TrendsTypeEnum.UPDATE, String.valueOf(getLoginUserId()));
return inspectionRequestMainMapper.updateById(inspectionRequestMainDO);
}
@ -167,7 +164,7 @@ public class InspectionRequestMainServiceImpl implements InspectionRequestMainSe
}
// 删除
int result = inspectionRequestMainMapper.deleteById(id);
trendsApi.createTrendsByTask(id, "request_inspection_main", "删除了检验申请", TrendsTypeEnum.DELETE, getLoginUserId().toString());
trendsApi.createTrends(id, "request_inspection_main", "删除了检验申请", TrendsTypeEnum.DELETE, String.valueOf(getLoginUserId()));
return result;
}
@ -204,8 +201,7 @@ public class InspectionRequestMainServiceImpl implements InspectionRequestMainSe
try {
inspectionRequestMainCreateReqVO.setExistException(false);
InspectionRequestMainDO inspectionRequestMainDO = this.createInspectionRequestMainVo(inspectionRequestMainCreateReqVO);
inspectionRequestMainCreateReqVO.setRemark(
"检验申请创建成功,物料代码:" + inspectionRequestMainDO.getItemCode() + ",创建时间:" + LocalDateTimeUtil.format(inspectionRequestMainDO.getCreateTime(), DatePattern.NORM_DATETIME_FORMATTER));
inspectionRequestMainCreateReqVO.setRemark("检验申请创建成功,物料代码:" + inspectionRequestMainDO.getItemCode() + ",创建时间:" + LocalDateTimeUtil.format(inspectionRequestMainDO.getCreateTime(), DatePattern.NORM_DATETIME_FORMATTER));
} catch (Exception ex) {
inspectionRequestMainCreateReqVO.setRemark(ex.getMessage());
inspectionRequestMainCreateReqVO.setExistException(true);
@ -316,7 +312,7 @@ public class InspectionRequestMainServiceImpl implements InspectionRequestMainSe
}
}
inspectionRequestMainCreateReqVO.setNumber(number);
trendsApi.createTrendsByTask(inspectionRequestMainDO.getId(), "request_inspection_main", "创建了检验申请", TrendsTypeEnum.CREATE, getLoginUserId().toString());
trendsApi.createTrends(inspectionRequestMainDO.getId(), "request_inspection_main", null, "创建了检验申请", JSONUtil.toJsonStr(inspectionRequestMainDO), TrendsTypeEnum.CREATE, String.valueOf(getLoginUserId()));
return inspectionRequestMainDO;
}
@ -335,7 +331,7 @@ public class InspectionRequestMainServiceImpl implements InspectionRequestMainSe
throw new ServiceException(INSPECT_REQUEST_CANNOT_CLOSE);
}
mainDO.setStatus(requestStatusState.getState().getCode());// 增加操作记录
trendsApi.createTrendsByTask(id, "request_inspection_main", "关闭了检验申请", TrendsTypeEnum.REQUEST_CLOSE, getLoginUserId().toString());
trendsApi.createTrends(id, "request_inspection_main", "关闭了检验申请", TrendsTypeEnum.REQUEST_CLOSE, String.valueOf(getLoginUserId()));
return inspectionRequestMainMapper.updateById(mainDO);
}
@ -353,7 +349,7 @@ public class InspectionRequestMainServiceImpl implements InspectionRequestMainSe
if (RequestStatusEnum.HANDLING.getCode().equals(mainDO.getStatus())) {
this.generateJob(mainDO);
}
trendsApi.createTrendsByTask(id, "request_inspection_main", "提交了检验申请", TrendsTypeEnum.REQUEST_SUBMIT, getLoginUserId().toString());
trendsApi.createTrends(id, "request_inspection_main", "提交了检验申请", TrendsTypeEnum.REQUEST_SUBMIT, String.valueOf(getLoginUserId()));
return inspectionRequestMainMapper.updateById(mainDO);
}
@ -372,7 +368,7 @@ public class InspectionRequestMainServiceImpl implements InspectionRequestMainSe
throw new ServiceException(INSPECTION_REQUEST_CANNOT_RE_ADD);
}
mainDO.setStatus(requestStatusState.getState().getCode());// 增加操作记录
trendsApi.createTrendsByTask(id, "request_inspection_main", "重新打开了检验申请", TrendsTypeEnum.REQUEST_RE_ADD, getLoginUserId().toString());
trendsApi.createTrends(id, "request_inspection_main", "重新打开了检验申请", TrendsTypeEnum.REQUEST_RE_ADD, String.valueOf(getLoginUserId()));
return inspectionRequestMainMapper.updateById(mainDO);
}
@ -391,7 +387,7 @@ public class InspectionRequestMainServiceImpl implements InspectionRequestMainSe
if (RequestStatusEnum.HANDLING.getCode().equals(mainDO.getStatus())) {
this.generateJob(mainDO);
}
trendsApi.createTrendsByTask(id, "request_inspection_main", "审批同意了检验申请", TrendsTypeEnum.REQUEST_AGREE, getLoginUserId().toString());
trendsApi.createTrends(id, "request_inspection_main", "审批同意了检验申请", TrendsTypeEnum.REQUEST_AGREE, String.valueOf(getLoginUserId()));
return inspectionRequestMainMapper.updateById(mainDO);
}
@ -408,7 +404,7 @@ public class InspectionRequestMainServiceImpl implements InspectionRequestMainSe
mainDO.setStatus(requestStatusState.getState().getCode());
// 调用执行方法
this.generateJob(mainDO);
trendsApi.createTrendsByTask(id, "request_inspection_main", "处理了检验申请", TrendsTypeEnum.REQUEST_HANDLE, getLoginUserId().toString());
trendsApi.createTrends(id, "request_inspection_main", "处理了检验申请", TrendsTypeEnum.REQUEST_HANDLE, String.valueOf(getLoginUserId()));
int updateCnt = inspectionRequestMainMapper.updateById(mainDO);
if (updateCnt == 0) {
throw exception(PLEASE_DO_NOT_RESUBMIT);
@ -427,7 +423,7 @@ public class InspectionRequestMainServiceImpl implements InspectionRequestMainSe
throw new ServiceException(INSPECTION_REQUEST_CANNOT_REFUSED);
}
mainDO.setStatus(requestStatusState.getState().getCode());
trendsApi.createTrendsByTask(id, "request_inspection_main", "审批拒绝了检验申请", TrendsTypeEnum.REQUEST_REFUSED, getLoginUserId().toString());
trendsApi.createTrends(id, "request_inspection_main", "审批拒绝了检验申请", TrendsTypeEnum.REQUEST_REFUSED, String.valueOf(getLoginUserId()));
return inspectionRequestMainMapper.updateById(mainDO);
}
@ -439,7 +435,7 @@ public class InspectionRequestMainServiceImpl implements InspectionRequestMainSe
queryWrapper.eq("callback_request_number", callbackRequestNumber);
queryWrapper.eq("available", "TRUE");
List<InspectionRequestMainDO> inspectionRequestMainDOList = inspectionRequestMainMapper.selectList(queryWrapper);
if (inspectionRequestMainDOList.size() > 0) {
if (!inspectionRequestMainDOList.isEmpty()) {
result = true;
}
return result;
@ -556,8 +552,8 @@ public class InspectionRequestMainServiceImpl implements InspectionRequestMainSe
inspectionJobCharacteristicsDO.setCreator(inspectionRequestMainDO.getCreator());
inspectionJobCharacteristicsDO.setUpdater(inspectionRequestMainDO.getCreator());
inspectionJobCharacteristicsMainMapper.insert(inspectionJobCharacteristicsDO);
trendsApi.createTrends(inspectionJobMainDO.getId(), "job_inspection_main", null, "创建了检验任务", JSONUtil.toJsonStr(inspectionJobDetailDO) ,TrendsTypeEnum.CREATE, inspectionRequestMainDO.getCreator());
}
trendsApi.createTrendsByTask(inspectionJobMainDO.getId(), "job_inspection_main", "创建了检验任务", TrendsTypeEnum.CREATE, inspectionRequestMainDO.getCreator());
return number;
}
@ -705,6 +701,7 @@ public class InspectionRequestMainServiceImpl implements InspectionRequestMainSe
inspectionRecordCharacteristicsDO.setCreator(inspectionRequestMainDO.getCreator());
inspectionRecordCharacteristicsDO.setUpdater(inspectionRequestMainDO.getUpdater());
inspectionRecordCharacteristicsMainMapper.insert(inspectionRecordCharacteristicsDO);
trendsApi.createTrends(inspectionRecordMainDO.getId(), "record_inspection_main", null, "创建了检验记录", JSONUtil.toJsonStr(inspectionRecordDetailDO), TrendsTypeEnum.CREATE, String.valueOf(getLoginUserId()));
}
// 生成记录之后修改状态为完成
inspectionRequestMainDO.setStatus(RequestStatusEnum.COMPLETED.getCode());
@ -721,12 +718,10 @@ public class InspectionRequestMainServiceImpl implements InspectionRequestMainSe
}
inspectionRecordMainUpdateReqVO.setPackageList(inspectionRecordPackageUpdateReqVOList);
inspectionRecordMainUpdateReqVO.setAvailable(Schema.AdditionalPropertiesValue.TRUE.toString());
trendsApi.createTrendsByTask(inspectionRecordMainDO.getId(), "record_inspection_main", "创建了检验记录", TrendsTypeEnum.CREATE, getLoginUserId().toString());
// 更新使用决策
inspectionRecordMainService.updateInspectionRecordMain(inspectionRecordMainUpdateReqVO);
// 发布
inspectionRecordMainService.publishInspectionRecordMain(inspectionRecordMainDO.getId());
trendsApi.createTrendsByTask(inspectionRecordMainDO.getId(), "record_inspection_main", "创建了检验记录", TrendsTypeEnum.CREATE, inspectionRequestMainDO.getCreator());
}
private InspectionRequestMainDO validateInspectionRequestMainExists(Long id) {

Loading…
Cancel
Save