Commit 424eedf9a87ab2849c9aadbdf1b94059aeaa046d
1 parent
37aa498a
Exists in
dev
1:日志
2:异动节点
Showing
3 changed files
with
23 additions
and
12 deletions
Show diff stats
zr-cloud/zr-modules/zr-schsf/src/main/java/com/chinagas/modules/schsf/controller/DingtalkController.java
1 | package com.chinagas.modules.schsf.controller; | 1 | package com.chinagas.modules.schsf.controller; |
2 | 2 | ||
3 | import com.chinagas.common.core.domain.AjaxResult; | 3 | import com.chinagas.common.core.domain.AjaxResult; |
4 | +import com.chinagas.common.core.utils.StringUtils; | ||
4 | import com.chinagas.modules.schsf.constant.DingtalkConstant; | 5 | import com.chinagas.modules.schsf.constant.DingtalkConstant; |
5 | import com.chinagas.modules.schsf.exception.OApiException; | 6 | import com.chinagas.modules.schsf.exception.OApiException; |
6 | import com.chinagas.modules.schsf.service.DingtalkService; | 7 | import com.chinagas.modules.schsf.service.DingtalkService; |
@@ -32,23 +33,21 @@ public class DingtalkController { | @@ -32,23 +33,21 @@ public class DingtalkController { | ||
32 | String appKey = dingtalkConstant.getAppKey(); | 33 | String appKey = dingtalkConstant.getAppKey(); |
33 | String agentId = dingtalkConstant.getAgentId(); | 34 | String agentId = dingtalkConstant.getAgentId(); |
34 | String corpId = dingtalkConstant.getCorpId(); | 35 | String corpId = dingtalkConstant.getCorpId(); |
36 | + if (StringUtils.isEmpty(appKey) || StringUtils.isEmpty(agentId) || StringUtils.isEmpty(corpId)){ | ||
37 | + log.warn("钉钉相关信息为配置,请在nacos中进行配置,appKey:{},agentId:{},corpId:{},", appKey,agentId,corpId); | ||
38 | + return AjaxResult.success(null); | ||
39 | + } | ||
40 | + | ||
35 | long timeStamp = System.currentTimeMillis(); | 41 | long timeStamp = System.currentTimeMillis(); |
36 | String nonceStr = "nonceStr"; | 42 | String nonceStr = "nonceStr"; |
37 | - | ||
38 | - | ||
39 | // 获取access token | 43 | // 获取access token |
40 | String accessToken = dingtalkService.getAccessToken(timeStamp); | 44 | String accessToken = dingtalkService.getAccessToken(timeStamp); |
41 | - System.out.println("成功获取access token: " + accessToken); | ||
42 | - | ||
43 | - | 45 | + log.info("成功获取access token:{}", accessToken); |
44 | // 获取jsapi ticket | 46 | // 获取jsapi ticket |
45 | String ticket = dingtalkService.getJsapiTicket(accessToken, timeStamp); | 47 | String ticket = dingtalkService.getJsapiTicket(accessToken, timeStamp); |
46 | - System.out.println("成功获取jsapi ticket: " + ticket); | ||
47 | - // 获取签名 | ||
48 | -// String url = "http://www.dingtalk.com"; | 48 | + log.info("成功获取jsapi ticket:{}", ticket); |
49 | String signature = dingtalkService.getSign(ticket, nonceStr, timeStamp, url); | 49 | String signature = dingtalkService.getSign(ticket, nonceStr, timeStamp, url); |
50 | - System.out.println("成功签名: " + signature); | ||
51 | - | 50 | + log.info("成功签名:{}", signature); |
52 | HashMap<Object, Object> objectObjectHashMap = new HashMap<>(); | 51 | HashMap<Object, Object> objectObjectHashMap = new HashMap<>(); |
53 | objectObjectHashMap.put("appKey", appKey); | 52 | objectObjectHashMap.put("appKey", appKey); |
54 | objectObjectHashMap.put("agentId", agentId); | 53 | objectObjectHashMap.put("agentId", agentId); |
zr-cloud/zr-modules/zr-schsf/src/main/java/com/chinagas/modules/schsf/controller/McBasicCmtyController.java
@@ -16,6 +16,7 @@ import com.chinagas.modules.schsf.domain.dto.CompanyDto; | @@ -16,6 +16,7 @@ import com.chinagas.modules.schsf.domain.dto.CompanyDto; | ||
16 | import com.chinagas.modules.schsf.domain.vo.McBasicCmtyVo; | 16 | import com.chinagas.modules.schsf.domain.vo.McBasicCmtyVo; |
17 | import com.chinagas.modules.schsf.service.IMcBasicCmtyService; | 17 | import com.chinagas.modules.schsf.service.IMcBasicCmtyService; |
18 | import com.chinagas.modules.schsf.utils.listener.McBasicCmtyImportInspection; | 18 | import com.chinagas.modules.schsf.utils.listener.McBasicCmtyImportInspection; |
19 | +import lombok.extern.slf4j.Slf4j; | ||
19 | import org.apache.commons.lang3.StringUtils; | 20 | import org.apache.commons.lang3.StringUtils; |
20 | import org.springframework.beans.factory.annotation.Autowired; | 21 | import org.springframework.beans.factory.annotation.Autowired; |
21 | import org.springframework.web.bind.annotation.*; | 22 | import org.springframework.web.bind.annotation.*; |
@@ -38,6 +39,7 @@ import java.util.stream.Collectors; | @@ -38,6 +39,7 @@ import java.util.stream.Collectors; | ||
38 | * @author cw | 39 | * @author cw |
39 | * @date 2024-05-22 | 40 | * @date 2024-05-22 |
40 | */ | 41 | */ |
42 | +@Slf4j | ||
41 | @RestController | 43 | @RestController |
42 | @RequestMapping("/mcBasicCmty") | 44 | @RequestMapping("/mcBasicCmty") |
43 | public class McBasicCmtyController extends BaseController { | 45 | public class McBasicCmtyController extends BaseController { |
@@ -130,7 +132,7 @@ public class McBasicCmtyController extends BaseController { | @@ -130,7 +132,7 @@ public class McBasicCmtyController extends BaseController { | ||
130 | .sheet(0) // 导入数据的sheet页编号,0代表第一个sheet页,如果不填,则会导入所有sheet页的数据 | 132 | .sheet(0) // 导入数据的sheet页编号,0代表第一个sheet页,如果不填,则会导入所有sheet页的数据 |
131 | .headRowNumber(4) // 列表头行数,1代表列表头有1行,第二行开始为数据行 | 133 | .headRowNumber(4) // 列表头行数,1代表列表头有1行,第二行开始为数据行 |
132 | .doReadSync(); // 开始读Excel,返回一个List<T>集合,继续后续入库操作 | 134 | .doReadSync(); // 开始读Excel,返回一个List<T>集合,继续后续入库操作 |
133 | - | 135 | + log.info("导入基础数据-户数总条数:{}", list == null ? 0 : list.size()); |
134 | // // 检验重复数据 | 136 | // // 检验重复数据 |
135 | // Map<String, List<McBasicCmty>> collect = list.stream().collect(Collectors.groupingBy(o -> | 137 | // Map<String, List<McBasicCmty>> collect = list.stream().collect(Collectors.groupingBy(o -> |
136 | // o.getRegionName() + | 138 | // o.getRegionName() + |
@@ -148,6 +150,7 @@ public class McBasicCmtyController extends BaseController { | @@ -148,6 +150,7 @@ public class McBasicCmtyController extends BaseController { | ||
148 | // if (strings.size() < list.size()) { | 150 | // if (strings.size() < list.size()) { |
149 | // throw new RuntimeException("表格中存在重复的数据"); | 151 | // throw new RuntimeException("表格中存在重复的数据"); |
150 | // } | 152 | // } |
153 | + long startTime = System.currentTimeMillis(); // 记录任务开始时间 | ||
151 | // 插入数据库 | 154 | // 插入数据库 |
152 | if (CollectionUtils.isNotEmpty(list)) { | 155 | if (CollectionUtils.isNotEmpty(list)) { |
153 | Runnable task = () -> { | 156 | Runnable task = () -> { |
@@ -159,7 +162,16 @@ public class McBasicCmtyController extends BaseController { | @@ -159,7 +162,16 @@ public class McBasicCmtyController extends BaseController { | ||
159 | Thread backgroundThread = new Thread(task, "后台插入任务线程"); | 162 | Thread backgroundThread = new Thread(task, "后台插入任务线程"); |
160 | backgroundThread.setDaemon(true); // 设置为守护线程,随主线程结束而结束 | 163 | backgroundThread.setDaemon(true); // 设置为守护线程,随主线程结束而结束 |
161 | backgroundThread.start(); | 164 | backgroundThread.start(); |
165 | + try { | ||
166 | + backgroundThread.join(); // 等待线程执行完毕,确保能准确计算运行时长 | ||
167 | + } catch (InterruptedException e) { | ||
168 | + Thread.currentThread().interrupt(); // 恢复中断状态 | ||
169 | + log.error("导入基础数据-户数,等待线程执行完毕时被中断", e); | ||
170 | + } | ||
162 | } | 171 | } |
172 | + long endTime = System.currentTimeMillis(); // 记录任务结束时间 | ||
173 | + long duration = endTime - startTime; // 计算任务运行时长 | ||
174 | + log.info("导入基础数据-户数,数据库插入任务运行时长:{}毫秒", duration); | ||
163 | } catch (Exception e) { | 175 | } catch (Exception e) { |
164 | Throwable cause = e.getCause(); | 176 | Throwable cause = e.getCause(); |
165 | if (cause instanceof SQLIntegrityConstraintViolationException) { | 177 | if (cause instanceof SQLIntegrityConstraintViolationException) { |
zr-cloud/zr-modules/zr-schsf/src/main/java/com/chinagas/modules/schsf/enums/VisitlsStatusNodeEnums.java
@@ -37,7 +37,7 @@ public enum VisitlsStatusNodeEnums { | @@ -37,7 +37,7 @@ public enum VisitlsStatusNodeEnums { | ||
37 | "APPROVED", "发布-通过", | 37 | "APPROVED", "发布-通过", |
38 | "PENDING_LEVEL_1_AUDIT", "异动-待一级审核", | 38 | "PENDING_LEVEL_1_AUDIT", "异动-待一级审核", |
39 | "APPROVE", "待审批", | 39 | "APPROVE", "待审批", |
40 | - "MODIFICATION_1_AUDIT", "异动-待一级审核" | 40 | + "MODIFICATION_1_AUDIT", "项目公司_分管领导" |
41 | )), | 41 | )), |
42 | //异动-一级审核通过 | 42 | //异动-一级审核通过 |
43 | MODIFICATION_2_AUDIT(new McVisitStatusNodeInfo( | 43 | MODIFICATION_2_AUDIT(new McVisitStatusNodeInfo( |