CreateDzzz.java 3.44 KB
package com.thinkgem.jeesite.modules.eci.task;

import com.thinkgem.jeesite.common.utils.IdGen;
import com.thinkgem.jeesite.common.utils.JsonUtil;
import com.thinkgem.jeesite.modules.eci.dao.ElecLicenseInfoDao;
import com.thinkgem.jeesite.modules.eci.entity.ElecLicenseInfo;
import com.thinkgem.jeesite.modules.reg.dao.bus.RegBusBdcqzsdjxxDao;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusBdcqzsdjxx;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusBdcqzsdjxxService;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Lazy(false)
@Component
public class CreateDzzz {


    @Autowired
    ElecLicenseInfoDao licenseInfoDao;

    @Autowired
    private RegBusBdcqzsdjxxService regBusBdcqzsdjxxService;

    @Autowired
    private RegBusBdcqzsdjxxDao regBusBdcqzsdjxxDao;


    protected Logger logger = LoggerFactory.getLogger(super.getClass());

    public synchronized void autoCreate() {
        logger.info("数据汇总标志:");
        System.out.println("566666666666666");

        List<RegBusBdcqzsdjxx> reg = regBusBdcqzsdjxxService.selectDzzz("1", "0");
        //setId(IdGen.uuid());
        for(RegBusBdcqzsdjxx bdc : reg){
            //todo 此处调用创建电子证照接口

            ElecLicenseInfo eli = new ElecLicenseInfo();
            eli.setBizId(IdGen.uuid());
            eli.setYwh(bdc.getYwh());
            eli.setZsbs(bdc.getId());
            //模板参数入库
            Map<String, String> map = new HashMap<String, String>();

            if(bdc.getBdcqzh().contains("证明")){
                map.put("ewm","imageBase64");
                map.put("djsj",bdc.getDbsj());
                map.put("bdczmh",bdc.getBdcqzh());
                map.put("zmqlhsx","");
                map.put("qlr",bdc.getQlrmc());
                map.put("ywr","");
                map.put("zl",bdc.getZl());
                map.put("bdcdyh",bdc.getBdcdyh());
                map.put("qt",bdc.getQlqtzk());
                map.put("fj",bdc.getFj());
                String param = JsonUtil.toJsonString(map);
                eli.setDocumentParam(param);
                eli.setHtlx("1");
            }else{
                map.put("ewm","imageBase64");
                map.put("djsj",bdc.getDbsj());
                map.put("bdczmh",bdc.getBdcqzh());
                map.put("zmqlhsx","");
                map.put("qlr",bdc.getQlrmc());
                map.put("ywr","");
                map.put("bdcdyh",bdc.getBdcdyh());
                map.put("qt",bdc.getQlqtzk());
                map.put("fj",bdc.getFj());
                map.put("gyqk",bdc.getGyqk());
                map.put("zl",bdc.getZl());
                map.put("qllx",bdc.getQllx());
                map.put("qlxz",bdc.getQlxz());
                map.put("yt",bdc.getYt());
                map.put("mj",bdc.getMj());
                map.put("syqx",bdc.getSyqx());
                String param = JsonUtil.toJsonString(map);
                eli.setDocumentParam(param);
                eli.setHtlx("2");
            }
            if(licenseInfoDao.selectZsbs(bdc.getId()).size() == 0 ){
                licenseInfoDao.insert(eli);
            }

            bdc.setIscjdzzz("1");
            regBusBdcqzsdjxxDao.update(bdc);

        }

    }
}