| | |
| | | public static void fillModuleFields(OperateLogCreateReqDTO reqDTO, LogRecord logRecord) { |
| | | reqDTO.setType(logRecord.getType()); // 大模åç±»åï¼ä¾å¦ï¼CRM å®¢æ· |
| | | reqDTO.setSubType(logRecord.getSubType());// æä½åç§°ï¼ä¾å¦ï¼è½¬ç§»å®¢æ· |
| | | reqDTO.setBizId(Long.parseLong(logRecord.getBizNo())); // ä¸å¡ç¼å·ï¼ä¾å¦ï¼å®¢æ·ç¼å· |
| | | reqDTO.setBizId(parseBizId(logRecord.getBizNo())); // ä¸å¡ç¼å·ï¼ä¾å¦ï¼å®¢æ·ç¼å· |
| | | reqDTO.setAction(logRecord.getAction());// æä½å
容ï¼ä¾å¦ï¼ä¿®æ¹ç¼å·ä¸º 1 çç¨æ·ä¿¡æ¯ï¼å°æ§å«ä»ç·æ¹æå¥³ï¼å°å§åä»è¶
级管çåæ¹ææºç ã |
| | | reqDTO.setExtra(logRecord.getExtra()); // æå±åæ®µï¼æäºå¤æçä¸å¡ï¼éè¦è®°å½ä¸äºå段 ( JSON æ ¼å¼ )ï¼ä¾å¦è¯´ï¼è®°å½è®¢åç¼å·ï¼{ orderId: "1"} |
| | | } |
| | | |
| | | /** |
| | | * è§£æä¸å¡ç¼å·ãæ¹é导å
¥çåºæ¯æ²¡æåä¸ä¸å¡ç¼å·ï¼æ³¨è§£ç bizNo 没填æå¡«äºéæ°åï¼ï¼ |
| | | * è¿éç¨ 0 å
åºââä¸è½è®© parseLong æå¼å¸¸ï¼å¦å {@link #record} ç catch ä¼ææ´æ¡æ¥å¿éé»åæ |
| | | * |
| | | * @param bizNo ä¸å¡ç¼å·å符串 |
| | | * @return ä¸å¡ç¼å·ï¼è§£æå¤±è´¥æ¶ä¸º 0 |
| | | */ |
| | | private static long parseBizId(String bizNo) { |
| | | if (bizNo == null || bizNo.isBlank()) { |
| | | return 0L; |
| | | } |
| | | try { |
| | | return Long.parseLong(bizNo.trim()); |
| | | } catch (NumberFormatException ex) { |
| | | log.warn("[parseBizId][ä¸å¡ç¼å·({}) 䏿¯æ°åï¼ç¨ 0 å
åº]", bizNo); |
| | | return 0L; |
| | | } |
| | | } |
| | | |
| | | private static void fillRequestFields(OperateLogCreateReqDTO reqDTO) { |
| | | // è·å¾ Request 对象 |
| | | HttpServletRequest request = ServletUtils.getRequest(); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.framework.operatelog.core.util; |
| | | |
| | | import com.mzt.logapi.context.LogRecordContext; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æä½æ¥å¿çå·¥å
·ç±» |
| | | * |
| | | * 主è¦è§£å³ã导å
¥ãè¿ç±»æ¹éæä½çæ¥å¿ææ¡ï¼ä¸æ¬¡å¯¼å
¥åªå䏿¡æ±æ»æ¥å¿ï¼ |
| | | * è䏿¯éè¡åï¼ä¸æ¬¡å¯¼å
¥å ç¾è¡å°±æ¯å ç¾æ¡æ¥å¿ï¼æ¥å¿é¡µä¼æ²¡æ³çï¼ã |
| | | * |
| | | * ç¨æ³ï¼å¨å¯¼å
¥æ¹æ³è¿ååè°ç¨ {@link #putImportSummary}ï¼æ³¨è§£ææ¡éå¼ç¨ {{#importSummary}}ï¼ |
| | | * <pre> |
| | | * @LogRecord(type = XXX_TYPE, subType = XXX_IMPORT_SUB_TYPE, bizNo = "0", success = XXX_IMPORT_SUCCESS) |
| | | * public XxxImportRespVO importXxxList(...) { |
| | | * ... |
| | | * OperateLogUtils.putImportSummary(respVO.getCreateList(), respVO.getUpdateList(), respVO.getFailureList()); |
| | | * return respVO; |
| | | * } |
| | | * </pre> |
| | | * |
| | | * 注æï¼æ³¨è§£ç bizNo å¿
é¡»ç»æ°åï¼å¯¼å
¥æ²¡æåä¸ä¸å¡ç¼å·ï¼ç»ä¸å¡« "0"ï¼ã |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public class OperateLogUtils { |
| | | |
| | | /** |
| | | * 导å
¥æ±æ»ææ¡å¨ {@link LogRecordContext} éçåéåï¼å¯¹åºæ³¨è§£ææ¡ç {{#importSummary}} |
| | | */ |
| | | public static final String IMPORT_SUMMARY = "importSummary"; |
| | | |
| | | /** |
| | | * è®°å½å¯¼å
¥ç»æçæ±æ»åéï¼æ°å¢/æ´æ°/å¤±è´¥æ¡æ°ï¼ï¼ç´æ¥ä¼ 忍¡å导å
¥ RespVO çåæ®µ |
| | | * |
| | | * 忍¡åç导å
¥ç»æå段形æä¸ç»ä¸ï¼æåçä¸è¬æ¯ Collectionï¼createUsernames / createList / |
| | | * createCustomerNames â¦ï¼ï¼å¤±è´¥çå夿¯ Mapï¼failureList / failureDeptNamesï¼key 为åç§°æè¡å·ï¼ï¼ |
| | | * ä¸æçæ¨¡å没æãæ´æ°ãè¿ä¸åï¼builder æªèµå¼æ¶ä¸º nullï¼ãæä»¥è¿éç»ä¸æãéå / Map / æ°å / nullã |
| | | * åæ¡æ°ï¼åä¸å°æ 0 å¤çââç»è®¡å¤±è´¥ä¸è½è®©æ´æ¡å¯¼å
¥æ¥å¿ä¸¢æã |
| | | * |
| | | * @param createResult æ°å¢æåçéåï¼ææ¡æ°ï¼ |
| | | * @param updateResult æ´æ°æåçéåï¼ææ¡æ°ï¼ï¼æ²¡æåä¼ null |
| | | * @param failureResult 失败çéå / Mapï¼ææ¡æ°ï¼ |
| | | */ |
| | | public static void putImportSummary(Object createResult, Object updateResult, Object failureResult) { |
| | | LogRecordContext.putVariable(IMPORT_SUMMARY, "æ°å¢ " + size(createResult) + " æ¡ãæ´æ° " |
| | | + size(updateResult) + " æ¡ã失败 " + size(failureResult) + " æ¡"); |
| | | } |
| | | |
| | | private static int size(Object result) { |
| | | if (result == null) { |
| | | return 0; |
| | | } |
| | | if (result instanceof Collection) { |
| | | return ((Collection<?>) result).size(); |
| | | } |
| | | if (result instanceof Map) { |
| | | return ((Map<?, ?>) result).size(); |
| | | } |
| | | if (result instanceof Number) { |
| | | return ((Number) result).intValue(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | |
| | | @Slf4j |
| | | public class ApiAccessLogFilter extends ApiRequestFilter { |
| | | |
| | | private static final String[] SANITIZE_KEYS = new String[]{"password", "token", "accessToken", "refreshToken"}; |
| | | /** |
| | | * ææå段åå表ï¼è¯·æ±åæ° / 请æ±ä½éå½ä¸è¿äº key çåæ®µï¼ä¸ä¼åå
¥è®¿é®æ¥å¿ |
| | | * |
| | | * è¿éæ¯ãå
¨éå
åºãååï¼è¦ç忍¡åå½åä¸ç»ä¸çå¯ç ä¸å¯é¥åæ®µï¼ |
| | | * 1. å¯ç ï¼passwordãoldPassword / newPassword / confirmPasswordï¼æ¹ååºæ¯ï¼ç²¾ç¡®å¹é
"password" å½ä¸ä¸ï¼ |
| | | * 2. 令çï¼tokenãaccessToken / access_tokenãrefreshToken / refresh_tokenï¼OAuth2 ç refresh_token èµ° query åæ°ï¼ |
| | | * æ¯ä¸å线å½åï¼ä¸åæç驼峰 refreshToken 䏿¯åä¸ä¸ª keyï¼ |
| | | * 3. å¯é¥ï¼secretãclientSecret / client_secretãapiKey / apiSecretï¼AIãçä¿¡ï¼ãaccessKeyï¼å¯¹è±¡åå¨ï¼ãprivateKey |
| | | * |
| | | * ä¸ªå«æ¥å£çææ key 䏿£å¸¸ä¸å¡å段éåï¼ä¾å¦çä¿¡éªè¯ç codeãä¸å¡åæ®ç¼ç ï¼ï¼ä¸è½æ¾è¿è¿ä»½å
¨å±ååï¼ |
| | | * ç±å¯¹åºæ¥å£èªè¡ç¨ @ApiAccessLog(sanitizeKeys = ...) æå®ã |
| | | */ |
| | | private static final String[] SANITIZE_KEYS = new String[]{ |
| | | "password", "oldPassword", "newPassword", "confirmPassword", |
| | | "token", "accessToken", "access_token", "refreshToken", "refresh_token", |
| | | "secret", "clientSecret", "client_secret", "apiKey", "apiSecret", "accessKey", "privateKey"}; |
| | | |
| | | private final String applicationName; |
| | | |
| | |
| | | String CRM_CUSTOMER_POOL_SUCCESS = "å°å®¢æ·ã{{#customerName}}ãæ¾å
¥äºå
¬æµ·"; |
| | | String CRM_CUSTOMER_RECEIVE_SUB_TYPE = "{{#ownerUserName != null ? 'åé
客æ·' : 'é¢å客æ·'}}"; |
| | | String CRM_CUSTOMER_RECEIVE_SUCCESS = "{{#ownerUserName != null ? 'å°å®¢æ·ã' + #customer.name + 'ãåé
ç»ã' + #ownerUserName + 'ã' : 'é¢å客æ·ã' + #customer.name + 'ã'}}"; |
| | | String CRM_CUSTOMER_IMPORT_SUB_TYPE = "{{#isUpdate ? '导å
¥å¹¶æ´æ°å®¢æ·' : '导å
¥å®¢æ·'}}"; |
| | | String CRM_CUSTOMER_IMPORT_SUCCESS = "{{#isUpdate ? '导å
¥å¹¶æ´æ°äºå®¢æ·ã'+ #customer.name +'ã' : '导å
¥äºå®¢æ·ã'+ #customer.name +'ã'}}"; |
| | | String CRM_CUSTOMER_IMPORT_SUB_TYPE = "导å
¥å®¢æ·"; |
| | | String CRM_CUSTOMER_IMPORT_SUCCESS = "导å
¥äºå®¢æ·ï¼{{#importSummary}}"; |
| | | String CRM_CUSTOMER_UPDATE_DEAL_STATUS_SUB_TYPE = "æ´æ°å®¢æ·æäº¤ç¶æ"; |
| | | String CRM_CUSTOMER_UPDATE_DEAL_STATUS_SUCCESS = "æ´æ°äºå®¢æ·ã{{#customerName}}ãçæäº¤ç¶æä¸ºã{{#dealStatus ? 'å·²æäº¤' : 'æªæäº¤'}}ã"; |
| | | String CRM_CUSTOMER_FOLLOW_UP_SUB_TYPE = "客æ·è·è¿"; |
| | |
| | | String CRM_CONTRACT_SUBMIT_SUCCESS = "æäº¤ååã{{#contractName}}ãå®¡æ¹æå"; |
| | | String CRM_CONTRACT_FOLLOW_UP_SUB_TYPE = "ååè·è¿"; |
| | | String CRM_CONTRACT_FOLLOW_UP_SUCCESS = "ååè·è¿ã{{#contractName}}ã"; |
| | | String CRM_CONTRACT_IMPORT_SUB_TYPE = "导å
¥åå"; |
| | | String CRM_CONTRACT_IMPORT_SUCCESS = "导å
¥äºååï¼{{#importSummary}}"; |
| | | |
| | | // ======================= CRM_PRODUCT 产å ======================= |
| | | |
| | |
| | | String CRM_INVOICE_DELETE_SUCCESS = "å é¤äºååã{getContractById{#invoice.contractId}}ãçç¼å·ä¸ºã{{#invoice.no}}ãçå¼ç¥¨"; |
| | | String CRM_INVOICE_SUBMIT_SUB_TYPE = "æäº¤å¼ç¥¨å®¡æ¹"; |
| | | String CRM_INVOICE_SUBMIT_SUCCESS = "æäº¤ç¼å·ä¸ºã{{#invoiceNo}}ãçå¼ç¥¨å®¡æ¹æå"; |
| | | String CRM_INVOICE_IMPORT_SUB_TYPE = "导å
¥å¼ç¥¨"; |
| | | String CRM_INVOICE_IMPORT_SUCCESS = "导å
¥äºå¼ç¥¨ï¼{{#importSummary}}"; |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; |
| | | import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; |
| | | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = CRM_CONTRACT_TYPE, subType = CRM_CONTRACT_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = CRM_CONTRACT_IMPORT_SUCCESS) |
| | | public CrmContractImportRespVO importContractList(List<CrmContractImportExcelVO> importList) { |
| | | CrmContractImportRespVO respVO = CrmContractImportRespVO.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; |
| | | } |
| | | |
| | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactTransferReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractTransferReqVO; |
| | |
| | | } |
| | | |
| | | @Override |
| | | @LogRecord(type = CRM_CUSTOMER_TYPE, subType = CRM_CUSTOMER_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = CRM_CUSTOMER_IMPORT_SUCCESS) |
| | | public CrmCustomerImportRespVO importCustomerList(List<CrmCustomerImportExcelVO> importCustomers, |
| | | CrmCustomerImportReqVO importReqVO) { |
| | | // æ ¡éªé空 |
| | |
| | | permissionService.createPermission(new CrmPermissionCreateReqBO().setBizType(CrmBizTypeEnum.CRM_CUSTOMER.getType()) |
| | | .setBizId(customer.getId()).setUserId(importReqVO.getOwnerUserId()).setLevel(CrmPermissionLevelEnum.OWNER.getLevel())); |
| | | } |
| | | // 1.3 è®°å½æä½æ¥å¿ |
| | | getSelf().importCustomerLog(customer, false); |
| | | return; |
| | | } |
| | | |
| | |
| | | .setId(existCustomer.getId()); |
| | | customerMapper.updateById(updateCustomer); |
| | | respVO.getUpdateCustomerNames().add(importCustomer.getName()); |
| | | // 2.2 è®°å½æä½æ¥å¿ |
| | | getSelf().importCustomerLog(updateCustomer, true); |
| | | }); |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateCustomerNames(), respVO.getUpdateCustomerNames(), |
| | | respVO.getFailureCustomerNames()); |
| | | return respVO; |
| | | } |
| | | |
| | | /** |
| | | * è®°å½å¯¼å
¥å®¢æ·æ¶çæä½æ¥å¿ |
| | | * |
| | | * @param customer 客æ·ä¿¡æ¯ |
| | | * @param isUpdate æ¯å¦æ´æ°ï¼true - æ´æ°ï¼false - æ°å¢ |
| | | */ |
| | | @LogRecord(type = CRM_CUSTOMER_TYPE, subType = CRM_CUSTOMER_IMPORT_SUB_TYPE, bizNo = "{{#customer.id}}", |
| | | success = CRM_CUSTOMER_IMPORT_SUCCESS) |
| | | public void importCustomerLog(CrmCustomerDO customer, boolean isUpdate) { |
| | | LogRecordContext.putVariable("customer", customer); |
| | | LogRecordContext.putVariable("isUpdate", isUpdate); |
| | | } |
| | | |
| | | // ==================== å
¬æµ·ç¸å
³æä½ ==================== |
| | |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| | | import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; |
| | | import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.invoice.vo.invoice.CrmInvoiceImportExcelVO; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = CRM_INVOICE_TYPE, subType = CRM_INVOICE_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = CRM_INVOICE_IMPORT_SUCCESS) |
| | | public CrmInvoiceImportRespVO importInvoiceList(List<CrmInvoiceImportExcelVO> importList) { |
| | | CrmInvoiceImportRespVO respVO = CrmInvoiceImportRespVO.builder() |
| | | .createList(new ArrayList<>()) |
| | | .failureList(new LinkedHashMap<>()) |
| | | .build(); |
| | | if (CollUtil.isEmpty(importList)) { |
| | | // 空æä»¶ä¹è¦ç»æ¥å¿ææ¡å
åºï¼é¿å
{{#importSummary}} åä¸å°å¼ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateList(), null, respVO.getFailureList()); |
| | | return respVO; |
| | | } |
| | | |
| | |
| | | respVO.getFailureList().put(label, resolveImportErrorMessage(ex)); |
| | | } |
| | | } |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ï¼å¼ç¥¨å¯¼å
¥æ ãæ´æ°ãåæ¯ï¼æ
ä¼ nullï¼ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateList(), null, respVO.getFailureList()); |
| | | return respVO; |
| | | } |
| | | |
| | |
| | | */ |
| | | public interface LogRecordConstants { |
| | | |
| | | // ======================= ERP_SALE_ORDER éå®è®¢å ======================= |
| | | |
| | | String ERP_SALE_ORDER_TYPE = "ERP éå®è®¢å"; |
| | | String ERP_SALE_ORDER_IMPORT_SUB_TYPE = "导å
¥éå®è®¢å"; |
| | | String ERP_SALE_ORDER_IMPORT_SUCCESS = "导å
¥äºéå®è®¢åï¼{{#importSummary}}"; |
| | | |
| | | // ======================= ERP_PURCHASE_ORDER éè´è®¢å ======================= |
| | | |
| | | String ERP_PURCHASE_ORDER_TYPE = "ERP éè´è®¢å"; |
| | | String ERP_PURCHASE_ORDER_IMPORT_SUB_TYPE = "导å
¥éè´è®¢å"; |
| | | String ERP_PURCHASE_ORDER_IMPORT_SUCCESS = "导å
¥äºéè´è®¢åï¼{{#importSummary}}"; |
| | | |
| | | // ======================= ERP_PURCHASE_REQUEST éè´ç³è¯· ======================= |
| | | |
| | | String ERP_PURCHASE_REQUEST_TYPE = "ERP éè´ç³è¯·"; |
| | | String ERP_PURCHASE_REQUEST_IMPORT_SUB_TYPE = "导å
¥éè´ç³è¯·"; |
| | | String ERP_PURCHASE_REQUEST_IMPORT_SUCCESS = "导å
¥äºéè´ç³è¯·ï¼{{#importSummary}}"; |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; |
| | | import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; |
| | | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO; |
| | |
| | | import cn.iocoder.yudao.module.srm.api.supplier.dto.SrmSupplierRespDTO; |
| | | import cn.iocoder.yudao.module.mes.api.arrivalnotice.MesArrivalNoticeApi; |
| | | import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi; |
| | | import com.mzt.logapi.starter.annotation.LogRecord; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| | | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| | | import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.erp.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * ERP éè´è®¢å Service å®ç°ç±» |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = ERP_PURCHASE_ORDER_TYPE, subType = ERP_PURCHASE_ORDER_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = ERP_PURCHASE_ORDER_IMPORT_SUCCESS) |
| | | public ErpPurchaseOrderImportRespVO importPurchaseOrderList(List<ErpPurchaseOrderImportExcelVO> importList, |
| | | Boolean directApprove) { |
| | | ErpPurchaseOrderImportRespVO respVO = ErpPurchaseOrderImportRespVO.builder() |
| | |
| | | .failureList(new LinkedHashMap<>()) |
| | | .build(); |
| | | if (CollUtil.isEmpty(importList)) { |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | 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; |
| | | } |
| | | |
| | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; |
| | | import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; |
| | | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO; |
| | |
| | | import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import com.mzt.logapi.starter.annotation.LogRecord; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| | | import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.erp.enums.LogRecordConstants.*; |
| | | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| | | |
| | | /** |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = ERP_PURCHASE_REQUEST_TYPE, subType = ERP_PURCHASE_REQUEST_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = ERP_PURCHASE_REQUEST_IMPORT_SUCCESS) |
| | | public ErpPurchaseRequestImportRespVO importPurchaseRequestList(List<ErpPurchaseRequestImportExcelVO> importList) { |
| | | ErpPurchaseRequestImportRespVO respVO = ErpPurchaseRequestImportRespVO.builder() |
| | | .createList(new ArrayList<>()) |
| | |
| | | .failureList(new LinkedHashMap<>()) |
| | | .build(); |
| | | if (CollUtil.isEmpty(importList)) { |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | 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; |
| | | } |
| | | |
| | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; |
| | | import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; |
| | | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO; |
| | |
| | | import cn.iocoder.yudao.module.mes.api.mps.dto.MesProMpsRespDTO; |
| | | import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import com.mzt.logapi.starter.annotation.LogRecord; |
| | | import jakarta.annotation.Resource; |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| | | import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.erp.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * ERP éå®è®¢å Service å®ç°ç±» |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = ERP_SALE_ORDER_TYPE, subType = ERP_SALE_ORDER_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = ERP_SALE_ORDER_IMPORT_SUCCESS) |
| | | public ErpSaleOrderImportRespVO importSaleOrderList(List<ErpSaleOrderImportExcelVO> importList) { |
| | | ErpSaleOrderImportRespVO respVO = ErpSaleOrderImportRespVO.builder() |
| | | .createList(new ArrayList<>()) |
| | |
| | | .failureList(new LinkedHashMap<>()) |
| | | .build(); |
| | | if (CollUtil.isEmpty(importList)) { |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | 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; |
| | | } |
| | | |
| | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmAttendanceRecordImportExcelVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmAttendanceRecordImportReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmAttendanceRecordPageReqVO; |
| | |
| | | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import com.mzt.logapi.starter.annotation.LogRecord; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.module.hrm.enums.ErrorCodeConstants.EMPLOYEE_NOT_EXISTS; |
| | | import static cn.iocoder.yudao.module.hrm.enums.LogRecordConstants.*; |
| | | |
| | | @Tag(name = "管çåå° - HRM èå¤è®°å½") |
| | | @RestController |
| | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导å
¥èå¤è®°å½") |
| | | @PreAuthorize("@ss.hasPermission('hrm:attendance-record:import')") |
| | | @LogRecord(type = HRM_ATTENDANCE_RECORD_TYPE, subType = HRM_ATTENDANCE_RECORD_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = HRM_ATTENDANCE_RECORD_IMPORT_SUCCESS) |
| | | public CommonResult<String> importExcel(@Valid HrmAttendanceRecordImportReqVO importReqVO) throws IOException { |
| | | List<HrmAttendanceRecordImportExcelVO> list = ExcelUtils.read(importReqVO.getFile(), HrmAttendanceRecordImportExcelVO.class); |
| | | if (CollUtil.isEmpty(list)) { |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(0, null, null); |
| | | return success("没æå¯å¯¼å
¥çæ°æ®"); |
| | | } |
| | | int successCount = 0; |
| | | int createCount = 0; // æ°å¢çè®°å½æ° |
| | | int updateCount = 0; // æ´æ°çè®°å½æ°ï¼ä»
å¾éãæ¯ææ´æ°ãæ¶æä¼èµ°æ´æ°ï¼ |
| | | Set<String> missingNames = new LinkedHashSet<>(); |
| | | Set<String> duplicateNames = new LinkedHashSet<>(); |
| | | Set<String> invalidRows = new LinkedHashSet<>(); |
| | |
| | | .location(item.getLocation()).remark(item.getRemark()) |
| | | .dataSource(2).build(); |
| | | attendanceRecordService.createImportedRecord(record); |
| | | createCount++; |
| | | } else if (Boolean.TRUE.equals(importReqVO.getUpdateSupport())) { |
| | | record.setClockInTime(item.getClockInTime()); |
| | | record.setClockOutTime(item.getClockOutTime()); |
| | |
| | | record.setLocation(item.getLocation()); |
| | | record.setRemark(item.getRemark()); |
| | | attendanceRecordService.updateImportedRecord(record); |
| | | updateCount++; |
| | | } |
| | | successCount++; |
| | | } |
| | |
| | | if (!invalidRows.isEmpty()) { |
| | | msg.append("ï¼ä»¥ä¸è®°å½æ°æ®ä¸å®æ´ï¼æªè½å¯¼å
¥ï¼").append(String.join("ã", invalidRows)); |
| | | } |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(createCount, updateCount, |
| | | missingNames.size() + duplicateNames.size() + invalidRows.size()); |
| | | return success(msg.toString()); |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.hrm.enums; |
| | | |
| | | /** |
| | | * Hrm æä½æ¥å¿æä¸¾ |
| | | * ç®çï¼ç»ä¸ç®¡çï¼ä¹åå° Service éåç§â夿âå符串 |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface LogRecordConstants { |
| | | |
| | | // ======================= HRM_ATTENDANCE_RECORD èå¤è®°å½ ======================= |
| | | |
| | | String HRM_ATTENDANCE_RECORD_TYPE = "HRM èå¤è®°å½"; |
| | | String HRM_ATTENDANCE_RECORD_IMPORT_SUB_TYPE = "导å
¥èå¤è®°å½"; |
| | | String HRM_ATTENDANCE_RECORD_IMPORT_SUCCESS = "导å
¥äºèå¤è®°å½ï¼{{#importSummary}}"; |
| | | |
| | | // ======================= HRM_EMPLOYEE åå·¥ ======================= |
| | | |
| | | String HRM_EMPLOYEE_TYPE = "HRM åå·¥"; |
| | | String HRM_EMPLOYEE_IMPORT_SUB_TYPE = "导å
¥åå·¥"; |
| | | String HRM_EMPLOYEE_IMPORT_SUCCESS = "导å
¥äºåå·¥ï¼{{#importSummary}}"; |
| | | |
| | | // ======================= HRM_EMPLOYEE_CONTRACT åå·¥åå ======================= |
| | | |
| | | String HRM_EMPLOYEE_CONTRACT_TYPE = "HRM åå·¥åå"; |
| | | String HRM_EMPLOYEE_CONTRACT_IMPORT_SUB_TYPE = "导å
¥åå·¥åå"; |
| | | String HRM_EMPLOYEE_CONTRACT_IMPORT_SUCCESS = "导å
¥äºåå·¥ååï¼{{#importSummary}}"; |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| | | 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.hrm.controller.admin.employee.vo.HrmEmployeeContractPageReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeContractRespVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeContractSaveReqVO; |
| | |
| | | import cn.iocoder.yudao.module.system.api.dept.DeptApi; |
| | | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| | | import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi; |
| | | 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.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.hrm.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.hrm.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * åå·¥åå Service å®ç°ç±» |
| | |
| | | } |
| | | |
| | | @Override |
| | | @LogRecord(type = HRM_EMPLOYEE_CONTRACT_TYPE, subType = HRM_EMPLOYEE_CONTRACT_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = HRM_EMPLOYEE_CONTRACT_IMPORT_SUCCESS) |
| | | public HrmEmployeeContractImportRespVO importContractList(List<HrmEmployeeContractImportExcelVO> importContracts, |
| | | HrmEmployeeContractImportReqVO importReqVO) { |
| | | // 1. è¿æ»¤åå·¥å§å为空çè¡ |
| | |
| | | respVO.getFailureNames().put(name, ex.getMessage()); |
| | | } |
| | | } |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateNames(), respVO.getUpdateNames(), |
| | | respVO.getFailureNames()); |
| | | return respVO; |
| | | } |
| | | |
| | |
| | | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| | | 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.hrm.controller.admin.employee.vo.HrmEmployeeEducationSaveReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeEmergencyContactSaveReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.employee.vo.HrmEmployeeImportExcelVO; |
| | |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserCreateReqDTO; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserUpdateReqDTO; |
| | | 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.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.filterList; |
| | | import static cn.iocoder.yudao.module.hrm.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.hrm.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * åå·¥ä¿¡æ¯ Service å®ç°ç±» |
| | |
| | | } |
| | | |
| | | @Override |
| | | @LogRecord(type = HRM_EMPLOYEE_TYPE, subType = HRM_EMPLOYEE_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = HRM_EMPLOYEE_IMPORT_SUCCESS) |
| | | public HrmEmployeeImportRespVO importEmployeeList(List<HrmEmployeeImportExcelVO> importEmployees, |
| | | HrmEmployeeImportReqVO importReqVO) { |
| | | // 1. æ ¡éªé空 |
| | |
| | | respVO.getFailureNames().put(name, ex.getMessage()); |
| | | } |
| | | } |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateNames(), respVO.getUpdateNames(), |
| | | respVO.getFailureNames()); |
| | | return respVO; |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mdm.enums; |
| | | |
| | | /** |
| | | * MDM æä½æ¥å¿æä¸¾ |
| | | * ç®çï¼ç»ä¸ç®¡çï¼ä¹åå° Service éåç§â夿âå符串 |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface LogRecordConstants { |
| | | |
| | | // ======================= MDM_ITEM ç©æ ======================= |
| | | |
| | | String MDM_ITEM_TYPE = "MDM ç©æ"; |
| | | String MDM_ITEM_IMPORT_SUB_TYPE = "导å
¥ç©æ"; |
| | | String MDM_ITEM_IMPORT_SUCCESS = "导å
¥äºç©æï¼{{#importSummary}}"; |
| | | |
| | | // ======================= MDM_UNIT_MEASURE 计éåä½ ======================= |
| | | |
| | | String MDM_UNIT_MEASURE_TYPE = "MDM 计éåä½"; |
| | | String MDM_UNIT_MEASURE_IMPORT_SUB_TYPE = "导å
¥è®¡éåä½"; |
| | | String MDM_UNIT_MEASURE_IMPORT_SUCCESS = "导å
¥äºè®¡éåä½ï¼{{#importSummary}}"; |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemImportExcelVO; |
| | | import cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemImportRespVO; |
| | | import cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemPageReqVO; |
| | |
| | | import cn.iocoder.yudao.module.mes.api.item.dto.MesMdItemSyncReqDTO; |
| | | import cn.iocoder.yudao.module.mes.api.item.dto.MesMdItemTypeRespDTO; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.mzt.logapi.starter.annotation.LogRecord; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | import static cn.iocoder.yudao.module.mdm.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.mdm.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * MDM ç©æä¸»æ°æ® Service å®ç°ç±» |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = MDM_ITEM_TYPE, subType = MDM_ITEM_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = MDM_ITEM_IMPORT_SUCCESS) |
| | | public MdmItemImportRespVO importItemList(List<MdmItemImportExcelVO> importList, Boolean isUpdateSupport) { |
| | | if (CollUtil.isEmpty(importList)) { |
| | | throw exception(MDM_ITEM_IMPORT_LIST_IS_EMPTY); |
| | |
| | | respVO.getFailureList().put(StrUtil.blankToDefault(importVO.getName(), importVO.getCode()), reason == null ? "导å
¥å¤±è´¥" : reason); |
| | | } |
| | | } |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateList(), respVO.getUpdateList(), respVO.getFailureList()); |
| | | return respVO; |
| | | } |
| | | |
| | |
| | | import cn.hutool.core.util.StrUtil; |
| | | 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.mdm.controller.admin.unit.vo.MdmUnitMeasureImportExcelVO; |
| | | import cn.iocoder.yudao.module.mdm.controller.admin.unit.vo.MdmUnitMeasureImportRespVO; |
| | | import cn.iocoder.yudao.module.mdm.controller.admin.unit.vo.MdmUnitMeasurePageReqVO; |
| | |
| | | import cn.iocoder.yudao.module.mdm.dal.dataobject.unit.MdmUnitMeasureDO; |
| | | import cn.iocoder.yudao.module.mdm.dal.mysql.item.MdmItemMapper; |
| | | import cn.iocoder.yudao.module.mdm.dal.mysql.unit.MdmUnitMeasureMapper; |
| | | import com.mzt.logapi.starter.annotation.LogRecord; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mdm.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.mdm.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * MDM 计éåä½ Service å®ç°ç±» |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = MDM_UNIT_MEASURE_TYPE, subType = MDM_UNIT_MEASURE_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = MDM_UNIT_MEASURE_IMPORT_SUCCESS) |
| | | public MdmUnitMeasureImportRespVO importUnitMeasureList(List<MdmUnitMeasureImportExcelVO> importList, Boolean isUpdateSupport) { |
| | | if (CollUtil.isEmpty(importList)) { |
| | | throw exception(MDM_UNIT_MEASURE_IMPORT_LIST_IS_EMPTY); |
| | |
| | | importedCodeIdMap.put(importVO.getCode(), newObj.getId()); |
| | | } |
| | | } |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateList(), respVO.getUpdateList(), respVO.getFailureList()); |
| | | return respVO; |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.enums; |
| | | |
| | | /** |
| | | * MES æä½æ¥å¿æä¸¾ |
| | | * ç®çï¼ç»ä¸ç®¡çï¼ä¹åå° Service éåç§â夿âå符串 |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface LogRecordConstants { |
| | | |
| | | // ======================= MES_WM_MATERIAL_STOCK ç©æåºå ======================= |
| | | |
| | | String MES_WM_MATERIAL_STOCK_TYPE = "MES ç©æåºå"; |
| | | String MES_WM_MATERIAL_STOCK_IMPORT_SUB_TYPE = "导å
¥ç©æåºå"; |
| | | String MES_WM_MATERIAL_STOCK_IMPORT_SUCCESS = "导å
¥äºç©æåºåï¼{{#importSummary}}"; |
| | | |
| | | // ======================= MES_DV_METERING 仪表 ======================= |
| | | |
| | | String MES_DV_METERING_TYPE = "MES 仪表"; |
| | | String MES_DV_METERING_IMPORT_SUB_TYPE = "导å
¥ä»ªè¡¨"; |
| | | String MES_DV_METERING_IMPORT_SUCCESS = "导å
¥äºä»ªè¡¨ï¼{{#importSummary}}"; |
| | | |
| | | // ======================= MES_DV_MACHINERY è®¾å¤ ======================= |
| | | |
| | | String MES_DV_MACHINERY_TYPE = "MES 设å¤"; |
| | | String MES_DV_MACHINERY_IMPORT_SUB_TYPE = "导å
¥è®¾å¤"; |
| | | String MES_DV_MACHINERY_IMPORT_SUCCESS = "导å
¥äºè®¾å¤ï¼{{#importSummary}}"; |
| | | |
| | | // ======================= MES_MD_ITEM_TYPE ç©æåç±» ======================= |
| | | |
| | | // åç¼éç ITEM_TYPE æ¯ä¸å¡å¯¹è±¡åï¼ç©æç±»åï¼çä¸é¨åï¼æä»¥å¸¸éå以 _TYPE_TYPE ç»å°¾ï¼ä¸æ¯ç¬è¯¯ |
| | | String MES_MD_ITEM_TYPE_TYPE = "MES ç©æåç±»"; |
| | | String MES_MD_ITEM_TYPE_IMPORT_SUB_TYPE = "导å
¥ç©æåç±»"; |
| | | String MES_MD_ITEM_TYPE_IMPORT_SUCCESS = "导å
¥äºç©æåç±»ï¼{{#importSummary}}"; |
| | | |
| | | // ======================= MES_QC_IPQC è¿ç¨æ£éªå ======================= |
| | | |
| | | String MES_QC_IPQC_TYPE = "MES è¿ç¨æ£éªå"; |
| | | String MES_QC_IPQC_IMPORT_SUB_TYPE = "导å
¥è¿ç¨æ£éªå"; |
| | | String MES_QC_IPQC_IMPORT_SUCCESS = "导å
¥äºè¿ç¨æ£éªåï¼{{#importSummary}}"; |
| | | |
| | | // ======================= MES_QC_IQC æ¥ææ£éªå ======================= |
| | | |
| | | String MES_QC_IQC_TYPE = "MES æ¥ææ£éªå"; |
| | | String MES_QC_IQC_IMPORT_SUB_TYPE = "导å
¥æ¥ææ£éªå"; |
| | | String MES_QC_IQC_IMPORT_SUCCESS = "导å
¥äºæ¥ææ£éªåï¼{{#importSummary}}"; |
| | | |
| | | // ======================= MES_QC_OQC åºè´§æ£éªå ======================= |
| | | |
| | | String MES_QC_OQC_TYPE = "MES åºè´§æ£éªå"; |
| | | String MES_QC_OQC_IMPORT_SUB_TYPE = "导å
¥åºè´§æ£éªå"; |
| | | String MES_QC_OQC_IMPORT_SUCCESS = "导å
¥äºåºè´§æ£éªåï¼{{#importSummary}}"; |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| | | 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.mes.controller.admin.dv.machinery.vo.MesDvMachineryImportExcelVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.MesDvMachineryImportRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.MesDvMachineryPageReqVO; |
| | |
| | | import cn.iocoder.yudao.module.mes.service.dv.repair.MesDvRepairService; |
| | | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkshopService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; |
| | | 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.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.mes.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * MES 设å¤å°è´¦ Service å®ç°ç±» |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = MES_DV_MACHINERY_TYPE, subType = MES_DV_MACHINERY_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = MES_DV_MACHINERY_IMPORT_SUCCESS) |
| | | public MesDvMachineryImportRespVO importMachineryList(List<MesDvMachineryImportExcelVO> importMachineryList, |
| | | boolean updateSupport) { |
| | | // 1. åæ°æ ¡éª |
| | |
| | | respVO.getFailureCodes().put(key, "设å¤ç¼ç å·²åå¨"); |
| | | } |
| | | }); |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateCodes(), respVO.getUpdateCodes(), respVO.getFailureCodes()); |
| | | return respVO; |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import cn.iocoder.yudao.module.mdm.api.category.MdmItemCategoryApi; |
| | | import cn.iocoder.yudao.module.mdm.api.category.dto.MdmItemCategoryRespDTO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.type.MesMdItemTypeImportExcelVO; |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.type.MesMdItemTypeSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemTypeDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.md.item.MesMdItemTypeMapper; |
| | | 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.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.mes.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * MES ç©æäº§ååç±» Service å®ç°ç±» |
| | |
| | | |
| | | @Override |
| | | @org.springframework.transaction.annotation.Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = MES_MD_ITEM_TYPE_TYPE, subType = MES_MD_ITEM_TYPE_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = MES_MD_ITEM_TYPE_IMPORT_SUCCESS) |
| | | public MesMdItemTypeImportRespVO importItemTypeList(List<MesMdItemTypeImportExcelVO> importList, Boolean isUpdateSupport) { |
| | | if (CollUtil.isEmpty(importList)) { |
| | | throw exception(MD_ITEM_TYPE_IMPORT_LIST_IS_EMPTY); |
| | |
| | | importedCodeIdMap.put(importVO.getCode(), newObj.getId()); |
| | | } |
| | | } |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateList(), respVO.getUpdateList(), respVO.getFailureList()); |
| | | return respVO; |
| | | } |
| | | |
| | |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceLineDO; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmQualityStatusEnum; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.ipqc.vo.MesQcIpqcImportExcelVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.ipqc.vo.MesQcIpqcPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.ipqc.vo.MesQcIpqcSaveReqVO; |
| | |
| | | import cn.iocoder.yudao.module.mes.service.qc.ncr.MesQcNcrService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.productproduce.MesWmProductProduceLineService; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import com.mzt.logapi.starter.annotation.LogRecord; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.annotation.Lazy; |
| | |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.mes.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * MES è¿ç¨æ£éªåï¼IPQCï¼ Service å®ç°ç±» |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = MES_QC_IPQC_TYPE, subType = MES_QC_IPQC_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = MES_QC_IPQC_IMPORT_SUCCESS) |
| | | public MesQcImportRespVO importIpqcList(List<MesQcIpqcImportExcelVO> importList) { |
| | | MesQcImportRespVO respVO = MesQcImportRespVO.builder() |
| | | .createList(new ArrayList<>()).failureList(new LinkedHashMap<>()).build(); |
| | | if (CollUtil.isEmpty(importList)) { |
| | | // 空æä»¶ä¹è¦ç»æ¥å¿ææ¡å
åºï¼é¿å
{{#importSummary}} åä¸å°å¼ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateList(), null, respVO.getFailureList()); |
| | | return respVO; |
| | | } |
| | | qcImportHelper.startImport(); |
| | |
| | | respVO.getFailureList().put(label, MesQcImportHelper.resolveImportErrorMessage(ex)); |
| | | } |
| | | } |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateList(), null, respVO.getFailureList()); |
| | | return respVO; |
| | | } |
| | | |
| | |
| | | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| | | 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.hutool.core.util.ObjectUtil; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.iqc.vo.MesQcIqcImportExcelVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.iqc.vo.MesQcIqcPageReqVO; |
| | |
| | | import cn.iocoder.yudao.module.srm.api.supplier.SrmSupplierApi; |
| | | import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | 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.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.mes.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * MES æ¥ææ£éªåï¼IQCï¼ Service å®ç°ç±» |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = MES_QC_IQC_TYPE, subType = MES_QC_IQC_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = MES_QC_IQC_IMPORT_SUCCESS) |
| | | public MesQcImportRespVO importIqcList(List<MesQcIqcImportExcelVO> importList) { |
| | | MesQcImportRespVO respVO = MesQcImportRespVO.builder() |
| | | .createList(new ArrayList<>()).failureList(new LinkedHashMap<>()).build(); |
| | | if (CollUtil.isEmpty(importList)) { |
| | | // 空æä»¶ä¹è¦ç»æ¥å¿ææ¡å
åºï¼é¿å
{{#importSummary}} åä¸å°å¼ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateList(), null, respVO.getFailureList()); |
| | | return respVO; |
| | | } |
| | | qcImportHelper.startImport(); |
| | |
| | | respVO.getFailureList().put(label, MesQcImportHelper.resolveImportErrorMessage(ex)); |
| | | } |
| | | } |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateList(), null, respVO.getFailureList()); |
| | | return respVO; |
| | | } |
| | | |
| | |
| | | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| | | 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.mes.controller.admin.qc.oqc.vo.MesQcOqcImportExcelVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.oqc.vo.MesQcOqcPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.oqc.vo.MesQcOqcSaveReqVO; |
| | |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | 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.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.mes.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * MES åºè´§æ£éªåï¼OQCï¼ Service å®ç°ç±» |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = MES_QC_OQC_TYPE, subType = MES_QC_OQC_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = MES_QC_OQC_IMPORT_SUCCESS) |
| | | public MesQcImportRespVO importOqcList(List<MesQcOqcImportExcelVO> importList) { |
| | | MesQcImportRespVO respVO = MesQcImportRespVO.builder() |
| | | .createList(new ArrayList<>()).failureList(new LinkedHashMap<>()).build(); |
| | | if (CollUtil.isEmpty(importList)) { |
| | | // 空æä»¶ä¹è¦ç»æ¥å¿ææ¡å
åºï¼é¿å
{{#importSummary}} åä¸å°å¼ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateList(), null, respVO.getFailureList()); |
| | | return respVO; |
| | | } |
| | | qcImportHelper.startImport(); |
| | |
| | | respVO.getFailureList().put(label, MesQcImportHelper.resolveImportErrorMessage(ex)); |
| | | } |
| | | } |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateList(), null, respVO.getFailureList()); |
| | | return respVO; |
| | | } |
| | | |
| | |
| | | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.SetUtils; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.materialstock.vo.MesWmMaterialStockAdjustReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.materialstock.vo.MesWmMaterialStockFreezeReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.materialstock.vo.MesWmMaterialStockImportExcelVO; |
| | |
| | | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseAreaService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseLocationService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseService; |
| | | 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.framework.common.util.collection.CollectionUtils.convertSet; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.filterList; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.mes.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * MES åºåå°è´¦ Service å®ç°ç±» |
| | |
| | | } |
| | | |
| | | @Override |
| | | @LogRecord(type = MES_WM_MATERIAL_STOCK_TYPE, subType = MES_WM_MATERIAL_STOCK_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = MES_WM_MATERIAL_STOCK_IMPORT_SUCCESS) |
| | | public MesWmMaterialStockImportRespVO importMaterialStockList(List<MesWmMaterialStockImportExcelVO> importList) { |
| | | // æä½ç±»ååå¼ï¼å¢å / åå° / è¦ç |
| | | final String OP_ADD = "å¢å "; |
| | |
| | | respVO.getFailureNames().put(key, ex.getMessage()); |
| | | } |
| | | } |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateNames(), respVO.getUpdateNames(), respVO.getFailureNames()); |
| | | return respVO; |
| | | } |
| | | |
| | |
| | | String LOG_AWARD_ORDER_SUB_TYPE = "çæéè´è®¢å"; |
| | | String LOG_AWARD_ORDER_SUCCESS = "宿 è®°å½çæäºéè´è®¢å"; |
| | | |
| | | // ======================= SRM_SUPPLIER ä¾åºå ======================= |
| | | String LOG_SUPPLIER_TYPE = "SRM ä¾åºå"; |
| | | String LOG_SUPPLIER_IMPORT_SUB_TYPE = "导å
¥ä¾åºå"; |
| | | String LOG_SUPPLIER_IMPORT_SUCCESS = "导å
¥äºä¾åºåï¼{{#importSummary}}"; |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import cn.iocoder.yudao.module.srm.controller.admin.supplier.vo.SrmSupplierImportExcelVO; |
| | | import cn.iocoder.yudao.module.srm.controller.admin.supplier.vo.SrmSupplierImportRespVO; |
| | | import cn.iocoder.yudao.module.srm.controller.admin.supplier.vo.SrmSupplierPageReqVO; |
| | |
| | | import cn.iocoder.yudao.module.srm.dal.mysql.SrmTenderBidMapper; |
| | | import cn.iocoder.yudao.module.srm.enums.ErrorCodeConstants; |
| | | import cn.iocoder.yudao.module.srm.enums.SupplierTypeEnum; |
| | | import com.mzt.logapi.starter.annotation.LogRecord; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.module.srm.enums.LogRecordConstants.*; |
| | | |
| | | @Service |
| | | @Validated |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @LogRecord(type = LOG_SUPPLIER_TYPE, subType = LOG_SUPPLIER_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = LOG_SUPPLIER_IMPORT_SUCCESS) |
| | | public SrmSupplierImportRespVO importSupplierList(List<SrmSupplierImportExcelVO> importList, Boolean updateSupport) { |
| | | if (CollUtil.isEmpty(importList)) { |
| | | throw ServiceExceptionUtil.exception(ErrorCodeConstants.SUPPLIER_IMPORT_LIST_IS_EMPTY); |
| | |
| | | respVO.getFailureList().put(name, reason == null ? "导å
¥å¤±è´¥" : reason); |
| | | } |
| | | } |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateList(), respVO.getUpdateList(), respVO.getFailureList()); |
| | | return respVO; |
| | | } |
| | | |
| | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| | | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | |
| | | @PostMapping("/sms-login") |
| | | @PermitAll |
| | | @Operation(summary = "使ç¨çä¿¡éªè¯ç ç»å½") |
| | | @ApiAccessLog(sanitizeKeys = {"code"}) // éªè¯ç æ¬èº«å°±æ¯ç»å½åè¯ï¼ä¸è½åè¿è®¿é®æ¥å¿ |
| | | // 坿éå¼å¯éæµï¼https://github.com/YunaiV/ruoyi-vue-pro/issues/851 |
| | | // @RateLimiter(time = 60, count = 6, keyResolver = ExpressionRateLimiterKeyResolver.class, keyArg = "#reqVO.mobile") |
| | | public CommonResult<AuthLoginRespVO> smsLogin(@RequestBody @Valid AuthSmsLoginReqVO reqVO) { |
| | |
| | | @PostMapping("/reset-password") |
| | | @PermitAll |
| | | @Operation(summary = "éç½®å¯ç ") |
| | | @ApiAccessLog(sanitizeKeys = {"code"}) // éªè¯ç çä»·äºéç½®å¯ç çåè¯ï¼ä¸è½åè¿è®¿é®æ¥å¿ |
| | | public CommonResult<Boolean> resetPassword(@RequestBody @Valid AuthResetPasswordReqVO reqVO) { |
| | | authService.resetPassword(reqVO); |
| | | return success(true); |
| | |
| | | String SYSTEM_USER_DELETE_SUCCESS = "å é¤äºç¨æ·ã{{#user.nickname}}ã"; |
| | | String SYSTEM_USER_UPDATE_PASSWORD_SUB_TYPE = "éç½®ç¨æ·å¯ç "; |
| | | String SYSTEM_USER_UPDATE_PASSWORD_SUCCESS = "å°ç¨æ·ã{{#user.nickname}}ãçå¯ç ä»ã{{#user.password}}ãé置为ã{{#newPassword}}ã"; |
| | | String SYSTEM_USER_IMPORT_SUB_TYPE = "导å
¥ç¨æ·"; |
| | | String SYSTEM_USER_IMPORT_SUCCESS = "导å
¥äºç¨æ·ï¼{{#importSummary}}"; |
| | | |
| | | // ======================= SYSTEM_ROLE è§è² ======================= |
| | | |
| | |
| | | String SYSTEM_ROLE_DELETE_SUB_TYPE = "å é¤è§è²"; |
| | | String SYSTEM_ROLE_DELETE_SUCCESS = "å é¤äºè§è²ã{{#role.name}}ã"; |
| | | |
| | | // ======================= SYSTEM_POST å²ä½ ======================= |
| | | |
| | | String SYSTEM_POST_TYPE = "SYSTEM å²ä½"; |
| | | String SYSTEM_POST_IMPORT_SUB_TYPE = "导å
¥å²ä½"; |
| | | String SYSTEM_POST_IMPORT_SUCCESS = "导å
¥äºå²ä½ï¼{{#importSummary}}"; |
| | | |
| | | // ======================= SYSTEM_DEPT é¨é¨ ======================= |
| | | |
| | | String SYSTEM_DEPT_TYPE = "SYSTEM é¨é¨"; |
| | | String SYSTEM_DEPT_IMPORT_SUB_TYPE = "导å
¥é¨é¨"; |
| | | String SYSTEM_DEPT_IMPORT_SUCCESS = "导å
¥äºé¨é¨ï¼{{#importSummary}}"; |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; |
| | | import cn.iocoder.yudao.module.system.dal.mysql.dept.DeptMapper; |
| | | import cn.iocoder.yudao.module.system.dal.redis.RedisKeyConstants; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import com.google.common.annotations.VisibleForTesting; |
| | | import com.mzt.logapi.starter.annotation.LogRecord; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.system.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * é¨é¨ Service å®ç°ç±» |
| | |
| | | } |
| | | |
| | | @Override |
| | | @LogRecord(type = SYSTEM_DEPT_TYPE, subType = SYSTEM_DEPT_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = SYSTEM_DEPT_IMPORT_SUCCESS) |
| | | public DeptImportRespVO importDeptList(List<DeptImportExcelVO> importDepts, boolean isUpdateSupport) { |
| | | if (CollUtil.isEmpty(importDepts)) { |
| | | throw exception(DEPT_IMPORT_LIST_IS_EMPTY); |
| | |
| | | fullPathDeptIdMap.put(myFullPath, newDept.getId()); |
| | | } |
| | | |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateDeptNames(), respVO.getUpdateDeptNames(), |
| | | respVO.getFailureDeptNames()); |
| | | return respVO; |
| | | } |
| | | |
| | |
| | | import java.util.LinkedHashMap; |
| | | |
| | | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostImportExcelVO; |
| | | import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostImportRespVO; |
| | | import com.mzt.logapi.starter.annotation.LogRecord; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| | | import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; |
| | | import static cn.iocoder.yudao.module.system.enums.LogRecordConstants.*; |
| | | |
| | | /** |
| | | * å²ä½ Service å®ç°ç±» |
| | |
| | | } |
| | | |
| | | @Override |
| | | @LogRecord(type = SYSTEM_POST_TYPE, subType = SYSTEM_POST_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = SYSTEM_POST_IMPORT_SUCCESS) |
| | | public PostImportRespVO importPostList(List<PostImportExcelVO> importPosts, boolean isUpdateSupport) { |
| | | if (CollUtil.isEmpty(importPosts)) { |
| | | throw exception(POST_IMPORT_LIST_IS_EMPTY); |
| | |
| | | postMapper.updateById(updatePost); |
| | | respVO.getUpdatePostNames().add(importPost.getName()); |
| | | }); |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreatePostNames(), respVO.getUpdatePostNames(), |
| | | respVO.getFailurePostNames()); |
| | | return respVO; |
| | | } |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.system.service.oauth2.OAuth2TokenService; |
| | | import cn.iocoder.yudao.module.system.service.permission.PermissionService; |
| | | import cn.iocoder.yudao.module.system.service.tenant.TenantService; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | | import com.google.common.annotations.VisibleForTesting; |
| | | import com.mzt.logapi.context.LogRecordContext; |
| | | import com.mzt.logapi.service.impl.DiffParseFunction; |
| | |
| | | } |
| | | |
| | | @Override |
| | | @LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_IMPORT_SUB_TYPE, bizNo = "0", |
| | | success = SYSTEM_USER_IMPORT_SUCCESS) |
| | | @Transactional(rollbackFor = Exception.class) // æ·»å äºå¡ï¼å¼å¸¸ååæ»ææå¯¼å
¥ |
| | | public UserImportRespVO importUserList(List<UserImportExcelVO> importUsers, boolean isUpdateSupport) { |
| | | // 1.1 åæ°æ ¡éª |
| | |
| | | userMapper.updateById(updateUser); |
| | | respVO.getUpdateUsernames().add(importUser.getUsername()); |
| | | }); |
| | | // è®°å½å¯¼å
¥ç»ææ±æ»ï¼ä¾ @LogRecord ç success ææ¡å¼ç¨ |
| | | OperateLogUtils.putImportSummary(respVO.getCreateUsernames(), respVO.getUpdateUsernames(), |
| | | respVO.getFailureUsernames()); |
| | | return respVO; |
| | | } |
| | | |
| | |
| | | security: |
| | | mock-enable: true |
| | | access-log: # è®¿é®æ¥å¿çé
置项 |
| | | enable: false |
| | | enable: true # æ ç§å¼å¯ï¼ææ /admin-apiã/app-api 请æ±è½ infra_api_access_logï¼å«å
¥åï¼ï¼ä½ä¸ºæä½ççå
åºï¼å¯ç /å¯é¥ç±»åæ®µç±æ¡æ¶ç»ä¸è±æï¼ApiAccessLogFilter.SANITIZE_KEYSï¼ï¼çä¿¡éªè¯ç çä¸ä¸å¡å段éåç key ç±æ¥å£ç¨ @ApiAccessLog(sanitizeKeys = ...) æå® |
| | | demo: false # å
³éæ¼ç¤ºæ¨¡å¼ |
| | | storage: # æä»¶ä¸ä¼ é
ç½® |
| | | path: /data/javaWork/mom/file # æä»¶å卿 ¹ç®å½ |