chengf
2026-01-30 b8bf2507bc7b23c90bc6dc71ea2460e277d3800a
service-api/src/main/java/com/java110/api/importData/adapt/ImportContractDataCleaningAdapt.java
@@ -4,10 +4,16 @@
import com.java110.api.importData.DefaultImportDataAdapt;
import com.java110.api.importData.IImportDataCleaningAdapt;
import com.java110.dto.PropertyWhiteListFlowDto;
import com.java110.dto.contract.ContractDto;
import com.java110.dto.contract.ContractPartyaDto;
import com.java110.dto.system.ComponentValidateResult;
import com.java110.intf.fee.IPayFeeBatchV1InnerServiceSMO;
import com.java110.intf.store.IContractInnerServiceSMO;
import com.java110.intf.store.IContractPartyaInnerServiceSMO;
import com.java110.intf.user.IUserInnerServiceSMO;
import com.java110.po.contract.ContractPo;
import com.java110.utils.util.Assert;
import com.java110.utils.util.DateUtil;
import com.java110.utils.util.ImportExcelUtils;
import com.java110.utils.util.StringUtil;
import org.apache.poi.ss.usermodel.Sheet;
@@ -26,31 +32,37 @@
    private IPayFeeBatchV1InnerServiceSMO payFeeBatchV1InnerServiceSMOImpl;
    @Autowired
    private IUserInnerServiceSMO userInnerServiceSMOImpl;
    private IContractInnerServiceSMO contractInnerServiceSMOImpl;
    @Autowired
    private IContractPartyaInnerServiceSMO contractPartyaInnerServiceSMOImpl;
    @Override
    public List analysisExcel(Workbook workbook, JSONObject paramIn, ComponentValidateResult result) throws Exception {
        generatorBatch(paramIn);
        List<PropertyWhiteListFlowDto> whiteLists = new ArrayList<PropertyWhiteListFlowDto>();
        List<ContractPo> whiteLists = new ArrayList<ContractPo>();
        //获取车辆信息
        getPropertyWhiteListFlowDtos(workbook, whiteLists);
        getConctractDtos(workbook, whiteLists);
        for (PropertyWhiteListFlowDto whiteList : whiteLists){
        for (ContractPo whiteList : whiteLists){
            whiteList.setCommunityId(paramIn.getString("communityId"));
            whiteList.setStoreId(paramIn.getString("storeId"));
            whiteList.setStartUserId(paramIn.getString("userId"));
            whiteList.setObjType("1111");
        }
        return whiteLists;
    }
    private void getPropertyWhiteListFlowDtos(Workbook workbook, List<PropertyWhiteListFlowDto> whiteLists) {
    private void getConctractDtos(Workbook workbook, List<ContractPo> whiteLists) {
        Sheet sheet = null;
        sheet = ImportExcelUtils.getSheet(workbook, "白单流水(归档数据)");
        sheet = ImportExcelUtils.getSheet(workbook, "起草合同模板");
        List<Object[]> oList = ImportExcelUtils.listFromSheet(sheet);
        PropertyWhiteListFlowDto white = null;
        ContractPo contractDto = null;
        for (int osIndex = 0; osIndex < oList.size(); osIndex++) {
            Object[] os = oList.get(osIndex);
            if (osIndex == 0) { // 第一行是 头部信息 直接跳过
            if (osIndex == 0 || osIndex == 1) { // 第一行是 头部信息 直接跳过
                continue;
            }
            if (StringUtil.isNullOrNone(os[0])) {
@@ -58,48 +70,44 @@
            }
            Assert.hasValue(os[0], (osIndex + 1) + "行收费日期不能为空");
            white = new PropertyWhiteListFlowDto();
            String chargeTime = excelDoubleToDate(os[0].toString());
            String changeStart = os[21] == null ? null : excelDoubleToDate(os[21].toString());
            String changeEnd = os[22] == null ? null : excelDoubleToDate(os[22].toString());
            String bankDepositDate =  os[8] == null ? null : excelDoubleToDate(os[8].toString());
            String inputTime = null;
            if(os[16] != null){
                inputTime = excelDoubleToDate(os[16].toString().split("\\.")[0]);
            contractDto = new ContractPo();
            try{
                String startTime = excelDoubleToDate(os[14].toString());
                String endTime = excelDoubleToDate(os[15].toString());
                String createTime = excelDoubleToDate(os[16].toString());
                Assert.isDate(startTime, DateUtil.DATE_FORMATE_STRING_B, (osIndex + 1) + "行开始时间格式错误 请填写YYYY-MM-DD 文本格式");
                Assert.isDate(endTime, DateUtil.DATE_FORMATE_STRING_B, (osIndex + 1) + "行结束时间格式错误 请填写YYYY-MM-DD 文本格式");
                Assert.isDate(createTime, DateUtil.DATE_FORMATE_STRING_B, (osIndex + 1) + "行签订时间格式错误 请填写YYYY-MM-DD 文本格式");
                contractDto.setStartTime(startTime);
                contractDto.setEndTime(endTime);
                contractDto.setSigningTime(createTime);
            }catch (Exception e){
                throw new IllegalArgumentException("请填写"+(osIndex+1)+"行"+oList.get(1)[14].toString()+"/"+oList.get(1)[15].toString()+"/"+oList.get(1)[16].toString());
            }
            white.setChargeTime(chargeTime);
            white.setInvoiceReceiptNo(os[1] == null ? null : os[1].toString());
            white.setRoomId(os[2] == null ? null : os[2].toString());
            white.setPropertyAddress(os[3] == null ? null : os[3].toString());
            white.setDoorRoomNum(os[4] == null ? null : os[4].toString());
            white.setSecondaryFeeTypeCd(os[5] == null ? null : os[5].toString());
            white.setChargeAmount(os[6] == null ? null : os[6].toString());
            white.setCharger(os[7] == null ? null : os[7].toString());
            white.setBankDepositDate(bankDepositDate);
            white.setBankDepositor(os[9] == null ? null : os[9].toString());
            white.setSplitBankDepositAmount(os[10] == null ? null : os[10].toString());
            white.setBankDepositAmount(os[11] == null ? null : os[11].toString());
            white.setCheckAmount(os[12] == null ? null : os[12].toString());
            white.setWhiteListArchiveNo(os[13] == null ? null : os[13].toString());
            white.setSheetCount(os[14] == null ? null : os[14].toString());
            white.setFinancialReceiver(os[15] == null ? null : os[15].toString());
            white.setInputTime(inputTime);
            white.setInputPerson(os[17] == null ? null : os[17].toString());
            white.setOrderNo(os[18] == null ? null : os[18].toString());
            white.setLicensePlate(os[19] == null ? null : os[19].toString());
            white.setCategory22(os[20] == null ? null : os[20].toString());
            white.setChargeStart(changeStart);
            white.setChargeEnd(changeEnd);
            white.setRow(osIndex + 1);
            whiteLists.add(white);
//                    01257101112131415
            try {
                contractDto.setContractName(os[0].toString());
                contractDto.setContractCode(os[1].toString());
                contractDto.setaPartyaId(os[2].toString());
                contractDto.setbPartyaId(os[5].toString());
                contractDto.setOperator(os[11].toString());
                contractDto.setOperatorLink(os[12].toString());
                contractDto.setAmount(os[13].toString());
            } catch (Exception e) {
                throw new IllegalArgumentException("请填写第"+(osIndex+1)+"行完整信息");
            }
            contractDto.setaContacts(!StringUtil.isNullOrNone(os[3]) ? os[3].toString() : null);
            contractDto.setaLink(!StringUtil.isNullOrNone(os[4]) ? os[4].toString() : null);
            contractDto.setbContacts(!StringUtil.isNullOrNone(os[6]) ? os[6].toString() : null);
            contractDto.setbLink(!StringUtil.isNullOrNone(os[7]) ? os[7].toString() : null);
            contractDto.setcPartyaId(!StringUtil.isNullOrNone(os[8]) ? os[8].toString() : null);
            contractDto.setcContacts(!StringUtil.isNullOrNone(os[9]) ? os[9].toString() : null);
            contractDto.setcLink(!StringUtil.isNullOrNone(os[10]) ? os[10].toString() : null);
            contractDto.setContractType(!StringUtil.isNullOrNone(os[17]) ? os[17].toString() : null);
            contractDto.setStatusCd("0");
            contractDto.setObjId("-1");
            whiteLists.add(contractDto);
        }
    }
    /**
     * 生成批次号
     *
     * @param reqJson
     */
}