CZT
2023-09-15 d6aa5189807dbbb1532e093af075473d28f52aae
添加3.5版本熏蒸作业同步
已修改1个文件
已添加3个文件
464 ■■■■■ 文件已修改
src/main/java/com/fzzy/async/fzzy35/Fzzy35SyncService13.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/async/fzzy35/entity/Fz35DrugLog.java 312 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/async/fzzy35/impl/Fzzy35Sync1306.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/async/fzzy35/repository/Fzzy35Sync1306Rep.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/async/fzzy35/Fzzy35SyncService13.java
@@ -26,6 +26,8 @@
    private Fzzy35Sync1310 fzzySync1310;
    @Autowired
    private Fzzy35Sync1023 fzzySync1023;
    @Autowired
    private Fzzy35Sync1306 fzzy35Sync1306;
    @Override
@@ -55,12 +57,12 @@
            fzzySync1023.syncData(param.getKqdm(), param.getDeptId(), param.getStart(), param.getEnd());
        }
//
//        //通风作业信息同步
        //通风作业信息同步
//        fzzySync1305.syncData(param.getDeptId(), param.getStart(), param.getEnd());
//
//        //熏蒸作业信息同步
//        fzzySync1306.syncData(param.getDeptId(), param.getStart(), param.getEnd());
        //熏蒸作业信息同步
        fzzy35Sync1306.syncData(param.getDeptId(), param.getDeptId(), param.getStart(), param.getEnd());
    }
}
src/main/java/com/fzzy/async/fzzy35/entity/Fz35DrugLog.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,312 @@
package com.fzzy.async.fzzy35.entity;
import com.bstek.dorado.annotation.PropertyDef;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * çŽ¯æµç†è’¸-熏蒸作业记录
 *
 * @date 2023å¹´7月26日
 */
@Data
@Entity
@Table(name = "D_DRUG_LOG")
public class Fz35DrugLog implements Serializable {
    @Id
    @Column(name = "ID_", length = 40)
    @PropertyDef(label = "熏蒸作业单号", description = "仓房代码+作业日期 (yyyyMMdd) +3 ä½é¡ºåºå·")
    private String id;
    @Column(name = "COMPANY_ID_", length = 10)
    @PropertyDef(label = "组织编码")
    private String companyId;
    @Column(name = "DEPT_ID_", length = 40)
    @PropertyDef(label = "所属分库")
    private String deptId;
    @Column(name = "DEPOT_ID_", length = 50)
    @PropertyDef(label = "仓库")
    private String depotId;
    @Column(name = "START_")
    @PropertyDef(label = "开始时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date start;
    @Column(name = "END_")
    @PropertyDef(label = "截至时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date end;
    @Column(name = "PEST_BATCH_ID_", length = 50)
    @PropertyDef(label = "虫害检测单号")
    private String pestBatchId;
    @Column(name = "NUM_")
    @PropertyDef(label = "第几次熏蒸")
    private Integer num = 0;
    @Column(name = "MODE_", length = 1)
    @PropertyDef(label = "熏蒸方式", description = "0:粮面潮解1:布袋埋藏2:探管3:综合施药")
    private String mode;
    @Column(name = "RECIR_MODE_", length = 1)
    @PropertyDef(label = "环流熏蒸方式", description = "0:固定式布置形式1:移动式布置形式")
    private String recirMode;
    @Column(name = "hlxzynhljsjh", length = 1)
    @PropertyDef(label = "环流熏蒸与内环流技术结合", description = "0:分别使用_固定式1:分别使用_移动式2:二合一应用_单向控制3:二合一应用_双向控制")
    private String hlxzynhljsjh;
    @PropertyDef(label = "熏蒸方案制定")
    @Column(name = "xzfazd", length = 128)
    private String xzfazd;
    @PropertyDef(label = "熏蒸方案起草人")
    @Column(name = "xzfaqcr", length = 64)
    private String xzfaqcr;
    @PropertyDef(label = "熏蒸方案批准人")
    @Column(name = "xzfapzr", length = 64)
    private String xzfapzr;
    @PropertyDef(label = "熏蒸方案报备情况")
    @Column(name = "xzfabbqk", length = 64)
    private String xzfabbqk;
    @PropertyDef(label = "施药人员资质情况")
    @Column(name = "syryzzqk", length = 64)
    private String syryzzqk;
    @PropertyDef(label = "施药资质审核")
    @Column(name = "syzzsh", length = 64)
    private String syzzsh;
    @Column(name = "DRUG_NAME_", length = 64)
    @PropertyDef(label = "药剂名称")
    private String drugName;
    @PropertyDef(label = "剂型")
    @Column(name = "jx", length = 64)
    private String jx;
    @Column(name = "CONCENTRATION_", length = 50)
    @PropertyDef(label = "药剂浓度", description = "%")
    private Double concentration = 0.0;
    @Column(name = "GRAIN_DOSE_")
    @PropertyDef(label = "粮堆单位用药量", description = "g/m³")
    private Double grainDose = 0.0;
    @Column(name = "SPACE_DOSE_")
    @PropertyDef(label = "空间单位用药量", description = "g/m³")
    private Double spaceDose = 0.0;
    @Column(name = "DOSE_")
    @PropertyDef(label = "总用药量", description = "kg")
    private Double dose = 0.0;
    @PropertyDef(label = "施药方法", description = "0:潮解法1:仓外发生器2:钢瓶气")
    @Column(name = "syff", length = 1)
    private String syff;
    @PropertyDef(label = "辅助施药措施")
    @Column(name = "fzsycs", length = 128)
    private String fzsycs;
    @PropertyDef(label = "空气呼吸器及安全检查情况")
    @Column(name = "kqhqjaqjcqk", length = 128)
    private String kqhqjaqjcqk;
    @PropertyDef(label = "磷化氢检测装置调试情况")
    @Column(name = "lhqjczztsqk", length = 128)
    private String lhqjczztsqk;
    @PropertyDef(label = "氧气深度检测装置调试情况")
    @Column(name = "yqsdjczztsqk", length = 128)
    private String yqsdjczztsqk;
    @PropertyDef(label = "磷化氢报警仪安全检查")
    @Column(name = "lhqbjyaqjc", length = 128)
    private String lhqbjyaqjc;
    @PropertyDef(label = "氧气报警仪安全检查")
    @Column(name = "yqbjyaqjc", length = 128)
    private String yqbjyaqjc;
    @PropertyDef(label = "补药前仓内磷化氢浓度")
    @Column(name = "byqcnlhqnd", precision = 20, scale = 3)
    private double byqcnlhqnd;
    @PropertyDef(label = "磷化氢浓度单位", description = "1:g/m³(默认);2:ppm;3:ml/m³;4:%VOL")
    @Column(name = "nlhqnddw", length = 1)
    private String nlhqnddw = "1";
    @PropertyDef(label = "目标浓度", description = "单位:g/m³")
    @Column(name = "mbnd", precision = 20, scale = 3)
    private double mbnd;
    @PropertyDef(label = "计算补药量", description = "单位:g")
    @Column(name = "jsbyl", precision = 20, scale = 3)
    private double jsbyl;
    @PropertyDef(label = "实际补药量", description = "单位:g")
    @Column(name = "sjbyl", precision = 20, scale = 3)
    private double sjbyl;
    @PropertyDef(label = "补药方法")
    @Column(name = "byff", length = 128)
    private String byff;
    @PropertyDef(label = "作业人数")
    @Column(name = "zyrs")
    private Integer zyrs;
    @PropertyDef(label = "补药作业批准人")
    @Column(name = "byzypzr", length = 64)
    private String byzypzr;
    @PropertyDef(label = "现场指挥人")
    @Column(name = "xczhr", length = 64)
    private String xczhr;
    @PropertyDef(label = "峰值浓度", description = "单位:g/m³")
    @Column(name = "fznd", precision = 20, scale = 3)
    private double fznd;
    @PropertyDef(label = "目标浓度维持天数", description = "单位:天")
    @Column(name = "mbndwcts")
    private Integer mbndwcts;
    @PropertyDef(label = "漏气位置监测")
    @Column(name = "lswzjc", length = 128)
    private String lswzjc;
    @PropertyDef(label = "漏气部位采取的补救措施")
    @Column(name = "lqbwcqdbjcs", length = 128)
    private String lqbwcqdbjcs;
    @PropertyDef(label = "密闭时间", description = "单位:天")
    @Column(name = "mbsj")
    private Integer mbsj;
    @PropertyDef(label = "CT值")
    @Column(name = "ctz", precision = 20, scale = 3)
    private double ctz;
    @PropertyDef(label = "散气前磷化氢浓度", description = "单位:g/m³")
    @Column(name = "sqqlhqnd", precision = 20, scale = 3)
    private double sqqlhqnd;
    @Column(name = "VENTILATE_TIME_")
    @PropertyDef(label = "散气时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date ventilateTime;
    @Column(name = "VENTILATE_METHOD_", length = 100)
    @PropertyDef(label = "散气方法")
    private String ventilateMethod;
    @PropertyDef(label = "散气批准人")
    @Column(name = "sqpzr", length = 64)
    private String sqpzr;
    @PropertyDef(label = "散气持续天数", description = "单位:天")
    @Column(name = "sqcsts")
    private Integer sqcsts;
    @Column(name = "AFTER_PH3_")
    @PropertyDef(label = "散气后磷化氢浓度", description = "单位:g/m³")
    private Double afterPh3;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @PropertyDef(label = "残渣收集作业时间")
    @Column(name = "czsjzysj")
    private Date czsjzysj;
    @PropertyDef(label = "残渣收集作业人数")
    @Column(name = "czsjzyrs")
    private Integer czsjzyrs;
    @PropertyDef(label = "残渣收集方法")
    @Column(name = "czsjff", length = 128)
    private String czsjff;
    @PropertyDef(label = "残渣收集作业批准人")
    @Column(name = "czsjzypzr", length = 64)
    private String czsjzypzr;
    @PropertyDef(label = "残渣处理措施")
    @Column(name = "czclcs", length = 128)
    private String czclcs;
    @PropertyDef(label = "残渣处理作业人数")
    @Column(name = "czclzyrs")
    private Integer czclzyrs;
    @PropertyDef(label = "残渣处理批准人")
    @Column(name = "czclpzr", length = 64)
    private String czclpzr;
    @PropertyDef(label = "熏蒸后活虫检出情况")
    @Column(name = "xzhhcjcqk", length = 128)
    private String xzhhcjcqk;
    @PropertyDef(label = "熏蒸后虫口密度", description = "单位:头/kg")
    @Column(name = "xzhckmd")
    private Integer xzhckmd;
    @PropertyDef(label = "培养15天后活虫数", description = "单位:头/kg")
    @Column(name = "pyswthhcs")
    private Integer pyswthhcs;
    @PropertyDef(label = "培养45天后活虫数", description = "单位:头/kg")
    @Column(name = "pysswthhcs")
    private Integer pysswthhcs;
    /**
     * 0:良好
     * 1:一般
     * 2:不好
     */
    @Column(name = "EVALUATE_", length = 1)
    @PropertyDef(label = "熏蒸评价", description = "0:良好 1:一般 2:不好")
    private String evaluate;
    @PropertyDef(label = "熏蒸负责人")
    @Column(name = "xzfzr", length = 64)
    private String xzfzr;
    @PropertyDef(label = "熏蒸作业人员")
    @Column(name = "xzzyry", length = 128)
    private String xzzyry;
    @Column(name = "USER_", length = 30)
    @PropertyDef(label = "操作人")
    private String user;
    @PropertyDef(label = "更新人")
    @Column(name = "UPDATE_USER_", length = 30)
    private String updateUser;
    @PropertyDef(label = "更新时间")
    @Column(name = "UPDATE_TIME_")
    private Date updateTime;
    @Column(name = "REMARKS_", length = 500)
    @PropertyDef(label = "备注说明")
    private String remarks;
}
src/main/java/com/fzzy/async/fzzy35/impl/Fzzy35Sync1306.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,113 @@
package com.fzzy.async.fzzy35.impl;
import com.fzzy.api.Constant;
import com.fzzy.api.entity.Api1105;
import com.fzzy.api.entity.Api1306;
import com.fzzy.api.entity.ApiLog;
import com.fzzy.api.service.ApiCommonService;
import com.fzzy.api.utils.ContextUtil;
import com.fzzy.api.view.repository.Api1306Rep;
import com.fzzy.api.view.repository.ApiLogRep;
import com.fzzy.async.fzzy35.entity.Fz35DrugLog;
import com.fzzy.async.fzzy35.repository.Fzzy35Sync1306Rep;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
/**
 * ç†è’¸ä½œä¸šæ•°æ®åŒæ­¥
 *
 * @author chen
 * @date 2022-09-08 09:51
 */
@Slf4j
@Component
public class Fzzy35Sync1306 {
    @Autowired
    private Fzzy35Sync1306Rep fzzySync1306Rep;
    @Autowired
    private ApiCommonService commonService;
    @Autowired
    private Api1306Rep api1306Rep;
    @Autowired
    private ApiLogRep apiLogRep;
    /**
     * åŒæ­¥å¹¶å°è£…保存熏蒸数据
     *
     * @param deptId ç³»ç»Ÿå¯¹åº”库区编码
     * @param start  èµ·å§‹æ—¶é—´
     * @param end    æˆªæ­¢æ—¶é—´
     */
    public void syncData(String kqdm, String deptId, Date start, Date end) {
        log.info("-------------1306接口数据开始同步------------------");
        //同步数据,只记录失败的信息
        ApiLog apiLog = new ApiLog();
        apiLog.setType(ApiLog.TYPE_SYNC);
        apiLog.setKqdm(kqdm);
        apiLog.setUploadTime(new Date());
        apiLog.setInteId(Constant.API_CODE_1306);
        apiLog.setStatus(99);
        apiLog.setId(ContextUtil.getUUID());
        try {
            List<Fz35DrugLog> list = fzzySync1306Rep.findByReceiveDate(deptId, start, end);
            if (null == list || list.isEmpty()) {
                return;
            }
            Api1306 api1306;
            Api1105 api1105;
            List<Api1306> api1306List;
            for (Fz35DrugLog fz35DrugLog : list) {
                //获取货位信息
                api1105 = commonService.getApi1105Cache(fz35DrugLog.getDepotId());
                if (null == api1105) {
                    continue;
                }
                api1306 = new Api1306();
                BeanUtils.copyProperties(fz35DrugLog, api1306);
                api1306.setXzzydh(fz35DrugLog.getId());
                api1306.setCfdm(fz35DrugLog.getDepotId());
                api1306.setXzkssj(fz35DrugLog.getStart());
                api1306.setXzjssj(fz35DrugLog.getEnd());
                api1306.setHcjcdh(fz35DrugLog.getPestBatchId());
                api1306.setDjcxz(fz35DrugLog.getNum());
                api1306.setCgxzfs(fz35DrugLog.getMode());
                api1306.setHlxzfs(fz35DrugLog.getRecirMode());
                api1306.setYjmc(fz35DrugLog.getDrugName());
                api1306.setNd(fz35DrugLog.getConcentration());
                api1306.setLddwyyl(fz35DrugLog.getGrainDose());
                api1306.setKjdwyyl(fz35DrugLog.getSpaceDose());
                api1306.setZyyl(fz35DrugLog.getDose());
                api1306.setSqrq(fz35DrugLog.getVentilateTime());
                api1306.setSqff(fz35DrugLog.getVentilateMethod());
                api1306.setSqjsslhqnd(fz35DrugLog.getAfterPh3());
                api1306.setXzxgpj(fz35DrugLog.getEvaluate());
                api1306.setZhgxsj(fz35DrugLog.getUpdateTime());
                api1306List = api1306Rep.getDataById(api1306.getXzzydh());
                if (null == api1306List || api1306List.isEmpty()) {
                    api1306.setCzbz(Constant.CZBZ_I);
                } else {
                    api1306.setCzbz(api1306List.get(0).getCzbz());
                }
                api1306Rep.save(api1306);
            }
        } catch (Exception e) {
            log.error("---同步失败----{}", e);
            apiLog.setResult("同步失败:" + e.getMessage());
            apiLogRep.save(apiLog);
        }
    }
}
src/main/java/com/fzzy/async/fzzy35/repository/Fzzy35Sync1306Rep.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
package com.fzzy.async.fzzy35.repository;
import com.fzzy.async.fzzy35.entity.Fz35DrugLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.Date;
import java.util.List;
/**
 * æŸ¥è¯¢é€šé£Žä½œä¸šæ•°æ®
 *
 * @author chen
 * @date 2022-09-08 10:42
 */
public interface Fzzy35Sync1306Rep extends JpaRepository<Fz35DrugLog, String> {
    /**
     * æ ¹æ®æ—¶é—´æ®µæŸ¥è¯¢é€šé£Žæ•°æ®
     * @param start
     * @param end
     * @return
     */
    @Query("from Fz35DrugLog where deptId =:deptId and start >=:start and start <:end order by start ")
    List<Fz35DrugLog> findByReceiveDate(@Param("deptId") String deptId, @Param("start") Date start, @Param("end") Date end);
}