| | |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.RoomDto; |
| | | import com.java110.dto.account.AccountDto; |
| | | import com.java110.dto.communitySpacePerson.CommunitySpacePersonDto; |
| | | import com.java110.dto.fee.FeeDetailDto; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.feeDiscount.FeeDiscountDto; |
| | |
| | | import com.java110.dto.feeDiscount.FeeDiscountSpecDto; |
| | | import com.java110.dto.onlinePay.OnlinePayDto; |
| | | import com.java110.dto.owner.OwnerCarDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.dto.owner.OwnerRoomRelDto; |
| | | import com.java110.dto.payFeeConfigDiscount.PayFeeConfigDiscountDto; |
| | | import com.java110.dto.payFeeDetailDiscount.PayFeeDetailDiscountDto; |
| | |
| | | import com.java110.intf.community.IRoomInnerServiceSMO; |
| | | import com.java110.intf.fee.*; |
| | | import com.java110.intf.user.IOwnerCarInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO; |
| | | import com.java110.po.account.AccountPo; |
| | | import com.java110.po.accountDetail.AccountDetailPo; |
| | | import com.java110.po.fee.PayFeeDetailPo; |
| | | import com.java110.po.fee.PayFeePo; |
| | | import com.java110.po.feeReceipt.FeeReceiptPo; |
| | | import com.java110.po.feeReceiptDetail.FeeReceiptDetailPo; |
| | | import com.java110.po.onlinePay.OnlinePayPo; |
| | | import com.java110.po.payFeeDetailDiscount.PayFeeDetailDiscountPo; |
| | | import com.java110.po.returnPayFee.ReturnPayFeePo; |
| | |
| | | private IOwnerRoomRelInnerServiceSMO ownerRoomRelInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | |
| | | |
| | | @Autowired |
| | | private IOnlinePayV1InnerServiceSMO onlinePayV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeReceiptInnerServiceSMO feeReceiptInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeReceiptDetailInnerServiceSMO feeReceiptDetailInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IRoomInnerServiceSMO roomInnerServiceSMOImpl; |
| | | |
| | | private static final String SPEC_RATE = "89002020980015"; //赠送月份 |
| | | |
| | |
| | | Assert.hasKeyAndValue(reqJson, "returnFeeId", "returnFeeId不能为空"); |
| | | Assert.hasKeyAndValue(reqJson, "state", "state不能为空"); |
| | | Assert.hasKeyAndValue(reqJson, "feeId", "feeId不能为空"); |
| | | |
| | | if (reqJson.containsKey("cycles")) { |
| | | String cycles = reqJson.getString("cycles"); |
| | | if (!cycles.startsWith("-")) { |
| | | throw new IllegalArgumentException("退费周期必须负数");// 这里必须传入负数,否则费用自动相加不会退费 |
| | | } |
| | | } |
| | | |
| | | FeeDetailDto feeDetailDto = new FeeDetailDto(); |
| | | feeDetailDto.setDetailId(reqJson.getString("detailId")); |
| | | feeDetailDto.setFeeId(reqJson.getString("feeId")); |
| | | feeDetailDto.setCommunityId(reqJson.getString("communityId")); |
| | | List<FeeDetailDto> feeDetailDtos = feeDetailInnerServiceSMOImpl.queryFeeDetails(feeDetailDto); |
| | | |
| | | Assert.listOnlyOne(feeDetailDtos, "不存在缴费记录"); |
| | | reqJson.put("feeDetailDto", feeDetailDtos.get(0)); |
| | | } |
| | |
| | | @Override |
| | | @Java110Transactional |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | |
| | | FeeDetailDto feeDetailDto = (FeeDetailDto) reqJson.get("feeDetailDto"); |
| | | updateReturnPayFee(reqJson); |
| | | |
| | | //退费审核通过 |
| | | if ("1100".equals(reqJson.getString("state"))) { |
| | | //判断退费周期是否为负数如果不是 抛出异常 |
| | |
| | | reqJson.put("state", "1300"); |
| | | reqJson.put("startTime", DateUtil.getFormatTimeString(feeDetailDto.getStartTime(), DateUtil.DATE_FORMATE_STRING_A)); |
| | | reqJson.put("endTime", DateUtil.getFormatTimeString(feeDetailDto.getEndTime(), DateUtil.DATE_FORMATE_STRING_A)); |
| | | reqJson.put("payOrderId",feeDetailDto.getPayOrderId()); |
| | | reqJson.put("payOrderId", feeDetailDto.getPayOrderId()); |
| | | addFeeDetail(reqJson); |
| | | |
| | | reqJson.put("state", "1100"); |
| | | String receivableAmount = (String) reqJson.get("receivableAmount"); |
| | | String receivedAmount = (String) reqJson.get("receivedAmount"); |
| | |
| | | FeeDto feeDto = new FeeDto(); |
| | | feeDto.setFeeId((String) reqJson.get("feeId")); |
| | | List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto); |
| | | |
| | | Assert.listOnlyOne(feeDtos, "费用不存在"); |
| | | FeeDto feeDto1 = feeDtos.get(0); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | |
| | | reqJson.put("state", "2008001"); |
| | | } |
| | | updateFee(reqJson); |
| | | reqJson.put("feeName", feeDto1.getFeeName()); |
| | | // dealFeeReceipt(reqJson); |
| | | //检查是否有优惠 |
| | | PayFeeDetailDiscountDto payFeeDetailDiscountDto = new PayFeeDetailDiscountDto(); |
| | | payFeeDetailDiscountDto.setCommunityId(feeDto1.getCommunityId()); |
| | |
| | | Date startTime = DateUtil.getDateFromStringA(reqJson.getString("startTime")); |
| | | FeeDiscountSpecDto feeDiscountSpecDto = new FeeDiscountSpecDto(); |
| | | feeDiscountSpecDto.setDiscountId(payFeeConfigDiscount.getDiscountId()); |
| | | feeDiscountSpecDto.setSpecId(SPEC_RATE); |
| | | feeDiscountSpecDto.setSpecId(SPEC_RATE); //赠送规则 |
| | | //查询打折规格 |
| | | List<FeeDiscountSpecDto> feeDiscountSpecDtos = feeDiscountSpecInnerServiceSMOImpl.queryFeeDiscountSpecs(feeDiscountSpecDto); |
| | | Assert.listOnlyOne(feeDiscountSpecDtos, "查询打折规格表错误!"); |
| | |
| | | BigDecimal value = new BigDecimal(specValue); |
| | | FeeDiscountSpecDto feeDiscountSpec = new FeeDiscountSpecDto(); |
| | | feeDiscountSpec.setDiscountId(payFeeConfigDiscount.getDiscountId()); |
| | | feeDiscountSpec.setSpecId(SPEC_MONTH); |
| | | feeDiscountSpec.setSpecId(SPEC_MONTH); //月份 |
| | | List<FeeDiscountSpecDto> feeDiscountSpecs = feeDiscountSpecInnerServiceSMOImpl.queryFeeDiscountSpecs(feeDiscountSpec); |
| | | Assert.listOnlyOne(feeDiscountSpecs, "查询打折规格表错误!"); |
| | | //获取月份 |
| | |
| | | } |
| | | //提交线上退费 |
| | | returnOnlinePayMoney(feeDetailDto); |
| | | |
| | | } |
| | | //不通过 |
| | | if ("1200".equals(reqJson.getString("state"))) { |
| | |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public void updateReturnPayFee(JSONObject paramInJson) { |
| | | |
| | | ReturnPayFeeDto returnPayFeeDto = new ReturnPayFeeDto(); |
| | | returnPayFeeDto.setReturnFeeId(paramInJson.getString("returnFeeId")); |
| | | List<ReturnPayFeeDto> returnPayFeeDtos = returnPayFeeInnerServiceSMOImpl.queryReturnPayFees(returnPayFeeDto); |
| | | |
| | | Assert.listOnlyOne(returnPayFeeDtos, "未找到需要修改的活动 或多条数据"); |
| | | |
| | | |
| | | JSONObject businessReturnPayFee = new JSONObject(); |
| | | businessReturnPayFee.putAll(BeanConvertUtil.beanCovertMap(returnPayFeeDtos.get(0))); |
| | | businessReturnPayFee.putAll(paramInJson); |
| | |
| | | } |
| | | |
| | | public void updateFeeDetail(JSONObject paramInJson) { |
| | | |
| | | FeeDetailDto feeDetailDto = new FeeDetailDto(); |
| | | feeDetailDto.setDetailId(paramInJson.getString("detailId")); |
| | | List<FeeDetailDto> feeDetailDtos = feeDetailInnerServiceSMOImpl.queryFeeDetails(feeDetailDto); |
| | | Assert.listOnlyOne(feeDetailDtos, "未找到需要修改的活动 或多条数据"); |
| | | |
| | | JSONObject businessReturnPayFee = new JSONObject(); |
| | | businessReturnPayFee.putAll(BeanConvertUtil.beanCovertMap(feeDetailDtos.get(0))); |
| | | businessReturnPayFee.putAll(paramInJson); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public void addFeeDetail(JSONObject paramInJson) { |
| | | |
| | | JSONObject businessReturnPayFee = new JSONObject(); |
| | | businessReturnPayFee.putAll(paramInJson); |
| | | businessReturnPayFee.put("detailId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_detailId)); |
| | |
| | | int flag = payFeeV1InnerServiceSMOImpl.updatePayFee(payFeePo); |
| | | if (flag < 1) { |
| | | throw new CmdException("更新数据失败"); |
| | | } |
| | | } |
| | | |
| | | //收据相关操作 |
| | | public void dealFeeReceipt(JSONObject paramInJson) { |
| | | //添加收据 |
| | | FeeReceiptPo feeReceiptPo = new FeeReceiptPo(); |
| | | feeReceiptPo.setReceiptId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_receiptId)); |
| | | feeReceiptPo.setCommunityId(paramInJson.getString("communityId")); |
| | | feeReceiptPo.setObjType(paramInJson.getString("payerObjType")); //收据对象 3333 房屋 6666 车位车辆 |
| | | feeReceiptPo.setObjId(paramInJson.getString("payerObjId")); //对象ID |
| | | feeReceiptPo.setObjName(paramInJson.getString("payerObjName")); //对象名称 |
| | | double receivedAmount = unum(paramInJson.getString("receivedAmount")); |
| | | feeReceiptPo.setAmount(String.valueOf(receivedAmount)); //总金额 |
| | | feeReceiptPo.setRemark("退费收据"); |
| | | String payObjId = ""; |
| | | String payObjName = ""; |
| | | String roomArea = ""; |
| | | if (!StringUtil.isEmpty(paramInJson.getString("payerObjType")) && paramInJson.getString("payerObjType").equals("3333")) { //房屋 |
| | | OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto(); |
| | | ownerRoomRelDto.setRoomId(paramInJson.getString("payerObjId")); |
| | | List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto); |
| | | Assert.listOnlyOne(ownerRoomRelDtos, "查询房屋错误!"); |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setOwnerId(ownerRoomRelDtos.get(0).getOwnerId()); |
| | | ownerDto.setOwnerTypeCd("1001"); //1001 业主本人 1002 家庭成员 |
| | | List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto); |
| | | Assert.listOnlyOne(ownerDtos, "查询业主信息错误!"); |
| | | payObjId = ownerDtos.get(0).getOwnerId(); |
| | | payObjName = ownerDtos.get(0).getName(); |
| | | } else if (!StringUtil.isEmpty(paramInJson.getString("payerObjType")) && paramInJson.getString("payerObjType").equals("6666")) { //车辆 |
| | | OwnerCarDto ownerCarDto = new OwnerCarDto(); |
| | | ownerCarDto.setCarId(paramInJson.getString("payerObjId")); |
| | | List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto); |
| | | Assert.listOnlyOne(ownerCarDtos, "查询业主车辆错误!"); |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setOwnerId(ownerCarDtos.get(0).getOwnerId()); |
| | | ownerDto.setOwnerTypeCd("1001"); //1001 业主本人 1002 家庭成员 |
| | | List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto); |
| | | Assert.listOnlyOne(ownerDtos, "查询业主信息错误!"); |
| | | payObjId = ownerDtos.get(0).getOwnerId(); |
| | | payObjName = ownerDtos.get(0).getName(); |
| | | } |
| | | feeReceiptPo.setPayObjId(payObjId); //付费人id |
| | | feeReceiptPo.setPayObjName(payObjName); //付费人姓名 |
| | | int i = feeReceiptInnerServiceSMOImpl.saveFeeReceipt(feeReceiptPo); |
| | | if (i < 1) { |
| | | throw new CmdException("添加收据失败"); |
| | | } |
| | | //添加收据详情 |
| | | FeeReceiptDetailPo feeReceiptDetailPo = new FeeReceiptDetailPo(); |
| | | feeReceiptDetailPo.setDetailId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_detailId)); |
| | | feeReceiptDetailPo.setReceiptId(feeReceiptPo.getReceiptId()); //收据id |
| | | feeReceiptDetailPo.setFeeId(paramInJson.getString("feeId")); //费用id |
| | | feeReceiptDetailPo.setFeeName(paramInJson.getString("feeName")); |
| | | if (!StringUtil.isEmpty(paramInJson.getString("payerObjType")) && paramInJson.getString("payerObjType").equals("3333")) { //房屋 |
| | | RoomDto roomDto = new RoomDto(); |
| | | roomDto.setRoomId(paramInJson.getString("payerObjId")); |
| | | List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto); |
| | | Assert.listOnlyOne(roomDtos, "查询房屋错误!"); |
| | | roomArea = roomDtos.get(0).getRoomArea(); |
| | | } |
| | | feeReceiptDetailPo.setArea(roomArea); //面积/用量 |
| | | feeReceiptDetailPo.setStartTime(paramInJson.getString("startTime")); |
| | | feeReceiptDetailPo.setEndTime(paramInJson.getString("endTime")); |
| | | feeReceiptDetailPo.setAmount(feeReceiptPo.getAmount()); |
| | | feeReceiptDetailPo.setCycle(paramInJson.getString("cycles")); |
| | | feeReceiptDetailPo.setCommunityId(paramInJson.getString("communityId")); |
| | | int flag = feeReceiptDetailInnerServiceSMOImpl.saveFeeReceiptDetail(feeReceiptDetailPo); |
| | | if (flag < 1) { |
| | | throw new CmdException("添加收据详情失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | * @param feeDetailDto |
| | | */ |
| | | private void returnOnlinePayMoney(FeeDetailDto feeDetailDto) { |
| | | |
| | | if(StringUtil.isEmpty(feeDetailDto.getPayOrderId())){ |
| | | if (StringUtil.isEmpty(feeDetailDto.getPayOrderId())) { |
| | | return; |
| | | } |
| | | |
| | | OnlinePayDto onlinePayDto = new OnlinePayDto(); |
| | | onlinePayDto.setOrderId(feeDetailDto.getPayOrderId()); |
| | | List<OnlinePayDto> onlinePayDtos = onlinePayV1InnerServiceSMOImpl.queryOnlinePays(onlinePayDto); |
| | | if (onlinePayDtos == null || onlinePayDtos.size() < 1) { |
| | | return; |
| | | } |
| | | |
| | | OnlinePayPo onlinePayPo = new OnlinePayPo(); |
| | | onlinePayPo.setOrderId(onlinePayDtos.get(0).getOrderId()); |
| | | onlinePayPo.setPayId(onlinePayDtos.get(0).getPayId()); |
| | |
| | | onlinePayPo.setRefundFee(feeDetailDto.getReceivedAmount()); |
| | | onlinePayV1InnerServiceSMOImpl.updateOnlinePay(onlinePayPo); |
| | | } |
| | | |
| | | } |