|
|
@@ -1,6 +1,7 @@
|
|
|
package com.fs.tulin.service.impl;
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.fs.tulin.entity.PeriodInfo;
|
|
|
import com.fs.tulin.entity.QwExUserInfo;
|
|
|
import com.fs.tulin.entity.StudentInfo;
|
|
|
import com.fs.tulin.entity.TulinInfoSyncLog;
|
|
|
@@ -11,6 +12,7 @@ import com.fs.tulin.utils.PharmacyEnum;
|
|
|
import com.fs.tulin.utils.SyncStudentInfoService;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.core.env.Environment;
|
|
|
@@ -36,9 +38,10 @@ public class TulinInfoSyncLogServiceImpl implements ITulinInfoSyncLogService {
|
|
|
private final Environment environment;
|
|
|
|
|
|
private final String PROD_URL = "https://papi.xiangyue.life/api/v1/mp/sync/student?sign=%s&t=%d";
|
|
|
- private final String DEV_URL = "https://api.xiangyue.life/api/v1/mp/sync/student?sign=%s&t=%d";
|
|
|
|
|
|
+ private final String DEV_URL = "https://api.xiangyue.life/api/v1/mp/sync/student?sign=%s&t=%d";
|
|
|
|
|
|
+ private final String PROD_CORPID = "lRz72QOIYBxJW2RBAp2UYe1ckjVpixHL";
|
|
|
@Override
|
|
|
public void syncInfo() {
|
|
|
// 获取当前激活的profile
|
|
|
@@ -58,26 +61,12 @@ public class TulinInfoSyncLogServiceImpl implements ITulinInfoSyncLogService {
|
|
|
studentInfo.setColumn_name(ColumnNameEnum.GYBNX.getName());
|
|
|
studentInfo.setPharmacy_id(PharmacyEnum.YJKYSY.getPharmacyId());
|
|
|
studentInfo.setService_phone("15141712344");
|
|
|
- try {
|
|
|
- TulinInfoSyncLog tulinInfoSyncLog = SyncStudentInfoService.send(PROD_URL,"lRz72QOIYBxJW2RBAp2UYe1ckjVpixHL", studentInfo);
|
|
|
- tulinInfoSyncLog.setFsUserId(qwExUserInfo.getFs_user_id());
|
|
|
- insert(tulinInfoSyncLog);
|
|
|
- } catch (JsonProcessingException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
+ List<PeriodInfo> periodInfos = tulinInfoSyncLogMapper.selectPeriodInfo(qwExUserInfo.getFs_user_id());
|
|
|
+ if(CollectionUtils.isNotEmpty(periodInfos)){
|
|
|
+ studentInfo.setPeriod_name(periodInfos.get(0).getCourseName());
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- if(activeProfile.equals("dev")) {
|
|
|
- log.info("线下开始执行数据同步");
|
|
|
- for (QwExUserInfo qwExUserInfo : qwExUserInfos) {
|
|
|
- StudentInfo studentInfo = new StudentInfo();
|
|
|
- BeanUtils.copyProperties(qwExUserInfo, studentInfo);
|
|
|
- studentInfo.setAppid("wx6688e6b9b6fb8700");
|
|
|
- studentInfo.setColumn_name(ColumnNameEnum.GYBNX.getName());
|
|
|
- studentInfo.setPharmacy_id(PharmacyEnum.YJKYSY.getPharmacyId());
|
|
|
- studentInfo.setService_phone("15141712344");
|
|
|
try {
|
|
|
- TulinInfoSyncLog tulinInfoSyncLog = SyncStudentInfoService.send(PROD_URL,"lRz72QOIYBxJW2RBAp2UYe1ckjVpixHL", studentInfo);
|
|
|
+ TulinInfoSyncLog tulinInfoSyncLog = SyncStudentInfoService.send(PROD_URL,PROD_CORPID, studentInfo);
|
|
|
tulinInfoSyncLog.setFsUserId(qwExUserInfo.getFs_user_id());
|
|
|
insert(tulinInfoSyncLog);
|
|
|
} catch (JsonProcessingException e) {
|
|
|
@@ -85,6 +74,28 @@ public class TulinInfoSyncLogServiceImpl implements ITulinInfoSyncLogService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+// if(activeProfile.equals("dev")) {
|
|
|
+// log.info("线下开始执行数据同步");
|
|
|
+// for (QwExUserInfo qwExUserInfo : qwExUserInfos) {
|
|
|
+// StudentInfo studentInfo = new StudentInfo();
|
|
|
+// BeanUtils.copyProperties(qwExUserInfo, studentInfo);
|
|
|
+// studentInfo.setAppid("wx6688e6b9b6fb8700");
|
|
|
+// studentInfo.setColumn_name(ColumnNameEnum.GYBNX.getName());
|
|
|
+// studentInfo.setPharmacy_id(PharmacyEnum.YJKYSY.getPharmacyId());
|
|
|
+// studentInfo.setService_phone("15141712344");
|
|
|
+// List<PeriodInfo> periodInfos = tulinInfoSyncLogMapper.selectPeriodInfo(qwExUserInfo.getFs_user_id());
|
|
|
+// if(CollectionUtils.isNotEmpty(periodInfos)){
|
|
|
+// studentInfo.setPeriod_name(periodInfos.get(0).getCourseName());
|
|
|
+// }
|
|
|
+// try {
|
|
|
+// TulinInfoSyncLog tulinInfoSyncLog = SyncStudentInfoService.send(PROD_URL,PROD_CORPID, studentInfo);
|
|
|
+// tulinInfoSyncLog.setFsUserId(qwExUserInfo.getFs_user_id());
|
|
|
+// insert(tulinInfoSyncLog);
|
|
|
+// } catch (JsonProcessingException e) {
|
|
|
+// throw new RuntimeException(e);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
|