CZT
2023-10-11 97c668bfeb07420baccadaf43abfbbb2b34fa467
src/main/java/com/fzzy/async/fzzy40/impl/Fzzy40Sync1109.java
@@ -2,15 +2,17 @@
import com.fzzy.api.Constant;
import com.fzzy.api.entity.Api1109;
import com.fzzy.api.entity.Api1202;
import com.fzzy.api.entity.Api1205;
import com.fzzy.api.entity.ApiLog;
import com.fzzy.api.utils.ContextUtil;
import com.fzzy.api.utils.FileUtil;
import com.fzzy.api.utils.FileUtils;
import com.fzzy.api.view.repository.Api1109Rep;
import com.fzzy.api.view.repository.Api1202Rep;
import com.fzzy.api.view.repository.Api1205Rep;
import com.fzzy.api.view.repository.ApiLogRep;
import com.fzzy.async.fzzy40.entity.Fz40FileInfo;
import com.fzzy.async.fzzy40.entity.Fz40InoutRecord;
import com.fzzy.async.fzzy40.repository.Fzzy40Sync1109Rep;
import com.fzzy.async.fzzy40.repository.Fzzy40Sync1202Rep;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -48,13 +50,15 @@
    @Autowired
    private Fzzy40Sync1109Rep fzzySync1109Rep;
    @Autowired
    private Fzzy40Sync1202Rep fzzySync1202Rep;
    @Autowired
    private Api1109Rep api1109Rep;
    @Autowired
    private Api1202Rep api1202Rep;
    @Autowired
    private Api1205Rep api1205Rep;
    @Autowired
    private ApiLogRep apiLogRep;
    @Autowired
    private FileUtil fileUtil;
    private FileUtils fileUtil;
    /**
     * 同步文件接口
@@ -88,24 +92,29 @@
            String wjlx;
            String wjmc;
            List<Api1109> api1109List;
            List<Fz40InoutRecord> listInout;
            List<Api1202> api1202List;
            List<Api1205> api1205List;
            String str = "";
            for (Fz40FileInfo sysData : list) {
                if (StringUtils.isEmpty(sysData.getBizId())) {
                    continue;
                }
                //根据图片id查询对应出入库信息
                listInout = fzzySync1202Rep.listInoutRecordById(sysData.getBizId());
                if (null == listInout || listInout.isEmpty()) {
                    continue;
                if(sysData.getBizId().startsWith(IMG_START_R)){
                    api1202List = api1202Rep.getDataByBizId(sysData.getBizId());
                    if (null == api1202List || api1202List.isEmpty()) {
                        continue;
                    }
                    str = api1202List.get(0).getRkywdh();
                }
                //若出入库信息为删除或者错误状态,则不同步
                if ("DEL".equals(listInout.get(0).getRecordStatus()) || "ERROR".equals(listInout.get(0).getRecordStatus())) {
                    continue;
                if(sysData.getBizId().startsWith(IMG_START_C)){
                    api1205List = api1205Rep.getDataByBizId(sysData.getBizId());
                    if (null == api1205List || api1205List.isEmpty()) {
                        continue;
                    }
                    str = api1205List.get(0).getCkywdh();
                }
                //若出入库信息中入库重量为空或为0,则不同步
                if (null == listInout.get(0).getRecordWeight() || listInout.get(0).getRecordWeight() == 0) {
                    continue;
                }
                //只同步称重
                if (BIZ_TAG_WEIGHT_FULL.equals(sysData.getBizTag()) || BIZ_TAG_WEIGHT_EMPTY.equals(sysData.getBizTag())) {
                    wjlx = "";
@@ -133,13 +142,13 @@
                    apiData.setWjdz(fileUtil.getInoutFilePath(sysData.getCreateTime()) + sysData.getFileName());
                    //文件名称
                    wjmc = getImgNameType(wjmc, sysData.getBizTag(), sysData.getBizId(), sysData.getFileName(), map);
                    wjmc = getImgNameType(wjmc, sysData.getBizTag(), str, sysData.getFileName(), map);
                    apiData.setWjmc(wjmc);
                    //文件类型
                    apiData.setWjlx(wjlx);
                    //操作标志及最后更新时间
                    apiData.setZhgxsj(new Date());
                    apiData.setZhgxsj(sysData.getCreateTime());
                    //业务id、库区编码、同步时间
                    apiData.setBizId(sysData.getFileId());