| @@ -493,6 +493,10 @@ public class WxBillAllController extends BillBaseController { | |||
| @PostMapping("updateReceivePay") | |||
| public ResultData updateReceivePay(@RequestBody WxBillReceiveUpdateDTO dto) { | |||
| dto.updateTenantInfo(getTenantInfo()); | |||
| //如果是管理费,默认一个商业管理费 | |||
| if (dto.getBillTypeValue().intValue() == Constant.bill_all_type_manage_fee) { | |||
| dto.setBillTypeValue(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); | |||
| } | |||
| billAllHelper.updateReceivePay(dto, getUser(), false); | |||
| return new ResultData(); | |||
| //return wxBillAllService.updateReceivePay(wxBillAll, getUser(),false); | |||
| @@ -501,6 +505,10 @@ public class WxBillAllController extends BillBaseController { | |||
| @PostMapping("pay") | |||
| public ResultData pay(@RequestBody WxBillPayDTO dto) { | |||
| dto.updateTenantInfo(getTenantInfo()); | |||
| //如果是管理费,默认一个商业管理费 | |||
| if (dto.getBillTypeValue().intValue() == Constant.bill_all_type_manage_fee) { | |||
| dto.setBillTypeValue(EnumBillAllType.RENT_BUSSINESS_MANAGE.getCode()); | |||
| } | |||
| billAllHelper.updatePay(dto, getUser()); | |||
| return new ResultData(); | |||
| //return wxBillAllService.updateReceivePay(wxBillAll, getUser(),false); | |||
| @@ -136,7 +136,6 @@ public class WxBillDailyController extends BillBaseController { | |||
| } | |||
| @PostMapping("update") | |||
| @SystemControllerLog(description = "日常账单-更新") | |||
| public ResultData update(@RequestBody WxBillDaily wxBillDaily) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::update"); | |||
| MallUserInfo user = getUser(); | |||
| @@ -156,7 +155,6 @@ public class WxBillDailyController extends BillBaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "日常账单-id查找") | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillDailyService.getById(this.getTenantInfo(),id)); | |||
| @@ -136,6 +136,12 @@ public class WxBillDepositController extends BillBaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDepositController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillDepositService.getById(id)); | |||
| } | |||
| @GetMapping("/detail") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData detail(Long id) { | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillDepositService.detail(this.getTenantInfo(),id)); | |||
| } | |||
| @GetMapping("/updatePaid") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @@ -111,7 +111,6 @@ public class WxBillOtherController extends BillBaseController { | |||
| } | |||
| @PostMapping("update") | |||
| @SystemControllerLog(description = "其它账单-更新") | |||
| public ResultData update(@RequestBody WxBillOther wxBillOther) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherController::update"); | |||
| MallUserInfo user = getUser(); | |||
| @@ -112,7 +112,6 @@ public class WxBillOtherDepositController extends BillBaseController { | |||
| } | |||
| @PostMapping("update") | |||
| @SystemControllerLog(description = "其它押金账单-更新") | |||
| public ResultData update(@RequestBody WxBillOtherDeposit wxBillOtherDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::update"); | |||
| MallUserInfo user = getUser(); | |||
| @@ -136,6 +136,14 @@ public class WxBillPropertyDepositController extends BillBaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillPropertyDepositService.getById(id)); | |||
| } | |||
| @GetMapping("/detail") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "物业押金账单-id查找") | |||
| public ResultData detail(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillPropertyDepositService.detail(this.getTenantInfo() ,id)); | |||
| } | |||
| @GetMapping("/updatePaid") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @@ -108,7 +108,7 @@ public class WxBillRentManageController extends BillBaseController { | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData detail(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillRentController::detail"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillRentManageService.getById(this.getTenantInfo(),id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillRentManageService.detail(this.getTenantInfo(),id)); | |||
| } | |||
| @PostMapping("add") | |||
| @@ -16,6 +16,9 @@ public class WxBillReceiveUpdateDTO extends TenantEntity{ | |||
| private String oldPrice;//原应付金额 | |||
| private String newPrice;//调整后应付金额 | |||
| private String serviceChargePayBefore;//原应付服务费 | |||
| private String serviceChargePayUpdate;//调整后应付服务费 | |||
| private String pay;//缴费金额 | |||
| private String oldLatePrice;//原应付滞纳金 | |||
| @@ -1,5 +1,8 @@ | |||
| package com.iformall.domain.po; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| @@ -10,6 +13,7 @@ import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.Date; | |||
| import java.util.Iterator; | |||
| import java.util.List; | |||
| /** | |||
| @@ -77,4 +81,16 @@ public class WxBillPropertyDeposit extends WxBillBaseEntity { | |||
| @TableField(exist = false) | |||
| private List<Long> merchantIds; | |||
| public String getShopNumberByShopInfo() { | |||
| StringBuffer sb = new StringBuffer(""); | |||
| String rentInfo = this.getShopInfo(); | |||
| if (!StringUtils.isBlank(rentInfo)) { | |||
| JSONObject rentInfoObject = JSONArray.parseObject(rentInfo); | |||
| for (Iterator<String> it = rentInfoObject.keySet().iterator();it.hasNext();) { | |||
| sb.append(it.next()).append(","); | |||
| } | |||
| } | |||
| return sb.toString(); | |||
| } | |||
| } | |||
| @@ -1,5 +1,7 @@ | |||
| package com.iformall.domain.po; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.common.SortColumn; | |||
| @@ -237,6 +239,23 @@ public class WxPropertyContract extends TenantEntity { | |||
| } | |||
| } | |||
| } | |||
| public String getRentInfoShopNumber() { | |||
| StringBuffer sb = new StringBuffer(""); | |||
| String rentInfo = this.getRentInfo(); | |||
| if (!StringUtils.isBlank(rentInfo)) { | |||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| int size = rentInfoArray.size(); | |||
| for (int i = 0; i < size; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| String shopNumber = rentInfoObject.getString("shopNumber"); | |||
| if (StringUtils.isNotBlank(shopNumber)) { | |||
| sb.append(shopNumber).append(","); | |||
| } | |||
| } | |||
| } | |||
| return sb.toString(); | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "合同类型", name = "contractType") | |||
| private Integer contractType; | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.service; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| @@ -13,6 +14,7 @@ import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillDeposit; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxPayAccountBill; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxBillHotNotify; | |||
| import com.iformall.domain.vo.WxBillSum; | |||
| @@ -38,6 +40,8 @@ public interface WxBillDepositService { | |||
| */ | |||
| WxBillDeposit getById(Long id); | |||
| Map detail(TenantEntity tenantEntity,Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.service; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| @@ -13,6 +14,7 @@ import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillPropertyDeposit; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxPayAccountBill; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxBillHotNotify; | |||
| import com.iformall.domain.vo.WxBillSum; | |||
| @@ -40,6 +42,7 @@ public interface WxBillPropertyDepositService { | |||
| * @return | |||
| */ | |||
| WxBillPropertyDeposit getById(Long id); | |||
| Map detail(TenantEntity tenantEntity ,Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| @@ -13,6 +13,7 @@ import com.iformall.domain.vo.WxBillHotNotify; | |||
| import com.iformall.domain.vo.WxBillSum; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| @@ -39,6 +40,8 @@ public interface WxBillRentManageService { | |||
| */ | |||
| WxBillRentManage getById(TenantEntity tenantEntity,Long id); | |||
| Map detail(TenantEntity tenantEntity,Long id); | |||
| PageInfo<WxBillRentManage> findByRentContractId(WxBillRentManage record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| @@ -266,70 +266,12 @@ public class WxBillDailyServiceImpl extends WxBillBaseService implements WxBillD | |||
| } | |||
| return new ResultData(Result.SUCCESS, "保存日常账单成功"); | |||
| } else { | |||
| logger.info("更新日常押金账单"); | |||
| WxBillDaily wxBillDaily = wxBillDailyMapper.selectById(record.getId()); | |||
| if(wxBillDaily==null){ | |||
| return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); | |||
| } | |||
| String price = ""; | |||
| String message = ""; | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| wxBillDaily.setServiceChargePay(record.getServiceChargePayUpdate()); | |||
| //wxBillDaily.setOwe(new BigDecimal(wxBillDaily.getReceivePay()).add(new BigDecimal(wxBillDaily.getServiceChargePay())) | |||
| // .subtract(new BigDecimal(wxBillDaily.getPay())).toPlainString()); | |||
| //wxBillDaily.setOwe(new BigDecimal(wxBillDaily.getReceivePay()).subtract(new BigDecimal(wxBillDaily.getPay())).toPlainString()); | |||
| }else{ | |||
| String addpay = wxBillDaily.getPay(); | |||
| wxBillDaily.setPayDate(record.getPayDate()); | |||
| wxBillDaily.setPay(record.getPay()); | |||
| wxBillDaily.setReceivePay(record.getReceivePay()); | |||
| //wxBillDaily.setOwe(new BigDecimal(record.getRealReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); | |||
| //wxBillDaily.setOwe(new BigDecimal(record.getReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); | |||
| if (record.getPay().equals(record.getRealReceivePay())) { | |||
| wxBillDaily.setStatus(EnumBillStatus.PAID.getCode()); | |||
| Date payDate = record.getPayDate(); | |||
| Date receiveDate = wxBillDaily.getReceiveDate(); | |||
| wxBillDaily.setExpiredDay(0L); | |||
| if (payDate.after(receiveDate)) { | |||
| int expiredDay = DateUtils.daysBetween(receiveDate, payDate); | |||
| wxBillDaily.setExpiredDay((long) expiredDay); | |||
| } | |||
| } | |||
| wxBillDaily.setPayDate(record.getPayDate()); | |||
| wxBillDaily.setUpdatetime(date); | |||
| wxBillDaily.setPayWay(record.getPayWay()); | |||
| wxBillDaily.setPriceDetail(record.getPriceDetail()); | |||
| message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); | |||
| price = new BigDecimal(record.getPay()).subtract(new BigDecimal(addpay)).toPlainString(); | |||
| } | |||
| try { | |||
| wxBillDailyMapper.updateById(wxBillDaily); | |||
| } catch (Exception e) { | |||
| logger.error("更新日常账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| //日志 | |||
| WxBillAction wxBillAction = new WxBillAction(); | |||
| wxBillAction.setBillId(wxBillDaily.getId()); | |||
| wxBillAction.setDetails(message + price + "元"); | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| wxBillAction.setDetails(record.getServiceChargePayBefore() + "元变更为" + record.getServiceChargePayUpdate() + "元"); | |||
| wxBillAction.setAction(EnumBillAction.UPDATE_SERVICE_MONEY.getCode()); | |||
| }else{ | |||
| wxBillAction.setAction(EnumBillAction.OFFLINE_PAY.getCode()); | |||
| } | |||
| wxBillAction.setUserId(user.getId()); | |||
| wxBillAction.setUserName(user.getName()); | |||
| wxBillAction.setPhone(user.getPhone()); | |||
| wxBillAction.updateTenantInfo(user); | |||
| wxBillAction.setPayDate(wxBillDaily.getPayDate()); | |||
| try { | |||
| wxBillActionService.save(wxBillAction); | |||
| } catch (Exception e) { | |||
| logger.error("添加日常账单行为日志,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| WxBillDaily wxBillDaily = wxBillDailyMapper.selectById(record.getId()); | |||
| if(wxBillDaily==null){ | |||
| return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); | |||
| } | |||
| wxBillDaily.setUpdatetime(date); | |||
| wxBillDailyMapper.updateById(wxBillDaily); | |||
| return new ResultData(Result.SUCCESS, "更新日常账单成功"); | |||
| } | |||
| } | |||
| @@ -504,6 +446,11 @@ public class WxBillDailyServiceImpl extends WxBillBaseService implements WxBillD | |||
| wxBillDailyMapper.updateById(wxBillDaily); | |||
| this.addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, dto.getBillTypeValue(), dto.getId(), | |||
| dto.getOldLatePrice(), dto.getNewLatePrice(),null,dto.getRemark(), user); | |||
| }else if (StringUtils.isNotBlank(dto.getServiceChargePayBefore()) && StringUtils.isNotBlank(dto.getServiceChargePayUpdate())) { | |||
| wxBillDaily.setServiceChargePay(dto.getServiceChargePayUpdate()); | |||
| wxBillDailyMapper.updateById(wxBillDaily); | |||
| this.addBillAction(EnumBillAction.UPDATE_SERVICE_MONEY, dto.getBillTypeValue(), dto.getId(), | |||
| dto.getServiceChargePayBefore(), dto.getServiceChargePayUpdate(),null,dto.getRemark(), user); | |||
| } else { | |||
| //租赁账单更新 | |||
| wxBillDaily.setReceivePay(dto.getNewPrice()); | |||
| @@ -19,12 +19,14 @@ import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxPayAccountBill; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxBillHotNotify; | |||
| import com.iformall.domain.vo.WxBillSum; | |||
| import com.iformall.enums.EnumBillAction; | |||
| import com.iformall.enums.EnumBillPayWay; | |||
| import com.iformall.enums.EnumBillStatus; | |||
| import com.iformall.enums.EnumDelStatus; | |||
| import com.iformall.enums.EnumRentContractType; | |||
| import com.iformall.enums.EnumRentShopType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillDepositMapper; | |||
| @@ -140,7 +142,6 @@ public class WxBillDepositServiceImpl extends WxBillBaseService implements WxBil | |||
| List<Long> rentContractIdList = wxBillDepositMapper.findRentContractIds(record); | |||
| Map<Long,WxRentContract> rentContractMap = new HashMap<Long,WxRentContract>(); | |||
| Map<Long,WxBillDeposit> billDepositMap = new HashMap<Long,WxBillDeposit>(); | |||
| if ( null != rentContractIdList && rentContractIdList.size() > 0 ) { | |||
| WxRentContract rcq = new WxRentContract(); | |||
| rcq.updateTenantInfo(record); | |||
| @@ -239,6 +240,29 @@ public class WxBillDepositServiceImpl extends WxBillBaseService implements WxBil | |||
| record.setId(id); | |||
| return wxBillDepositMapper.queryBillDepositList(record).get(0); | |||
| } | |||
| @Override | |||
| public Map detail(TenantEntity tenantEntity, Long id) { | |||
| WxBillDeposit record = new WxBillDeposit(); | |||
| record.updateTenantInfo(tenantEntity); | |||
| record.setId(id); | |||
| PageInfo<WxBillDeposit> page = this.listAsPage(record, 1, 1); | |||
| WxBillDeposit deposit = null; | |||
| WxRentContract wxRentContract = null; | |||
| if (null != page && null != page.getList()) { | |||
| deposit = page.getList().get(0); | |||
| //合同 | |||
| wxRentContract = wxRentContractMapper.selectById(deposit.getRentContractId()); | |||
| if (null != wxRentContract) { | |||
| wxRentContract.setTypeName(EnumRentContractType.getEnum(wxRentContract.getType()).getMessage()); | |||
| } | |||
| } | |||
| Map<String, Object> result = new HashMap<>(3); | |||
| result.put("despoit", deposit); | |||
| result.put("wxRentContract", wxRentContract); | |||
| return result; | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillDeposit record, MallUserInfo user) { | |||
| @@ -264,52 +288,7 @@ public class WxBillDepositServiceImpl extends WxBillBaseService implements WxBil | |||
| } | |||
| return new ResultData(Result.SUCCESS, "保存租赁押金账单成功"); | |||
| } else { | |||
| logger.info("更新租赁押金账单"); | |||
| WxBillDeposit wxBillDeposit = wxBillDepositMapper.selectById(record.getId()); | |||
| if(wxBillDeposit==null){ | |||
| return new ResultData(ErrorCode.BILL_RENT_DEPOSIT_IS_NOT_FOUND); | |||
| } | |||
| String addpay = wxBillDeposit.getPay(); | |||
| wxBillDeposit.setPay(record.getPay()); | |||
| wxBillDeposit.setReceivePay(record.getReceivePay()); | |||
| //wxBillDeposit.setOwe(new BigDecimal(receivepay).subtract(new BigDecimal(pay)).toPlainString()); | |||
| if (record.getPay().equals(record.getReceivePay())) { | |||
| wxBillDeposit.setStatus(EnumBillStatus.PAID.getCode()); | |||
| Date receiveDate = wxBillDeposit.getReceiveDate(); | |||
| wxBillDeposit.setExpiredDay(0L); | |||
| if (date.after(receiveDate)) { | |||
| int expiredDay = DateUtils.daysBetween(receiveDate, date); | |||
| wxBillDeposit.setExpiredDay((long) expiredDay); | |||
| } | |||
| } | |||
| wxBillDeposit.setPayDate(date); | |||
| wxBillDeposit.setUpdatetime(date); | |||
| wxBillDeposit.setPayWay(record.getPayWay()); | |||
| try { | |||
| wxBillDepositMapper.updateById(wxBillDeposit); | |||
| } catch (Exception e) { | |||
| logger.error("更新租赁押金账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| // //日志 | |||
| // WxBillAction wxBillAction = new WxBillAction(); | |||
| // wxBillAction.setBillId(wxBillDeposit.getId()); | |||
| // String message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); | |||
| // String price = new BigDecimal(record.getPay() - addpay).divide(new BigDecimal(100)).toPlainString(); | |||
| // wxBillAction.setDetails(message + price + "元"); | |||
| // wxBillAction.setAction(EnumBillAction.OFFLINE_PAY.getCode()); | |||
| // wxBillAction.setUserId(user.getId()); | |||
| // wxBillAction.setUserName(user.getName()); | |||
| // wxBillAction.setPhone(user.getPhone()); | |||
| // wxBillAction.updateTenantInfo(user); | |||
| // wxBillAction.setPayDate(wxBillDeposit.getPayDate()); | |||
| // 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); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -440,16 +419,26 @@ public class WxBillDepositServiceImpl extends WxBillBaseService implements WxBil | |||
| wxBillDeposit.setStatus(EnumBillStatus.PAID.getCode()); | |||
| billDepositOldPrce = dbBill.getPay(); | |||
| billDepositNewPrce = dbBill.getPay(); | |||
| }else { | |||
| wxBillDepositMapper.updateById(wxBillDeposit); | |||
| this.addBillAction(EnumBillAction.DEPOSIT_MODIFY, dto.getBillTypeValue(),dto.getId(), billDepositOldPrce, | |||
| billDepositNewPrce,payDate, dto.getRemark(), user); | |||
| }else if (StringUtils.isNotBlank(dto.getServiceChargePayBefore()) && StringUtils.isNotBlank(dto.getServiceChargePayUpdate())) { | |||
| wxBillDeposit.setServiceChargePay(dto.getServiceChargePayUpdate()); | |||
| wxBillDepositMapper.updateById(wxBillDeposit); | |||
| this.addBillAction(EnumBillAction.UPDATE_SERVICE_MONEY, dto.getBillTypeValue(), dto.getId(), | |||
| dto.getServiceChargePayBefore(), dto.getServiceChargePayUpdate(),null,dto.getRemark(), user); | |||
| }else { | |||
| wxBillDeposit.setReceivePay(dto.getNewPrice()); | |||
| if (new BigDecimal(dto.getNewPrice()).compareTo(new BigDecimal(dbBill.getPay())) >= 0) { | |||
| wxBillDeposit.setStatus(EnumBillStatus.PAID.getCode()); | |||
| payDate = new Date(); | |||
| } | |||
| wxBillDeposit.setUpdatetime(new Date()); | |||
| payDate = new Date(); | |||
| wxBillDepositMapper.updateById(wxBillDeposit); | |||
| this.addBillAction(EnumBillAction.DEPOSIT_MODIFY, dto.getBillTypeValue(),dto.getId(), billDepositOldPrce, | |||
| billDepositNewPrce,payDate, dto.getRemark(), user); | |||
| } | |||
| this.addBillAction(EnumBillAction.DEPOSIT_MODIFY, dto.getBillTypeValue(),dto.getId(), billDepositOldPrce, | |||
| billDepositNewPrce,payDate, dto.getRemark(), user); | |||
| } | |||
| @Override | |||
| @@ -475,5 +464,4 @@ public class WxBillDepositServiceImpl extends WxBillBaseService implements WxBil | |||
| dto.getAddpay(), dto.getAddpay(),wxBillRent.getPayDate(), dto.getRemark(), user); | |||
| } | |||
| } | |||
| @@ -275,64 +275,8 @@ public class WxBillOtherDepositServiceImpl extends WxBillBaseService implements | |||
| if (wxBillOtherDeposit == null) { | |||
| return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); | |||
| } | |||
| String message = ""; | |||
| String price = ""; | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| wxBillOtherDeposit.setServiceChargePay(record.getServiceChargePayUpdate()); | |||
| //wxBillOtherDeposit.setOwe(new BigDecimal(wxBillOtherDeposit.getReceivePay()).add(new BigDecimal(wxBillOtherDeposit.getServiceChargePay())).subtract(new BigDecimal(wxBillOtherDeposit.getPay())).toPlainString()); | |||
| //wxBillOtherDeposit.setOwe(new BigDecimal(wxBillOtherDeposit.getReceivePay()).subtract(new BigDecimal(wxBillOtherDeposit.getPay())).toPlainString()); | |||
| }else{ | |||
| String addpay = wxBillOtherDeposit.getPay(); | |||
| wxBillOtherDeposit.setPayDate(record.getPayDate()); | |||
| wxBillOtherDeposit.setPay(record.getPay()); | |||
| wxBillOtherDeposit.setReceivePay(record.getReceivePay()); | |||
| //wxBillOtherDeposit.setOwe(new BigDecimal(record.getRealReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); | |||
| //wxBillOtherDeposit.setOwe(new BigDecimal(record.getReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); | |||
| if (record.getPay().equals(record.getRealReceivePay())) { | |||
| wxBillOtherDeposit.setStatus(EnumBillStatus.PAID.getCode()); | |||
| Date payDate = record.getPayDate(); | |||
| Date receiveDate = wxBillOtherDeposit.getReceiveDate(); | |||
| wxBillOtherDeposit.setExpiredDay(0L); | |||
| if (payDate.after(receiveDate)) { | |||
| int expiredDay = DateUtils.daysBetween(receiveDate, payDate); | |||
| wxBillOtherDeposit.setExpiredDay((long) expiredDay); | |||
| } | |||
| } | |||
| wxBillOtherDeposit.setPayDate(record.getPayDate()); | |||
| wxBillOtherDeposit.setUpdatetime(date); | |||
| wxBillOtherDeposit.setPayWay(record.getPayWay()); | |||
| wxBillOtherDeposit.setComments(record.getComments()); | |||
| message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); | |||
| price = new BigDecimal(record.getPay()).subtract(new BigDecimal(addpay)).toPlainString(); | |||
| } | |||
| try { | |||
| wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); | |||
| } catch (Exception e) { | |||
| logger.error("更新其他账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| //日志 | |||
| WxBillAction wxBillAction = new WxBillAction(); | |||
| wxBillAction.setBillId(wxBillOtherDeposit.getId()); | |||
| wxBillAction.setDetails(message + price + "元"); | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| wxBillAction.setDetails(record.getServiceChargePayBefore() + "元变更为" + record.getServiceChargePayUpdate() + "元"); | |||
| wxBillAction.setAction(EnumBillAction.UPDATE_SERVICE_MONEY.getCode()); | |||
| }else{ | |||
| wxBillAction.setAction(EnumBillAction.OFFLINE_PAY.getCode()); | |||
| } | |||
| wxBillAction.setUserId(user.getId()); | |||
| wxBillAction.setUserName(user.getName()); | |||
| wxBillAction.setPhone(user.getPhone()); | |||
| wxBillAction.updateTenantInfo(user); | |||
| wxBillAction.setPayDate(wxBillOtherDeposit.getPayDate()); | |||
| try { | |||
| wxBillActionService.save(wxBillAction); | |||
| } catch (Exception e) { | |||
| logger.error("添加其他押金账单行为日志,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| wxBillOtherDeposit.setUpdatetime(date); | |||
| wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); | |||
| return new ResultData(Result.SUCCESS, "更新其他账单成功"); | |||
| } | |||
| } | |||
| @@ -459,19 +403,29 @@ public class WxBillOtherDepositServiceImpl extends WxBillBaseService implements | |||
| wxBillOtherDeposit.updateTenantInfo(dto); | |||
| wxBillOtherDeposit.setUpdatetime(new Date()); | |||
| if (forcePaid) { | |||
| wxBillOtherDeposit.setReceivePay(dbBill.getPay()); | |||
| wxBillOtherDeposit.setStatus(EnumBillStatus.PAID.getCode()); | |||
| wxBillOtherDeposit.setReceivePay(dbBill.getPay()); | |||
| wxBillOtherDeposit.setStatus(EnumBillStatus.PAID.getCode()); | |||
| wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); | |||
| //账单日志 | |||
| this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), | |||
| dto.getOldPrice(), dto.getNewPrice(),null, dto.getRemark(), user); | |||
| }else if (StringUtils.isNotBlank(dto.getServiceChargePayBefore()) && StringUtils.isNotBlank(dto.getServiceChargePayUpdate())) { | |||
| wxBillOtherDeposit.setServiceChargePay(dto.getServiceChargePayUpdate()); | |||
| wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); | |||
| this.addBillAction(EnumBillAction.UPDATE_SERVICE_MONEY, dto.getBillTypeValue(), dto.getId(), | |||
| dto.getServiceChargePayBefore(), dto.getServiceChargePayUpdate(),null,dto.getRemark(), user); | |||
| }else { | |||
| wxBillOtherDeposit.setReceivePay(dto.getNewPrice()); | |||
| Date payDate = null; | |||
| if (new BigDecimal(dto.getNewPrice()).compareTo(new BigDecimal(dbBill.getPay())) >= 0) { | |||
| wxBillOtherDeposit.setStatus(EnumBillStatus.PAID.getCode()); | |||
| payDate = new Date(); | |||
| } | |||
| wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); | |||
| //账单日志 | |||
| this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), | |||
| dto.getOldPrice(), dto.getNewPrice(),payDate, dto.getRemark(), user); | |||
| } | |||
| wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); | |||
| //账单日志 | |||
| this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), | |||
| dto.getOldPrice(), dto.getNewPrice(),null, dto.getRemark(), user); | |||
| } | |||
| @Override | |||
| @@ -274,66 +274,8 @@ public class WxBillOtherServiceImpl extends WxBillBaseService implements WxBillO | |||
| if(wxBillOther==null){ | |||
| return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); | |||
| } | |||
| String message = ""; | |||
| String price = ""; | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| wxBillOther.setServiceChargePay(record.getServiceChargePayUpdate()); | |||
| //wxBillOther.setOwe(new BigDecimal(wxBillOther.getReceivePay()).add(new BigDecimal(wxBillOther.getServiceChargePay())).subtract(new BigDecimal(wxBillOther.getPay())).toPlainString()); | |||
| //wxBillOther.setOwe(new BigDecimal(wxBillOther.getReceivePay()).subtract(new BigDecimal(wxBillOther.getPay())).toPlainString()); | |||
| }else{ | |||
| String addpay = wxBillOther.getPay(); | |||
| wxBillOther.setPayDate(record.getPayDate()); | |||
| wxBillOther.setPay(record.getPay()); | |||
| wxBillOther.setReceivePay(record.getReceivePay()); | |||
| //wxBillOther.setOwe(new BigDecimal(record.getRealReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); | |||
| //wxBillOther.setOwe(new BigDecimal(record.getReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); | |||
| if (record.getPay().equals(record.getRealReceivePay())) { | |||
| wxBillOther.setStatus(EnumBillStatus.PAID.getCode()); | |||
| Date payDate = record.getPayDate(); | |||
| Date receiveDate = wxBillOther.getReceiveDate(); | |||
| wxBillOther.setExpiredDay(0L); | |||
| if (payDate.after(receiveDate)) { | |||
| int expiredDay = DateUtils.daysBetween(receiveDate, payDate); | |||
| wxBillOther.setExpiredDay((long) expiredDay); | |||
| } | |||
| } | |||
| wxBillOther.setPayDate(record.getPayDate()); | |||
| wxBillOther.setUpdatetime(date); | |||
| wxBillOther.setPayWay(record.getPayWay()); | |||
| wxBillOther.setComments(record.getComments()); | |||
| wxBillOther.setName(record.getName()); | |||
| message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); | |||
| price = new BigDecimal(record.getPay()).subtract(new BigDecimal(addpay)).toPlainString(); | |||
| } | |||
| try { | |||
| wxBillOtherMapper.updateById(wxBillOther); | |||
| } catch (Exception e) { | |||
| logger.error("更新其他押金账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| //日志 | |||
| WxBillAction wxBillAction = new WxBillAction(); | |||
| wxBillAction.setBillId(wxBillOther.getId()); | |||
| wxBillAction.setDetails(message + price + "元"); | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| wxBillAction.setDetails(record.getServiceChargePayBefore() + "元变更为" + record.getServiceChargePayUpdate() + "元"); | |||
| wxBillAction.setAction(EnumBillAction.UPDATE_SERVICE_MONEY.getCode()); | |||
| }else{ | |||
| wxBillAction.setAction(EnumBillAction.OFFLINE_PAY.getCode()); | |||
| } | |||
| wxBillAction.setUserId(user.getId()); | |||
| wxBillAction.setUserName(user.getName()); | |||
| wxBillAction.setPhone(user.getPhone()); | |||
| wxBillAction.updateTenantInfo(user); | |||
| wxBillAction.setPayDate(wxBillOther.getPayDate()); | |||
| try { | |||
| wxBillActionService.save(wxBillAction); | |||
| } catch (Exception e) { | |||
| logger.error("添加其他押金账单行为日志,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| wxBillOther.setUpdatetime(date); | |||
| wxBillOtherMapper.updateById(wxBillOther); | |||
| return new ResultData(Result.SUCCESS, "更新其他押金账单成功"); | |||
| } | |||
| } | |||
| @@ -405,16 +347,29 @@ public class WxBillOtherServiceImpl extends WxBillBaseService implements WxBillO | |||
| if (forcePaid) { | |||
| wxBillOther.setReceivePay(dbBill.getPay()); | |||
| wxBillOther.setStatus(EnumBillStatus.PAID.getCode()); | |||
| wxBillOtherMapper.updateById(wxBillOther); | |||
| //账单日志 | |||
| this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), | |||
| dto.getOldPrice(), dto.getNewPrice(),null, dto.getRemark(), user); | |||
| }else if (StringUtils.isNotBlank(dto.getServiceChargePayBefore()) && StringUtils.isNotBlank(dto.getServiceChargePayUpdate())) { | |||
| wxBillOther.setServiceChargePay(dto.getServiceChargePayUpdate()); | |||
| wxBillOtherMapper.updateById(wxBillOther); | |||
| this.addBillAction(EnumBillAction.UPDATE_SERVICE_MONEY, dto.getBillTypeValue(), dto.getId(), | |||
| dto.getServiceChargePayBefore(), dto.getServiceChargePayUpdate(),null,dto.getRemark(), user); | |||
| }else { | |||
| wxBillOther.setReceivePay(dto.getNewPrice()); | |||
| Date payDate = null; | |||
| if (new BigDecimal(dto.getNewPrice()).compareTo(new BigDecimal(dbBill.getPay())) >= 0) { | |||
| wxBillOther.setStatus(EnumBillStatus.PAID.getCode()); | |||
| payDate = new Date(); | |||
| } | |||
| wxBillOtherMapper.updateById(wxBillOther); | |||
| //账单日志 | |||
| this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), | |||
| dto.getOldPrice(), dto.getNewPrice(),payDate, dto.getRemark(), user); | |||
| } | |||
| wxBillOtherMapper.updateById(wxBillOther); | |||
| //账单日志 | |||
| this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), | |||
| dto.getOldPrice(), dto.getNewPrice(),null, dto.getRemark(), user); | |||
| } | |||
| @Override | |||
| @@ -16,7 +16,9 @@ import com.iformall.domain.po.WxBillPropertyDeposit; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxPayAccountBill; | |||
| import com.iformall.domain.po.WxPropertyContract; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxBillHotNotify; | |||
| import com.iformall.domain.vo.WxBillSum; | |||
| import com.iformall.enums.EnumBillAction; | |||
| @@ -26,6 +28,8 @@ import com.iformall.enums.EnumDelStatus; | |||
| import com.iformall.enums.EnumRentShopType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillPropertyDepositMapper; | |||
| import com.iformall.mapper.WxBillPropertyMapper; | |||
| import com.iformall.mapper.WxPropertyContractMapper; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxBillActionService; | |||
| import com.iformall.service.WxBillPropertyDepositService; | |||
| @@ -62,6 +66,8 @@ public class WxBillPropertyDepositServiceImpl extends WxBillBaseService implemen | |||
| @Autowired | |||
| WxBillPropertyDepositMapper wxBillPropertyDepositMapper; | |||
| @Autowired | |||
| WxPropertyContractMapper wxPropertyContractMapper; | |||
| @Autowired | |||
| WxBillActionService wxBillActionService; | |||
| @Autowired | |||
| WxPayAccountBillService wxPayAccountBillService; | |||
| @@ -126,9 +132,9 @@ public class WxBillPropertyDepositServiceImpl extends WxBillBaseService implemen | |||
| wq.updateTenantInfo(record); | |||
| Map<Long,WxMerchant> merchantMap = wxMerchantService.findMerchantMap(wq); | |||
| WxShop sq = new WxShop(); | |||
| sq.updateTenantInfo(record); | |||
| Map<Long,WxShop> shopMap = wxShopService.findShopMap(sq); | |||
| // WxShop sq = new WxShop(); | |||
| // sq.updateTenantInfo(record); | |||
| // Map<Long,WxShop> shopMap = wxShopService.findShopMap(sq); | |||
| if (null != page.getList()) { | |||
| for (int i = 0 ; i < page.getList().size() ; i ++) { | |||
| @@ -142,13 +148,13 @@ public class WxBillPropertyDepositServiceImpl extends WxBillBaseService implemen | |||
| e.setMerchantName(m.getName()); | |||
| } | |||
| } | |||
| if (null != e.getShopId()) { | |||
| WxShop shop = shopMap.get(e.getShopId()); | |||
| if (null != shop) { | |||
| e.setShopNumber(shop.getShopNumber()); | |||
| } | |||
| } | |||
| e.setShopNumber(e.getShopNumberByShopInfo()); | |||
| // if (null != e.getShopId()) { | |||
| // WxShop shop = shopMap.get(e.getShopId()); | |||
| // if (null != shop) { | |||
| // e.setShopNumber(shop.getShopNumber()); | |||
| // } | |||
| // } | |||
| } | |||
| } | |||
| @@ -217,6 +223,24 @@ public class WxBillPropertyDepositServiceImpl extends WxBillBaseService implemen | |||
| record.setId(id); | |||
| return wxBillPropertyDepositMapper.queryBillDepositList(record).get(0); | |||
| } | |||
| @Override | |||
| public Map detail(TenantEntity tenantEntity, Long id) { | |||
| WxBillPropertyDeposit record = new WxBillPropertyDeposit(); | |||
| record.setId(id); | |||
| record.updateTenantInfo(tenantEntity); | |||
| PageInfo<WxBillPropertyDeposit> page = this.listAsPage(record, 1, 1); | |||
| WxBillPropertyDeposit deposit = null; | |||
| WxPropertyContract propertyContract = null; | |||
| if (null != page && null != page.getList()) { | |||
| deposit = page.getList().get(0); | |||
| propertyContract = wxPropertyContractMapper.selectById(deposit.getPropertyContractId()); | |||
| } | |||
| Map<String, Object> result = new HashMap<>(3); | |||
| result.put("deposit", deposit); | |||
| result.put("propertyContract", propertyContract); | |||
| return result; | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillPropertyDeposit record, MallUserInfo user) { | |||
| @@ -242,52 +266,7 @@ public class WxBillPropertyDepositServiceImpl extends WxBillBaseService implemen | |||
| } | |||
| return new ResultData(Result.SUCCESS, "保存物业押金账单成功"); | |||
| } else { | |||
| logger.info("更新押金账单"); | |||
| WxBillPropertyDeposit wxBillDeposit = wxBillPropertyDepositMapper.selectById(record.getId()); | |||
| if(record==null){ | |||
| return new ResultData(ErrorCode.BILL_PROPERTY_DEPOSIT_IS_NOT_FOUND); | |||
| } | |||
| String addpay = wxBillDeposit.getPay(); | |||
| wxBillDeposit.setPay(record.getPay()); | |||
| wxBillDeposit.setReceivePay(record.getReceivePay()); | |||
| //wxBillDeposit.setOwe(new BigDecimal(receivepay).subtract(new BigDecimal(pay)).toPlainString()); | |||
| if (record.getPay().equals(record.getReceivePay())) { | |||
| wxBillDeposit.setStatus(EnumBillStatus.PAID.getCode()); | |||
| Date receiveDate = wxBillDeposit.getReceiveDate(); | |||
| wxBillDeposit.setExpiredDay(0L); | |||
| if (date.after(receiveDate)) { | |||
| int expiredDay = DateUtils.daysBetween(receiveDate, date); | |||
| wxBillDeposit.setExpiredDay((long) expiredDay); | |||
| } | |||
| } | |||
| wxBillDeposit.setPayDate(date); | |||
| wxBillDeposit.setUpdatetime(date); | |||
| wxBillDeposit.setPayWay(record.getPayWay()); | |||
| try { | |||
| wxBillPropertyDepositMapper.updateById(wxBillDeposit); | |||
| } catch (Exception e) { | |||
| logger.error("更新物业押金账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| //日志 | |||
| WxBillAction wxBillAction = new WxBillAction(); | |||
| wxBillAction.setBillId(wxBillDeposit.getId()); | |||
| String message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); | |||
| String price = new BigDecimal(record.getPay()).subtract(new BigDecimal(addpay)).toPlainString(); | |||
| wxBillAction.setDetails(message + price + "元"); | |||
| wxBillAction.setAction(EnumBillAction.OFFLINE_PAY.getCode()); | |||
| wxBillAction.setUserId(user.getId()); | |||
| wxBillAction.setUserName(user.getName()); | |||
| wxBillAction.setPhone(user.getPhone()); | |||
| wxBillAction.updateTenantInfo(user); | |||
| wxBillAction.setPayDate(wxBillDeposit.getPayDate()); | |||
| 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); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -417,17 +396,28 @@ public class WxBillPropertyDepositServiceImpl extends WxBillBaseService implemen | |||
| wxBillPropertyDeposit.setStatus(EnumBillStatus.PAID.getCode()); | |||
| billPropertyDepositOldPrce = dbBill.getPay(); | |||
| billPropertyDepositNewPrce = dbBill.getPay(); | |||
| wxBillPropertyDepositMapper.updateById(wxBillPropertyDeposit); | |||
| //账单日志 | |||
| this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), | |||
| billPropertyDepositOldPrce, billPropertyDepositNewPrce,null, dto.getRemark(), user); | |||
| }else if (StringUtils.isNotBlank(dto.getServiceChargePayBefore()) && StringUtils.isNotBlank(dto.getServiceChargePayUpdate())) { | |||
| wxBillPropertyDeposit.setServiceChargePay(dto.getServiceChargePayUpdate()); | |||
| wxBillPropertyDepositMapper.updateById(wxBillPropertyDeposit); | |||
| this.addBillAction(EnumBillAction.UPDATE_SERVICE_MONEY, dto.getBillTypeValue(), dto.getId(), | |||
| dto.getServiceChargePayBefore(), dto.getServiceChargePayUpdate(),null,dto.getRemark(), user); | |||
| }else { | |||
| wxBillPropertyDeposit.setReceivePay(dto.getNewPrice()); | |||
| Date payDate = null; | |||
| if (new BigDecimal(dto.getNewPrice()).compareTo(new BigDecimal(dbBill.getPay())) >= 0) { | |||
| wxBillPropertyDeposit.setStatus(EnumBillStatus.PAID.getCode()); | |||
| payDate = new Date(); | |||
| } | |||
| wxBillPropertyDepositMapper.updateById(wxBillPropertyDeposit); | |||
| //账单日志 | |||
| this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), | |||
| billPropertyDepositOldPrce, billPropertyDepositNewPrce,payDate, dto.getRemark(), user); | |||
| } | |||
| wxBillPropertyDeposit.setUpdatetime(new Date()); | |||
| wxBillPropertyDepositMapper.updateById(wxBillPropertyDeposit); | |||
| //账单日志 | |||
| this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), | |||
| billPropertyDepositOldPrce, billPropertyDepositNewPrce,null, dto.getRemark(), user); | |||
| } | |||
| @Override | |||
| @@ -452,4 +442,6 @@ public class WxBillPropertyDepositServiceImpl extends WxBillBaseService implemen | |||
| this.addBillAction(EnumBillAction.OFFLINE_PAY, dto.getBillTypeValue(),dto.getId(), | |||
| dto.getAddpay(), dto.getAddpay(),wxBillRent.getPayDate(), dto.getRemark(), user); | |||
| } | |||
| } | |||
| @@ -135,7 +135,7 @@ public class WxBillPropertyServiceImpl extends WxBillBaseService implements WxBi | |||
| List<Long> propertyContractIdList = wxBillPropertyMapper.queryPropertyContractIdList(record); | |||
| Map<Long,WxPropertyContract> propertyContractMap = new HashMap<Long,WxPropertyContract>(); | |||
| Map<Long,WxBillPropertyDeposit> billDepositMap = new HashMap<Long,WxBillPropertyDeposit>(); | |||
| // Map<Long,WxBillPropertyDeposit> billDepositMap = new HashMap<Long,WxBillPropertyDeposit>(); | |||
| if ( null != propertyContractIdList && propertyContractIdList.size() > 0 ) { | |||
| WxPropertyContract rcq = new WxPropertyContract(); | |||
| rcq.updateTenantInfo(record); | |||
| @@ -148,16 +148,16 @@ public class WxBillPropertyServiceImpl extends WxBillBaseService implements WxBi | |||
| } | |||
| } | |||
| WxBillPropertyDeposit bdq = new WxBillPropertyDeposit(); | |||
| bdq.updateTenantInfo(record); | |||
| bdq.setPropertyContractIdList(propertyContractIdList); | |||
| List<WxBillPropertyDeposit> bdlist = wxBillPropertyDepositMapper.findList(bdq); | |||
| if (null != bdlist && bdlist.size() > 0 ) { | |||
| for (int i = 0 ; i < bdlist.size(); i++) { | |||
| WxBillPropertyDeposit rc = bdlist.get(i); | |||
| billDepositMap.put(rc.getId(), rc); | |||
| } | |||
| } | |||
| // WxBillPropertyDeposit bdq = new WxBillPropertyDeposit(); | |||
| // bdq.updateTenantInfo(record); | |||
| // bdq.setPropertyContractIdList(propertyContractIdList); | |||
| // List<WxBillPropertyDeposit> bdlist = wxBillPropertyDepositMapper.findList(bdq); | |||
| // if (null != bdlist && bdlist.size() > 0 ) { | |||
| // for (int i = 0 ; i < bdlist.size(); i++) { | |||
| // WxBillPropertyDeposit rc = bdlist.get(i); | |||
| // billDepositMap.put(rc.getId(), rc); | |||
| // } | |||
| // } | |||
| } | |||
| WxMerchant wq = new WxMerchant(); | |||
| wq.updateTenantInfo(record); | |||
| @@ -193,13 +193,14 @@ public class WxBillPropertyServiceImpl extends WxBillBaseService implements WxBi | |||
| // e.setLatePayRatio(Integer.parseInt(rent.getLatePayRatio())); | |||
| // } | |||
| e.setLatePayDay(rent.getLatePayDay()); | |||
| e.setShopNumber(rent.getRentInfoShopNumber()); | |||
| } | |||
| WxBillPropertyDeposit bd = billDepositMap.get(e.getPropertyContractId()); | |||
| if (null != bd) { | |||
| e.setDeposit(bd.getReceivePay()); | |||
| e.setDepositStatus(bd.getStatus()); | |||
| } | |||
| // WxBillPropertyDeposit bd = billDepositMap.get(e.getPropertyContractId()); | |||
| // if (null != bd) { | |||
| // e.setDeposit(bd.getReceivePay()); | |||
| // e.setDepositStatus(bd.getStatus()); | |||
| // } | |||
| } | |||
| } | |||
| @@ -313,77 +314,7 @@ public class WxBillPropertyServiceImpl extends WxBillBaseService implements WxBi | |||
| } | |||
| return new ResultData(Result.SUCCESS, "保存物业账单成功"); | |||
| } else { | |||
| logger.info("更新物业账单"); | |||
| WxBillProperty property = wxBillPropertyMapper.selectById(record.getId()); | |||
| if (property == null) { | |||
| return new ResultData(ErrorCode.BILL_PROPERTY_IS_NOT_FOUND); | |||
| } | |||
| String message = ""; | |||
| String price = ""; | |||
| if (record.getServiceChargePayUpdate() != null) { | |||
| property.setServiceChargePay(record.getServiceChargePayUpdate()); | |||
| String latePayPrice = StringUtils.isBlank(property.getLatePayPrice()) ? "0" : property.getLatePayPrice(); | |||
| //property.setOwe(new BigDecimal(property.getReceivePay()).add(new BigDecimal(latePayPrice)) | |||
| // .add(new BigDecimal(property.getServiceChargePay())).subtract(new BigDecimal(property.getPay())).toPlainString()); | |||
| //property.setOwe(new BigDecimal(property.getReceivePay()).subtract(new BigDecimal(property.getPay())).toPlainString()); | |||
| } else { | |||
| String addpay = property.getPay(); | |||
| property.setRevenue(record.getRevenue()); | |||
| property.setLatePayRatio(record.getLatePayRatio()); | |||
| property.setLatePayTime(record.getLatePayTime()); | |||
| property.setLatePayStatus(record.getLatePayStatus()); | |||
| property.setPayDate(record.getPayDate()); | |||
| property.setPay(record.getPay()); | |||
| property.setReceivePay(record.getReceivePay()); | |||
| //property.setOwe(new BigDecimal(record.getRealReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); | |||
| //property.setOwe(new BigDecimal(record.getReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); | |||
| if (record.getPay().equals(record.getRealReceivePay())) { | |||
| property.setStatus(EnumBillStatus.PAID.getCode()); | |||
| Date payDate = record.getPayDate(); | |||
| Date receiveDate = property.getReceiveDate(); | |||
| property.setExpiredDay(0L); | |||
| if (payDate.after(receiveDate)) { | |||
| int expiredDay = DateUtils.daysBetween(receiveDate, payDate); | |||
| property.setExpiredDay((long) expiredDay); | |||
| } | |||
| } | |||
| property.setPayDate(record.getPayDate()); | |||
| property.setUpdatetime(date); | |||
| property.setPayWay(record.getPayWay()); | |||
| message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); | |||
| price = new BigDecimal(record.getPay()).subtract(new BigDecimal(addpay)).toPlainString(); | |||
| } | |||
| try { | |||
| wxBillPropertyMapper.updateById(property); | |||
| } catch (Exception e) { | |||
| logger.error("更新物业账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| //日志 | |||
| WxBillAction wxBillAction = new WxBillAction(); | |||
| wxBillAction.setBillId(property.getId()); | |||
| wxBillAction.setDetails(message + price + "元"); | |||
| if (record.getServiceChargePayUpdate() != null) { | |||
| wxBillAction.setDetails(record.getServiceChargePayBefore() + "元变更为" + record.getServiceChargePayUpdate() + "元"); | |||
| wxBillAction.setAction(EnumBillAction.UPDATE_SERVICE_MONEY.getCode()); | |||
| } else { | |||
| wxBillAction.setAction(EnumBillAction.OFFLINE_PAY.getCode()); | |||
| } | |||
| wxBillAction.setUserId(user.getId()); | |||
| wxBillAction.setUserName(user.getName()); | |||
| wxBillAction.setPhone(user.getPhone()); | |||
| wxBillAction.updateTenantInfo(user); | |||
| wxBillAction.setPayDate(property.getPayDate()); | |||
| 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, "更新物业账单成功", property); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -430,20 +361,22 @@ public class WxBillPropertyServiceImpl extends WxBillBaseService implements WxBi | |||
| public Object detail(TenantEntity tenantEntity,Long id) { | |||
| //物业 | |||
| WxBillProperty property = getById(tenantEntity,id); | |||
| //押金 | |||
| WxBillPropertyDeposit depositParam = new WxBillPropertyDeposit(); | |||
| depositParam.setPropertyContractId(property.getPropertyContractId()); | |||
| WxBillPropertyDeposit deposit = null; | |||
| List<WxBillPropertyDeposit> billDepositList = wxBillPropertyDepositMapper.queryBillDepositList(depositParam); | |||
| if (!billDepositList.isEmpty()) { | |||
| deposit = billDepositList.get(0); | |||
| //WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(property.getTenantId()); | |||
| //wxBillPropertyDepositService.computeTotalMoney(wxPayAccountBill, deposit); | |||
| //deposit.setOwe(deposit.getRealReceivePay() - deposit.getPay()); | |||
| } | |||
| WxPropertyContract propertyContract = wxPropertyContractMapper.selectById(property.getPropertyContractId()); | |||
| // //押金 | |||
| // WxBillPropertyDeposit depositParam = new WxBillPropertyDeposit(); | |||
| // depositParam.setPropertyContractId(property.getPropertyContractId()); | |||
| // WxBillPropertyDeposit deposit = null; | |||
| // List<WxBillPropertyDeposit> billDepositList = wxBillPropertyDepositMapper.queryBillDepositList(depositParam); | |||
| // if (!billDepositList.isEmpty()) { | |||
| // deposit = billDepositList.get(0); | |||
| // //WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(property.getTenantId()); | |||
| // //wxBillPropertyDepositService.computeTotalMoney(wxPayAccountBill, deposit); | |||
| // //deposit.setOwe(deposit.getRealReceivePay() - deposit.getPay()); | |||
| // } | |||
| Map<String, Object> result = new HashMap<>(2); | |||
| result.put("property", property); | |||
| result.put("deposit", deposit); | |||
| result.put("propertyContract", propertyContract); | |||
| // result.put("deposit", deposit); | |||
| return result; | |||
| } | |||
| @@ -558,6 +491,11 @@ public class WxBillPropertyServiceImpl extends WxBillBaseService implements WxBi | |||
| wxBillPropertyMapper.updateById(wxBillProperty); | |||
| this.addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, dto.getBillTypeValue(), dto.getId(), | |||
| dto.getOldLatePrice(), dto.getNewLatePrice(),null,dto.getRemark(), user); | |||
| }else if (StringUtils.isNotBlank(dto.getServiceChargePayBefore()) && StringUtils.isNotBlank(dto.getServiceChargePayUpdate())) { | |||
| wxBillProperty.setServiceChargePay(dto.getServiceChargePayUpdate()); | |||
| wxBillPropertyMapper.updateById(wxBillProperty); | |||
| this.addBillAction(EnumBillAction.UPDATE_SERVICE_MONEY, dto.getBillTypeValue(), dto.getId(), | |||
| dto.getServiceChargePayBefore(), dto.getServiceChargePayUpdate(),null,dto.getRemark(), user); | |||
| } else { | |||
| Date payDate = null; | |||
| wxBillProperty.setReceivePay(dto.getNewPrice()); | |||
| @@ -154,6 +154,7 @@ public class WxBillRentManageServiceImpl extends WxBillBaseService implements W | |||
| // e.setLatePayRatio(Integer.parseInt(rent.getLatePayRatio())); | |||
| // } | |||
| //e.setLatePayDay(rent.getLatePayDay()); | |||
| e.setShopNumber(rent.getRentInfoShopNumber()); | |||
| } | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| @@ -187,73 +188,7 @@ public class WxBillRentManageServiceImpl extends WxBillBaseService implements W | |||
| } | |||
| return new ResultData(Result.SUCCESS, "保存租赁账单成功"); | |||
| } else { | |||
| logger.info("更新租赁账单"); | |||
| WxBillRentManage wxBillRent = wxBillRentManageMapper.selectById(record.getId()); | |||
| if(wxBillRent==null){ | |||
| return new ResultData(ErrorCode.BILL_RENT_IS_NOT_FOUND); | |||
| } | |||
| String price = ""; | |||
| String message =""; | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| wxBillRent.setServiceChargePay(record.getServiceChargePayUpdate()); | |||
| String latePayPrice = StringUtils.isBlank(wxBillRent.getLatePayPrice()) ? "0" : wxBillRent.getLatePayPrice(); | |||
| //wxBillRent.setOwe(new BigDecimal(wxBillRent.getReceivePay()).add(new BigDecimal(latePayPrice)).add(new BigDecimal(wxBillRent.getServiceChargePay())) | |||
| // .subtract(new BigDecimal(wxBillRent.getPay())).toPlainString()); | |||
| //wxBillRent.setOwe(new BigDecimal(wxBillRent.getReceivePay()).subtract(new BigDecimal(wxBillRent.getPay())).toPlainString()); | |||
| }else{ | |||
| String addpay = wxBillRent.getPay(); | |||
| wxBillRent.setLatePayRatio(record.getLatePayRatio()); | |||
| wxBillRent.setLatePayTime(record.getLatePayTime()); | |||
| wxBillRent.setLatePayStatus(record.getLatePayStatus()); | |||
| wxBillRent.setPay(record.getPay()); | |||
| wxBillRent.setReceivePay(record.getReceivePay()); | |||
| //wxBillRent.setOwe(new BigDecimal(receivepay).subtract(new BigDecimal(pay)).toPlainString()); | |||
| if (record.getPay().equals(record.getRealReceivePay())) { | |||
| wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); | |||
| Date payDate = record.getPayDate(); | |||
| Date receiveDate = wxBillRent.getReceiveDate(); | |||
| wxBillRent.setExpiredDay(0L); | |||
| if (payDate.after(receiveDate)) { | |||
| int expiredDay = DateUtils.daysBetween(receiveDate, payDate); | |||
| wxBillRent.setExpiredDay((long) expiredDay); | |||
| } | |||
| } | |||
| wxBillRent.setPayDate(record.getPayDate()); | |||
| wxBillRent.setUpdatetime(date); | |||
| wxBillRent.setPayWay(record.getPayWay()); | |||
| price = new BigDecimal(record.getPay()).subtract(new BigDecimal(addpay)).toPlainString(); | |||
| } | |||
| try { | |||
| wxBillRentManageMapper.updateById(wxBillRent); | |||
| } catch (Exception e) { | |||
| logger.error("更新租赁账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| //日志 | |||
| WxBillAction wxBillAction = new WxBillAction(); | |||
| wxBillAction.setBillId(wxBillRent.getId()); | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| wxBillAction.setDetails(record.getServiceChargePayBefore()+"元变更为" +record.getServiceChargePayUpdate()+"元"); | |||
| wxBillAction.setAction(EnumBillAction.UPDATE_SERVICE_MONEY.getCode()); | |||
| }else{ | |||
| wxBillAction.setAction(EnumBillAction.OFFLINE_PAY.getCode()); | |||
| message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); | |||
| wxBillAction.setDetails(message + price + "元"); | |||
| } | |||
| wxBillAction.setUserId(user.getId()); | |||
| wxBillAction.setUserName(user.getName()); | |||
| wxBillAction.setPhone(user.getPhone()); | |||
| wxBillAction.updateTenantInfo(wxBillRent); | |||
| wxBillAction.setPayDate(wxBillRent.getPayDate()); | |||
| 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, "更新租赁账单成功", wxBillRent); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -270,6 +205,17 @@ public class WxBillRentManageServiceImpl extends WxBillBaseService implements W | |||
| return rentManage; | |||
| } | |||
| @Override | |||
| public Map detail(TenantEntity tenantEntity, Long id) { | |||
| WxBillRentManage manage = getById(tenantEntity, id); | |||
| //合同 | |||
| WxRentContract wxRentContract = wxRentContractMapper.selectById(manage.getRentContractId()); | |||
| Map<String, Object> result = new HashMap<>(3); | |||
| result.put("manage", manage); | |||
| result.put("wxRentContract", wxRentContract); | |||
| return result; | |||
| } | |||
| @Override | |||
| public PageInfo<WxBillRentManage> findByRentContractId(WxBillRentManage record, Integer pageIndex, Integer pageSize) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | |||
| @@ -472,6 +418,11 @@ public class WxBillRentManageServiceImpl extends WxBillBaseService implements W | |||
| wxBillRentManageMapper.updateById(wxBillRent); | |||
| this.addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, dto.getBillTypeValue(),dto.getId(), | |||
| dto.getOldLatePrice(), dto.getNewLatePrice(),null,dto.getRemark(), user); | |||
| }else if (StringUtils.isNotBlank(dto.getServiceChargePayBefore()) && StringUtils.isNotBlank(dto.getServiceChargePayUpdate())) { | |||
| wxBillRent.setServiceChargePay(dto.getServiceChargePayUpdate()); | |||
| wxBillRentManageMapper.updateById(wxBillRent); | |||
| this.addBillAction(EnumBillAction.UPDATE_SERVICE_MONEY, dto.getBillTypeValue(), dto.getId(), | |||
| dto.getServiceChargePayBefore(), dto.getServiceChargePayUpdate(),null,dto.getRemark(), user); | |||
| } else { | |||
| //租赁账单更新 | |||
| wxBillRent.setReceivePay(dto.getNewPrice()); | |||
| @@ -183,75 +183,6 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe | |||
| } | |||
| return new ResultData(Result.SUCCESS, "保存租赁账单成功"); | |||
| } else { | |||
| // logger.info("更新租赁账单"); | |||
| // WxBillRent wxBillRent = wxBillRentMapper.selectById(record.getId()); | |||
| // if(wxBillRent==null){ | |||
| // return new ResultData(ErrorCode.BILL_RENT_IS_NOT_FOUND); | |||
| // } | |||
| // | |||
| // String price = ""; | |||
| // String message =""; | |||
| // if(record.getServiceChargePayUpdate() != null){ | |||
| // wxBillRent.setServiceChargePay(record.getServiceChargePayUpdate()); | |||
| // String latePayPrice = StringUtils.isBlank(wxBillRent.getLatePayPrice()) ? "0" : wxBillRent.getLatePayPrice(); | |||
| // //wxBillRent.setOwe(new BigDecimal(wxBillRent.getReceivePay()).add(new BigDecimal(latePayPrice)) | |||
| // // .add(new BigDecimal(wxBillRent.getServiceChargePay())).subtract(new BigDecimal(wxBillRent.getPay())).toPlainString()); | |||
| // //wxBillRent.setOwe(new BigDecimal(wxBillRent.getReceivePay()).subtract(new BigDecimal(wxBillRent.getPay())).toPlainString()); | |||
| // }else{ | |||
| // String addpay = wxBillRent.getPay(); | |||
| // wxBillRent.setRevenue(record.getRevenue()); | |||
| // wxBillRent.setLatePayRatio(record.getLatePayRatio()); | |||
| // wxBillRent.setLatePayTime(record.getLatePayTime()); | |||
| // wxBillRent.setLatePayStatus(record.getLatePayStatus()); | |||
| // wxBillRent.setPay(record.getPay()); | |||
| // wxBillRent.setReceivePay(record.getReceivePay()); | |||
| // //wxBillRent.setOwe(new BigDecimal(record.getRealReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); | |||
| // //wxBillRent.setOwe(new BigDecimal(record.getReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); | |||
| // if (record.getPay().equals(record.getRealReceivePay())) { | |||
| // wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); | |||
| // Date payDate = record.getPayDate(); | |||
| // Date receiveDate = wxBillRent.getReceiveDate(); | |||
| // wxBillRent.setExpiredDay(0L); | |||
| // if (payDate.after(receiveDate)) { | |||
| // int expiredDay = DateUtils.daysBetween(receiveDate, payDate); | |||
| // wxBillRent.setExpiredDay((long) expiredDay); | |||
| // } | |||
| // } | |||
| // wxBillRent.setPayDate(record.getPayDate()); | |||
| // wxBillRent.setUpdatetime(date); | |||
| // wxBillRent.setPayWay(record.getPayWay()); | |||
| // price = new BigDecimal(record.getPay()).subtract(new BigDecimal(addpay)).toPlainString(); | |||
| // } | |||
| // | |||
| // try { | |||
| // wxBillRentMapper.updateById(wxBillRent); | |||
| // } catch (Exception e) { | |||
| // logger.error("更新租赁账单失败,e:" + e.getMessage()); | |||
| // throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| // } | |||
| // //日志 | |||
| // WxBillAction wxBillAction = new WxBillAction(); | |||
| // wxBillAction.setBillId(wxBillRent.getId()); | |||
| // if(record.getServiceChargePayUpdate() != null){ | |||
| // wxBillAction.setDetails(record.getServiceChargePayBefore()+"元变更为" +record.getServiceChargePayUpdate()+"元"); | |||
| // wxBillAction.setAction(EnumBillAction.UPDATE_SERVICE_MONEY.getCode()); | |||
| // }else{ | |||
| // wxBillAction.setAction(EnumBillAction.OFFLINE_PAY.getCode()); | |||
| // message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); | |||
| // wxBillAction.setDetails(message + price + "元"); | |||
| // } | |||
| // wxBillAction.setUserId(user.getId()); | |||
| // wxBillAction.setUserName(user.getName()); | |||
| // wxBillAction.setPhone(user.getPhone()); | |||
| // wxBillAction.updateTenantInfo(wxBillRent); | |||
| // wxBillAction.setPayDate(wxBillRent.getPayDate()); | |||
| // 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, "更新租赁账单成功", wxBillRent); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -293,17 +224,17 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe | |||
| WxBillRent rent = getById(tenantEntity,id); | |||
| //合同 | |||
| WxRentContract wxRentContract = wxRentContractMapper.selectById(rent.getRentContractId()); | |||
| //押金 | |||
| WxBillDeposit depositParam = new WxBillDeposit(); | |||
| depositParam.setRentContractId(rent.getRentContractId()); | |||
| WxBillDeposit deposit = null; | |||
| List<WxBillDeposit> billDepositList = wxBillDepositMapper.queryBillDepositList(depositParam); | |||
| if (!billDepositList.isEmpty()) { | |||
| deposit = billDepositList.get(0); | |||
| //WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(rent.getTenantId()); | |||
| //wxBillDepositService.computeTotalMoney(wxPayAccountBill, deposit); | |||
| //deposit.setOwe(deposit.getRealReceivePay() - deposit.getPay()); | |||
| } | |||
| // //押金 | |||
| // WxBillDeposit depositParam = new WxBillDeposit(); | |||
| // depositParam.setRentContractId(rent.getRentContractId()); | |||
| // WxBillDeposit deposit = null; | |||
| // List<WxBillDeposit> billDepositList = wxBillDepositMapper.queryBillDepositList(depositParam); | |||
| // if (!billDepositList.isEmpty()) { | |||
| // deposit = billDepositList.get(0); | |||
| // //WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(rent.getTenantId()); | |||
| // //wxBillDepositService.computeTotalMoney(wxPayAccountBill, deposit); | |||
| // //deposit.setOwe(deposit.getRealReceivePay() - deposit.getPay()); | |||
| // } | |||
| //周期 | |||
| Map<String, Object> result = new HashMap<>(3); | |||
| result.put("rent", rent); | |||
| @@ -311,20 +242,20 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe | |||
| wxRentContract.setTypeName(EnumRentContractType.getEnum(wxRentContract.getType()).getMessage()); | |||
| } | |||
| result.put("wxRentContract", wxRentContract); | |||
| result.put("deposit", deposit); | |||
| // result.put("deposit", deposit); | |||
| //解单金额 | |||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| WxBillRent billRent = wxBillRentMapper.selectById(id); | |||
| WxMerchantTradeDaily merchantTradeDaily = new WxMerchantTradeDaily(); | |||
| merchantTradeDaily.setMerchantId(billRent.getMerchantId()); | |||
| merchantTradeDaily.setStartTime(sd.format(billRent.getStarttime())); | |||
| merchantTradeDaily.setEndTime(sd.format(billRent.getEndtime())); | |||
| merchantTradeDaily.updateTenantInfo(wxRentContract); | |||
| Integer money = wxMerchantTradeDailyService.findSumMoney(merchantTradeDaily); | |||
| String moneyStr = new BigDecimal(money.toString()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).toPlainString(); | |||
| result.put("solutionBillMoney", moneyStr); | |||
| // //解单金额 | |||
| // SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| // WxBillRent billRent = wxBillRentMapper.selectById(id); | |||
| // WxMerchantTradeDaily merchantTradeDaily = new WxMerchantTradeDaily(); | |||
| // merchantTradeDaily.setMerchantId(billRent.getMerchantId()); | |||
| // merchantTradeDaily.setStartTime(sd.format(billRent.getStarttime())); | |||
| // merchantTradeDaily.setEndTime(sd.format(billRent.getEndtime())); | |||
| // merchantTradeDaily.updateTenantInfo(wxRentContract); | |||
| // Integer money = wxMerchantTradeDailyService.findSumMoney(merchantTradeDaily); | |||
| // String moneyStr = new BigDecimal(money.toString()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).toPlainString(); | |||
| // result.put("solutionBillMoney", moneyStr); | |||
| return result; | |||
| } | |||
| @@ -530,7 +461,7 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe | |||
| List<Long> rentContractIdList = wxBillRentMapper.queryBillRentContractIdList(wxBillRent); | |||
| Map<Long,WxRentContract> rentContractMap = new HashMap<Long,WxRentContract>(); | |||
| Map<Long,WxBillDeposit> billDepositMap = new HashMap<Long,WxBillDeposit>(); | |||
| // Map<Long,WxBillDeposit> billDepositMap = new HashMap<Long,WxBillDeposit>(); | |||
| if ( null != rentContractIdList && rentContractIdList.size() > 0 ) { | |||
| WxRentContract rcq = new WxRentContract(); | |||
| rcq.updateTenantInfo(wxBillRent); | |||
| @@ -543,16 +474,16 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe | |||
| } | |||
| } | |||
| WxBillDeposit bdq = new WxBillDeposit(); | |||
| bdq.updateTenantInfo(wxBillRent); | |||
| bdq.setRentContractIdList(rentContractIdList); | |||
| List<WxBillDeposit> bdlist = wxBillDepositMapper.findList(bdq); | |||
| if (null != bdlist && bdlist.size() > 0 ) { | |||
| for (int i = 0 ; i < bdlist.size(); i++) { | |||
| WxBillDeposit rc = bdlist.get(i); | |||
| billDepositMap.put(rc.getId(), rc); | |||
| } | |||
| } | |||
| // WxBillDeposit bdq = new WxBillDeposit(); | |||
| // bdq.updateTenantInfo(wxBillRent); | |||
| // bdq.setRentContractIdList(rentContractIdList); | |||
| // List<WxBillDeposit> bdlist = wxBillDepositMapper.findList(bdq); | |||
| // if (null != bdlist && bdlist.size() > 0 ) { | |||
| // for (int i = 0 ; i < bdlist.size(); i++) { | |||
| // WxBillDeposit rc = bdlist.get(i); | |||
| // billDepositMap.put(rc.getId(), rc); | |||
| // } | |||
| // } | |||
| } | |||
| if (null != billRentList.getList()) { | |||
| @@ -580,11 +511,11 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| computeTotalMoney(decimalSize,wxPayAccountBill, e); | |||
| WxBillDeposit bd = billDepositMap.get(e.getRentContractId()); | |||
| if (null != bd) { | |||
| e.setDeposit(bd.getReceivePay()); | |||
| e.setDepositStatus(bd.getStatus()); | |||
| } | |||
| // WxBillDeposit bd = billDepositMap.get(e.getRentContractId()); | |||
| // if (null != bd) { | |||
| // e.setDeposit(bd.getReceivePay()); | |||
| // e.setDepositStatus(bd.getStatus()); | |||
| // } | |||
| @@ -652,7 +583,12 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe | |||
| wxBillRentMapper.updateById(wxBillRent); | |||
| this.addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, dto.getBillTypeValue(), dto.getId(), | |||
| dto.getOldLatePrice(), dto.getNewLatePrice(),null,dto.getRemark(), user); | |||
| } else { | |||
| }else if (StringUtils.isNotBlank(dto.getServiceChargePayBefore()) && StringUtils.isNotBlank(dto.getServiceChargePayUpdate())) { | |||
| wxBillRent.setServiceChargePay(dto.getServiceChargePayUpdate()); | |||
| wxBillRentMapper.updateById(wxBillRent); | |||
| this.addBillAction(EnumBillAction.UPDATE_SERVICE_MONEY, dto.getBillTypeValue(), dto.getId(), | |||
| dto.getServiceChargePayBefore(), dto.getServiceChargePayUpdate(),null,dto.getRemark(), user); | |||
| }else { | |||
| //租赁账单更新 | |||
| wxBillRent.setReceivePay(dto.getNewPrice()); | |||
| Date payDate = null; | |||