From 0ad53b755fb839f3275940530229d4705824e7e0 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期三, 10 七月 2024 14:16:35 +0800 Subject: [PATCH] 修复bug --- /dev/null | 172 ------------------------ server/admin_sys_timer/src/main/java/com/doumee/SysTimerApplication.java | 25 +++ server/admin_sys_timer/src/main/resources/application.yml | 75 ++++++++++ server/pom.xml | 1 server/dmvisit_admin/src/main/java/com/doumee/service/impl/HkSyncEventServiceImpl.java | 7 + server/admin_sys_timer/src/main/java/com/doumee/Main.java | 7 + server/admin_sys_timer/src/main/java/com/doumee/task/ScheduleTool.java | 17 + server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java | 1 server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java | 25 ++- server/dmvisit_service/src/main/java/com/doumee/core/erp/ErpTool.java | 29 ++- server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java | 27 ++- 11 files changed, 173 insertions(+), 213 deletions(-) diff --git a/server/admin_sys_timer/src/main/java/com/doumee/Main.java b/server/admin_sys_timer/src/main/java/com/doumee/Main.java new file mode 100644 index 0000000..ada0d0d --- /dev/null +++ b/server/admin_sys_timer/src/main/java/com/doumee/Main.java @@ -0,0 +1,7 @@ +package com.doumee; + +public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} \ No newline at end of file diff --git a/server/admin_sys_timer/src/main/java/com/doumee/SysTimerApplication.java b/server/admin_sys_timer/src/main/java/com/doumee/SysTimerApplication.java new file mode 100644 index 0000000..5580150 --- /dev/null +++ b/server/admin_sys_timer/src/main/java/com/doumee/SysTimerApplication.java @@ -0,0 +1,25 @@ +package com.doumee; + +import lombok.extern.slf4j.Slf4j; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ApplicationContext; +import org.springframework.scheduling.annotation.EnableAsync; + +/** + * 鍚姩绫� + * @author Eva.Caesar Liu + * @date 2023/03/21 14:49 + */ +@Slf4j +@EnableAsync +@SpringBootApplication +@MapperScan("com.doumee.dao.*") +public class SysTimerApplication { + + public static void main(String[] args) { + ApplicationContext context = SpringApplication.run(SysTimerApplication.class); + context.getEnvironment(); + } +} diff --git a/server/admin_timer/src/main/java/com/doumee/task/ScheduleCommonTool.java b/server/admin_sys_timer/src/main/java/com/doumee/task/ScheduleTool.java similarity index 93% rename from server/admin_timer/src/main/java/com/doumee/task/ScheduleCommonTool.java rename to server/admin_sys_timer/src/main/java/com/doumee/task/ScheduleTool.java index 2a6b41e..4237c2a 100644 --- a/server/admin_timer/src/main/java/com/doumee/task/ScheduleCommonTool.java +++ b/server/admin_sys_timer/src/main/java/com/doumee/task/ScheduleTool.java @@ -20,17 +20,21 @@ import java.util.Date; /** - * 瀹氭椂浠诲姟 + * 瀹氭椂浠诲姟锛堝簾寮冿級 * @author jiangping * @date 2021-10-10 14:40:35 * https://www.bejson.com/othertools/cron/ cron 琛ㄨ揪寮忕敓鎴愬湴鍧� */ -//@Component -//@EnableScheduling -public class ScheduleCommonTool { +@Component +@EnableScheduling +public class ScheduleTool { @Autowired + private HkSyncParkServiceImpl hkSyncParkService; + @Autowired private HkSyncImgServiceImpl hkSyncImgService; + @Autowired + private HkSyncEmpowerServiceImpl hkSyncEmpowerService; @Autowired private HkSyncOrgUserToHKServiceImpl hkSyncOrgUserService; @Autowired @@ -61,7 +65,7 @@ * 姣忓垎閽熸媺鍙栦竴娆′粖鏃ョ殑璁垮棰勭害鏁版嵁 * @throws Exception */ - @Scheduled(fixedRate= 30*1000) + @Scheduled(fixedRate= 3*60*1000) public void syncVistAppointData() throws Exception { if(Constants.DEALING_FROM_HK_VISIT){ return ; @@ -126,6 +130,7 @@ } + /** * 瀹氭椂鍐荤粨鍐呴儴浜哄憳 */ @@ -137,7 +142,7 @@ * 姣忓ぉ娓呯悊瓒呰繃涓�鍛ㄧ殑鎺ュ彛鏃ュ織鏁版嵁锛堟竻闄ゅ拰瀹夐槻骞冲彴瀵规帴鐨勬帴鍙f暟鎹級 * @throws Exception */ - @Scheduled(cron= "0 0 23 * * ?") +// @Scheduled(cron= "0 0 23 * * ?") public void clearThreeMonthLog() throws Exception { interfaceLogService.clearThreeMonthLog(); } diff --git a/server/admin_sys_timer/src/main/resources/application.yml b/server/admin_sys_timer/src/main/resources/application.yml new file mode 100644 index 0000000..fefb609 --- /dev/null +++ b/server/admin_sys_timer/src/main/resources/application.yml @@ -0,0 +1,75 @@ +# 椤圭洰淇℃伅閰嶇疆 +project: + name: 璁垮绯荤粺 + version: 1.0.0 + env: development +# env: production + + +spring: + # application: + # name: doumeevisit + profiles: + active: proHS + + # JSON杩斿洖閰嶇疆 + jackson: + # 榛樿鏃跺尯 + time-zone: GMT+8 + # 榛樿鏃ユ湡鏍煎紡鍖� + date-format: yyyy-MM-dd HH:mm:ss + servlet: + multipart: + max-file-size: 200MB + max-request-size: 200MB + enabled: true +# MyBatis閰嶇疆 +mybatis-plus: + mapper-locations: classpath*:/mappers/**/*.xml + configuration: + map-underscore-to-camel-case: true + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + +# 缂撳瓨鍐呭璁剧疆 +cache: + session: + # 浼氳瘽杩囨湡鏃堕暱(s) + expire: 18000 + captcha: + # 楠岃瘉鐮佽繃鏈熸椂闀�(s) + expire: 300 + +# 璺熻釜鏃ュ織 +trace: + # 寮�鍚櫤鑳借窡韪ā寮� + smart: true + # 鎺掗櫎璺熻釜鐨刄RL姝e垯 + exclude-patterns: .+/list[a-zA-Z0-9\-\_]*$, .+/tree[a-zA-Z0-9\-\_]*$, .+/page[a-zA-Z0-9\-\_]*$, .+/all[a-zA-Z0-9\-\_]*$, /swagger-resources.* + +# 鏃ュ織閰嶇疆 +logback: + level: INFO + appender: ${project.env} +# dao灞傜殑鏃ュ織璁剧疆涓篸ebug锛屾柟渚挎煡鐪媠ql +logging: + level: + com.doumee.dao: debug + +knife4j: + enable: true + basic: + enable: true + username: admin + password: 111111 + +# WEB鏈嶅姟鍣ㄩ厤缃� +server: + compression: + enabled: true + mime-types: application/json + port: 10031 + tomcat: + max-swallow-size: -1 + servlet: + session: + timeout: PT3H #琛ㄧず12灏忔椂 diff --git a/server/dmvisit_admin/src/main/java/com/doumee/service/impl/HkSyncEventServiceImpl.java b/server/dmvisit_admin/src/main/java/com/doumee/service/impl/HkSyncEventServiceImpl.java index b7f4fef..c0f4baf 100644 --- a/server/dmvisit_admin/src/main/java/com/doumee/service/impl/HkSyncEventServiceImpl.java +++ b/server/dmvisit_admin/src/main/java/com/doumee/service/impl/HkSyncEventServiceImpl.java @@ -1,6 +1,7 @@ package com.doumee.service.impl; import com.doumee.biz.system.SystemDictDataBiz; +import com.doumee.core.erp.ErpTool; import com.doumee.core.haikang.model.HKConstants; import com.doumee.core.haikang.model.HKTools; import com.doumee.core.haikang.model.param.BaseResponse; @@ -34,6 +35,12 @@ @PostConstruct public int initHkConfig(){ + ArtemisConfig.host = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_HOST).getCode(); + ArtemisConfig.appKey = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_APPKEY).getCode(); + ArtemisConfig.appSecret = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_APPSECRET).getCode(); + HKConstants.https = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_HTTPS).getCode(); + HKTools.interfaceLogService=interfaceLogService; + ErpTool.interfaceLogService=interfaceLogService; //鑾峰彇鏍圭粍缁囩紪鐮� getRootOrgCode(); //寮�濮嬭闃呴棬绂佷簨浠躲�佽瀹簨浠躲�佸拰鍋滆溅鍦轰簨浠� diff --git a/server/dmvisit_admin/src/main/java/com/doumee/task/ScheduleTool.java b/server/dmvisit_admin/src/main/java/com/doumee/task/ScheduleTool.java deleted file mode 100644 index 5cc9bcd..0000000 --- a/server/dmvisit_admin/src/main/java/com/doumee/task/ScheduleTool.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.doumee.task; - - -import com.doumee.config.DataSyncConfig; -import com.doumee.core.constants.ResponseStatus; -import com.doumee.core.exception.BusinessException; -import com.doumee.core.utils.Constants; -import com.doumee.service.business.InterfaceLogService; -import com.doumee.service.business.MemberService; -import com.doumee.service.business.impl.hksync.*; -import com.doumee.service.business.impl.hksync.ferp.HkSyncOrgUserToHKServiceImpl; -import com.doumee.service.business.impl.hksync.fhk.HkSyncVehicleFromHKServiceImpl; -import com.doumee.service.business.impl.hksync.fhk.HkSyncVisitFromHKServiceImpl; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import java.util.Date; - -/** - * 瀹氭椂浠诲姟锛堝簾寮冿級 - * @author jiangping - * @date 2021-10-10 14:40:35 - * https://www.bejson.com/othertools/cron/ cron 琛ㄨ揪寮忕敓鎴愬湴鍧� - */ -@Component -@EnableScheduling -public class ScheduleTool { - - @Autowired - private HkSyncParkServiceImpl hkSyncParkService; - @Autowired - private HkSyncImgServiceImpl hkSyncImgService; - @Autowired - private HkSyncEmpowerServiceImpl hkSyncEmpowerService; - @Autowired - private HkSyncOrgUserToHKServiceImpl hkSyncOrgUserService; - @Autowired - private HkSyncVisitFromHKServiceImpl hkSyncVisitFromHKService; - @Autowired - private HkSyncVehicleFromHKServiceImpl hkSyncVehicleFromHKService; - @Autowired - private HkSyncVisitServiceImpl hkSyncVisitService; - @Autowired - private MemberService memberService; - @Autowired - private InterfaceLogService interfaceLogService; - /** - * 鏄惁寮�鍙戣�� - */ - @Autowired - private DataSyncConfig dataSyncConfig; - - /** - * 姣忓垎閽熸媺鍙栦竴娆′粖鏃ョ殑璁垮棰勭害鏁版嵁 - * @throws Exception - */ - @Scheduled(cron= "0 0 23 * * ?") - public void syncVehicleUpdateData() throws Exception { - hkSyncVehicleFromHKService.syncVehicleUpdateData(new Date(System.currentTimeMillis()-24*60*60*1000)); - } - /** - * 姣忓垎閽熸媺鍙栦竴娆′粖鏃ョ殑璁垮棰勭害鏁版嵁 - * @throws Exception - */ - @Scheduled(fixedRate= 3*60*1000) - public void syncVistAppointData() throws Exception { - if(Constants.DEALING_FROM_HK_VISIT){ - return ; - } - try { - Constants.DEALING_FROM_HK_VISIT =true; - hkSyncVisitFromHKService.syncVistAppointData(new Date()); - Constants.DEALING_FROM_HK_VISIT =false; - }catch (Exception e){ -// throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵逛笉璧凤紝娴峰悍鍚屾鏁版嵁澶辫触~"); - }finally { - Constants.DEALING_FROM_HK_VISIT =false; - } - } - /** - * 姣�10鍒嗛挓鎷夊彇涓�娆℃渶鏂拌瀹㈢櫥璁扮姸鎬侊紙棰勭害鎴愬姛鍜屽凡鐧昏锛� - * @throws Exception - */ - @Scheduled(fixedRate= 10*60*1000) - public void syncVisitOuttimeStatus() throws Exception { - hkSyncVisitService.getOutTimeVisitRecord(); - } - /** - * 涓嬭浇娴峰悍绯荤粺鍥剧墖鏁版嵁 - * @throws Exception - */ - @Scheduled(fixedRate= 60*1000) - public void downloadHkImg() throws Exception { - if(dataSyncConfig.getNeedDealImg()!=null && dataSyncConfig.getNeedDealImg()){ - hkSyncImgService.downHKImgs(0); - } - } - /** - * 瀹氭椂鍚屾缁勭粐淇℃伅鍒版捣搴风郴缁� - * @throws Exception - */ - @Scheduled(fixedRate= 60*1000) - public void syncOrgData() { - if(Constants.formatIntegerNum(dataSyncConfig.getOrgUserDataOrigin()) == DataSyncConfig.origin.erp){ - //濡傛灉鏄疎RP绯荤粺鍚屾涓嬪彂 - hkSyncOrgUserService.syncOrgData(); - } - } - /** - * 瀹氭椂鍚屾鐢ㄦ埛淇℃伅鍒版捣搴风郴缁� - * @throws Exception - */ - @Scheduled(fixedRate= 60*1000) - public void syncUserData() { - if(Constants.formatIntegerNum(dataSyncConfig.getOrgUserDataOrigin()) == DataSyncConfig.origin.erp) { - //濡傛灉鏄疎RP绯荤粺鍚屾涓嬪彂 - hkSyncOrgUserService.syncUserData(); - } - } - /** - * 瀹氭椂鍚屾鐢宠閫氳繃鐨勮瀹㈡暟鎹埌娴峰悍绯荤粺 - * @throws Exception - */ - @Scheduled(fixedRate= 60*1000) - public void syncVisitData() { - hkSyncVisitService.syncVisitData(); - } - /* *//** - * 瀹氭椂鍚屾鍐呴儴浜哄憳鎺堟潈鍒版捣搴风郴缁� - * @throws Exception - *//* - @Scheduled(fixedRate= 3*1000) - public void syncEmpowerData() { - hkSyncEmpowerService.syncEmpowerData(); - } - *//** - * 瀹氭椂鏌ヨ浜哄憳涓嬪彂娴峰悍缁撴灉锛堜换鍔℃槸鍚﹀凡涓嬭浇缁撴潫锛� - * @throws Exception - *//* - @Scheduled(fixedRate= 60*1000) - public void syncEmpowerResultData() { - hkSyncEmpowerService.syncEmpowerResultData(); - } - */ - /** - * 瀹氭椂鏌ヨ浜哄憳瀹為檯涓嬪彂鏉冮檺缁撴灉锛屾槸鍚﹀凡缁忎笅杞芥垚鍔� - * @throws Exception - *//* - @Scheduled(fixedRate= 60*1000) - public void syncEmpowerDetailData() { - hkSyncEmpowerService.syncEmpowerDetailData(); - }*/ - - - /** - * 瀹氭椂鍐荤粨鍐呴儴浜哄憳 - */ -// @Scheduled(fixedRate= 60*1000) - public void memberFreeze() { - memberService.memberFreeze(); - } - /** - * 姣忓ぉ娓呯悊瓒呰繃涓�鍛ㄧ殑鎺ュ彛鏃ュ織鏁版嵁锛堟竻闄ゅ拰瀹夐槻骞冲彴瀵规帴鐨勬帴鍙f暟鎹級 - * @throws Exception - */ - @Scheduled(cron= "0 0 23 * * ?") - public void clearThreeMonthLog() throws Exception { - interfaceLogService.clearThreeMonthLog(); - } -} diff --git a/server/dmvisit_service/src/main/java/com/doumee/core/erp/ErpTool.java b/server/dmvisit_service/src/main/java/com/doumee/core/erp/ErpTool.java index 1d6699c..e391901 100644 --- a/server/dmvisit_service/src/main/java/com/doumee/core/erp/ErpTool.java +++ b/server/dmvisit_service/src/main/java/com/doumee/core/erp/ErpTool.java @@ -37,21 +37,24 @@ public static InterfaceLogService interfaceLogService; public void saveInterfaceLog(Object param, String path,String result,Integer type) { - if(interfaceLogService !=null) { - InterfaceLog interfaceLog = new InterfaceLog(); - interfaceLog.setType(type); - interfaceLog.setCreateDate(new Date()); - interfaceLog.setIsdeleted(Constants.ZERO); - if (param != null) { - interfaceLog.setRequest(JSONObject.toJSONString(param)); + try { + if(interfaceLogService !=null) { + InterfaceLog interfaceLog = new InterfaceLog(); + interfaceLog.setType(type); + interfaceLog.setCreateDate(new Date()); + interfaceLog.setIsdeleted(Constants.ZERO); + if (param != null) { + interfaceLog.setRequest(JSONObject.toJSONString(param)); + } + interfaceLog.setPlat(Constants.ONE); + interfaceLog.setRepose(result); + interfaceLog.setName(path); + interfaceLog.setUrl(path); + interfaceLogService.create(interfaceLog); } - interfaceLog.setPlat(Constants.ONE); - interfaceLog.setRepose(result); - interfaceLog.setName(path); - interfaceLog.setUrl(path); - interfaceLogService.create(interfaceLog); + }catch (Exception e){ + e.printStackTrace(); } - } diff --git a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java index d6dbb86..6bee11b 100644 --- a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java +++ b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java @@ -167,7 +167,6 @@ this.createFk(visits,true); } - @Transactional(propagation = Propagation.NOT_SUPPORTED) void saveInterfaceLog(Object param, String path, String result, Integer type) { InterfaceLog interfaceLog=new InterfaceLog(); interfaceLog.setType(type); diff --git a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java index e50e043..9cdf479 100644 --- a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java +++ b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java @@ -1167,18 +1167,23 @@ @Override public void saveInterfaceLog(Object param, String path, String result, Integer type) { - InterfaceLog interfaceLog=new InterfaceLog(); - interfaceLog.setType(type); - interfaceLog.setCreateDate(new Date()); - interfaceLog.setIsdeleted(Constants.ZERO); - if(param!=null){ - interfaceLog.setRequest(JSONObject.toJSONString(param)); + try { + InterfaceLog interfaceLog=new InterfaceLog(); + interfaceLog.setType(type); + interfaceLog.setCreateDate(new Date()); + interfaceLog.setIsdeleted(Constants.ZERO); + if(param!=null){ + interfaceLog.setRequest(JSONObject.toJSONString(param)); + } + interfaceLog.setPlat(Constants.ONE); + interfaceLog.setRepose(result); + interfaceLog.setName(path); + interfaceLog.setUrl(path); + interfaceLogService.create(interfaceLog); + }catch (Exception e){ +e.printStackTrace(); } - interfaceLog.setPlat(Constants.ONE); - interfaceLog.setRepose(result); - interfaceLog.setName(path); - interfaceLog.setUrl(path); - interfaceLogService.create(interfaceLog); + } } diff --git a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java index a68cbb0..128d9b6 100644 --- a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java +++ b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java @@ -590,17 +590,22 @@ if(!need){ return; } - InterfaceLog hkMonitoryLogDO=new InterfaceLog(); - hkMonitoryLogDO.setType(1); - hkMonitoryLogDO.setCreateDate(new Date()); - hkMonitoryLogDO.setIsdeleted(0); - if(param!=null){ - hkMonitoryLogDO.setRequest(JSONObject.toJSONString(param)); + try { + InterfaceLog hkMonitoryLogDO=new InterfaceLog(); + hkMonitoryLogDO.setType(1); + hkMonitoryLogDO.setCreateDate(new Date()); + hkMonitoryLogDO.setIsdeleted(0); + if(param!=null){ + hkMonitoryLogDO.setRequest(JSONObject.toJSONString(param)); + } + hkMonitoryLogDO.setRepose(result); + hkMonitoryLogDO.setName(path); + hkMonitoryLogDO.setUrl(path); + interfaceLogMapper.insert(hkMonitoryLogDO); + }catch (Exception e){ + } - hkMonitoryLogDO.setRepose(result); - hkMonitoryLogDO.setName(path); - hkMonitoryLogDO.setUrl(path); - interfaceLogMapper.insert(hkMonitoryLogDO); + } diff --git a/server/pom.xml b/server/pom.xml index 218290a..c46240c 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -16,6 +16,7 @@ <module>dmvisit_web</module> <module>openapi</module> <module>admin_timer</module> + <module>admin_sys_timer</module> </modules> -- Gitblit v1.9.3