|
@@ -0,0 +1,75 @@
|
|
|
|
+package com.dragonsoft.dcuc.approve.business;
|
|
|
|
+
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
|
+import cn.hutool.crypto.digest.DigestUtil;
|
|
|
|
+import com.dragonsoft.auditlog.collection.qmtj.LogSendComponent;
|
|
|
|
+import com.dragonsoft.auditlog.collection.qmtj.pojo.req.ApproveRegisterLog;
|
|
|
|
+import com.dragonsoft.auditlog.collection.qmtj.pojo.resp.BaseResponse;
|
|
|
|
+import com.dragonsoft.duceap.commons.util.json.JsonUtils;
|
|
|
|
+import com.google.common.base.Joiner;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import java.util.Optional;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * <p>
|
|
|
|
+ * 启明审计业务类
|
|
|
|
+ * </p>
|
|
|
|
+ *
|
|
|
|
+ * @author huangzqa
|
|
|
|
+ * @date 2021/7/5
|
|
|
|
+ */
|
|
|
|
+@Slf4j
|
|
|
|
+@Service
|
|
|
|
+public class QmAuditBusiness {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private LogSendComponent logSendComponent;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 注册信息
|
|
|
|
+ *
|
|
|
|
+ * @param approveRegisterLog 审批注册信息
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public ResponseEntity<BaseResponse> registerInfo(ApproveRegisterLog approveRegisterLog) {
|
|
|
|
+ String checkSum = approveRegisterLog.getCheckSum();
|
|
|
|
+ if (StrUtil.isBlank(checkSum)) {
|
|
|
|
+ String sysType = approveRegisterLog.getSysType();
|
|
|
|
+ String sysId = approveRegisterLog.getSysId();
|
|
|
|
+ String companyId = approveRegisterLog.getCompanyId();
|
|
|
|
+ String orgcode = approveRegisterLog.getOrgcode();
|
|
|
|
+ String sysCode = approveRegisterLog.getSysCode();
|
|
|
|
+ String sysName = approveRegisterLog.getSysName();
|
|
|
|
+ String sysDesc = approveRegisterLog.getSysDesc();
|
|
|
|
+ String onlinetime = approveRegisterLog.getOnlinetime();
|
|
|
|
+ String trustIpList = Optional.ofNullable(approveRegisterLog.getTrustIpList()).map(e -> Joiner.on(",").join(e)).orElse(null);
|
|
|
|
+ String targetIpList = Optional.ofNullable(approveRegisterLog.getTargetIpList()).map(e -> Joiner.on(",").join(e)).orElse(null);
|
|
|
|
+
|
|
|
|
+ StringBuilder stringBuilder = new StringBuilder(sysType + "&");
|
|
|
|
+ if (StrUtil.isNotBlank(sysId)) {
|
|
|
|
+ stringBuilder.append(sysId).append("&");
|
|
|
|
+ }
|
|
|
|
+ stringBuilder.append(companyId).append("&").append(orgcode).append("&").append(sysCode)
|
|
|
|
+ .append("&").append(sysName).append("&").append(sysDesc).append("&").append(onlinetime)
|
|
|
|
+ .append("&").append(trustIpList).append("&").append(targetIpList);
|
|
|
|
+ checkSum = stringBuilder.toString();
|
|
|
|
+ log.info("register md5 source:{}", checkSum);
|
|
|
|
+
|
|
|
|
+ checkSum = DigestUtil.md5Hex(checkSum);
|
|
|
|
+ log.info("register md5 target:{}", checkSum);
|
|
|
|
+
|
|
|
|
+ approveRegisterLog.setCheckSum(checkSum);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ log.info("Qm audit log register request:{}", JsonUtils.toJSONString(approveRegisterLog));
|
|
|
|
+ ResponseEntity<BaseResponse> responseEntity = logSendComponent.sendApproveRegisterLog(approveRegisterLog);
|
|
|
|
+ log.info("QM audit log register response:{}", JsonUtils.toJSONString(responseEntity));
|
|
|
|
+ return responseEntity;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|