| | |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import cn.iocoder.yudao.module.infra.api.config.ConfigApi; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.metering.vo.MesDvMeteringPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.metering.vo.MesDvMeteringSaveReqVO; |
| | |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.dv.metering.MesDvMeteringMapper; |
| | | import cn.iocoder.yudao.module.mes.service.dv.meteringcheck.MesDvMeteringCheckService; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.mzt.logapi.starter.annotation.LogRecord; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.DV_METERING_CODE_DUPLICATE; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.DV_METERING_HAS_CHECK_RECORD; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.DV_METERING_NOT_EXISTS; |
| | | import static cn.iocoder.yudao.module.mes.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * MES 计量器具 Service 实现类 |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = MES_DV_METERING_TYPE, subType = MES_DV_METERING_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = MES_DV_METERING_IMPORT_SUCCESS) |
| | | public MesDvMeteringImportRespVO importMeteringList(List<MesDvMeteringImportExcelVO> importList) { |
| | | MesDvMeteringImportRespVO respVO = MesDvMeteringImportRespVO.builder() |
| | | .createList(new ArrayList<>()) |
| | |
| | | .failureList(new LinkedHashMap<>()) |
| | | .build(); |
| | | if (CollUtil.isEmpty(importList)) { |
| | | // 空文件也要给日志文案兜底,避免 {{#importSummary}} 取不到值 |
| | | OperateLogUtils.putImportSummary(respVO.getCreateList(), respVO.getUpdateList(), respVO.getFailureList()); |
| | | return respVO; |
| | | } |
| | | |
| | |
| | | respVO.getFailureList().put(label, resolveImportErrorMessage(ex)); |
| | | } |
| | | } |
| | | // 记录导入结果汇总,供 @LogRecord 的 success 文案引用 |
| | | OperateLogUtils.putImportSummary(respVO.getCreateList(), respVO.getUpdateList(), respVO.getFailureList()); |
| | | return respVO; |
| | | } |
| | | |