| @@ -47,7 +47,7 @@ public class WxBillDailyController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::add"); | |||
| wxBillDaily.setTenantId(getTenantId()); | |||
| wxBillDaily.setUserId(getUser().getId()); | |||
| return wxBillDailyService.saveOrUpdate(wxBillDaily); | |||
| return wxBillDailyService.saveOrUpdate(wxBillDaily, getUser()); | |||
| } | |||
| @PostMapping("update") | |||
| @@ -55,7 +55,7 @@ public class WxBillDailyController extends BaseController { | |||
| public ResultData update(@RequestBody WxBillDaily wxBillDaily) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::update"); | |||
| wxBillDaily.setUserId(getUser().getId()); | |||
| return wxBillDailyService.saveOrUpdate(wxBillDaily); | |||
| return wxBillDailyService.saveOrUpdate(wxBillDaily, getUser()); | |||
| } | |||
| @GetMapping("/del") | |||
| @@ -46,7 +46,7 @@ public class WxBillDepositController extends BaseController { | |||
| public ResultData add(@RequestBody WxBillDeposit wxBillDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDepositController::add"); | |||
| wxBillDeposit.setTenantId(getTenantId()); | |||
| return wxBillDepositService.saveOrUpdate(wxBillDeposit); | |||
| return wxBillDepositService.saveOrUpdate(wxBillDeposit, getUser()); | |||
| } | |||
| @@ -54,7 +54,7 @@ public class WxBillDepositController extends BaseController { | |||
| @SystemControllerLog(description = "租赁押金-更新") | |||
| public ResultData update(@RequestBody WxBillDeposit wxBillDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDepositController::update"); | |||
| return wxBillDepositService.saveOrUpdate(wxBillDeposit); | |||
| return wxBillDepositService.saveOrUpdate(wxBillDeposit, getUser()); | |||
| } | |||
| @@ -47,7 +47,7 @@ public class WxBillOtherController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherController::add"); | |||
| wxBillOther.setTenantId(getTenantId()); | |||
| wxBillOther.setUserId(getUser().getId()); | |||
| return wxBillOtherService.saveOrUpdate(wxBillOther); | |||
| return wxBillOtherService.saveOrUpdate(wxBillOther, getUser()); | |||
| } | |||
| @PostMapping("update") | |||
| @@ -55,7 +55,7 @@ public class WxBillOtherController extends BaseController { | |||
| public ResultData update(@RequestBody WxBillOther wxBillOther) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherController::update"); | |||
| wxBillOther.setUserId(getUser().getId()); | |||
| return wxBillOtherService.saveOrUpdate(wxBillOther); | |||
| return wxBillOtherService.saveOrUpdate(wxBillOther, getUser()); | |||
| } | |||
| @GetMapping("/del") | |||
| @@ -47,7 +47,7 @@ public class WxBillOtherDepositController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::add"); | |||
| wxBillOtherDeposit.setTenantId(getTenantId()); | |||
| wxBillOtherDeposit.setUserId(getUser().getId()); | |||
| return wxBillOtherDepositService.saveOrUpdate(wxBillOtherDeposit); | |||
| return wxBillOtherDepositService.saveOrUpdate(wxBillOtherDeposit, getUser()); | |||
| } | |||
| @PostMapping("update") | |||
| @@ -55,7 +55,7 @@ public class WxBillOtherDepositController extends BaseController { | |||
| public ResultData update(@RequestBody WxBillOtherDeposit wxBillOtherDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::update"); | |||
| wxBillOtherDeposit.setUserId(getUser().getId()); | |||
| return wxBillOtherDepositService.saveOrUpdate(wxBillOtherDeposit); | |||
| return wxBillOtherDepositService.saveOrUpdate(wxBillOtherDeposit, getUser()); | |||
| } | |||
| @GetMapping("/del") | |||
| @@ -47,7 +47,7 @@ public class WxBillPropertyController extends BaseController { | |||
| public ResultData add(@RequestBody WxBillProperty wxBillProperty) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyController::add"); | |||
| wxBillProperty.setTenantId(getTenantId()); | |||
| wxBillPropertyService.saveOrUpdate(wxBillProperty); | |||
| wxBillPropertyService.saveOrUpdate(wxBillProperty, getUser()); | |||
| return new ResultData(); | |||
| } | |||
| @@ -55,7 +55,7 @@ public class WxBillPropertyController extends BaseController { | |||
| @SystemControllerLog(description = "物业账单-更新") | |||
| public ResultData update(@RequestBody WxBillProperty wxBillProperty) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyController::update"); | |||
| wxBillPropertyService.saveOrUpdate(wxBillProperty); | |||
| wxBillPropertyService.saveOrUpdate(wxBillProperty, getUser()); | |||
| return new ResultData(); | |||
| } | |||
| @@ -4,7 +4,6 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillOtherDeposit; | |||
| import com.iformall.domain.po.WxBillPropertyDeposit; | |||
| import com.iformall.service.WxBillPropertyDepositService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -47,7 +46,7 @@ public class WxBillPropertyDepositController extends BaseController { | |||
| public ResultData add(@RequestBody WxBillPropertyDeposit wxBillPropertyDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::add"); | |||
| wxBillPropertyDeposit.setTenantId(getTenantId()); | |||
| wxBillPropertyDepositService.saveOrUpdate(wxBillPropertyDeposit); | |||
| wxBillPropertyDepositService.saveOrUpdate(wxBillPropertyDeposit, getUser()); | |||
| return new ResultData(); | |||
| } | |||
| @@ -55,7 +54,7 @@ public class WxBillPropertyDepositController extends BaseController { | |||
| @SystemControllerLog(description = "物业押金账单-更新") | |||
| public ResultData update(@RequestBody WxBillPropertyDeposit wxBillPropertyDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::update"); | |||
| return wxBillPropertyDepositService.saveOrUpdate(wxBillPropertyDeposit); | |||
| return wxBillPropertyDepositService.saveOrUpdate(wxBillPropertyDeposit, getUser()); | |||
| } | |||
| @GetMapping("/del") | |||
| @@ -47,14 +47,14 @@ public class WxBillRentController extends BaseController { | |||
| public ResultData add(@RequestBody WxBillRent wxBillRent) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillRentController::add"); | |||
| wxBillRent.setTenantId(getTenantId()); | |||
| return wxBillRentService.saveOrUpdate(wxBillRent); | |||
| return wxBillRentService.saveOrUpdate(wxBillRent, getUser()); | |||
| } | |||
| @PostMapping("update") | |||
| @SystemControllerLog(description = "租赁押金账单-更新") | |||
| public ResultData update(@RequestBody WxBillRent wxBillRent) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillRentController::update"); | |||
| return wxBillRentService.saveOrUpdate(wxBillRent); | |||
| return wxBillRentService.saveOrUpdate(wxBillRent, getUser()); | |||
| } | |||
| @GetMapping("/del") | |||
| @@ -10,7 +10,8 @@ public enum EnumBillAction { | |||
| UPDATE_BILL(2, "变更账单"), | |||
| OFFLINE_PAY(3, "线下缴费"), | |||
| DEPOSIT_PAY(4, "押金缴费"), | |||
| DEPOSIT_RETURN(5, "押金退款"),; | |||
| DEPOSIT_RETURN(5, "押金退款"), | |||
| DEPOSIT_MODIFY(6, "押金变更"),; | |||
| public static EnumBillAction getEnum(Integer code) { | |||
| for (EnumBillAction value : values()) { | |||
| @@ -4,11 +4,11 @@ package com.iformall.enums; | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumBillPayWay { | |||
| CASH(1, "现金"), | |||
| ALIPAY(2, "支付宝"), | |||
| WECHAT_PAY(3, "微信"), | |||
| BANK(4, "银行卡转账"), | |||
| OTHER(-1, "其他"); | |||
| CASH(1, "现金缴费"), | |||
| ALIPAY(2, "支付宝缴费"), | |||
| WECHAT_PAY(3, "微信缴费"), | |||
| BANK(4, "银行卡转账缴费"), | |||
| OTHER(-1, "其他缴费"); | |||
| public static EnumBillPayWay getEnum(Integer code) { | |||
| for (EnumBillPayWay value : values()) { | |||
| @@ -3,8 +3,13 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public interface WxBillActionService { | |||
| PageInfo<WxBillAction> listAsPage(WxBillAction record, Integer pageIndex, Integer pageSize); | |||
| int save(WxBillAction action); | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillDaily; | |||
| import java.util.Map; | |||
| @@ -34,9 +35,10 @@ public interface WxBillDailyService { | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| ResultData saveOrUpdate(WxBillDaily record); | |||
| * @param record | |||
| * @param user | |||
| */ | |||
| ResultData saveOrUpdate(WxBillDaily record, MallUserInfo user); | |||
| /** | |||
| * 根据Id删除实体 | |||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillDeposit; | |||
| import java.util.Map; | |||
| @@ -31,9 +32,10 @@ public interface WxBillDepositService { | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| ResultData saveOrUpdate(WxBillDeposit record); | |||
| * @param record | |||
| * @param user | |||
| */ | |||
| ResultData saveOrUpdate(WxBillDeposit record, MallUserInfo user); | |||
| /** | |||
| * 根据Id删除实体 | |||
| @@ -2,8 +2,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillDeposit; | |||
| import com.iformall.domain.po.WxBillOther; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillOtherDeposit; | |||
| import java.util.Map; | |||
| @@ -37,8 +36,9 @@ public interface WxBillOtherDepositService { | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| * @param user | |||
| */ | |||
| ResultData saveOrUpdate(WxBillOtherDeposit record); | |||
| ResultData saveOrUpdate(WxBillOtherDeposit record, MallUserInfo user); | |||
| /** | |||
| * 根据Id删除实体 | |||
| @@ -2,7 +2,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillOther; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillOther; | |||
| import java.util.Map; | |||
| @@ -35,9 +35,10 @@ public interface WxBillOtherService { | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| ResultData saveOrUpdate(WxBillOther record); | |||
| * @param record | |||
| * @param user | |||
| */ | |||
| ResultData saveOrUpdate(WxBillOther record, MallUserInfo user); | |||
| /** | |||
| * 根据Id删除实体 | |||
| @@ -2,7 +2,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillDeposit; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillPropertyDeposit; | |||
| import java.util.Map; | |||
| @@ -36,8 +36,9 @@ public interface WxBillPropertyDepositService { | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| * @param user | |||
| */ | |||
| ResultData saveOrUpdate(WxBillPropertyDeposit record); | |||
| ResultData saveOrUpdate(WxBillPropertyDeposit record, MallUserInfo user); | |||
| /** | |||
| * 根据Id删除实体 | |||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillProperty; | |||
| import java.util.Map; | |||
| @@ -36,8 +37,9 @@ public interface WxBillPropertyService { | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| * @param user | |||
| */ | |||
| ResultData saveOrUpdate(WxBillProperty record); | |||
| ResultData saveOrUpdate(WxBillProperty record, MallUserInfo user); | |||
| /** | |||
| * 根据Id删除实体 | |||
| @@ -3,6 +3,7 @@ package com.iformall.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| /** | |||
| @@ -34,8 +35,9 @@ public interface WxBillRentService { | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| * @param user | |||
| */ | |||
| ResultData saveOrUpdate(WxBillRent record); | |||
| ResultData saveOrUpdate(WxBillRent record, MallUserInfo user); | |||
| /** | |||
| * 根据Id删除实体 | |||
| @@ -2,6 +2,7 @@ package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.mapper.WxBillActionMapper; | |||
| import com.iformall.service.WxBillActionService; | |||
| @@ -10,6 +11,8 @@ import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.Date; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @@ -25,4 +28,14 @@ public class WxBillActionServiceImpl implements WxBillActionService { | |||
| logger.info("查询账单操作记录列表"); | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillActionMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public int save(WxBillAction action) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| action.setId(idWorker.nextId()); | |||
| Date date = new Date(); | |||
| action.setCreatetime(date); | |||
| action.setUpdatetime(date); | |||
| return wxBillActionMapper.insertSelective(action); | |||
| } | |||
| } | |||
| @@ -89,6 +89,12 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| @Autowired | |||
| MqBaseProducer mqBaseProducer; | |||
| @Autowired | |||
| WxBillActionService wxBillActionService; | |||
| @Autowired | |||
| WxMerchantBUserMapper wxMerchantBUserMapper; | |||
| @Override | |||
| public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { | |||
| //更新各账单状态 | |||
| @@ -195,6 +201,12 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| if(wxBillOther!=null && !wxBillOther.getStatus().equals(EnumBillRentStatus.PAID.getCode())){ | |||
| updateBillOther(bill); | |||
| } | |||
| } else if (billTypeValue == EnumBillTypeParam.ROUTINE.getCode().intValue()) { | |||
| //更新其他账单 | |||
| WxBillOtherDeposit wxBillOtherDeposit = wxBillOtherDepositMapper.selectByPrimaryKey(bill.get("id")); | |||
| if (wxBillOtherDeposit != null && !wxBillOtherDeposit.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { | |||
| updateBillOtherDeposit(bill); | |||
| } | |||
| } else { | |||
| logger.info("账单类型不存在"); | |||
| } | |||
| @@ -371,6 +383,49 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| } | |||
| } | |||
| */ | |||
| private int updateBillOtherDeposit(Map<String, Object> bill) { | |||
| logger.info("updateBillOtherDeposit params:" + bill.toString()); | |||
| Object id = bill.get("id"); | |||
| WxBillOtherDeposit wxBillOtherDeposit = wxBillOtherDepositMapper.selectByPrimaryKey(id); | |||
| if (wxBillOtherDeposit == null) { | |||
| return 0; | |||
| } | |||
| Date date = new Date(); | |||
| wxBillOtherDeposit.setPayDate(date); | |||
| Integer owe = (Integer) bill.get("owe"); | |||
| wxBillOtherDeposit.setPay(wxBillOtherDeposit.getPay() + owe); | |||
| wxBillOtherDeposit.setOwe(0); | |||
| wxBillOtherDeposit.setStatus(EnumBillDailyStatus.PAID.getCode()); | |||
| wxBillOtherDeposit.setUpdatetime(date); | |||
| wxBillOtherDeposit.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); | |||
| int count = 0; | |||
| try { | |||
| count = wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillOtherDeposit); | |||
| } catch (Exception e) { | |||
| logger.error("更新其他押金账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| //日志 | |||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bill.get("userId")); | |||
| WxBillAction wxBillAction = new WxBillAction(); | |||
| wxBillAction.setBillId(wxBillOtherDeposit.getId()); | |||
| String price = new BigDecimal(owe).divide(new BigDecimal(100)).toPlainString(); | |||
| wxBillAction.setDetails("线上缴费" + price + "元"); | |||
| wxBillAction.setAction(EnumBillAction.SELF_SERVICE_PAY.getCode()); | |||
| wxBillAction.setUserId(wxMerchantBUser.getId()); | |||
| wxBillAction.setUserName(wxMerchantBUser.getName()); | |||
| wxBillAction.setPhone(wxMerchantBUser.getPhone()); | |||
| wxBillAction.setTenantId(wxMerchantBUser.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 count; | |||
| } | |||
| private int updateBillOther(Map<String, Object> bill) { | |||
| logger.info("updateBillOther params:"+bill.toString()); | |||
| Object id = bill.get("id"); | |||
| @@ -385,12 +440,32 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| wxBillOther.setOwe(0); | |||
| wxBillOther.setStatus(EnumBillDailyStatus.PAID.getCode()); | |||
| wxBillOther.setUpdatetime(date); | |||
| wxBillOther.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); | |||
| int count = 0; | |||
| try { | |||
| return wxBillOtherMapper.updateByPrimaryKeySelective(wxBillOther); | |||
| count = wxBillOtherMapper.updateByPrimaryKeySelective(wxBillOther); | |||
| } catch (Exception e) { | |||
| logger.error("更新其他账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| //日志 | |||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bill.get("userId")); | |||
| WxBillAction wxBillAction = new WxBillAction(); | |||
| wxBillAction.setBillId(wxBillOther.getId()); | |||
| String price = new BigDecimal(owe).divide(new BigDecimal(100)).toPlainString(); | |||
| wxBillAction.setDetails("线上缴费" + price + "元"); | |||
| wxBillAction.setAction(EnumBillAction.SELF_SERVICE_PAY.getCode()); | |||
| wxBillAction.setUserId(wxMerchantBUser.getId()); | |||
| wxBillAction.setUserName(wxMerchantBUser.getName()); | |||
| wxBillAction.setPhone(wxMerchantBUser.getPhone()); | |||
| wxBillAction.setTenantId(wxMerchantBUser.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 count; | |||
| } | |||
| private int updateBillDaily(Map<String, Object> bill) { | |||
| @@ -407,12 +482,33 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| wxBillDaily.setOwe(0); | |||
| wxBillDaily.setStatus(EnumBillDailyStatus.PAID.getCode()); | |||
| wxBillDaily.setUpdatetime(date); | |||
| wxBillDaily.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); | |||
| int count = 0; | |||
| try { | |||
| return wxBillDailyMapper.updateByPrimaryKeySelective(wxBillDaily); | |||
| count = wxBillDailyMapper.updateByPrimaryKeySelective(wxBillDaily); | |||
| } catch (Exception e) { | |||
| logger.error("更新日常账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| //日志 | |||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bill.get("userId")); | |||
| WxBillAction wxBillAction = new WxBillAction(); | |||
| wxBillAction.setBillId(wxBillDaily.getId()); | |||
| String price = new BigDecimal(owe).divide(new BigDecimal(100)).toPlainString(); | |||
| wxBillAction.setDetails("线上缴费" + price + "元"); | |||
| wxBillAction.setAction(EnumBillAction.SELF_SERVICE_PAY.getCode()); | |||
| wxBillAction.setUserId(wxMerchantBUser.getId()); | |||
| wxBillAction.setUserName(wxMerchantBUser.getName()); | |||
| wxBillAction.setPhone(wxMerchantBUser.getPhone()); | |||
| wxBillAction.setTenantId(wxMerchantBUser.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 count; | |||
| } | |||
| private int updateBillPropertyDeposit(Map<String, Object> bill) { | |||
| @@ -429,12 +525,33 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| wxBillPropertyDeposit.setOwe(0); | |||
| wxBillPropertyDeposit.setStatus(EnumBillDailyStatus.PAID.getCode()); | |||
| wxBillPropertyDeposit.setUpdatetime(date); | |||
| wxBillPropertyDeposit.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); | |||
| int count = 0; | |||
| try { | |||
| return wxBillPropertyDepositMapper.updateByPrimaryKeySelective(wxBillPropertyDeposit); | |||
| count = wxBillPropertyDepositMapper.updateByPrimaryKeySelective(wxBillPropertyDeposit); | |||
| } catch (Exception e) { | |||
| logger.error("更新物业押金账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| //日志 | |||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bill.get("userId")); | |||
| WxBillAction wxBillAction = new WxBillAction(); | |||
| wxBillAction.setBillId(wxBillPropertyDeposit.getId()); | |||
| String price = new BigDecimal(owe).divide(new BigDecimal(100)).toPlainString(); | |||
| wxBillAction.setDetails("线上缴费" + price + "元"); | |||
| wxBillAction.setAction(EnumBillAction.SELF_SERVICE_PAY.getCode()); | |||
| wxBillAction.setUserId(wxMerchantBUser.getId()); | |||
| wxBillAction.setUserName(wxMerchantBUser.getName()); | |||
| wxBillAction.setPhone(wxMerchantBUser.getPhone()); | |||
| wxBillAction.setTenantId(wxMerchantBUser.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 count; | |||
| } | |||
| private int updateBillProperty(Map<String, Object> bill) { | |||
| @@ -451,12 +568,33 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| property.setOwe(0); | |||
| property.setStatus(EnumBillDailyStatus.PAID.getCode()); | |||
| property.setUpdatetime(date); | |||
| property.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); | |||
| int count = 0; | |||
| try { | |||
| return wxBillPropertyMapper.updateByPrimaryKeySelective(property); | |||
| count = wxBillPropertyMapper.updateByPrimaryKeySelective(property); | |||
| } catch (Exception e) { | |||
| logger.error("更新物业账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| //日志 | |||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bill.get("userId")); | |||
| WxBillAction wxBillAction = new WxBillAction(); | |||
| wxBillAction.setBillId(property.getId()); | |||
| String price = new BigDecimal(owe).divide(new BigDecimal(100)).toPlainString(); | |||
| wxBillAction.setDetails("线上缴费" + price + "元"); | |||
| wxBillAction.setAction(EnumBillAction.SELF_SERVICE_PAY.getCode()); | |||
| wxBillAction.setUserId(wxMerchantBUser.getId()); | |||
| wxBillAction.setUserName(wxMerchantBUser.getName()); | |||
| wxBillAction.setPhone(wxMerchantBUser.getPhone()); | |||
| wxBillAction.setTenantId(wxMerchantBUser.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 count; | |||
| } | |||
| private int updateBillRentDeposit(Map<String, Object> bill) { | |||
| @@ -473,12 +611,33 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| wxBillDeposit.setOwe(0); | |||
| wxBillDeposit.setStatus(EnumBillDailyStatus.PAID.getCode()); | |||
| wxBillDeposit.setUpdatetime(date); | |||
| wxBillDeposit.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); | |||
| int count = 0; | |||
| try { | |||
| return wxBillDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); | |||
| count = wxBillDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); | |||
| } catch (Exception e) { | |||
| logger.error("更新租赁押金账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| //日志 | |||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bill.get("userId")); | |||
| WxBillAction wxBillAction = new WxBillAction(); | |||
| wxBillAction.setBillId(wxBillDeposit.getId()); | |||
| String price = new BigDecimal(owe).divide(new BigDecimal(100)).toPlainString(); | |||
| wxBillAction.setDetails("线上缴费" + price + "元"); | |||
| wxBillAction.setAction(EnumBillAction.SELF_SERVICE_PAY.getCode()); | |||
| wxBillAction.setUserId(wxMerchantBUser.getId()); | |||
| wxBillAction.setUserName(wxMerchantBUser.getName()); | |||
| wxBillAction.setPhone(wxMerchantBUser.getPhone()); | |||
| wxBillAction.setTenantId(wxMerchantBUser.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 count; | |||
| } | |||
| private int updateBillRent(Map<String, Object> bill) { | |||
| @@ -495,12 +654,33 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| wxBillRent.setOwe(0); | |||
| wxBillRent.setStatus(EnumBillDailyStatus.PAID.getCode()); | |||
| wxBillRent.setUpdatetime(date); | |||
| wxBillRent.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); | |||
| int count = 0; | |||
| try { | |||
| return wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| count = wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| } catch (Exception e) { | |||
| logger.error("更新租金账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| //日志 | |||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bill.get("userId")); | |||
| WxBillAction wxBillAction = new WxBillAction(); | |||
| wxBillAction.setBillId(wxBillRent.getId()); | |||
| String price = new BigDecimal(owe).divide(new BigDecimal(100)).toPlainString(); | |||
| wxBillAction.setDetails("线上缴费" + price + "元"); | |||
| wxBillAction.setAction(EnumBillAction.SELF_SERVICE_PAY.getCode()); | |||
| wxBillAction.setUserId(wxMerchantBUser.getId()); | |||
| wxBillAction.setUserName(wxMerchantBUser.getName()); | |||
| wxBillAction.setPhone(wxMerchantBUser.getPhone()); | |||
| wxBillAction.setTenantId(wxMerchantBUser.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 count; | |||
| } | |||
| @@ -6,14 +6,15 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.domain.po.WxBillDaily; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.enums.EnumBillDailyStatus; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.enums.EnumDelStatus; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillDailyMapper; | |||
| import com.iformall.mapper.WxShopMapper; | |||
| import com.iformall.service.WxBillActionService; | |||
| import com.iformall.service.WxBillDailyService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.math.BigDecimal; | |||
| import java.util.*; | |||
| /** | |||
| @@ -35,6 +37,8 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| @Autowired | |||
| WxShopMapper wxShopMapper; | |||
| @Autowired | |||
| WxBillActionService wxBillActionService; | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillDaily record, Integer pageIndex, Integer pageSize) { | |||
| @@ -108,7 +112,7 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillDaily record) { | |||
| public ResultData saveOrUpdate(WxBillDaily record, MallUserInfo user) { | |||
| int receivepay = record.getReceivePay().intValue(); | |||
| int pay = record.getPay().intValue(); | |||
| if(pay>receivepay){ | |||
| @@ -145,12 +149,30 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| wxBillDaily.setOwe(record.getReceivePay()-record.getPay()); | |||
| wxBillDaily.setStatus(record.getPay().equals(record.getReceivePay()) ? EnumBillDailyStatus.PAID.getCode() : wxBillDaily.getStatus()); | |||
| wxBillDaily.setUpdatetime(new Date()); | |||
| wxBillDaily.setPayWay(record.getPayWay()); | |||
| try { | |||
| wxBillDailyMapper.updateByPrimaryKeySelective(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()); | |||
| String message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); | |||
| String price = new BigDecimal(record.getPay()).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.setTenantId(wxBillDaily.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, "更新日常账单成功"); | |||
| } | |||
| } | |||
| @@ -6,11 +6,16 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.domain.po.WxBillDeposit; | |||
| import com.iformall.enums.EnumBillAction; | |||
| import com.iformall.enums.EnumBillPayWay; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.enums.EnumDelStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillDepositMapper; | |||
| import com.iformall.service.WxBillActionService; | |||
| import com.iformall.service.WxBillDepositService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -18,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| @@ -33,6 +39,8 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||
| @Autowired | |||
| WxBillDepositMapper wxBillDepositMapper; | |||
| @Autowired | |||
| WxBillActionService wxBillActionService; | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize) { | |||
| @@ -92,7 +100,7 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillDeposit record) { | |||
| public ResultData saveOrUpdate(WxBillDeposit record, MallUserInfo user) { | |||
| int receivepay = record.getReceivePay().intValue(); | |||
| int pay = record.getPay().intValue(); | |||
| if(pay>receivepay){ | |||
| @@ -126,12 +134,30 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||
| wxBillDeposit.setOwe(record.getReceivePay()-record.getPay()); | |||
| wxBillDeposit.setStatus(record.getPay().equals(record.getReceivePay())?EnumBillRentStatus.PAID.getCode():wxBillDeposit.getStatus()); | |||
| wxBillDeposit.setUpdatetime(new Date()); | |||
| wxBillDeposit.setPayWay(record.getPayWay()); | |||
| try { | |||
| wxBillDepositMapper.updateByPrimaryKeySelective(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()).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.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); | |||
| } | |||
| } | |||
| @@ -6,14 +6,15 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.domain.po.WxBillOtherDeposit; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.enums.EnumBillDailyStatus; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.enums.EnumDelStatus; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillOtherDepositMapper; | |||
| import com.iformall.mapper.WxShopMapper; | |||
| import com.iformall.service.WxBillActionService; | |||
| import com.iformall.service.WxBillOtherDepositService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.math.BigDecimal; | |||
| import java.util.*; | |||
| /** | |||
| @@ -36,6 +38,10 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| @Autowired | |||
| WxShopMapper wxShopMapper; | |||
| @Autowired | |||
| WxBillActionService wxBillActionService; | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillOtherDeposit record, Integer pageIndex, Integer pageSize) { | |||
| //更新账单状态 | |||
| @@ -108,7 +114,7 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillOtherDeposit record) { | |||
| public ResultData saveOrUpdate(WxBillOtherDeposit record, MallUserInfo user) { | |||
| int receivepay = record.getReceivePay().intValue(); | |||
| int pay = record.getPay().intValue(); | |||
| if (pay > receivepay) { | |||
| @@ -144,12 +150,30 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| wxBillOtherDeposit.setOwe(record.getReceivePay() - record.getPay()); | |||
| wxBillOtherDeposit.setStatus(record.getPay().equals(record.getReceivePay()) ? EnumBillDailyStatus.PAID.getCode() : wxBillOtherDeposit.getStatus()); | |||
| wxBillOtherDeposit.setUpdatetime(new Date()); | |||
| wxBillOtherDeposit.setPayWay(record.getPayWay()); | |||
| try { | |||
| wxBillOtherDepositMapper.updateByPrimaryKeySelective(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()); | |||
| String message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); | |||
| String price = new BigDecimal(record.getPay()).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.setTenantId(wxBillOtherDeposit.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, "更新其他账单成功"); | |||
| } | |||
| } | |||
| @@ -6,14 +6,15 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.domain.po.WxBillOther; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.enums.EnumBillDailyStatus; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.enums.EnumDelStatus; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillOtherMapper; | |||
| import com.iformall.mapper.WxShopMapper; | |||
| import com.iformall.service.WxBillActionService; | |||
| import com.iformall.service.WxBillOtherService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.math.BigDecimal; | |||
| import java.util.*; | |||
| /** | |||
| @@ -36,6 +38,9 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| @Autowired | |||
| WxShopMapper wxShopMapper; | |||
| @Autowired | |||
| WxBillActionService wxBillActionService; | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillOther record, Integer pageIndex, Integer pageSize) { | |||
| //更新账单状态 | |||
| @@ -108,7 +113,7 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillOther record) { | |||
| public ResultData saveOrUpdate(WxBillOther record, MallUserInfo user) { | |||
| int receivepay = record.getReceivePay().intValue(); | |||
| int pay = record.getPay().intValue(); | |||
| if(pay>receivepay){ | |||
| @@ -144,12 +149,30 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| wxBillOther.setOwe(record.getReceivePay()-record.getPay()); | |||
| wxBillOther.setStatus(record.getPay().equals(record.getReceivePay()) ? EnumBillDailyStatus.PAID.getCode() : wxBillOther.getStatus()); | |||
| wxBillOther.setUpdatetime(new Date()); | |||
| wxBillOther.setPayWay(record.getPayWay()); | |||
| try { | |||
| wxBillOtherMapper.updateByPrimaryKeySelective(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()); | |||
| String message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); | |||
| String price = new BigDecimal(record.getPay()).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.setTenantId(wxBillOther.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, "更新其他账单成功"); | |||
| } | |||
| } | |||
| @@ -6,11 +6,16 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.domain.po.WxBillPropertyDeposit; | |||
| import com.iformall.enums.EnumBillAction; | |||
| import com.iformall.enums.EnumBillPayWay; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.enums.EnumDelStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillPropertyDepositMapper; | |||
| import com.iformall.service.WxBillActionService; | |||
| import com.iformall.service.WxBillPropertyDepositService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -18,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| @@ -32,7 +38,8 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe | |||
| @Autowired | |||
| WxBillPropertyDepositMapper wxBillPropertyDepositMapper; | |||
| @Autowired | |||
| WxBillActionService wxBillActionService; | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize) { | |||
| @@ -93,7 +100,7 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillPropertyDeposit record) { | |||
| public ResultData saveOrUpdate(WxBillPropertyDeposit record, MallUserInfo user) { | |||
| int receivepay = record.getReceivePay().intValue(); | |||
| int pay = record.getPay().intValue(); | |||
| if(pay>receivepay){ | |||
| @@ -127,12 +134,30 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe | |||
| wxBillDeposit.setOwe(record.getReceivePay()-record.getPay()); | |||
| wxBillDeposit.setStatus(record.getPay().equals(record.getReceivePay())?EnumBillRentStatus.PAID.getCode():wxBillDeposit.getStatus()); | |||
| wxBillDeposit.setUpdatetime(new Date()); | |||
| wxBillDeposit.setPayWay(record.getPayWay()); | |||
| try { | |||
| wxBillPropertyDepositMapper.updateByPrimaryKeySelective(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()).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.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); | |||
| } | |||
| } | |||
| @@ -6,13 +6,18 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.domain.po.WxBillProperty; | |||
| import com.iformall.domain.po.WxBillPropertyDeposit; | |||
| import com.iformall.enums.EnumBillAction; | |||
| import com.iformall.enums.EnumBillPayWay; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.enums.EnumDelStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillPropertyDepositMapper; | |||
| import com.iformall.mapper.WxBillPropertyMapper; | |||
| import com.iformall.service.WxBillActionService; | |||
| import com.iformall.service.WxBillPropertyService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -20,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| @@ -38,6 +44,9 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| @Autowired | |||
| WxBillPropertyDepositMapper wxBillPropertyDepositMapper; | |||
| @Autowired | |||
| WxBillActionService wxBillActionService; | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize) { | |||
| //更新账单状态 | |||
| @@ -96,7 +105,7 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillProperty record) { | |||
| public ResultData saveOrUpdate(WxBillProperty record, MallUserInfo user) { | |||
| int receivepay = record.getReceivePay().intValue(); | |||
| int pay = record.getPay().intValue(); | |||
| if(pay>receivepay){ | |||
| @@ -133,12 +142,30 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| property.setOwe(record.getReceivePay()-record.getPay()); | |||
| property.setStatus(record.getPay().equals(record.getReceivePay())?EnumBillRentStatus.PAID.getCode():property.getStatus()); | |||
| property.setUpdatetime(new Date()); | |||
| property.setPayWay(record.getPayWay()); | |||
| try { | |||
| wxBillPropertyMapper.updateByPrimaryKeySelective(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()); | |||
| String message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); | |||
| String price = new BigDecimal(record.getPay()).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.setTenantId(property.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, "更新物业账单成功", property); | |||
| } | |||
| } | |||
| @@ -6,13 +6,18 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.domain.po.WxBillDeposit; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.enums.EnumBillAction; | |||
| import com.iformall.enums.EnumBillPayWay; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.enums.EnumDelStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillDepositMapper; | |||
| import com.iformall.mapper.WxBillRentMapper; | |||
| import com.iformall.service.WxBillActionService; | |||
| import com.iformall.service.WxBillRentService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -20,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| @@ -38,6 +44,9 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| @Autowired | |||
| WxBillDepositMapper wxBillDepositMapper; | |||
| @Autowired | |||
| WxBillActionService wxBillActionService; | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { | |||
| //更新账单状态 | |||
| @@ -96,7 +105,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillRent record) { | |||
| public ResultData saveOrUpdate(WxBillRent record, MallUserInfo user) { | |||
| int receivepay = record.getReceivePay().intValue(); | |||
| int pay = record.getPay().intValue(); | |||
| if(pay>receivepay){ | |||
| @@ -133,12 +142,30 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| wxBillRent.setOwe(record.getReceivePay()-record.getPay()); | |||
| wxBillRent.setStatus(record.getPay().equals(record.getReceivePay())?EnumBillRentStatus.PAID.getCode():wxBillRent.getStatus()); | |||
| wxBillRent.setUpdatetime(new Date()); | |||
| wxBillRent.setPayWay(record.getPayWay()); | |||
| try { | |||
| wxBillRentMapper.updateByPrimaryKeySelective(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()); | |||
| String message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); | |||
| String price = new BigDecimal(record.getPay()).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.setTenantId(wxBillRent.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, "更新租赁账单成功"); | |||
| } | |||
| } | |||
| @@ -669,6 +669,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||
| List<Map<String, Object>> bills = wxBillAllMapper.listData(wxBillAll); | |||
| if (bills.size() > 0) { | |||
| Map<String, Object> bill = bills.get(0); | |||
| bill.put("userId", record.getbUserId()); | |||
| wxBillAllService.updateBill(bill); | |||
| } | |||
| } catch (Exception e) { | |||
| @@ -686,7 +687,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||
| } | |||
| Map<String, Object> bill; | |||
| bill = bills.get(0); | |||
| bill.put("userId", record.getbUserId()); | |||
| // 修改支付订单状态 | |||
| WxPayBill updateBill = new WxPayBill(); | |||
| updateBill.setId(record.getId()); | |||