| @@ -91,7 +91,7 @@ public class WxBillOtherDepositController extends BaseController { | |||||
| @SystemControllerLog(description = "其它账单-退回押金") | @SystemControllerLog(description = "其它账单-退回押金") | ||||
| public ResultData returnDeposit(@RequestBody WxBillOtherDeposit wxBillDeposit) { | public ResultData returnDeposit(@RequestBody WxBillOtherDeposit wxBillDeposit) { | ||||
| logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::returnDeposit"); | logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::returnDeposit"); | ||||
| return wxBillOtherDepositService.returnDeposit(wxBillDeposit); | |||||
| return wxBillOtherDepositService.returnDeposit(wxBillDeposit, getUser()); | |||||
| } | } | ||||
| @@ -50,7 +50,7 @@ public interface WxBillOtherDepositService { | |||||
| ResultData updatePaid(Long id); | ResultData updatePaid(Long id); | ||||
| ResultData returnDeposit(WxBillOtherDeposit wxBillDeposit); | |||||
| ResultData returnDeposit(WxBillOtherDeposit wxBillDeposit, MallUserInfo user); | |||||
| ResultData adjustDeposit(WxBillOtherDeposit wxBillDeposit); | ResultData adjustDeposit(WxBillOtherDeposit wxBillDeposit); | ||||
| } | } | ||||
| @@ -210,7 +210,7 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData returnDeposit(WxBillOtherDeposit record) { | |||||
| public ResultData returnDeposit(WxBillOtherDeposit record, MallUserInfo user) { | |||||
| logger.info("其他押金退还"); | logger.info("其他押金退还"); | ||||
| WxBillOtherDeposit wxBillDeposit = wxBillOtherDepositMapper.selectByPrimaryKey(record.getId()); | WxBillOtherDeposit wxBillDeposit = wxBillOtherDepositMapper.selectByPrimaryKey(record.getId()); | ||||
| if (wxBillDeposit == null) { | if (wxBillDeposit == null) { | ||||
| @@ -222,10 +222,29 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||||
| try { | try { | ||||
| wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); | wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("租赁押金退还失败,e:" + e.getMessage()); | |||||
| logger.error("押金退还失败,e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | ||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "租赁押金退还成功", wxBillDeposit); | |||||
| //日志 | |||||
| WxBillAction wxBillAction = new WxBillAction(); | |||||
| wxBillAction.setBillId(wxBillDeposit.getId()); | |||||
| String message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); | |||||
| String price = new BigDecimal(record.getReturnPrice()).divide(new BigDecimal(100)).toPlainString(); | |||||
| wxBillAction.setDetails(message + price + "元"); | |||||
| wxBillAction.setAction(EnumBillAction.DEPOSIT_RETURN.getCode()); | |||||
| wxBillAction.setUserId(user.getId()); | |||||
| wxBillAction.setUserName(user.getName()); | |||||
| wxBillAction.setPhone(user.getPhone()); | |||||
| wxBillAction.setTenantId(wxBillDeposit.getTenantId()); | |||||
| try { | |||||
| wxBillActionService.save(wxBillAction); | |||||
| } catch (Exception e) { | |||||
| logger.error("添加其他押金账单行为日志,e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||||
| } | |||||
| return new ResultData(Result.SUCCESS, "押金退还成功", wxBillDeposit); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -677,6 +677,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| //修改flowRecord | //修改flowRecord | ||||
| WxFlowRecord fr = new WxFlowRecord(); | WxFlowRecord fr = new WxFlowRecord(); | ||||
| fr.setBusinessId(id); | fr.setBusinessId(id); | ||||
| fr.setCurrStatus(EnumRentContractAppStatus.CANCLE.getCode()); | |||||
| wxFlowRecordMapper.updateCurrStatus(fr); | wxFlowRecordMapper.updateCurrStatus(fr); | ||||
| logger.info("合同id:{},开始停止...", id); | logger.info("合同id:{},开始停止...", id); | ||||
| @@ -759,7 +760,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| long[] priceArr = new long[arraySize]; | long[] priceArr = new long[arraySize]; | ||||
| for (int i = 0; i < arraySize; i++) { | for (int i = 0; i < arraySize; i++) { | ||||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | ||||
| priceArr[i] = new BigDecimal(rentInfoObject.getString("price")).multiply(new BigDecimal(100)).longValue(); | |||||
| //年 需要除12 | |||||
| if(EnumPriceUnit.Y.getCode().equals(priceUnit)){ | |||||
| BigDecimal yprice = new BigDecimal(rentInfoObject.getString("price")).divide(new BigDecimal(12),2, BigDecimal.ROUND_HALF_DOWN); | |||||
| priceArr[i] = yprice.multiply(new BigDecimal(100)).longValue(); | |||||
| }else{ | |||||
| priceArr[i] = new BigDecimal(rentInfoObject.getString("price")).multiply(new BigDecimal(100)).longValue(); | |||||
| } | |||||
| } | } | ||||
| priceList.add(priceArr); | priceList.add(priceArr); | ||||
| //大于一年 | //大于一年 | ||||