| | |
| | | import com.java110.intf.common.IPrinterRuleFeeV1InnerServiceSMO; |
| | | import com.java110.intf.common.IPrinterRuleMachineV1InnerServiceSMO; |
| | | import com.java110.intf.common.IPrinterRuleV1InnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeDetailInnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeInnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeReceiptDetailInnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeReceiptInnerServiceSMO; |
| | | import com.java110.intf.fee.*; |
| | | import com.java110.job.adapt.DatabusAdaptImpl; |
| | | import com.java110.job.printer.IPrinter; |
| | | import com.java110.po.fee.PayFeeDetailPo; |
| | |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(PayFeeReceiptAdapt.class); |
| | | |
| | | @Autowired |
| | | private ISaveSystemErrorSMO saveSystemErrorSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeReceiptInnerServiceSMO feeReceiptInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeReceiptDetailInnerServiceSMO feeReceiptDetailInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeInnerServiceSMO feeInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeDetailInnerServiceSMO feeDetailInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IComputeFeeSMO computeFeeSMOImpl; |
| | | |
| | | //键(退费收据开关) |
| | | public static final String REFUND_RECEIPT_SWITCH = "REFUND_RECEIPT_SWITCH"; |
| | | |
| | | @Autowired |
| | | private IPrinterRuleFeeV1InnerServiceSMO printerRuleFeeV1InnerServiceSMOImpl; |
| | |
| | | |
| | | @Autowired |
| | | private IMachinePrinterV1InnerServiceSMO machinePrinterV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeDetailInnerServiceSMO feeDetailInnerServiceSMOImpl; |
| | | |
| | | |
| | | @Autowired |
| | | private IGeneratorFeeReceiptInnerServiceSMO generatorFeeReceiptInnerServiceSMOImpl; |
| | | |
| | | |
| | | //模板信息推送地址 |
| | |
| | | } |
| | | |
| | | private void doPayFeeDetail(Business business, JSONObject businessPayFeeDetail) { |
| | | try { |
| | | //查询缴费明细 |
| | | PayFeeDetailPo payFeeDetailPo = BeanConvertUtil.covertBean(businessPayFeeDetail, PayFeeDetailPo.class); |
| | | FeeDto feeDto = new FeeDto(); |
| | | feeDto.setFeeId(payFeeDetailPo.getFeeId()); |
| | | feeDto.setCommunityId(payFeeDetailPo.getCommunityId()); |
| | | List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto); |
| | | Assert.listOnlyOne(feeDtos, "未查询到费用信息"); |
| | | feeDto = feeDtos.get(0); |
| | | //查询业主信息 |
| | | OwnerDto ownerDto = computeFeeSMOImpl.getFeeOwnerDto(feeDto); |
| | | //获取小区配置里退费收据开关(open开;off关) |
| | | String refundReceiptSwitch = CommunitySettingFactory.getValue(payFeeDetailPo.getCommunityId(), REFUND_RECEIPT_SWITCH); |
| | | // if received amount lt zero |
| | | if (!StringUtil.isEmpty(refundReceiptSwitch) && refundReceiptSwitch.equals("off") && businessPayFeeDetail.containsKey("receivedAmount") |
| | | && businessPayFeeDetail.getDoubleValue("receivedAmount") < 0) { |
| | | return; |
| | | } |
| | | //查询缴费明细 |
| | | PayFeeDetailPo payFeeDetailPo = BeanConvertUtil.covertBean(businessPayFeeDetail, PayFeeDetailPo.class); |
| | | generatorFeeReceiptInnerServiceSMOImpl.generator(payFeeDetailPo); |
| | | |
| | | String receiptCode = CommonCache.getValue(payFeeDetailPo.getDetailId()+CommonCache.RECEIPT_CODE); |
| | | //todo 如果为空重新生成收据编号 |
| | | if(StringUtil.isEmpty(receiptCode)){ |
| | | receiptCode = feeReceiptInnerServiceSMOImpl.generatorReceiptCode(payFeeDetailPo.getCommunityId()); |
| | | } |
| | | |
| | | //添加收据和收据详情 |
| | | FeeReceiptPo feeReceiptPo = new FeeReceiptPo(); |
| | | FeeReceiptDetailPo feeReceiptDetailPo = new FeeReceiptDetailPo(); |
| | | feeReceiptDetailPo.setAmount(businessPayFeeDetail.getString("receivedAmount")); |
| | | feeReceiptDetailPo.setCommunityId(feeDto.getCommunityId()); |
| | | feeReceiptDetailPo.setCycle(businessPayFeeDetail.getString("cycles")); |
| | | feeReceiptDetailPo.setDetailId(businessPayFeeDetail.getString("detailId")); |
| | | feeReceiptDetailPo.setEndTime(businessPayFeeDetail.getString("endTime")); |
| | | feeReceiptDetailPo.setFeeId(feeDto.getFeeId()); |
| | | feeReceiptDetailPo.setFeeName(StringUtil.isEmpty(feeDto.getImportFeeName()) ? feeDto.getFeeName() : feeDto.getImportFeeName()); |
| | | feeReceiptDetailPo.setStartTime(businessPayFeeDetail.getString("startTime")); |
| | | feeReceiptDetailPo.setReceiptId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_receiptId)); |
| | | feeReceiptDetailPo.setCreateTime(payFeeDetailPo.getCreateTime()); |
| | | //处理 小数点后 0 |
| | | feeDto.setSquarePrice(Double.parseDouble(feeDto.getSquarePrice()) + ""); |
| | | feeDto.setAdditionalAmount(Double.parseDouble(feeDto.getAdditionalAmount()) + ""); |
| | | computeFeeSMOImpl.freshFeeReceiptDetail(feeDto, feeReceiptDetailPo); |
| | | feeReceiptPo.setAmount(feeReceiptDetailPo.getAmount()); |
| | | feeReceiptPo.setCommunityId(feeReceiptDetailPo.getCommunityId()); |
| | | feeReceiptPo.setReceiptId(feeReceiptDetailPo.getReceiptId()); |
| | | feeReceiptPo.setObjType(feeDto.getPayerObjType()); |
| | | feeReceiptPo.setObjId(feeDto.getPayerObjId()); |
| | | feeReceiptPo.setObjName(computeFeeSMOImpl.getFeeObjName(feeDto)); |
| | | feeReceiptPo.setPayObjId(ownerDto.getOwnerId()); |
| | | feeReceiptPo.setPayObjName(ownerDto.getName()); |
| | | feeReceiptPo.setCreateTime(payFeeDetailPo.getCreateTime()); |
| | | feeReceiptPo.setReceiptCode(receiptCode); |
| | | //这里只是写入 收据表,暂不考虑 事务一致性问题,就算写入失败 也只是影响 收据打印,如果 贵公司对 收据要求 比较高,不能有失败的情况 请加入事务管理 |
| | | feeReceiptDetailInnerServiceSMOImpl.saveFeeReceiptDetail(feeReceiptDetailPo); |
| | | feeReceiptInnerServiceSMOImpl.saveFeeReceipt(feeReceiptPo); |
| | | |
| | | // 是否配置了自动打印功能 如果配置了自动打印功能 自动打印 |
| | | autoPrintReceipt(businessPayFeeDetail.getString("detailId"), feeDto.getCommunityId()); |
| | | } catch (Exception e) { |
| | | LogSystemErrorPo logSystemErrorPo = new LogSystemErrorPo(); |
| | | logSystemErrorPo.setErrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_errId)); |
| | | logSystemErrorPo.setErrType(LogSystemErrorDto.ERR_TYPE_NOTICE); |
| | | logSystemErrorPo.setMsg(ExceptionUtil.getStackTrace(e)); |
| | | saveSystemErrorSMOImpl.saveLog(logSystemErrorPo); |
| | | logger.error("通知异常", e); |
| | | } |
| | | //todo 是否配置了自动打印功能 如果配置了自动打印功能 自动打印 |
| | | autoPrintReceipt(payFeeDetailPo.getDetailId(), payFeeDetailPo.getCommunityId()); |
| | | } |
| | | |
| | | |
| | | |
| | | private void autoPrintReceipt(String detailId, String communityId) { |
| | | |
| | |
| | | throw new CmdException("打印机异常,未包含适配器"); |
| | | } |
| | | |
| | | printer.printPayFeeDetail(new String[]{detailId}, tmpPrinterRuleMachineDto.getCommunityId(), Integer.parseInt(tmpPrinterRuleMachineDto.getQuantity()), machinePrinterDtos.get(0),""); |
| | | printer.printPayFeeDetail(new String[]{detailId}, tmpPrinterRuleMachineDto.getCommunityId(), Integer.parseInt(tmpPrinterRuleMachineDto.getQuantity()), machinePrinterDtos.get(0), ""); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |