CZT
2023-10-20 3631219246be48aec1e745e94e5b28ff4e8799c8
igds-api-inte/src/main/java/com/ld/igds/sh/service/ApiShServiceImpl1504.java
@@ -2,10 +2,9 @@
import com.alibaba.fastjson.JSONObject;
import com.bstek.bdf2.core.model.DefaultDept;
import com.ld.igds.constant.RedisConst;
import com.ld.igds.log.service.InteStatusLogService;
import com.ld.igds.models.InoutContract;
import com.ld.igds.models.InteStatusLog;
import com.ld.igds.models.MContract;
import com.ld.igds.sh.dto.ApiResponse;
import com.ld.igds.sh.dto.Dto1504;
import com.ld.igds.sh.param.ApiRequest;
@@ -15,14 +14,12 @@
import com.ld.igds.sh.util.RespCodeEnum;
import com.ld.igds.sh.util.RespUtil;
import com.ld.igds.util.ContextUtil;
import com.ld.igds.util.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@@ -38,8 +35,6 @@
    private HApiShServiceImpl hApiShServiceImpl;
    @Autowired
    private InteStatusLogService inteStatusLogService;
    @Autowired
    private RedisUtil redisUtil;
    @Override
    public String getInterfaceId() {
        return ApiShConst.API_SH_1504;
@@ -55,16 +50,19 @@
        String companyId = ContextUtil.getDefaultCompanyId();
        String key = RedisConst.buildKey(companyId, ApiShConst.API_SH_1504);
        Date startTime = (Date) redisUtil.get(key);
        if(null == startTime){
            startTime = DateUtils.addDays(param.getEndTime(), -100);
//        String key = RedisConst.buildKey(companyId, ApiShConst.API_SH_1112);
//        Date startTime = (Date) redisUtil.get(key);
//        if(null == startTime){
//            startTime = DateUtils.addDays(param.getEndTime(), -30);
//        }
//        redisUtil.set(key, param.getEndTime());
        if(null == param.getStartTime()){
            param.setStartTime(DateUtils.addDays(param.getEndTime(), -1));
        }
        redisUtil.set(key, param.getEndTime());
        //查询合同信息
        List<MContract> dataList = hApiShServiceImpl.listContract(companyId,
                startTime, param.getEndTime());
        List<InoutContract> dataList = hApiShServiceImpl.listContract(companyId,
                param.getStartTime(), param.getEndTime());
        //响应数据为空则直接返回响应码2000
        if(dataList == null || dataList.isEmpty()){
@@ -79,7 +77,7 @@
        List<DefaultDept> deptList = hApiShServiceImpl.listDept(companyId, companyId);
        DefaultDept dept = deptList.get(0);
        //封装数据信息
        for (MContract contract : dataList) {
        for (InoutContract contract : dataList) {
            dto = new Dto1504();
            dto.setZznm(contract.getId());