| | |
| | | <if test="paId !=null and paId != ''"> |
| | | and t.pa_id= #{paId} |
| | | </if> |
| | | <if test="psId !=null and psId != ''"> |
| | | and t.ps_id= #{psId} |
| | | </if> |
| | | <!-- <if test="psId !=null and psId != ''">--> |
| | | <!-- and t.ps_id= #{psId}--> |
| | | <!-- </if>--> |
| | | <if test="remark !=null and remark != ''"> |
| | | and t.remark= #{remark} |
| | | </if> |
| | |
| | | <if test="paId !=null and paId != ''"> |
| | | and t.pa_id= #{paId} |
| | | </if> |
| | | <if test="psId !=null and psId != ''"> |
| | | and t.ps_id= #{psId} |
| | | </if> |
| | | <!-- <if test="psId !=null and psId != ''">--> |
| | | <!-- and t.ps_id= #{psId}--> |
| | | <!-- </if>--> |
| | | <if test="remark !=null and remark != ''"> |
| | | and t.remark= #{remark} |
| | | </if> |
| | |
| | | public static final String DATE_FORMATE_STRING_DEFAULT = "yyyyMMddHHmmss"; |
| | | public static final String DATE_FORMATE_STRING_A = "yyyy-MM-dd HH:mm:ss"; |
| | | public static final String DATE_FORMATE_STRING_B = "yyyy-MM-dd"; |
| | | public static final String DATE_FORMATE_STRING_SLASH_NON_ZERO = "yyyy/M/d"; |
| | | public static final String DATE_FORMATE_STRING_C = "MM/dd/yyyy HH:mm:ss a"; |
| | | public static final String DATE_FORMATE_STRING_D = "yyyy-MM-dd HH:mm:ss a"; |
| | | public static final String DATE_FORMATE_STRING_E = "yyyy-MM-dd'T'HH:mm:ss'Z'"; |
| | |
| | | formats.put("yyyyMMddHHmmss", new SimpleDateFormat("yyyyMMddHHmmss")); |
| | | formats.put("yyyy-MM-dd HH:mm:ss", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); |
| | | formats.put("yyyy-MM-dd", new SimpleDateFormat("yyyy-MM-dd")); |
| | | formats.put("yyyy/MM/dd", new SimpleDateFormat("yyyy/M/d")); |
| | | formats.put("MM/dd/yyyy HH:mm:ss a", new SimpleDateFormat("MM/dd/yyyy HH:mm:ss a")); |
| | | formats.put("yyyy-MM-dd HH:mm:ss a", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss a")); |
| | | formats.put("yyyy-MM-dd'T'HH:mm:ss'Z'", new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")); |
| | |
| | | import com.java110.utils.util.Assert; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | @Autowired |
| | | private IPayFeeBatchV1InnerServiceSMO payFeeBatchV1InnerServiceSMOImpl; |
| | | |
| | | private static final Date EXCEL_EPOCH; |
| | | |
| | | static { |
| | | // 初始化Excel起始日期(1899-12-30,对应Excel的0天) |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.set(1899, Calendar.DECEMBER, 30, 0, 0, 0); |
| | | cal.set(Calendar.MILLISECOND, 0); |
| | | EXCEL_EPOCH = cal.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 将Excel日期数值(如45734.0)转换为Date对象 |
| | | * @param excelDate Excel日期数值 |
| | | * @return 对应的Date对象 |
| | | */ |
| | | public static Date doubleToDate(double excelDate) { |
| | | // 处理Excel 1900年闰年错误(Excel错误地将1900年视为闰年) |
| | | long days = (long) Math.floor(excelDate); |
| | | if (days >= 60) { // 1900-03-01及之后的日期需要减1天 |
| | | days--; |
| | | } |
| | | |
| | | // 计算总毫秒数(天数部分 + 时间部分) |
| | | long totalMillis = (long)(days * 86400000L) // 1天 = 86400000毫秒 |
| | | + (long)((excelDate - days) * 86400000L); |
| | | |
| | | // 从基准日期开始累加毫秒数 |
| | | return new Date(EXCEL_EPOCH.getTime() + totalMillis); |
| | | } |
| | | |
| | | /** |
| | | * 处理Excel日期字符串(如"45734.0"),转换为"yyyy-MM-dd"格式 |
| | | * @param strDate Excel日期数值字符串 |
| | | * @return 格式化后的日期字符串 |
| | | * @throws ParseException 转换失败时抛出 |
| | | */ |
| | | public String handleExcelDateString(String strDate){ |
| | | // 1. 将字符串转换为double(如"45734.0" -> 45734.0) |
| | | double excelDateValue = Double.parseDouble(strDate); |
| | | |
| | | // 2. 将Excel数值转换为Date对象 |
| | | Date tDate = doubleToDate(excelDateValue); |
| | | |
| | | // 3. 格式化为"yyyy-MM-dd" |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | return sdf.format(tDate); |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private IUserInnerServiceSMO userInnerServiceSMOImpl; |
| | | protected boolean hasSpecialCharacters(String str) { |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 一次性费用导入 |
| | |
| | | @Autowired |
| | | private IUserInnerServiceSMO userInnerServiceSMOImpl; |
| | | |
| | | // @Override |
| | | // public List analysisExcel(Workbook workbook, JSONObject paramIn, ComponentValidateResult result) throws Exception { |
| | | // List<ImportRoomFee> importRoomFees = new ArrayList<ImportRoomFee>(); |
| | | // if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(paramIn.getString("objType"))) { |
| | | // getRooms(workbook, importRoomFees); |
| | | // }else{ |
| | | // getCars(workbook, importRoomFees); |
| | | // } |
| | | //// getRoomsAndCars(workbook, importRoomFees); |
| | | // generatorBatch(paramIn); |
| | | // for (ImportRoomFee importRoomFee : importRoomFees) { |
| | | // importRoomFee.setBatchId(paramIn.getString("batchId")); |
| | | // importRoomFee.setUserId(paramIn.getString("userId")); |
| | | // importRoomFee.setStoreId(paramIn.getString("storeId")); |
| | | // importRoomFee.setCommunityId(paramIn.getString("communityId")); |
| | | // importRoomFee.setFeeTypeCd(paramIn.getString("feeTypeCd")); |
| | | // importRoomFee.setObjType(paramIn.getString("objType")); |
| | | // |
| | | // } |
| | | // return importRoomFees; |
| | | // } |
| | | |
| | | @Override |
| | | public List analysisExcel(Workbook workbook, JSONObject paramIn, ComponentValidateResult result) throws Exception { |
| | | List<ImportRoomFee> importRoomFees = new ArrayList<ImportRoomFee>(); |
| | | if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(paramIn.getString("objType"))) { |
| | | getRooms(workbook, importRoomFees); |
| | | }else{ |
| | | getCars(workbook, importRoomFees); |
| | | } |
| | | getRoomsAndCars(workbook, importRoomFees); |
| | | generatorBatch(paramIn); |
| | | for (ImportRoomFee importRoomFee : importRoomFees) { |
| | | importRoomFee.setBatchId(paramIn.getString("batchId")); |
| | | importRoomFee.setUserId(paramIn.getString("userId")); |
| | | importRoomFee.setStoreId(paramIn.getString("storeId")); |
| | | importRoomFee.setCommunityId(paramIn.getString("communityId")); |
| | | importRoomFee.setFeeTypeCd(paramIn.getString("feeTypeCd")); |
| | | // importRoomFee.setFeeTypeCd(paramIn.getString("feeTypeCd")); |
| | | importRoomFee.setObjType(paramIn.getString("objType")); |
| | | |
| | | } |
| | | return importRoomFees; |
| | | } |
| | | |
| | | private void getRoomsAndCars(Workbook workbook, List<ImportRoomFee> importRoomFees) { |
| | | Sheet sheet = null; |
| | | sheet = ImportExcelUtils.getSheet(workbook, "房屋费用信息"); |
| | | List<Object[]> oList = ImportExcelUtils.listFromSheet(sheet); |
| | | ImportRoomFee importRoomFee = null; |
| | | Map<Integer, Object> debugs = new HashMap<Integer, Object>(); |
| | | for (int osIndex = 0; osIndex < oList.size(); osIndex++) { |
| | | Object[] os = oList.get(osIndex); |
| | | if (osIndex == 0) { // 第一行是 头部信息 直接跳过 |
| | | continue; |
| | | } |
| | | if (os[2] == null) { |
| | | continue; |
| | | } |
| | | if ((StringUtil.isNullOrNone(os[0]) && StringUtil.isNullOrNone(os[1])) || (!StringUtil.isNullOrNone(os[0]) && !StringUtil.isNullOrNone(os[1]))) { |
| | | Assert.hasValue(os[2], (osIndex + 1) + "行请写入费用主体和车牌号其中一列"); |
| | | continue; |
| | | } |
| | | Assert.hasValue(os[2], (osIndex + 1) + "行费用类型不能为空"); |
| | | Assert.hasValue(os[3], (osIndex + 1) + "行费用项目不能为空"); |
| | | |
| | | String startTime = handleExcelDateString(os[4].toString()); |
| | | String endTime = handleExcelDateString(os[5].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 文本格式"); |
| | | |
| | | |
| | | importRoomFee = new ImportRoomFee(); |
| | | importRoomFee.setPayerObjName(os[0]==null?os[1].toString():os[0].toString()); |
| | | // importRoomFee.set |
| | | importRoomFee.setFeeTypeCd(os[2].toString()); |
| | | |
| | | importRoomFee.setFeeName(os[3].toString()); |
| | | if(startTime != null){ |
| | | importRoomFee.setStartTime(startTime); |
| | | } |
| | | if(endTime != null){ |
| | | importRoomFee.setEndTime(endTime); |
| | | } |
| | | importRoomFee.setAmount(os[7].toString()); |
| | | importRoomFees.add(importRoomFee); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取 房屋信息 |
| | | * |
| | |
| | | // todo 适配器封装数据 |
| | | List datas = importDataCleaningAdapt.analysisExcel(workbook, paramIn, result); |
| | | |
| | | |
| | | if (datas == null || datas.size() > MAX_LINE) { |
| | | throw new IllegalArgumentException("数据为空,或者数据行数大于" + MAX_LINE); |
| | | } |
| | |
| | | continue; |
| | | } |
| | | Assert.hasValue(os[1], (osIndex + 1) + "行物品名称不能为空"); |
| | | Assert.hasValue(os[2], (osIndex + 1) + "行物品编号不能为空"); |
| | | // Assert.hasValue(os[2], (osIndex + 1) + "行物品编号不能为空"); |
| | | os[2] = os[2] == null ? "" : os[2]; |
| | | os[3] = os[3] == null ? "0" : os[3]; |
| | | os[4] = os[4] == null ? "0" : os[4]; |
| | | os[6] = os[6] == null ? "0" : os[6]; |
| | |
| | | os[8] = os[8] == null ? "0" : os[8]; |
| | | os[9] = os[9] == null ? "" : os[9]; |
| | | os[10] = os[10] == null ? "Y" : os[10]; |
| | | os[5] = os[5] == null ? "0" : os[5]; |
| | | // Assert.hasValue(os[3], (osIndex + 1) + "行物品单价不能为空"); |
| | | // Assert.hasValue(os[4], (osIndex + 1) + "行物品库存不能为空"); |
| | | Assert.hasValue(os[5], (osIndex + 1) + "行物品单位不能为空"); |
| | | // Assert.hasValue(os[5], (osIndex + 1) + "行物品单位不能为空"); |
| | | // Assert.hasValue(os[6], (osIndex + 1) + "行物品对外最低售价不能为空"); |
| | | // Assert.hasValue(os[7], (osIndex + 1) + "行物品对外最高售价不能为空"); |
| | | // Assert.hasValue(os[8], (osIndex + 1) + "行物品告警库存不能为空"); |
| | |
| | | ApiParkingSpaceVo apiParkingSpaceVo = new ApiParkingSpaceVo(); |
| | | ParkingSpaceDto parkingSpaceDto = BeanConvertUtil.covertBean(reqJson, ParkingSpaceDto.class); |
| | | //查询总记录数 |
| | | parkingSpaceDto.setState(null); |
| | | int total = parkingSpaceInnerServiceSMOImpl.queryParkingSpacesCount(parkingSpaceDto); |
| | | apiParkingSpaceVo.setTotal(total); |
| | | if (total > 0) { |
| | |
| | | @Override |
| | | public List<ParkingSpaceDto> queryParkingSpaces(@RequestBody ParkingSpaceDto parkingSpaceDto) { |
| | | |
| | | parkingSpaceDto.setState(null); |
| | | |
| | | //校验是否传了 分页信息 |
| | | |
| | | int page = parkingSpaceDto.getPage(); |
| | |
| | | Assert.hasKeyAndValue(reqJson, "carBrand", "请求报文中未包含carBrand"); |
| | | Assert.hasKeyAndValue(reqJson, "carType", "请求报文中未包含carType"); |
| | | Assert.hasKeyAndValue(reqJson, "carColor", "请求报文中未包含carColor"); |
| | | Assert.hasKeyAndValue(reqJson, "psId", "请求报文中未包含psId"); |
| | | //Assert.hasKeyAndValue(reqJson, "psId", "请求报文中未包含psId"); |
| | | Assert.hasKeyAndValue(reqJson, "userId", "请求报文中未包含userId"); |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId"); |
| | | Assert.hasKeyAndValue(reqJson, "startTime", "请求报文中未包含startTime"); |
| | |
| | | for (int roomIndex = 0; roomIndex < roomDtos.size(); roomIndex++) { |
| | | //todo 加入 房屋费用 |
| | | feePos.add(addRoomFee(roomDtos.get(roomIndex), data, feeConfigDtos.get(0))); |
| | | feeAttrsPos.add(addFeeAttr(data, FeeAttrDto.SPEC_CD_ONCE_FEE_DEADLINE_TIME, data.containsKey("endTime") ? data.getString("endTime") : data.getString("configEndTime"))); |
| | | if (!StringUtil.isEmpty(roomDtos.get(roomIndex).getOwnerId())) { |
| | | if (!FeeDto.FEE_FLAG_CYCLE.equals(data.getString("feeFlag"))) { |
| | | feeAttrsPos.add(addFeeAttr(data, FeeAttrDto.SPEC_CD_ONCE_FEE_DEADLINE_TIME, data.containsKey("endTime") ? data.getString("endTime") : data.getString("configEndTime"))); |
| | | } |
| | | feeAttrsPos.add(addFeeAttr(data, FeeAttrDto.SPEC_CD_OWNER_ID, roomDtos.get(roomIndex).getOwnerId())); |
| | | feeAttrsPos.add(addFeeAttr(data, FeeAttrDto.SPEC_CD_OWNER_LINK, roomDtos.get(roomIndex).getLink())); |
| | | feeAttrsPos.add(addFeeAttr(data, FeeAttrDto.SPEC_CD_OWNER_NAME, roomDtos.get(roomIndex).getOwnerName())); |
| | |
| | | if (flag < 1) { |
| | | return flag; |
| | | } |
| | | |
| | | flag = feeAttrInnerServiceSMOImpl.saveFeeAttrs(feeAttrsPos); |
| | | |
| | | // todo 这里异步的方式计算 月数据 和欠费数据 |
| | |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | //Assert.hasKeyAndValue(reqJson, "xxx", "xxx"); |
| | | Assert.hasKeyAndValue(reqJson, "resName", "必填,请填写物品名称"); |
| | | Assert.hasKeyAndValue(reqJson, "storeId", "必填,请填写商户信息"); |
| | | Assert.hasKeyAndValue(reqJson, "price", "必填,请填写物品价格"); |
| | | Assert.hasKeyAndValue(reqJson, "shId", "必填,请填写仓库"); |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "必填,请填写小区"); |
| | | // Assert.hasKeyAndValue(reqJson, "storeId", "必填,请填写商户信息"); |
| | | // Assert.hasKeyAndValue(reqJson, "price", "必填,请填写物品价格"); |
| | | // Assert.hasKeyAndValue(reqJson, "shId", "必填,请填写仓库"); |
| | | // Assert.hasKeyAndValue(reqJson, "communityId", "必填,请填写小区"); |
| | | //获取最低收费标准 |
| | | double outLowPrice = Double.parseDouble(reqJson.getString("outLowPrice")); |
| | | //获取最高收费标准 |
| | | double outHighPrice = Double.parseDouble(reqJson.getString("outHighPrice")); |
| | | if (outLowPrice > outHighPrice) { |
| | | throw new IllegalArgumentException("最低收费标准不能大于最高收费标准!"); |
| | | } |
| | | // double outLowPrice = Double.parseDouble(reqJson.getString("outLowPrice")); |
| | | // //获取最高收费标准 |
| | | // double outHighPrice = Double.parseDouble(reqJson.getString("outHighPrice")); |
| | | // if (outLowPrice > outHighPrice) { |
| | | // throw new IllegalArgumentException("最低收费标准不能大于最高收费标准!"); |
| | | // } |
| | | String resCode = reqJson.getString("resCode"); |
| | | String storeId = cmdDataFlowContext.getReqHeaders().get("store-id"); |
| | | //根据物品编码查询物品资源表 |
| | |
| | | resourceStoreDto.setStoreId(storeId); |
| | | List<ResourceStoreDto> resourceStoreDtos = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStoreDto); |
| | | //判断资源表里是否有该物品编码,避免物品编码重复 |
| | | Assert.listIsNull(resourceStoreDtos, "物品编码重复,请重新添加!"); |
| | | // Assert.listIsNull(resourceStoreDtos, "物品编码重复,请重新添加!"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | Assert.hasKeyAndValue(reqJson, "ownerId", "请求报文中未包含ownerId"); |
| | | Assert.hasKeyAndValue(reqJson, "carNum", "请求报文中未包含carNum"); |
| | | Assert.hasKeyAndValue(reqJson, "carType", "请求报文中未包含carType"); |
| | | Assert.hasKeyAndValue(reqJson, "psId", "未包含psId"); |
| | | // Assert.hasKeyAndValue(reqJson, "psId", "未包含psId"); |
| | | |
| | | if (OwnerCarDto.LEASE_TYPE_MONTH.equals(reqJson.getString("leaseType"))) { |
| | | Assert.hasKeyAndValue(reqJson, "startTime", "请求报文中未包含开始时间"); |
| | |
| | | ParkingSpaceDto parkingSpaceDto = new ParkingSpaceDto(); |
| | | parkingSpaceDto.setPsId(reqJson.getString("psId")); |
| | | List<ParkingSpaceDto> parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto); |
| | | Assert.listOnlyOne(parkingSpaceDtos, "查询车位错误!"); |
| | | // Assert.listOnlyOne(parkingSpaceDtos, "查询车位错误!"); |
| | | //获取车位状态 |
| | | String state = parkingSpaceDtos.get(0).getState(); |
| | | if (StringUtil.isEmpty(state) || !ParkingSpaceDto.STATE_FREE.equals(state)) { |
| | | throw new IllegalArgumentException("该车位不是空闲状态!"); |
| | | } |
| | | // if (StringUtil.isEmpty(state) || !ParkingSpaceDto.STATE_FREE.equals(state)) { |
| | | // throw new IllegalArgumentException("该车位不是空闲状态!"); |
| | | // } |
| | | |
| | | //校验车牌号是否存在 |
| | | OwnerCarDto ownerCarDto = new OwnerCarDto(); |
| | |
| | | spring: |
| | | profiles: |
| | | active: dev |
| | | active: debug |