| @@ -19,21 +19,22 @@ import java.util.Map; | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxBillDeposit") | |||
| public class WxBillDepositController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxBillDepositController extends BaseController { | |||
| @Autowired | |||
| private WxBillDepositService wxBillDepositService; | |||
| private Logger logger = LoggerFactory.getLogger(WxBillDepositController.class); | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxBillDeposit wxBillDeposit, Integer pageNum, Integer pageSize) { | |||
| if (null == wxBillDeposit) wxBillDeposit = new WxBillDeposit(); | |||
| wxBillDeposit.setTenantId(getTenantId()); | |||
| final PageInfo<Map<String, Object>> page = wxBillDepositService.listAsPage(wxBillDeposit, pageNum, pageSize); | |||
| if (null == wxBillDeposit) { | |||
| wxBillDeposit = new WxBillDeposit(); | |||
| } | |||
| wxBillDeposit.setTenantId(getTenantId()); | |||
| final PageInfo<Map<String, Object>> page = wxBillDepositService.listAsPage(wxBillDeposit, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -51,16 +52,16 @@ public class WxBillDepositController extends BaseController | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxBillDepositService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxBillDepositService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillDepositService.getById(id)); | |||
| } | |||
| @GetMapping("/updatePaid") | |||
| @@ -68,6 +69,6 @@ public class WxBillDepositController extends BaseController | |||
| public ResultData updatePaid(Long id) { | |||
| return wxBillDepositService.updatePaid(id); | |||
| } | |||
| } | |||
| @@ -14,21 +14,25 @@ import org.springframework.web.bind.annotation.*; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxBillProperty") | |||
| public class WxBillPropertyController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxBillPropertyController extends BaseController { | |||
| @Autowired | |||
| private WxBillPropertyService wxBillPropertyService; | |||
| private Logger logger = LoggerFactory.getLogger(WxBillPropertyController.class); | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxBillProperty wxBillProperty, Integer pageNum, Integer pageSize) { | |||
| if (null == wxBillProperty) wxBillProperty = new WxBillProperty(); | |||
| if (null == wxBillProperty) { | |||
| wxBillProperty = new WxBillProperty(); | |||
| } | |||
| wxBillProperty.setTenantId(getTenantId()); | |||
| PageInfo<Map<String, Object>> result = wxBillPropertyService.listAsPage(wxBillProperty, pageNum, pageSize); | |||
| return new ResultData(result); | |||
| @@ -48,18 +52,23 @@ public class WxBillPropertyController extends BaseController | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxBillPropertyService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxBillPropertyService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillPropertyService.getById(id)); | |||
| } | |||
| @GetMapping("/updatePaid") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData updatePaid(Long id) { | |||
| return wxBillPropertyService.updatePaid(id); | |||
| } | |||
| } | |||
| @@ -31,7 +31,9 @@ public class WxBillPropertyDepositController extends BaseController | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxBillPropertyDeposit wxBillPropertyDeposit, Integer pageNum, Integer pageSize) { | |||
| if (null == wxBillPropertyDeposit) wxBillPropertyDeposit = new WxBillPropertyDeposit(); | |||
| if (null == wxBillPropertyDeposit) { | |||
| wxBillPropertyDeposit = new WxBillPropertyDeposit(); | |||
| } | |||
| wxBillPropertyDeposit.setTenantId(getTenantId()); | |||
| PageInfo<Map<String, Object>> result = wxBillPropertyDepositService.listAsPage(wxBillPropertyDeposit, pageNum, pageSize); | |||
| return new ResultData(result); | |||
| @@ -62,7 +64,12 @@ public class WxBillPropertyDepositController extends BaseController | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxBillPropertyDepositService.getById(id)); | |||
| } | |||
| @GetMapping("/updatePaid") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData updatePaid(Long id) { | |||
| return wxBillPropertyDepositService.updatePaid(id); | |||
| } | |||
| } | |||
| @@ -231,7 +231,47 @@ public enum ErrorCode{ | |||
| /** | |||
| * 标签 | |||
| */ | |||
| TAGS_MATCHED_NULL(14000, "此标签没命中用户") | |||
| TAGS_MATCHED_NULL(14000, "此标签没命中用户"), | |||
| /** | |||
| * 租赁合同 | |||
| * */ | |||
| RENT_CONTRACT_IS_NOT_FOUND(15000,"租赁合同不存在"), | |||
| /** | |||
| * 物业合同 | |||
| * */ | |||
| PROPERTY_CONTRACT_IS_NOT_FOUND(16000,"物业合同不存在"), | |||
| /** | |||
| * 租赁账单 | |||
| * */ | |||
| BILL_RENT_IS_NOT_FOUND(17000,"租赁账单不存在"), | |||
| /** | |||
| * 租赁押金账单 | |||
| * */ | |||
| BILL_RENT_DEPOSIT_IS_NOT_FOUND(18000,"租赁押金账单不存在"), | |||
| /** | |||
| * 物业账单 | |||
| * */ | |||
| BILL_PROPERTY_IS_NOT_FOUND(19000,"物业账单不存在"), | |||
| /** | |||
| * 物业押金账单 | |||
| * */ | |||
| BILL_PROPERTY_DEPOSIT_IS_NOT_FOUND(20000,"物业押金账单不存在"), | |||
| /** | |||
| * 日常费用账单 | |||
| * */ | |||
| BILL_ROUTINE_IS_NOT_FOUND(20000,"账单不存在"), | |||
| ; | |||
| @@ -20,8 +20,10 @@ public interface WxBillDailyService { | |||
| * @return | |||
| */ | |||
| PageInfo<Map<String, Object>> listAsPage(WxBillDaily record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| void updateBillStatus(WxBillDaily record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| @@ -17,8 +17,10 @@ public interface WxBillDepositService { | |||
| * @return | |||
| */ | |||
| PageInfo<Map<String, Object>> listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| void updateBillStatus(WxBillDeposit record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| @@ -22,6 +22,8 @@ public interface WxBillPropertyDepositService { | |||
| */ | |||
| PageInfo<Map<String, Object>> listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize); | |||
| void updateBillStatus(WxBillPropertyDeposit record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| @@ -23,6 +23,8 @@ public interface WxBillPropertyService { | |||
| */ | |||
| PageInfo<Map<String, Object>> listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize); | |||
| void updateBillStatus(WxBillProperty record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| @@ -19,8 +19,10 @@ public interface WxBillRentService { | |||
| * @return | |||
| */ | |||
| PageInfo<Map<String, Object>> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| void updateBillStatus(WxBillRent record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| @@ -2,11 +2,11 @@ package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.enums.EnumRentContractStatus; | |||
| import com.iformall.mapper.WxBillAllMapper; | |||
| import com.iformall.service.WxBillAllService; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -27,20 +27,69 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| @Autowired | |||
| WxBillAllMapper wxBillAllMapper; | |||
| @Autowired | |||
| WxBillDailyService wxBillDailyService; | |||
| @Autowired | |||
| WxBillDepositService wxBillDepositService; | |||
| @Autowired | |||
| WxBillPropertyDepositService wxBillPropertyDepositService; | |||
| @Autowired | |||
| WxBillPropertyService wxBillPropertyService; | |||
| @Autowired | |||
| WxBillRentService wxBillRentService; | |||
| @Override | |||
| public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { | |||
| //更新各账单状态 | |||
| updateBillStatus(record); | |||
| //得到当前月 | |||
| String month=DateUtils.getSystemTime("yyyy-MM"); | |||
| //获取账单信息-欠缴笔数、欠缴金额、结清笔数、结清金额 | |||
| Object billInfo = getBillInfo(record.getTenantId(),month); | |||
| //设置查询参数-当前月 | |||
| record.setMonth(month); | |||
| //分页-页数、条数 | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| //查询 | |||
| List<Map<String, Object>> rentContractData = wxBillAllMapper.list(record); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(rentContractData); | |||
| //返回值 | |||
| Map<String, Object> result = new HashMap<>(); | |||
| result.put("billInfo", billInfo); | |||
| result.put("pageInfo", pageInfo); | |||
| return result; | |||
| } | |||
| private void updateBillStatus(WxBillAll record) { | |||
| logger.info("更新各账单状态开始"); | |||
| //更新日常账单状态 | |||
| WxBillDaily wxBillDaily = new WxBillDaily(); | |||
| wxBillDaily.setTenantId(record.getTenantId()); | |||
| wxBillDailyService.updateBillStatus(wxBillDaily); | |||
| //更新租赁押金账单状态 | |||
| WxBillDeposit wxBillDeposit = new WxBillDeposit(); | |||
| wxBillDeposit.setTenantId(record.getTenantId()); | |||
| wxBillDepositService.updateBillStatus(wxBillDeposit); | |||
| //更新物业押金账单状态 | |||
| WxBillPropertyDeposit wxBillPropertyDeposit = new WxBillPropertyDeposit(); | |||
| wxBillPropertyDeposit.setTenantId(record.getTenantId()); | |||
| wxBillPropertyDepositService.updateBillStatus(wxBillPropertyDeposit); | |||
| //更新物业账单状态 | |||
| WxBillProperty wxBillProperty = new WxBillProperty(); | |||
| wxBillProperty.setTenantId(record.getTenantId()); | |||
| wxBillPropertyService.updateBillStatus(wxBillProperty); | |||
| //更新租赁账单状态 | |||
| WxBillRent wxBillRent = new WxBillRent(); | |||
| wxBillRent.setTenantId(record.getTenantId()); | |||
| wxBillRentService.updateBillStatus(wxBillRent); | |||
| logger.info("更新各账单状态结束"); | |||
| } | |||
| private Object getBillInfo(String tenantId,String month) { | |||
| WxBillAll record = new WxBillAll(); | |||
| record.setTenantId(tenantId); | |||
| @@ -7,6 +7,7 @@ import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillDaily; | |||
| import com.iformall.domain.po.WxBillDeposit; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.enums.EnumBillDailyStatus; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| @@ -37,18 +38,28 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillDaily record, Integer pageIndex, Integer pageSize) { | |||
| //更新逾期天数及状态 | |||
| updateNotPaidStatus(record); | |||
| //更新待缴的状态 | |||
| updateWaidPayStatus(record); | |||
| //更新账单状态 | |||
| updateBillStatus(record); | |||
| //分页对象设置页数和条数 | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| //查询 | |||
| List<Map<String, Object>> billDepositList = wxBillDailyMapper.queryBillDailyList(record); | |||
| //结果放入分页对象 | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billDepositList); | |||
| return pageInfo; | |||
| } | |||
| @Override | |||
| public void updateBillStatus(WxBillDaily record) { | |||
| logger.info("更新日常账单状态开始..."); | |||
| //更新逾期天数及状态 | |||
| updateNotPaidStatus(record); | |||
| //更新待缴的状态 | |||
| updateWaidPayStatus(record); | |||
| logger.info("更新日常账单状态结束..."); | |||
| } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public void updateWaidPayStatus(WxBillDaily record) { | |||
| Map<String, Object> params = new HashMap<>(); | |||
| @@ -117,6 +128,9 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| } else { | |||
| logger.info("更新日常押金账单"); | |||
| WxBillDaily wxBillDaily = wxBillDailyMapper.selectByPrimaryKey(record.getId()); | |||
| if(wxBillDaily==null){ | |||
| return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); | |||
| } | |||
| wxBillDaily.setPayDate(record.getPayDate()); | |||
| wxBillDaily.setPay(record.getPay() * 100); | |||
| wxBillDaily.setReceivePay(record.getReceivePay() * 100); | |||
| @@ -143,6 +157,9 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| @Override | |||
| public ResultData updatePaid(Long id) { | |||
| WxBillDaily wxBillDaily = wxBillDailyMapper.selectByPrimaryKey(id); | |||
| if(wxBillDaily==null){ | |||
| return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); | |||
| } | |||
| wxBillDaily.setStatus(EnumBillDailyStatus.PAID.getCode()); | |||
| Date d =new Date(); | |||
| wxBillDaily.setPayDate(d); | |||
| @@ -7,6 +7,7 @@ import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillDeposit; | |||
| import com.iformall.domain.po.WxPropertyContract; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillDepositMapper; | |||
| @@ -32,17 +33,23 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize) { | |||
| //更新逾期天数及状态 | |||
| updateNotPaidStatus(record); | |||
| //更新待缴的状态 | |||
| updateWaidPayStatus(record); | |||
| //更新账单状态 | |||
| updateBillStatus(record); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String, Object>> billDepositList = wxBillDepositMapper.queryBillDepositList(record); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billDepositList); | |||
| return pageInfo; | |||
| } | |||
| @Override | |||
| public void updateBillStatus(WxBillDeposit record) { | |||
| logger.info("更新租赁押金账单状态开始..."); | |||
| //更新逾期天数及状态 | |||
| updateNotPaidStatus(record); | |||
| //更新待缴的状态 | |||
| updateWaidPayStatus(record); | |||
| logger.info("更新租赁押金账单状态结束..."); | |||
| } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public void updateWaidPayStatus(WxBillDeposit record) { | |||
| @@ -101,6 +108,9 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||
| } else { | |||
| logger.info("更新租赁押金账单"); | |||
| WxBillDeposit wxBillDeposit = wxBillDepositMapper.selectByPrimaryKey(record.getId()); | |||
| if(wxBillDeposit==null){ | |||
| return new ResultData(ErrorCode.BILL_RENT_DEPOSIT_IS_NOT_FOUND); | |||
| } | |||
| wxBillDeposit.setPayDate(record.getPayDate()); | |||
| wxBillDeposit.setPay(record.getPay()*100); | |||
| wxBillDeposit.setReceivePay(record.getReceivePay()*100); | |||
| @@ -126,6 +136,9 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||
| @Override | |||
| public ResultData updatePaid(Long id) { | |||
| WxBillDeposit wxBillDeposit = wxBillDepositMapper.selectByPrimaryKey(id); | |||
| if(wxBillDeposit==null){ | |||
| return new ResultData(ErrorCode.BILL_RENT_DEPOSIT_IS_NOT_FOUND); | |||
| } | |||
| wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| Date d =new Date(); | |||
| wxBillDeposit.setPayDate(d); | |||
| @@ -6,6 +6,7 @@ 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.WxBillProperty; | |||
| import com.iformall.domain.po.WxBillPropertyDeposit; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -32,16 +33,24 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize) { | |||
| //更新逾期天数及状态 | |||
| updateNotPaidStatus(record); | |||
| //更新待缴的状态 | |||
| updateWaidPayStatus(record); | |||
| //更新账单状态 | |||
| updateBillStatus(record); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String, Object>> billDepositList = wxBillPropertyDepositMapper.queryBillDepositList(record); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billDepositList); | |||
| return pageInfo; | |||
| } | |||
| @Override | |||
| public void updateBillStatus(WxBillPropertyDeposit record) { | |||
| logger.info("更新物业押金账单状态开始..."); | |||
| //更新逾期天数及状态 | |||
| updateNotPaidStatus(record); | |||
| //更新待缴的状态 | |||
| updateWaidPayStatus(record); | |||
| logger.info("更新物业押金账单状态结束..."); | |||
| } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public void updateWaidPayStatus(WxBillPropertyDeposit record) { | |||
| @@ -100,6 +109,9 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe | |||
| } else { | |||
| logger.info("更新押金账单"); | |||
| WxBillPropertyDeposit wxBillDeposit = wxBillPropertyDepositMapper.selectByPrimaryKey(record.getId()); | |||
| if(record==null){ | |||
| return new ResultData(ErrorCode.BILL_PROPERTY_DEPOSIT_IS_NOT_FOUND); | |||
| } | |||
| wxBillDeposit.setPayDate(record.getPayDate()); | |||
| wxBillDeposit.setPay(record.getPay()*100); | |||
| wxBillDeposit.setReceivePay(record.getReceivePay()*100); | |||
| @@ -125,6 +137,9 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe | |||
| @Override | |||
| public ResultData updatePaid(Long id) { | |||
| WxBillPropertyDeposit wxBillDeposit = wxBillPropertyDepositMapper.selectByPrimaryKey(id); | |||
| if(wxBillDeposit==null){ | |||
| return new ResultData(ErrorCode.BILL_PROPERTY_DEPOSIT_IS_NOT_FOUND); | |||
| } | |||
| wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| Date d =new Date(); | |||
| wxBillDeposit.setPayDate(d); | |||
| @@ -7,6 +7,7 @@ import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillProperty; | |||
| import com.iformall.domain.po.WxBillPropertyDeposit; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillPropertyMapper; | |||
| @@ -31,16 +32,24 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize) { | |||
| //更新逾期天数及状态 | |||
| updateNotPaidStatus(record); | |||
| //更新待缴的状态 | |||
| updateWaidPayStatus(record); | |||
| //更新账单状态 | |||
| updateBillStatus(record); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String, Object>> billRentList = wxBillPropertyMapper.queryBillPropertyList(record); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billRentList); | |||
| return pageInfo; | |||
| } | |||
| @Override | |||
| public void updateBillStatus(WxBillProperty record) { | |||
| logger.info("更新物业账单状态开始..."); | |||
| //更新逾期天数及状态 | |||
| updateNotPaidStatus(record); | |||
| //更新待缴的状态 | |||
| updateWaidPayStatus(record); | |||
| logger.info("更新物业账单状态结束..."); | |||
| } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public void updateWaidPayStatus(WxBillProperty record) { | |||
| Map<String, Object> params = new HashMap<>(); | |||
| @@ -97,6 +106,9 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| } else { | |||
| logger.info("更新物业账单"); | |||
| WxBillProperty property = wxBillPropertyMapper.selectByPrimaryKey(record.getId()); | |||
| if(record==null){ | |||
| return new ResultData(ErrorCode.BILL_PROPERTY_IS_NOT_FOUND); | |||
| } | |||
| property.setPayDate(record.getPayDate()); | |||
| property.setPay(record.getPay()*100); | |||
| property.setReceivePay(record.getReceivePay()*100); | |||
| @@ -129,6 +141,9 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| @Override | |||
| public ResultData updatePaid(Long id) { | |||
| WxBillProperty record = wxBillPropertyMapper.selectByPrimaryKey(id); | |||
| if(record==null){ | |||
| return new ResultData(ErrorCode.BILL_PROPERTY_IS_NOT_FOUND); | |||
| } | |||
| record.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| Date d =new Date(); | |||
| record.setPayDate(d); | |||
| @@ -6,6 +6,8 @@ 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.WxBillDaily; | |||
| import com.iformall.domain.po.WxBillProperty; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -35,16 +37,24 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { | |||
| //更新逾期天数及状态 | |||
| updateNotPaidStatus(record); | |||
| //更新待缴的状态 | |||
| updateWaidPayStatus(record); | |||
| //更新账单状态 | |||
| updateBillStatus(record); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String, Object>> billRentList = wxBillRentMapper.queryBillRentList(record); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billRentList); | |||
| return pageInfo; | |||
| } | |||
| @Override | |||
| public void updateBillStatus(WxBillRent record) { | |||
| logger.info("更新租赁账单状态开始..."); | |||
| //更新逾期天数及状态 | |||
| updateNotPaidStatus(record); | |||
| //更新待缴的状态 | |||
| updateWaidPayStatus(record); | |||
| logger.info("更新租赁账单状态结束..."); | |||
| } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public void updateWaidPayStatus(WxBillRent record) { | |||
| Map<String, Object> params = new HashMap<>(); | |||
| @@ -85,7 +95,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillRent record) { | |||
| if (record.getId() == null) { | |||
| logger.info("新增物业账单"); | |||
| logger.info("新增租赁账单"); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| Date date = new Date(); | |||
| @@ -94,13 +104,16 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| try { | |||
| wxBillRentMapper.insertSelective(record); | |||
| } catch (Exception e) { | |||
| logger.error("保存物业账单失败,e:" + e.getMessage()); | |||
| logger.error("保存租赁账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "保存物业账单成功"); | |||
| return new ResultData(Result.SUCCESS, "保存租赁账单成功"); | |||
| } else { | |||
| logger.info("更新物业账单"); | |||
| logger.info("更新租赁账单"); | |||
| WxBillRent wxBillRent = wxBillRentMapper.selectByPrimaryKey(record.getId()); | |||
| if(wxBillRent==null){ | |||
| return new ResultData(ErrorCode.BILL_RENT_IS_NOT_FOUND); | |||
| } | |||
| wxBillRent.setPayDate(record.getPayDate()); | |||
| wxBillRent.setPay(record.getPay()*100); | |||
| wxBillRent.setReceivePay(record.getReceivePay()*100); | |||
| @@ -110,10 +123,10 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| try { | |||
| wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| } catch (Exception e) { | |||
| logger.error("更新物业账单失败,e:" + e.getMessage()); | |||
| logger.error("更新租赁账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "更新物业账单成功"); | |||
| return new ResultData(Result.SUCCESS, "更新租赁账单成功"); | |||
| } | |||
| } | |||
| @@ -133,6 +146,9 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| @Override | |||
| public ResultData updatePaid(Long id) { | |||
| WxBillRent wxBillRent = wxBillRentMapper.selectByPrimaryKey(id); | |||
| if(wxBillRent==null){ | |||
| return new ResultData(ErrorCode.BILL_RENT_IS_NOT_FOUND); | |||
| } | |||
| wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| Date d =new Date(); | |||
| wxBillRent.setPayDate(d); | |||
| @@ -140,10 +156,10 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| try { | |||
| wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| } catch (Exception e) { | |||
| logger.error("物业账单结单失败,e:" + e.getMessage()); | |||
| logger.error("租赁账单结单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "物业账单结单成功"); | |||
| return new ResultData(Result.SUCCESS, "租赁账单结单成功"); | |||
| } | |||
| } | |||
| @@ -68,6 +68,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| Map<String, Object> result = new HashMap<>(); | |||
| WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectByPrimaryKey(id); | |||
| if(wxPropertyContract==null){ | |||
| return new ResultData(ErrorCode.PROPERTY_CONTRACT_IS_NOT_FOUND); | |||
| } | |||
| wxPropertyContract.setPrice(wxPropertyContract.getPrice() != null ? wxPropertyContract.getPrice() / 100 : 0); | |||
| wxPropertyContract.setDeposit(wxPropertyContract.getDeposit() != null ? wxPropertyContract.getDeposit() / 100 : 0); | |||
| @@ -114,7 +117,10 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| } | |||
| return new ResultData(Result.SUCCESS, "保存物业合同信息成功", record); | |||
| } else {//更新物业合同信息 | |||
| WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectByPrimaryKey(record.getId()); | |||
| if(wxPropertyContract==null){ | |||
| return new ResultData(ErrorCode.PROPERTY_CONTRACT_IS_NOT_FOUND); | |||
| } | |||
| Calendar instance = Calendar.getInstance(); | |||
| instance.setTime(record.getRentalStartDate()); | |||
| instance.add(Calendar.MONTH, record.getLease()); | |||
| @@ -340,11 +346,12 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| public ResultData endRentContract(Long id) { | |||
| WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectByPrimaryKey(id); | |||
| if(wxPropertyContract==null){ | |||
| return new ResultData(ErrorCode.PROPERTY_CONTRACT_IS_NOT_FOUND); | |||
| } | |||
| wxPropertyContract.setStatus(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()); | |||
| try { | |||
| wxPropertyContractMapper.updateByPrimaryKeySelective(wxPropertyContract); | |||
| //停用商户 | |||
| // wxMerchantService.disable(wxRentContract.getMerchantId()); | |||
| } catch (MallinkException e) { | |||
| logger.info("终止合同失败:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| @@ -70,6 +70,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| public ResultData getById(Long id) { | |||
| Map<String, Object> result = new HashMap<>(); | |||
| WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(id); | |||
| if(wxRentContract==null){ | |||
| return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); | |||
| } | |||
| wxRentContract.setPrice(wxRentContract.getPrice() != null ? wxRentContract.getPrice() / 100 : 0); | |||
| wxRentContract.setDeposit(wxRentContract.getDeposit() != null ? wxRentContract.getDeposit() / 100 : 0); | |||
| @@ -116,6 +120,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| return new ResultData(Result.SUCCESS, "保存租赁合同信息成功", record); | |||
| } else {//更新租赁合同信息 | |||
| WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(record.getId()); | |||
| if(wxRentContract==null){ | |||
| return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); | |||
| } | |||
| Calendar instance = Calendar.getInstance(); | |||
| instance.setTime(record.getRentalStartDate()); | |||
| instance.add(Calendar.MONTH, record.getLease()); | |||
| @@ -341,6 +349,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| public ResultData endRentContract(Long id) { | |||
| WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(id); | |||
| if(wxRentContract==null){ | |||
| return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); | |||
| } | |||
| wxRentContract.setStatus(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()); | |||
| try { | |||
| wxRentContractMapper.updateByPrimaryKeySelective(wxRentContract); | |||
| @@ -357,6 +368,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| @Override | |||
| public ResultData updateMerchant(WxRentContract wxRentContract) { | |||
| WxRentContract record = wxRentContractMapper.selectByPrimaryKey(wxRentContract); | |||
| if(wxRentContract==null){ | |||
| return new ResultData(ErrorCode.RENT_CONTRACT_IS_NOT_FOUND); | |||
| } | |||
| record.setMerchantId(wxRentContract.getMerchantId()); | |||
| try { | |||
| wxRentContractMapper.updateByPrimaryKeySelective(record); | |||