| | |
| | | import com.java110.core.smo.IComputeFeeSMO; |
| | | import com.java110.dto.account.AccountDto; |
| | | import com.java110.dto.account.AccountDetailDto; |
| | | import com.java110.dto.fee.FeeAttrDto; |
| | | import com.java110.dto.fee.FeeConfigDto; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.fee.FeeReceiptDetailDto; |
| | | import com.java110.dto.fee.*; |
| | | import com.java110.dto.owner.OwnerCarDto; |
| | | import com.java110.dto.parking.ParkingSpaceDto; |
| | | import com.java110.dto.repair.RepairDto; |
| | |
| | | JSONObject param = params.getJSONObject(paramIndex); |
| | | String maximumNumber = param.getString("maximumNumber"); |
| | | } |
| | | |
| | | //todo 是否按缴费时间段缴费 |
| | | validateIfPayFeeStartEndDate(reqJson, feeConfigDtos.get(0)); |
| | | } |
| | | |
| | | |
| | |
| | | List<UserDto> userDtos = userV1InnerServiceSMOImpl.queryUsers(userDto); |
| | | Assert.listOnlyOne(userDtos, "用户未登录"); |
| | | |
| | | String cycle = paramObj.getString("cycle"); |
| | | String cycles = paramObj.getString("cycles"); |
| | | Date endTime = null; |
| | | |
| | | PayFeePo payFeePo = null; |
| | |
| | | throw new CmdException("缴费失败"); |
| | | } |
| | | // todo 如果是按 自定义时间段缴费,这里补一条缴费记录 和 欠费费用 |
| | | ifCustomStartEndTimePayFee(cycle, endTime, payFeeDetailPo, payFeePo, paramObj); |
| | | ifCustomStartEndTimePayFee(cycles, endTime, payFeeDetailPo, payFeePo, paramObj); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 校验是否按缴费时间段缴费 |
| | | * |
| | | * @param reqJson |
| | | * @param feeConfigDto |
| | | */ |
| | | private void validateIfPayFeeStartEndDate(JSONObject reqJson, FeeConfigDto feeConfigDto) { |
| | | if (!"-105".equals(reqJson.getString("cycles"))) { |
| | | return; |
| | | } |
| | | // todo 自己是间接性费用 |
| | | if (FeeDto.FEE_FLAG_CYCLE_ONCE.equals(feeConfigDto.getFeeFlag())) { |
| | | return; |
| | | } |
| | | |
| | | FeeConfigDto tmpFeeConfigDto = new FeeConfigDto(); |
| | | tmpFeeConfigDto.setFeeNameEq(feeConfigDto.getFeeName() + "欠费"); |
| | | tmpFeeConfigDto.setFeeFlag(FeeDto.FEE_FLAG_CYCLE_ONCE); |
| | | tmpFeeConfigDto.setComputingFormula(feeConfigDto.getComputingFormula()); |
| | | List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(tmpFeeConfigDto); |
| | | |
| | | Assert.listOnlyOne(feeConfigDtos, "按自定义时间段缴费时,费用必须为间接性费用,或者存在名称为 " + feeConfigDto.getFeeName() + "欠费 的间接性费用,它的公式计算必须要和" + feeConfigDto.getFeeName() + "一致"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 自定义时间段 缴费 |
| | | * |
| | | * @param cycle |
| | | * @param cycles |
| | | * @param endTime |
| | | * @param payFeeDetailPo |
| | | * @param payFeePo |
| | | */ |
| | | private void ifCustomStartEndTimePayFee(String cycle, Date endTime, PayFeeDetailPo payFeeDetailPo, PayFeePo payFeePo, JSONObject reqJson) { |
| | | if (!"-105".equals(cycle)) { |
| | | private void ifCustomStartEndTimePayFee(String cycles, Date endTime, PayFeeDetailPo payFeeDetailPo, PayFeePo payFeePo, JSONObject reqJson) { |
| | | if (!"-105".equals(cycles)) { |
| | | return; |
| | | } |
| | | |
| | |
| | | tmpPayFeeDetailPo.setPayableAmount("0"); |
| | | tmpPayFeeDetailPo.setStartTime(DateUtil.getFormatTimeStringB(endTime)); |
| | | tmpPayFeeDetailPo.setEndTime(reqJson.getString("customStartTime")); |
| | | tmpPayFeeDetailPo.setState(FeeDetailDto.STATE_OWE); |
| | | tmpPayFeeDetailPo.setRemark("按缴费时间段缴费,这部分费用按欠费的方式重新生成,请在" + payObjNameRemark + "上查看"); |
| | | int flag = payFeeDetailNewV1InnerServiceSMOImpl.savePayFeeDetailNew(tmpPayFeeDetailPo); |
| | | |
| | |
| | | } |
| | | |
| | | //todo 生成费用 |
| | | PayFeePo tmpPayFeePo = BeanConvertUtil.covertBean(feeInfo, PayFeePo.class);; |
| | | PayFeePo tmpPayFeePo = BeanConvertUtil.covertBean(feeInfo, PayFeePo.class); |
| | | tmpPayFeePo.setFeeId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_feeId)); |
| | | tmpPayFeePo.setEndTime(DateUtil.getFormatTimeStringB(endTime)); |
| | | tmpPayFeePo.setState(FeeDto.STATE_DOING); |
| | | |
| | | // todo 处理configId |
| | | doChangeConfigId(tmpPayFeePo, feeInfo); |
| | | |
| | | |
| | | flag = payFeeV1InnerServiceSMOImpl.savePayFee(tmpPayFeePo); |
| | | if (flag < 1) { |
| | |
| | | feeAttrDto.setCommunityId(payFeePo.getCommunityId()); |
| | | List<FeeAttrDto> feeAttrDtos = feeAttrInnerServiceSMOImpl.queryFeeAttrs(feeAttrDto); |
| | | |
| | | if(feeAttrDtos == null || feeAttrDtos.size() < 1){ |
| | | if (feeAttrDtos == null || feeAttrDtos.size() < 1) { |
| | | return; |
| | | } |
| | | |
| | | List<FeeAttrPo> tmpFeeAttrPos = new ArrayList<>(); |
| | | FeeAttrPo tmpFeeAttrPo = null; |
| | | for(FeeAttrDto tmpFeeAttrDto: feeAttrDtos){ |
| | | boolean hasDeadLineTime = false; |
| | | for (FeeAttrDto tmpFeeAttrDto : feeAttrDtos) { |
| | | tmpFeeAttrDto.setFeeId(tmpPayFeePo.getFeeId()); |
| | | tmpFeeAttrDto.setAttrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId,true)); |
| | | tmpFeeAttrDto.setAttrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId, true)); |
| | | |
| | | if(FeeAttrDto.SPEC_CD_ONCE_FEE_DEADLINE_TIME.equals(tmpFeeAttrDto.getSpecCd())){ |
| | | if (FeeAttrDto.SPEC_CD_ONCE_FEE_DEADLINE_TIME.equals(tmpFeeAttrDto.getSpecCd())) { |
| | | tmpFeeAttrDto.setValue(reqJson.getString("customStartTime")); |
| | | hasDeadLineTime = true; |
| | | } |
| | | tmpFeeAttrPo = BeanConvertUtil.covertBean(tmpFeeAttrDto,FeeAttrPo.class); |
| | | tmpFeeAttrPo = BeanConvertUtil.covertBean(tmpFeeAttrDto, FeeAttrPo.class); |
| | | tmpFeeAttrPos.add(tmpFeeAttrPo); |
| | | } |
| | | //todo 没有结束时间时 |
| | | if(!hasDeadLineTime){ |
| | | tmpFeeAttrPo = new FeeAttrPo(); |
| | | tmpFeeAttrPo.setAttrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId, true)); |
| | | tmpFeeAttrPo.setFeeId(tmpPayFeePo.getFeeId()); |
| | | tmpFeeAttrPo.setCommunityId(tmpFeeAttrPo.getCommunityId()); |
| | | tmpFeeAttrPo.setSpecCd(FeeAttrDto.SPEC_CD_ONCE_FEE_DEADLINE_TIME); |
| | | tmpFeeAttrPo.setValue(reqJson.getString("customStartTime")); |
| | | tmpFeeAttrPos.add(tmpFeeAttrPo); |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 处理费用项ID |
| | | * |
| | | * @param tmpPayFeePo |
| | | * @param feeInfo |
| | | */ |
| | | private void doChangeConfigId(PayFeePo tmpPayFeePo, FeeDto feeInfo) { |
| | | FeeConfigDto feeConfigDto = new FeeConfigDto(); |
| | | feeConfigDto.setConfigId(feeInfo.getConfigId()); |
| | | feeConfigDto.setCommunityId(feeInfo.getCommunityId()); |
| | | List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto); |
| | | Assert.listOnlyOne(feeConfigDtos, "费用项不存在"); |
| | | if (FeeDto.FEE_FLAG_CYCLE_ONCE.equals(feeConfigDtos.get(0).getFeeFlag())) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | FeeConfigDto tmpFeeConfigDto = new FeeConfigDto(); |
| | | tmpFeeConfigDto.setFeeNameEq(feeConfigDtos.get(0).getFeeName() + "欠费"); |
| | | tmpFeeConfigDto.setFeeFlag(FeeDto.FEE_FLAG_CYCLE_ONCE); |
| | | tmpFeeConfigDto.setComputingFormula(feeConfigDto.getComputingFormula()); |
| | | //todo 校验的时候校验过了 所以这里不可能为空 |
| | | feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(tmpFeeConfigDto); |
| | | |
| | | tmpPayFeePo.setConfigId(feeConfigDtos.get(0).getConfigId()); |
| | | } |
| | | |
| | | private static Calendar getTargetEndTime(Calendar endCalender, Double cycles) { |
| | | if (StringUtil.isInteger(cycles.toString())) { |
| | | endCalender.add(Calendar.MONTH, new Double(cycles).intValue()); |