|
@@ -1,87 +0,0 @@
|
|
|
-package com.rongwei.bscommon.sys.strategy;
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
-import com.rongwei.bscommon.sys.service.JtScsdlService;
|
|
|
-import com.rongwei.bscommon.sys.utils.AttendanceAssessmentSdk;
|
|
|
-import com.rongwei.bsentity.domain.JtGsjtbsj;
|
|
|
-import com.rongwei.bsentity.domain.JtScsdl;
|
|
|
-import com.rongwei.bsentity.domain.JtYjbhgl;
|
|
|
-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;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-import static com.rongwei.bscommon.sys.utils.ApiDataOrgUtil.*;
|
|
|
-import static com.rongwei.bscommon.sys.utils.ApiDataOrgUtil.setDatePattern;
|
|
|
-import static com.rongwei.bscommon.sys.utils.JXKHConstant.DatePattern.DATE_PATTERN_YMD;
|
|
|
-
|
|
|
-/**
|
|
|
- * AssembleK34ApiData class
|
|
|
- *
|
|
|
- * @author XH
|
|
|
- * @date 2024/12/03
|
|
|
- */
|
|
|
-@Component
|
|
|
-public class KC115ApiRequestAndProcessing implements ApiRequestAndProcessingStrategy {
|
|
|
- private static AttendanceAssessmentSdk attendanceAssessmentSdk;
|
|
|
- private static JtScsdlService jtScsdlService;
|
|
|
-
|
|
|
-
|
|
|
- @Autowired
|
|
|
- public void setAttendanceAssessmentSdk(AttendanceAssessmentSdk attendanceAssessmentSdk) {
|
|
|
- KC115ApiRequestAndProcessing.attendanceAssessmentSdk = attendanceAssessmentSdk;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Autowired
|
|
|
- public void setJtXcjhqdServiceImpl(JtScsdlService jtScsdlService) {
|
|
|
- KC115ApiRequestAndProcessing.jtScsdlService = jtScsdlService;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Map<String, Object> assembleData(String id,String dateId, String code) {
|
|
|
- List<OrgApiDataConfigDTO> assembleData = new ArrayList<>();
|
|
|
- assembleData.add(setOrdinaryDate("DATAID", JtScsdl::getDataid));
|
|
|
- assembleData.add(setOrdinaryDate("INDEXID", JtScsdl::getId));
|
|
|
- assembleData.add(setOrdinaryDate("xmbh", JtScsdl::getXmbh));
|
|
|
- assembleData.add(setOrdinaryDate("xmmc", JtScsdl::getXmmc));
|
|
|
- assembleData.add(setOrdinaryDate("qdbh", JtScsdl::getQdbh));
|
|
|
- assembleData.add(setOrdinaryDate("qdmc", JtScsdl::getQdmc));
|
|
|
- assembleData.add(setOrdinaryDate("rwhjbh", JtScsdl::getRwhjbh));
|
|
|
- assembleData.add(setOrdinaryDate("rwhjmc", JtScsdl::getRwhjmc));
|
|
|
- assembleData.add(setOrdinaryDate("zzjdsdzrr", JtScsdl::getZzjdsdzrr));
|
|
|
- assembleData.add(setOrdinaryDate("dzqmyyjdmc", JtScsdl::getQmmc));
|
|
|
- assembleData.add(setDatePattern("pzsj", JtScsdl::getPzsj,DATE_PATTERN_YMD));
|
|
|
- assembleData.add(setDatePattern("zgcshsqrqzgzsj", JtScsdl::getQzsj,DATE_PATTERN_YMD));
|
|
|
-
|
|
|
- JtScsdl jtScsdl= jtScsdlService.getById(id);
|
|
|
- Map<String, Object> stringObjectMap = assembleApiData(jtScsdl, assembleData);
|
|
|
- return stringObjectMap;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public R apiCallAndDataProcessing(String id,String dataId, String code, Map<String, Object> apiCallData) {
|
|
|
- ApiCallDto paramVo = new ApiCallDto();
|
|
|
- paramVo.setData(apiCallData);
|
|
|
- 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");
|
|
|
- }
|
|
|
- jtScsdlService.update(new LambdaUpdateWrapper<JtScsdl>()
|
|
|
- .eq(JtScsdl::getId, id).set(JtScsdl::getDataid, realDataId));
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
-}
|
|
|
-
|