|
@@ -1,11 +1,16 @@
|
|
|
package com.rongwei.bscommon.sys.strategy;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.rongwei.bscommon.sys.service.impl.JtJscgpyqdServiceImpl;
|
|
|
import com.rongwei.bscommon.sys.utils.AttendanceAssessmentSdk;
|
|
|
-import com.rongwei.bsentity.domain.JtGsjtbsj;
|
|
|
+import com.rongwei.bsentity.domain.JtJscgpyqd;
|
|
|
+import com.rongwei.bsentity.domain.JtZjfjflqd;
|
|
|
import com.rongwei.bsentity.dto.ApiCallDto;
|
|
|
import com.rongwei.bsentity.dto.ApiReturnDto;
|
|
|
import com.rongwei.bsentity.dto.OrgApiDataConfigDTO;
|
|
|
import com.rongwei.rwcommon.base.R;
|
|
|
+import com.rongwei.rwcommon.base.exception.CustomException;
|
|
|
+import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -13,8 +18,8 @@ import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
-import static com.rongwei.bscommon.sys.utils.ApiDataOrgUtil.assembleApiData;
|
|
|
-import static com.rongwei.bscommon.sys.utils.ApiDataOrgUtil.setOrdinaryDatePattern;
|
|
|
+import static com.rongwei.bscommon.sys.utils.ApiDataOrgUtil.*;
|
|
|
+import static com.rongwei.bscommon.sys.utils.JXKHConstant.DatePattern.DATE_PATTERN_YMD;
|
|
|
|
|
|
/**
|
|
|
* AssembleK34ApiData class
|
|
@@ -24,16 +29,29 @@ import static com.rongwei.bscommon.sys.utils.ApiDataOrgUtil.setOrdinaryDatePatte
|
|
|
*/
|
|
|
@Component
|
|
|
public class KC137ApiRequestAndProcessing implements ApiRequestAndProcessingStrategy {
|
|
|
+ private static AttendanceAssessmentSdk attendanceAssessmentSdk;
|
|
|
+ private static JtJscgpyqdServiceImpl jtJscgpyqdService;
|
|
|
+
|
|
|
@Autowired
|
|
|
- private AttendanceAssessmentSdk attendanceAssessmentSdk;
|
|
|
+ public void setAttendanceAssessmentSdk(AttendanceAssessmentSdk attendanceAssessmentSdk) {
|
|
|
+ KC137ApiRequestAndProcessing.attendanceAssessmentSdk = attendanceAssessmentSdk;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ public void setJtXcjhqdServiceImpl(JtJscgpyqdServiceImpl jtJscgpyqdService) {
|
|
|
+ KC137ApiRequestAndProcessing.jtJscgpyqdService = jtJscgpyqdService;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> assembleData(String id,String dataId,String code) {
|
|
|
List<OrgApiDataConfigDTO> assembleData = new ArrayList<>();
|
|
|
-
|
|
|
- assembleData.add(setOrdinaryDatePattern("DATAID", JtGsjtbsj::getDataid));
|
|
|
-
|
|
|
- JtGsjtbsj jtGsjtbsj = new JtGsjtbsj();
|
|
|
+ assembleData.add(setOrdinaryDate("INDEXID", JtJscgpyqd::getIndexid));
|
|
|
+ assembleData.add(setOrdinaryDate("DATAID", JtJscgpyqd::getDataid));
|
|
|
+ assembleData.add(setOrdinaryDate("cgpyhdmc", JtJscgpyqd::getCgpyhdmc));
|
|
|
+ assembleData.add(setOrdinaryDate("pyfl", JtJscgpyqd::getPyfl));
|
|
|
+ assembleData.add(setDatePattern("kzsj", JtJscgpyqd::getKzsj,DATE_PATTERN_YMD));
|
|
|
+ assembleData.add(setFileInfo("zmwjtzgg", JtJscgpyqd::getZmwjtzgg,true));
|
|
|
+ JtJscgpyqd jtGsjtbsj = jtJscgpyqdService.getById(id);
|
|
|
Map<String, Object> stringObjectMap = assembleApiData(jtGsjtbsj, assembleData);
|
|
|
return stringObjectMap;
|
|
|
}
|
|
@@ -45,6 +63,13 @@ public class KC137ApiRequestAndProcessing implements ApiRequestAndProcessingStra
|
|
|
paramVo.setApiCode(code);
|
|
|
ApiReturnDto apiReturnDto = attendanceAssessmentSdk.apiCall(paramVo);
|
|
|
// 后续逻辑处理
|
|
|
+ Map<String, String> apiReturnData = apiReturnDto.getApiReturnData();
|
|
|
+ String realDataId = apiReturnData.getOrDefault("DATAID", "").toString();
|
|
|
+ if (StringUtils.isBlank(realDataId)) {
|
|
|
+ throw new CustomException("接口请求成功,但无法获取dataId");
|
|
|
+ }
|
|
|
+ jtJscgpyqdService.update(new LambdaUpdateWrapper<JtJscgpyqd>()
|
|
|
+ .eq(JtJscgpyqd::getId, id).set(JtJscgpyqd::getDataid, realDataId));
|
|
|
return R.ok();
|
|
|
}
|
|
|
}
|