diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxSettleMerchantController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxSettleMerchantController.java index 08ea074b9..77a9a76e1 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxSettleMerchantController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxSettleMerchantController.java @@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; +import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxBillProperty; import com.iformall.domain.po.WxBillRent; import com.iformall.domain.po.WxPropertyContract; @@ -53,8 +54,6 @@ public class WxSettleMerchantController extends BaseController { private WxBillRentService wxBillRentService; @Autowired WxPropertyContractService wxPropertyContractService; - @Autowired - WxBillPropertyMapper wxBillPropertyMapper; @Lazy @Autowired @@ -155,7 +154,7 @@ public class WxSettleMerchantController extends BaseController { return new ResultData(Result.ERROR,"无计租中租金合同"); } WxRentContract rent = rlist.get(0); - WxBillRent br = new WxBillRent(); + WxAllBill br = new WxAllBill(); br.setMerchantId(wxSettleMerchant.getMerchantId()); br.setRentContractId(rent.getId()); br.setStarttime(wxSettleMerchant.getBeginTime()); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillDailyController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillDailyController.java deleted file mode 100644 index 98bf59d38..000000000 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillDailyController.java +++ /dev/null @@ -1,309 +0,0 @@ -package com.iformall.controller.rent; - -import com.alibaba.fastjson.JSONArray; -import com.github.pagehelper.PageInfo; -import com.iformall.annotation.SystemControllerLog; -import com.iformall.common.ErrorCode; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.controller.base.BaseController; -import com.iformall.controller.base.BillBaseController; -import com.iformall.controller.mem.BillDailyAsyncTask; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillDaily; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxUserDataRule; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillDailyBuildWay; -import com.iformall.enums.EnumBillDailyType; -import com.iformall.enums.EnumBillOweOrNearType; -import com.iformall.exception.MallinkException; -import com.iformall.service.WxBillDailyService; -import com.iformall.service.helper.WxBillAllHelper; -import com.iformall.utils.Constant; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -/** - * @author gongbiao - */ -@RestController -@RequestMapping("wxBillDaily") -public class WxBillDailyController extends BillBaseController { - - @Autowired - private String fmUploadDir; - - @Autowired - private WxBillDailyService wxBillDailyService; - - @Autowired - StringRedisTemplate stringRedisTemplate; - - @Autowired - private BillDailyAsyncTask billDailyAsyncTask; - - @Autowired - WxBillAllHelper wxBillAllHelper; - - private Logger logger = LoggerFactory.getLogger(this.getClass()); - - - @GetMapping("billDailyTypes") - public ResultData billDailyTypes() { - Map tmap = new HashMap(); - for (EnumBillDailyType t : EnumBillDailyType.values()) { - tmap.put(t.getCode(), t.getMessage()); - } - return new ResultData(tmap); - } - - @GetMapping("list") - @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 WxBillDaily wxBillDaily, Integer pageNum, Integer pageSize) { - if (null == wxBillDaily) { - wxBillDaily = new WxBillDaily(); - } - wxBillDaily.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillDaily.setFloorForRule(dataRule.getFloorIds()); - wxBillDaily.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillDaily.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillDaily.getOnlyOweOrNear().intValue()) { - wxBillDaily.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillDaily.getOnlyOweOrNear().intValue()) { - wxBillDaily.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillDaily.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - } - wxBillDaily.setSortColumns("status asc,starttime asc , merchant_id desc"); - final PageInfo page = wxBillDailyService.listAsPage(wxBillDaily, pageNum, pageSize); - return new ResultData(page); - } - - @GetMapping("exportBill") - public void exportBill(@ModelAttribute WxBillDaily wxBillDaily, HttpServletRequest request, HttpServletResponse response) { - wxBillDaily.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillDaily.setFloorForRule(dataRule.getFloorIds()); - wxBillDaily.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillDaily.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillDaily.getOnlyOweOrNear().intValue()) { - wxBillDaily.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillDaily.getOnlyOweOrNear().intValue()) { - wxBillDaily.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillDaily.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - } - wxBillDailyService.exportBill(request, response, wxBillDaily); - } - - @GetMapping("monthBillSum") - public ResultData monthBillSum(@ModelAttribute WxBillDaily wxBillDaily) { - if (StringUtils.isBlank(wxBillDaily.getMonth())) { - new ResultData(Result.ERROR, "请选择月份"); - } - wxBillDaily.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillDaily.setFloorForRule(dataRule.getFloorIds()); - wxBillDaily.setBusinessForRule(dataRule.getBussinessIds()); - } - WxBillSum sum = wxBillDailyService.getBillMonthSum(wxBillDaily); - if (null == sum) { - sum = new WxBillSum(); - } - return new ResultData(sum); - } - - @PostMapping("add") - public ResultData add(@RequestBody WxBillDaily wxBillDaily) { - MallUserInfo user = getUser(); - wxBillDaily.updateTenantInfo(user); - wxBillDaily.setUserId(user.getId()); - wxBillDaily.setBuildWay(EnumBillDailyBuildWay.HAND.getCode()); - wxBillDaily.setPayWay(null); - wxBillDaily.setPayDate(null); - wxBillDaily.setReceiveDate(wxBillDaily.getStarttime()); - wxBillDaily.setRemark(wxBillDaily.getBillRemark()); - return wxBillDailyService.saveOrUpdate(wxBillDaily, user); - } - - @PostMapping("update") - public ResultData update(@RequestBody WxBillDaily wxBillDaily) { - MallUserInfo user = getUser(); - wxBillDaily.updateTenantInfo(user); - wxBillDaily.setUserId(user.getId()); - wxBillDaily.setPayWay(null); - wxBillDaily.setPayDate(null); - wxBillDaily.setReceiveDate(wxBillDaily.getStarttime()); - wxBillDaily.setRemark(wxBillDaily.getBillRemark()); - return wxBillDailyService.saveOrUpdate(wxBillDaily, user); - } - - @GetMapping("/del") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - @SystemControllerLog(description = "日常账单-删除") - public ResultData delete(Long id) { - wxBillDailyService.deleteById(this.getTenantInfo(),id); - return new ResultData(Result.SUCCESS, "删除成功", null); - } - - @GetMapping("/findById") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - public ResultData findById(Long id) { - return new ResultData(Result.SUCCESS, "查询成功", wxBillDailyService.getById(this.getTenantInfo(),id)); - } - -// @GetMapping("/updatePaid") -// @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) -// public ResultData updatePaid(Long id) { -// return wxBillDailyService.updatePaid(id); -// } - - @RequestMapping("/exportTemplate") - public void exportTemplate(HttpServletRequest request, HttpServletResponse response) { - wxBillDailyService.exportTemplate(request, response, getUser()); - - } - - @PostMapping(value = "/importTemplate", consumes = "multipart/*") - public ResultData importTemplate(@RequestParam("file") MultipartFile mFile) { - if (mFile.isEmpty()) { - throw new MallinkException(Result.ERROR, "上传文件不能为空"); - } - //得到当前用户ID - final MallUserInfo user = getUser(); - String userId = "bill_daily_" + user.getId(); - String importKey = Constant.importMemPrev + userId; - - //查询当前用户得到的值是否为空,为空继续,不为空,返回模板正在导入 - Boolean allCount = stringRedisTemplate.opsForHash().hasKey(importKey, "allCount"); - if (allCount) { - return new ResultData(Result.SUCCESS, "模板正在导入"); - } - - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", 0 + ""); - stringRedisTemplate.expire(importKey, 30, TimeUnit.MINUTES); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allSuccessCount", 0 + ""); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "processCount", ""); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "failCount", ""); - - String fpath = fmUploadDir; - File targetFile = new File(fpath); - if (!targetFile.exists()) { - targetFile.mkdirs(); - } - String fileName = "bill_daily.xlsx"; - int dot = mFile.getOriginalFilename().lastIndexOf('.'); - fileName = fileName + mFile.getOriginalFilename().substring(dot, mFile.getOriginalFilename().length()); - - File lFile = new File(fpath + File.separator + fileName); - - FileOutputStream fos = null; - BufferedInputStream fs = null; - try { - fos = new FileOutputStream(lFile); - fs = (BufferedInputStream) mFile.getInputStream(); - byte[] buffer = new byte[1024]; - int len = 0; - while ((len = fs.read(buffer)) != -1) { - fos.write(buffer, 0, len); - } - fos.close(); - fs.close(); - } catch (Exception e) { - stringRedisTemplate.expire(importKey, 3, TimeUnit.SECONDS); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", "1"); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "failCount", "1"); - logger.error(e.getMessage()); - return new ResultData(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); - } finally { - if (fos != null) { - try { - fos.close(); - } catch (IOException e) { - stringRedisTemplate.expire(importKey, 3, TimeUnit.SECONDS); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", "1"); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "failCount", "1"); - logger.error(e.getMessage()); - return new ResultData(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); - } - } - if (fs != null) { - try { - fs.close(); - } catch (IOException e) { - stringRedisTemplate.expire(importKey, 3, TimeUnit.SECONDS); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", "1"); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "failCount", "1"); - logger.error(e.getMessage()); - return new ResultData(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); - } - } - } - - billDailyAsyncTask.importExcelData(lFile, user, importKey); - - return new ResultData(Result.SUCCESS, "模板正在导入"); - } - - @GetMapping("/queryTemplateCount") - public ResultData queryTemplateCount() { - String importKey = Constant.importMemPrev + "bill_daily_" + getUser().getId(); - Map entries = stringRedisTemplate.opsForHash().entries(importKey); - logger.info(JSONArray.toJSONString(entries) + ">>>>>>>>>>>>>>>>>>>>>1"); - if (entries.size() < 4) { - entries.clear(); - return new ResultData(Result.SUCCESS, "ok", entries); - } - String allCount = entries.get("allCount").toString(); - String allSuccessCount = entries.get("allSuccessCount").toString(); - String processCount = entries.get("processCount").toString(); - String failCount = entries.get("failCount").toString(); - - if (StringUtils.isNotBlank(failCount) && allCount.equals(failCount)) {//stringRedisTemplate.expire(userId,1,TimeUnit.SECONDS); - logger.info(JSONArray.toJSONString(entries) + ">>>>>>>>>>>>>>>>>>>>>2"); - //完全失败 - stringRedisTemplate.opsForHash().delete(importKey, "allCount"); - stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount"); - stringRedisTemplate.opsForHash().delete(importKey, "processCount"); - stringRedisTemplate.opsForHash().delete(importKey, "failCount"); - return new ResultData(ErrorCode.MEM_IMPORT_ERR); - } - //导入完成 - if (StringUtils.isNotBlank(allSuccessCount) && allSuccessCount.equals(processCount)) { - ResultData ok = new ResultData(Result.SUCCESS, "ok", entries); - stringRedisTemplate.opsForHash().delete(importKey, "allCount"); - stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount"); - stringRedisTemplate.opsForHash().delete(importKey, "processCount"); - stringRedisTemplate.opsForHash().delete(importKey, "failCount"); - return ok; - } - return new ResultData(Result.SUCCESS, "查询成功", entries); - } - -} diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillDepositController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillDepositController.java deleted file mode 100644 index 1b5ddcf44..000000000 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillDepositController.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.iformall.controller.rent; - -import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; -import com.github.pagehelper.PageInfo; -import com.iformall.annotation.SystemControllerLog; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.controller.base.BaseController; -import com.iformall.controller.base.BillBaseController; -import com.iformall.domain.po.WxBillDeposit; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxUserDataRule; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillOweOrNearType; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.service.WxBillDepositService; -import com.iformall.service.helper.WxBillAllHelper; - -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -/** - * @author gongbiao - */ -@RestController -@RequestMapping("wxBillDeposit") -public class WxBillDepositController extends BillBaseController { - @Autowired - private WxBillDepositService wxBillDepositService; - - @Autowired - WxBillAllHelper wxBillAllHelper; - - 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)}) - public ResultData list(@ModelAttribute WxBillDeposit wxBillDeposit, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxBillDepositController::list"); - if (null == wxBillDeposit) { - wxBillDeposit = new WxBillDeposit(); - } - wxBillDeposit.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillDeposit.setFloorForRule(dataRule.getFloorIds()); - wxBillDeposit.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillDeposit.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillDeposit.getOnlyOweOrNear().intValue()) { - wxBillDeposit.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillDeposit.getOnlyOweOrNear().intValue()) { - wxBillDeposit.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillDeposit.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - - } - wxBillDeposit.setSortColumns("status asc,starttime asc , merchant_id desc"); - final PageInfo page = wxBillDepositService.listAsPage(wxBillDeposit, pageNum, pageSize); - return new ResultData(page); - } - - @GetMapping("exportBill") - public void exportBill(@ModelAttribute WxBillDeposit wxBillDeposit, HttpServletRequest request, HttpServletResponse response) { - wxBillDeposit.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillDeposit.setFloorForRule(dataRule.getFloorIds()); - wxBillDeposit.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillDeposit.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillDeposit.getOnlyOweOrNear().intValue()) { - wxBillDeposit.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillDeposit.getOnlyOweOrNear().intValue()) { - wxBillDeposit.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillDeposit.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - - } - wxBillDepositService.exportBill(request, response, wxBillDeposit); - } - - @GetMapping("monthBillSum") - public ResultData monthBillSum(@ModelAttribute WxBillDeposit wxBillDeposit) { - if (StringUtils.isBlank(wxBillDeposit.getMonth())) { - new ResultData(Result.ERROR, "请选择月份"); - } - wxBillDeposit.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillDeposit.setFloorForRule(dataRule.getFloorIds()); - wxBillDeposit.setBusinessForRule(dataRule.getBussinessIds()); - } - WxBillSum sum = wxBillDepositService.getBillMonthSum(wxBillDeposit); - if (null == sum) { - sum = new WxBillSum(); - } - return new ResultData(sum); - } - - @PostMapping("add") - public ResultData add(@RequestBody WxBillDeposit wxBillDeposit) { - wxBillDeposit.updateTenantInfo(getTenantInfo()); - return wxBillDepositService.saveOrUpdate(wxBillDeposit, getUser()); - - } - - @PostMapping("update") - public ResultData update(@RequestBody WxBillDeposit wxBillDeposit) { - wxBillDeposit.updateTenantInfo(getTenantInfo()); - return wxBillDepositService.saveOrUpdate(wxBillDeposit, getUser()); - - } - - @GetMapping("/del") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - @SystemControllerLog(description = "租赁押金-删除") - public ResultData delete(Long id) { - wxBillDepositService.deleteById(this.getTenantInfo(),id); - return new ResultData(Result.SUCCESS, "删除成功", null); - } - - @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(this.getTenantInfo(),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) -// public ResultData updatePaid(Long id) { -// return wxBillDepositService.updatePaid(id); -// } -// -// @PostMapping("returnDeposit") -// public ResultData returnDeposit(@RequestBody WxBillDeposit wxBillDeposit) { -// wxBillDeposit.updateTenantInfo(getTenantInfo()); -// return wxBillDepositService.returnDeposit(wxBillDeposit, getUser()); -// -// } -// -// @PostMapping("adjustDeposit") -// public ResultData adjustDeposit(@RequestBody WxBillDeposit wxBillDeposit) { -// wxBillDeposit.updateTenantInfo(getTenantInfo()); -// return wxBillDepositService.adjustDeposit(wxBillDeposit); -// -// } - - -} diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillOtherController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillOtherController.java deleted file mode 100644 index d2cc5c307..000000000 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillOtherController.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.iformall.controller.rent; - -import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; -import com.github.pagehelper.PageInfo; -import com.iformall.annotation.SystemControllerLog; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.controller.base.BaseController; -import com.iformall.controller.base.BillBaseController; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillOther; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxUserDataRule; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillOweOrNearType; -import com.iformall.service.WxBillOtherService; -import com.iformall.service.helper.WxBillAllHelper; - -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author gongbiao - */ -@RestController -@RequestMapping("wxBillOther") -public class WxBillOtherController extends BillBaseController { - @Autowired - private WxBillOtherService wxBillOtherService; - - @Autowired - WxBillAllHelper wxBillAllHelper; - - private Logger logger = LoggerFactory.getLogger(this.getClass()); - - @GetMapping("list") - @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 WxBillOther wxBillOther, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxBillOtherController::list"); - if (null == wxBillOther) { - wxBillOther = new WxBillOther(); - } - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillOther.setFloorForRule(dataRule.getFloorIds()); - wxBillOther.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillOther.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillOther.getOnlyOweOrNear().intValue()) { - wxBillOther.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillOther.getOnlyOweOrNear().intValue()) { - wxBillOther.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillOther.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - } - wxBillOther.updateTenantInfo(getTenantInfo()); - wxBillOther.setSortColumns("status asc, starttime asc , merchant_id desc"); - final PageInfo page = wxBillOtherService.listAsPage(wxBillOther, pageNum, pageSize); - return new ResultData(page); - } - - @GetMapping("exportBill") - public void exportBill(@ModelAttribute WxBillOther wxBillOther, HttpServletRequest request, HttpServletResponse response) { - wxBillOther.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillOther.setFloorForRule(dataRule.getFloorIds()); - wxBillOther.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillOther.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillOther.getOnlyOweOrNear().intValue()) { - wxBillOther.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillOther.getOnlyOweOrNear().intValue()) { - wxBillOther.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillOther.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - } - wxBillOtherService.exportBill(request, response, wxBillOther); - } - - @GetMapping("monthBillSum") - public ResultData monthBillSum(@ModelAttribute WxBillOther wxBillOther) { - if (StringUtils.isBlank(wxBillOther.getMonth())) { - new ResultData(Result.ERROR, "请选择月份"); - } - wxBillOther.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillOther.setFloorForRule(dataRule.getFloorIds()); - wxBillOther.setBusinessForRule(dataRule.getBussinessIds()); - } - WxBillSum sum = wxBillOtherService.getBillMonthSum(wxBillOther); - if (null == sum) { - sum = new WxBillSum(); - } - return new ResultData(sum); - } - - @PostMapping("add") - public ResultData add(@RequestBody WxBillOther wxBillOther) { - MallUserInfo user = getUser(); - wxBillOther.updateTenantInfo(user); - wxBillOther.setUserId(user.getId()); - wxBillOther.setPayWay(null); - wxBillOther.setPayDate(null); - wxBillOther.setReceiveDate(wxBillOther.getStarttime()); - return wxBillOtherService.saveOrUpdate(wxBillOther, user); - } - - @PostMapping("update") - public ResultData update(@RequestBody WxBillOther wxBillOther) { - MallUserInfo user = getUser(); - wxBillOther.updateTenantInfo(user); - wxBillOther.setUserId(user.getId()); - wxBillOther.setPayWay(null); - wxBillOther.setPayDate(null); - wxBillOther.setReceiveDate(wxBillOther.getStarttime()); - return wxBillOtherService.saveOrUpdate(wxBillOther, user); - } - - @GetMapping("/del") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - @SystemControllerLog(description = "其它账单-删除") - public ResultData delete(Long id) { - wxBillOtherService.deleteById(this.getTenantInfo(),id); - return new ResultData(Result.SUCCESS, "删除成功", null); - } - - @GetMapping("/findById") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - public ResultData findById(Long id) { - return new ResultData(Result.SUCCESS, "查询成功", wxBillOtherService.getById(this.getTenantInfo(),id)); - } - - /** - * 结单 - * @param id - * @return - */ -// @GetMapping("/updatePaid") -// @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) -// public ResultData updatePaid(Long id) { -// return wxBillOtherService.updatePaid(id); -// } - -} diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillOtherDepositController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillOtherDepositController.java deleted file mode 100644 index 9c0f1daf8..000000000 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillOtherDepositController.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.iformall.controller.rent; - -import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; -import com.github.pagehelper.PageInfo; -import com.iformall.annotation.SystemControllerLog; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.controller.base.BaseController; -import com.iformall.controller.base.BillBaseController; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillOtherDeposit; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxUserDataRule; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillOweOrNearType; -import com.iformall.service.WxBillOtherDepositService; -import com.iformall.service.helper.WxBillAllHelper; - -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author gongbiao - */ -@RestController -@RequestMapping("wxBillOtherDeposit") -public class WxBillOtherDepositController extends BillBaseController { - @Autowired - private WxBillOtherDepositService wxBillOtherDepositService; - - @Autowired - WxBillAllHelper wxBillAllHelper; - - private Logger logger = LoggerFactory.getLogger(this.getClass()); - - @GetMapping("list") - @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 WxBillOtherDeposit wxBillOtherDeposit, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::list"); - if (null == wxBillOtherDeposit) { - wxBillOtherDeposit = new WxBillOtherDeposit(); - } - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillOtherDeposit.setFloorForRule(dataRule.getFloorIds()); - wxBillOtherDeposit.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillOtherDeposit.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillOtherDeposit.getOnlyOweOrNear().intValue()) { - wxBillOtherDeposit.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillOtherDeposit.getOnlyOweOrNear().intValue()) { - wxBillOtherDeposit.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillOtherDeposit.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - } - wxBillOtherDeposit.updateTenantInfo(getTenantInfo()); - wxBillOtherDeposit.setSortColumns("status asc, starttime asc , merchant_id desc"); - final PageInfo page = wxBillOtherDepositService.listAsPage(wxBillOtherDeposit, pageNum, pageSize); - return new ResultData(page); - } - - @GetMapping("exportBill") - public void exportBill(@ModelAttribute WxBillOtherDeposit wxBillOtherDeposit, HttpServletRequest request, HttpServletResponse response) { - wxBillOtherDeposit.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillOtherDeposit.setFloorForRule(dataRule.getFloorIds()); - wxBillOtherDeposit.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillOtherDeposit.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillOtherDeposit.getOnlyOweOrNear().intValue()) { - wxBillOtherDeposit.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillOtherDeposit.getOnlyOweOrNear().intValue()) { - wxBillOtherDeposit.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillOtherDeposit.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - } - wxBillOtherDepositService.exportBill(request, response, wxBillOtherDeposit); - } - - @GetMapping("monthBillSum") - public ResultData monthBillSum(@ModelAttribute WxBillOtherDeposit wxBillOtherDeposit) { - if (StringUtils.isBlank(wxBillOtherDeposit.getMonth())) { - new ResultData(Result.ERROR, "请选择月份"); - } - wxBillOtherDeposit.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillOtherDeposit.setFloorForRule(dataRule.getFloorIds()); - wxBillOtherDeposit.setBusinessForRule(dataRule.getBussinessIds()); - } - WxBillSum sum = wxBillOtherDepositService.getBillMonthSum(wxBillOtherDeposit); - if (null == sum) { - sum = new WxBillSum(); - } - return new ResultData(sum); - } - - @PostMapping("add") - public ResultData add(@RequestBody WxBillOtherDeposit wxBillOtherDeposit) { - MallUserInfo user = getUser(); - wxBillOtherDeposit.updateTenantInfo(user); - wxBillOtherDeposit.setUserId(user.getId()); - wxBillOtherDeposit.setPayWay(null); - wxBillOtherDeposit.setPayDate(null); - wxBillOtherDeposit.setReceiveDate(wxBillOtherDeposit.getStarttime()); - return wxBillOtherDepositService.saveOrUpdate(wxBillOtherDeposit, user); - } - - @PostMapping("update") - public ResultData update(@RequestBody WxBillOtherDeposit wxBillOtherDeposit) { - MallUserInfo user = getUser(); - wxBillOtherDeposit.updateTenantInfo(user); - wxBillOtherDeposit.setUserId(user.getId()); - wxBillOtherDeposit.setPayWay(null); - wxBillOtherDeposit.setPayDate(null); - wxBillOtherDeposit.setReceiveDate(wxBillOtherDeposit.getStarttime()); - return wxBillOtherDepositService.saveOrUpdate(wxBillOtherDeposit, user); - } - - @GetMapping("/del") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - @SystemControllerLog(description = "其它押金账单-删除") - public ResultData delete(Long id) { - wxBillOtherDepositService.deleteById(this.getTenantInfo(),id); - return new ResultData(Result.SUCCESS, "删除成功", null); - } - - @GetMapping("/findById") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - public ResultData findById(Long id) { - return new ResultData(Result.SUCCESS, "查询成功", wxBillOtherDepositService.getById(this.getTenantInfo(),id)); - } - -// @GetMapping("/updatePaid") -// @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) -// public ResultData updatePaid(Long id) { -// return wxBillOtherDepositService.updatePaid(id); -// } -// -// @PostMapping("returnDeposit") -// public ResultData returnDeposit(@RequestBody WxBillOtherDeposit wxBillDeposit) { -// wxBillDeposit.updateTenantInfo(getTenantInfo()); -// return wxBillOtherDepositService.returnDeposit(wxBillDeposit, getUser()); -// -// } -// -// @PostMapping("adjustDeposit") -// public ResultData adjustDeposit(@RequestBody WxBillOtherDeposit wxBillDeposit) { -// wxBillDeposit.updateTenantInfo(getTenantInfo()); -// return wxBillOtherDepositService.adjustDeposit(wxBillDeposit); -// } - -} diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyController.java deleted file mode 100644 index d10779b4e..000000000 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyController.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.iformall.controller.rent; - -import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; -import com.github.pagehelper.PageInfo; -import com.iformall.annotation.SystemControllerLog; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.controller.base.BaseController; -import com.iformall.controller.base.BillBaseController; -import com.iformall.domain.po.WxBillProperty; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxUserDataRule; -import com.iformall.domain.po.base.BaseEntity; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillOweOrNearType; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.service.WxBillPropertyService; -import com.iformall.service.helper.WxBillAllHelper; - -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author gongbiao - */ -@RestController -@RequestMapping("wxBillProperty") -public class WxBillPropertyController extends BillBaseController { - @Autowired - private WxBillPropertyService wxBillPropertyService; - - @Autowired - WxBillAllHelper wxBillAllHelper; - - 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)}) - public ResultData list(@ModelAttribute WxBillProperty wxBillProperty, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxBillPropertyController::list"); - if (null == wxBillProperty) { - wxBillProperty = new WxBillProperty(); - } - wxBillProperty.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillProperty.setFloorForRule(dataRule.getFloorIds()); - wxBillProperty.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillProperty.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillProperty.getOnlyOweOrNear().intValue()) { - wxBillProperty.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillProperty.getOnlyOweOrNear().intValue()) { - wxBillProperty.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillProperty.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - } - wxBillProperty.setSortColumns("status asc,starttime asc , merchant_id desc"); - PageInfo result = wxBillPropertyService.listAsPage(wxBillProperty, pageNum, pageSize); - return new ResultData(result); - } - - @GetMapping("exportBill") - public void exportBill(@ModelAttribute WxBillProperty wxBillProperty, HttpServletRequest request, HttpServletResponse response) { - wxBillProperty.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillProperty.setFloorForRule(dataRule.getFloorIds()); - wxBillProperty.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillProperty.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillProperty.getOnlyOweOrNear().intValue()) { - wxBillProperty.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillProperty.getOnlyOweOrNear().intValue()) { - wxBillProperty.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillProperty.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - } - wxBillPropertyService.exportBill(request, response, wxBillProperty); - } - - @GetMapping("monthBillSum") - public ResultData monthBillSum(@ModelAttribute WxBillProperty wxBillProperty) { - if (StringUtils.isBlank(wxBillProperty.getMonth())) { - new ResultData(Result.ERROR, "请选择月份"); - } - wxBillProperty.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillProperty.setFloorForRule(dataRule.getFloorIds()); - wxBillProperty.setBusinessForRule(dataRule.getBussinessIds()); - } - WxBillSum sum = wxBillPropertyService.getBillMonthSum(wxBillProperty); - if (null == sum) { - sum = new WxBillSum(); - } - return new ResultData(sum); - } - - @PostMapping("add") - public ResultData add(@RequestBody WxBillProperty wxBillProperty) { - wxBillProperty.updateTenantInfo(getTenantInfo()); - wxBillPropertyService.saveOrUpdate(wxBillProperty, getUser()); - return new ResultData(); - } - - @PostMapping("update") - public ResultData update(@RequestBody WxBillProperty wxBillProperty) { - wxBillProperty.updateTenantInfo(getTenantInfo()); - return wxBillPropertyService.saveOrUpdate(wxBillProperty, getUser()); - } - - @ApiOperation("修改滞纳金") - @PostMapping("updateLatePayMoney") - public ResultData updateLatePayMoney(@RequestBody WxBillProperty wxBillProperty) { - wxBillProperty.updateTenantInfo(getTenantInfo()); - return wxBillPropertyService.updateLatePayMoney(wxBillProperty, getUser()); - } - - @GetMapping("/del") - @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) - @SystemControllerLog(description = "物业账单-删除") - public ResultData delete(Long id) { - wxBillPropertyService.deleteById(this.getTenantInfo(),id); - return new ResultData(Result.SUCCESS, "删除成功", null); - } - - @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(this.getTenantInfo(),id)); - } - -// @GetMapping("/updatePaid") -// @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) -// public ResultData updatePaid(Long id) { -// return wxBillPropertyService.updatePaid(id); -// } - - @GetMapping("/detail") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - public ResultData detail(Long id) { - return new ResultData(Result.SUCCESS, "查询成功", wxBillPropertyService.detail(this.getTenantInfo(),id)); - } - - @GetMapping("/findByPropertyContractId") - @ApiImplicitParams({ - @ApiImplicitParam(name = "propertyContractId", value = "merchantId", dataType = "Long", paramType = "query", required = true), - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) - public ResultData findByPropertyContractId(Long propertyContractId, Integer pageNum, Integer pageSize) { - final PageInfo page = wxBillPropertyService.findByPropertyContractId(propertyContractId, getTenantInfo(), pageNum, pageSize); - return new ResultData(page); - } - - @PostMapping("updateLatePayStatus") - public ResultData updateLatePayStatus(@RequestBody WxBillProperty wxBillProperty) { - wxBillProperty.updateTenantInfo(getTenantInfo()); - return wxBillPropertyService.updateLatePayStatus(wxBillProperty); - } - -} diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyDepositController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyDepositController.java deleted file mode 100644 index 18fbe59c5..000000000 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyDepositController.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.iformall.controller.rent; - -import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; -import com.github.pagehelper.PageInfo; -import com.iformall.annotation.SystemControllerLog; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.controller.base.BaseController; -import com.iformall.controller.base.BillBaseController; -import com.iformall.domain.po.WxBillDeposit; -import com.iformall.domain.po.WxBillPropertyDeposit; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxUserDataRule; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillOweOrNearType; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.service.WxBillPropertyDepositService; -import com.iformall.service.helper.WxBillAllHelper; - -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -/** - * @author gongbiao - */ -@RestController -@RequestMapping("wxBillPropertyDeposit") -public class WxBillPropertyDepositController extends BillBaseController { - @Autowired - private WxBillPropertyDepositService wxBillPropertyDepositService; - - @Autowired - WxBillAllHelper wxBillAllHelper; - - private Logger logger = LoggerFactory.getLogger(WxBillPropertyDepositController.class); - - @GetMapping("list") - @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 WxBillPropertyDeposit wxBillPropertyDeposit, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::list"); - if (null == wxBillPropertyDeposit) { - wxBillPropertyDeposit = new WxBillPropertyDeposit(); - } - wxBillPropertyDeposit.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillPropertyDeposit.setFloorForRule(dataRule.getFloorIds()); - wxBillPropertyDeposit.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillPropertyDeposit.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillPropertyDeposit.getOnlyOweOrNear().intValue()) { - wxBillPropertyDeposit.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillPropertyDeposit.getOnlyOweOrNear().intValue()) { - wxBillPropertyDeposit.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillPropertyDeposit.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - - } - wxBillPropertyDeposit.setSortColumns("status asc, starttime asc , merchant_id desc"); - PageInfo result = wxBillPropertyDepositService.listAsPage(wxBillPropertyDeposit, pageNum, pageSize); - return new ResultData(result); - } - - @GetMapping("exportBill") - public void exportBill(@ModelAttribute WxBillPropertyDeposit wxBillPropertyDeposit, HttpServletRequest request, HttpServletResponse response) { - wxBillPropertyDeposit.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillPropertyDeposit.setFloorForRule(dataRule.getFloorIds()); - wxBillPropertyDeposit.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillPropertyDeposit.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillPropertyDeposit.getOnlyOweOrNear().intValue()) { - wxBillPropertyDeposit.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillPropertyDeposit.getOnlyOweOrNear().intValue()) { - wxBillPropertyDeposit.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillPropertyDeposit.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - - } - wxBillPropertyDepositService.exportBill(request, response, wxBillPropertyDeposit); - } - - @GetMapping("monthBillSum") - public ResultData monthBillSum(@ModelAttribute WxBillPropertyDeposit wxBillPropertyDeposit) { - if (StringUtils.isBlank(wxBillPropertyDeposit.getMonth())) { - new ResultData(Result.ERROR, "请选择月份"); - } - wxBillPropertyDeposit.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillPropertyDeposit.setFloorForRule(dataRule.getFloorIds()); - wxBillPropertyDeposit.setBusinessForRule(dataRule.getBussinessIds()); - } - WxBillSum sum = wxBillPropertyDepositService.getBillMonthSum(wxBillPropertyDeposit); - if (null == sum) { - sum = new WxBillSum(); - } - return new ResultData(sum); - } - - @PostMapping("add") - public ResultData add(@RequestBody WxBillPropertyDeposit wxBillPropertyDeposit) { - wxBillPropertyDeposit.updateTenantInfo(getTenantInfo()); - wxBillPropertyDepositService.saveOrUpdate(wxBillPropertyDeposit, getUser()); - return new ResultData(); - } - - @PostMapping("update") - public ResultData update(@RequestBody WxBillPropertyDeposit wxBillPropertyDeposit) { - wxBillPropertyDeposit.updateTenantInfo(getTenantInfo()); - return wxBillPropertyDepositService.saveOrUpdate(wxBillPropertyDeposit, getUser()); - } - - @GetMapping("/del") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - @SystemControllerLog(description = "物业押金账单-删除") - public ResultData delete(Long id) { - wxBillPropertyDepositService.deleteById(this.getTenantInfo() ,id); - return new ResultData(Result.SUCCESS, "删除成功", null); - } - - @GetMapping("/findById") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - public ResultData findById(Long id) { - return new ResultData(Result.SUCCESS, "查询成功", wxBillPropertyDepositService.getById(this.getTenantInfo() ,id)); - } - - @GetMapping("/detail") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - public ResultData detail(Long id) { - return new ResultData(Result.SUCCESS, "查询成功", wxBillPropertyDepositService.detail(this.getTenantInfo() ,id)); - } - -// @GetMapping("/updatePaid") -// @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) -// public ResultData updatePaid(Long id) { -// return wxBillPropertyDepositService.updatePaid(id); -// } -// -// @PostMapping("returnDeposit") -// public ResultData returnDeposit(@RequestBody WxBillPropertyDeposit wxBillPropertyDeposit) { -// wxBillPropertyDeposit.updateTenantInfo(getTenantInfo()); -// return wxBillPropertyDepositService.returnDeposit(wxBillPropertyDeposit, getUser()); -// -// } -// -// @PostMapping("adjustDeposit") -// public ResultData adjustDeposit(@RequestBody WxBillPropertyDeposit wxBillPropertyDeposit) { -// wxBillPropertyDeposit.updateTenantInfo(getTenantInfo()); -// return wxBillPropertyDepositService.adjustDeposit(wxBillPropertyDeposit); -// -// } - - -} diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillRentController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillRentController.java deleted file mode 100644 index de4c65455..000000000 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillRentController.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.iformall.controller.rent; - -import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; -import com.github.pagehelper.PageInfo; -import com.iformall.annotation.SystemControllerLog; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.controller.base.BaseController; -import com.iformall.controller.base.BillBaseController; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxUserDataRule; -import com.iformall.domain.po.base.BaseEntity; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillOweOrNearType; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.service.WxBillRentService; -import com.iformall.service.helper.WxBillAllHelper; - -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author gongbiao - */ -@RestController -@RequestMapping("wxBillRent") -public class WxBillRentController extends BillBaseController { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - private WxBillRentService wxBillRentService; - - @Autowired - WxBillAllHelper wxBillAllHelper; - - @GetMapping("list") - @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 WxBillRent wxBillRent, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxBillRentController::list"); - if (null == wxBillRent) { - wxBillRent = new WxBillRent(); - } - wxBillRent.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillRent.setFloorForRule(dataRule.getFloorIds()); - wxBillRent.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillRent.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillRent.getOnlyOweOrNear().intValue()) { - wxBillRent.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillRent.getOnlyOweOrNear().intValue()) { - wxBillRent.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillRent.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - - } - wxBillRent.setSortColumns("status asc, starttime asc , merchant_id desc"); - final PageInfo page = wxBillRentService.listAsPage(wxBillRent, pageNum, pageSize); - return new ResultData(page); - } - - @GetMapping("exportBill") - public void exportBill(@ModelAttribute WxBillRent wxBillRent, HttpServletRequest request, HttpServletResponse response) { - wxBillRent.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillRent.setFloorForRule(dataRule.getFloorIds()); - wxBillRent.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillRent.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillRent.getOnlyOweOrNear().intValue()) { - wxBillRent.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillRent.getOnlyOweOrNear().intValue()) { - wxBillRent.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillRent.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - - } - wxBillRentService.exportBill(request, response, wxBillRent); - } - - @GetMapping("monthBillSum") - public ResultData monthBillSum(@ModelAttribute WxBillRent wxBillRent) { - if (StringUtils.isBlank(wxBillRent.getMonth())) { - new ResultData(Result.ERROR, "请选择月份"); - } - wxBillRent.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillRent.setFloorForRule(dataRule.getFloorIds()); - wxBillRent.setBusinessForRule(dataRule.getBussinessIds()); - } - WxBillSum sum = wxBillRentService.getBillMonthSum(wxBillRent); - if (null == sum) { - sum = new WxBillSum(); - } - return new ResultData(sum); - } - - @PostMapping("add") - public ResultData add(@RequestBody WxBillRent wxBillRent) { - logger.debug("[" + getIpAddr() + "] WxBillRentController::add"); - wxBillRent.updateTenantInfo(getTenantInfo()); - return wxBillRentService.saveOrUpdate(wxBillRent, getUser()); - } - - @PostMapping("update") - public ResultData update(@RequestBody WxBillRent wxBillRent) { - logger.debug("[" + getIpAddr() + "] WxBillRentController::update"); - wxBillRent.updateTenantInfo(getTenantInfo()); - return wxBillRentService.saveOrUpdate(wxBillRent, getUser()); - } - - @ApiOperation("修改滞纳金") - @PostMapping("updateLatePayMoney") - public ResultData updateLatePayMoney(@RequestBody WxBillRent wxBillRent) { - logger.debug("[" + getIpAddr() + "] WxBillRentController::updateLatePayMoney"); - wxBillRent.updateTenantInfo(getTenantInfo()); - return wxBillRentService.updateLatePayMoney(wxBillRent, getUser()); - } - - @GetMapping("/del") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - @SystemControllerLog(description = "租赁押金账单-删除") - public ResultData delete(Long id) { - logger.debug("[" + getIpAddr() + "] WxBillRentController::delete"); - wxBillRentService.deleteById(this.getTenantInfo(),id); - return new ResultData(Result.SUCCESS, "删除成功", null); - } - - @GetMapping("/findById") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - public ResultData findById(Long id) { - return new ResultData(Result.SUCCESS, "查询成功", wxBillRentService.getById(this.getTenantInfo(),id)); - } - - @GetMapping("/findByRentContractId") - @ApiImplicitParams({ - @ApiImplicitParam(name = "rentContractId", value = "merchantId", dataType = "Long", paramType = "query", required = true), - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) - public ResultData findByRentContractId(Long rentContractId, Integer pageNum, Integer pageSize) { - WxBillRent record = new WxBillRent(); - record.setRentContractId(rentContractId); - record.updateTenantInfo(getTenantInfo()); - final PageInfo page = wxBillRentService.findByRentContractId(record, pageNum, pageSize); - return new ResultData(page); - } - -// @GetMapping("/updatePaid") -// @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) -// @SystemControllerLog(description = "租赁押金账单-支付更新") -// public ResultData updatePaid(Long id) { -// logger.debug("[" + getIpAddr() + "] WxBillRentController::updatePaid"); -// return wxBillRentService.updatePaid(id); -// } - - @GetMapping("/detail") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - public ResultData detail(Long id) { - return new ResultData(Result.SUCCESS, "查询成功", wxBillRentService.detail(this.getTenantInfo(),id)); - } - - @PostMapping("updateRevenue") - public ResultData updateRevenue(@RequestBody WxBillRent wxBillRent) { - wxBillRent.updateTenantInfo(getTenantInfo()); - return wxBillRentService.updateRevenue(wxBillRent, getUser()); - } - - - @PostMapping("updateLatePayStatus") - public ResultData updateLatePayStatus(@RequestBody WxBillRent wxBillRent) { - wxBillRent.updateTenantInfo(getTenantInfo()); - return wxBillRentService.updateLatePayStatus(wxBillRent); - } - -} diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillRentManageController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillRentManageController.java deleted file mode 100644 index 6d1aa35a6..000000000 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillRentManageController.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.iformall.controller.rent; - -import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; -import com.github.pagehelper.PageInfo; -import com.iformall.annotation.SystemControllerLog; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.controller.base.BaseController; -import com.iformall.controller.base.BillBaseController; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxBillRentManage; -import com.iformall.domain.po.WxUserDataRule; -import com.iformall.domain.po.base.BaseEntity; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillOweOrNearType; -import com.iformall.enums.EnumRentContractManageFeeType; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.service.WxBillRentManageService; -import com.iformall.service.helper.WxBillAllHelper; - -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author gongbiao - */ -@RestController -@RequestMapping("wxBillRentManage") -public class WxBillRentManageController extends BillBaseController { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - private WxBillRentManageService wxBillRentManageService; - - @Autowired - WxBillAllHelper wxBillAllHelper; - - @GetMapping("list") - @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 WxBillRentManage wxBillRentManage, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxBillRentController::list"); - if (null == wxBillRentManage) { - wxBillRentManage = new WxBillRentManage(); - } - wxBillRentManage.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillRentManage.setFloorForRule(dataRule.getFloorIds()); - wxBillRentManage.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillRentManage.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillRentManage.getOnlyOweOrNear().intValue()) { - wxBillRentManage.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillRentManage.getOnlyOweOrNear().intValue()) { - wxBillRentManage.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillRentManage.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - } - wxBillRentManage.setSortColumns("status asc,starttime asc , merchant_id desc"); - final PageInfo page = wxBillRentManageService.listAsPage(wxBillRentManage, pageNum, pageSize); - return new ResultData(page); - } - - @GetMapping("exportBill") - public void exportBill(@ModelAttribute WxBillRentManage wxBillRentManage, HttpServletRequest request, HttpServletResponse response) { - wxBillRentManage.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillRentManage.setFloorForRule(dataRule.getFloorIds()); - wxBillRentManage.setBusinessForRule(dataRule.getBussinessIds()); - } - if (null != wxBillRentManage.getOnlyOweOrNear()) { - if (EnumBillOweOrNearType.OWE.getCode().intValue() == wxBillRentManage.getOnlyOweOrNear().intValue()) { - wxBillRentManage.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - }else if (EnumBillOweOrNearType.NEAR.getCode().intValue() == wxBillRentManage.getOnlyOweOrNear().intValue()) { - wxBillRentManage.setOweBillLastTime(wxBillAllHelper.getDateBefore(getOweBillBeforeDays())); - wxBillRentManage.setNearBillLastTime(wxBillAllHelper.getDateBefore(getNearBillBeforeDays())); - } - } - wxBillRentManageService.exportBill(request, response, wxBillRentManage); - } - - @GetMapping("monthBillSum") - public ResultData monthBillSum(@ModelAttribute WxBillRentManage wxBillRentManage) { - if (StringUtils.isBlank(wxBillRentManage.getMonth())) { - new ResultData(Result.ERROR, "请选择月份"); - } - wxBillRentManage.updateTenantInfo(getTenantInfo()); - WxUserDataRule dataRule = this.getCurrentDataFloors(); - if (null != dataRule) { - wxBillRentManage.setFloorForRule(dataRule.getFloorIds()); - wxBillRentManage.setBusinessForRule(dataRule.getBussinessIds()); - } - WxBillSum sum = wxBillRentManageService.getBillMonthSum(wxBillRentManage); - if (null == sum) { - sum = new WxBillSum(); - } - return new ResultData(sum); - } - - @GetMapping("/detail") - @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.detail(this.getTenantInfo(),id)); - } - - @PostMapping("add") - public ResultData add(@RequestBody WxBillRentManage wxBillRentManage) { - logger.debug("[" + getIpAddr() + "] WxBillRentController::add"); - wxBillRentManage.updateTenantInfo(getTenantInfo()); -// if (null == wxBillRentManage.getManageFeeType()) { -// return new ResultData(Result.ERROR, "参数错误", null); -// } -// if (null == EnumRentContractManageFeeType.getEnum(wxBillRentManage.getManageFeeType())) { -// return new ResultData(Result.ERROR, "参数错误", null); -// } - return wxBillRentManageService.saveOrUpdate(wxBillRentManage, getUser()); - } - - @PostMapping("update") - public ResultData update(@RequestBody WxBillRentManage wxBillRentManage) { - logger.debug("[" + getIpAddr() + "] WxBillRentController::update"); - wxBillRentManage.updateTenantInfo(getTenantInfo()); - return wxBillRentManageService.saveOrUpdate(wxBillRentManage, getUser()); - } - - @GetMapping("/findByRentContractId") - @ApiImplicitParams({ - @ApiImplicitParam(name = "rentContractId", value = "合同编号", dataType = "Long", paramType = "query", required = true), - @ApiImplicitParam(name = "manageFeeType", value = "管理费类型", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) - public ResultData findByRentContractId(Long rentContractId, Integer manageFeeType,Integer pageNum, Integer pageSize) { - WxBillRentManage record = new WxBillRentManage(); - record.setRentContractId(rentContractId); - record.updateTenantInfo(getTenantInfo()); - if (null == EnumRentContractManageFeeType.getEnum(manageFeeType)) { - return new ResultData(Result.ERROR, "参数错误", null); - } - //record.setManageFeeType(manageFeeType); - final PageInfo page = wxBillRentManageService.findByRentContractId(record, pageNum, pageSize); - return new ResultData(page); - } - - @ApiOperation("修改滞纳金") - @PostMapping("updateLatePayMoney") - public ResultData updateLatePayMoney(@RequestBody WxBillRentManage wxBillRentManage) { - wxBillRentManage.updateTenantInfo(getTenantInfo()); - return wxBillRentManageService.updateLatePayMoney(wxBillRentManage, getUser()); - } - - @GetMapping("/del") - @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) - @SystemControllerLog(description = "租赁押金账单-删除") - public ResultData delete(Long id) { - wxBillRentManageService.deleteById(this.getTenantInfo(),id); - return new ResultData(Result.SUCCESS, "删除成功", null); - } - -// @GetMapping("/updatePaid") -// @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) -// public ResultData updatePaid(Long id) { -// return wxBillRentManageService.updatePaid(id); -// } - - - @PostMapping("updateLatePayStatus") - public ResultData updateLatePayStatus(@RequestBody WxBillRentManage wxBillRent) { - wxBillRent.updateTenantInfo(getTenantInfo()); - return wxBillRentManageService.updateLatePayStatus(wxBillRent); - } - -} diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxMallAdminController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxMallAdminController.java index 7704bd64a..b22959ad0 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxMallAdminController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxMallAdminController.java @@ -11,8 +11,8 @@ import com.iformall.domain.po.MallRolePermission; import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.MallUserRole; import com.iformall.domain.po.SysConfig; +import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxBillAction; -import com.iformall.domain.po.WxBillDaily; import com.iformall.domain.po.WxCouponOrder; import com.iformall.domain.po.WxFlowModel; import com.iformall.domain.po.WxMerchant; @@ -42,9 +42,9 @@ import com.iformall.service.MallRolePermissionService; import com.iformall.service.MallUserInfoService; import com.iformall.service.MallUserRoleService; import com.iformall.service.SysConfigService; +import com.iformall.service.WxAllBillService; import com.iformall.service.WxBillActionService; import com.iformall.service.WxBillAllService; -import com.iformall.service.WxBillDailyService; import com.iformall.service.WxBillSettleService; import com.iformall.service.WxChartDataService; import com.iformall.service.WxCouponOrderService; @@ -101,7 +101,7 @@ public class WxMallAdminController extends BaseController { @Autowired private WxCouponOrderService wxCouponOrderService; @Autowired - WxBillDailyService wxBillDailyService; + WxAllBillService wxAllBillService; private WxUserDataRule getCurrentDataFloors(MallUserInfo user) { @@ -336,14 +336,11 @@ public class WxMallAdminController extends BaseController { @PostMapping("billDailyAdd") - public ResultData add(@RequestBody WxBillDaily wxBillDaily) { + public ResultData add(@RequestBody WxAllBill wxBillDaily) { setQueryDataRule(wxBillDaily); - wxBillDaily.setUserId(this.getLoginMallUserInfo().getId()); - wxBillDaily.setBuildWay(EnumBillDailyBuildWay.HAND.getCode()); wxBillDaily.setPayWay(null); wxBillDaily.setPayDate(null); - wxBillDaily.setReceiveDate(wxBillDaily.getStarttime()); - wxBillDaily.setRemark(wxBillDaily.getBillRemark()); - return wxBillDailyService.saveOrUpdate(wxBillDaily, this.getLoginMallUserInfo()); + wxBillDaily.setBillRemark(wxBillDaily.getBillRemark()); + return wxAllBillService.saveOrUpdate(wxBillDaily, this.getLoginMallUserInfo()); } } diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/ActivitySchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/ActivitySchedule.java index cc027e3c5..de15c22a4 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/ActivitySchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/ActivitySchedule.java @@ -42,65 +42,65 @@ public class ActivitySchedule { @Autowired private WxCampaignMapper wxCampaignMapper; - /** - * 每天12点执行 - */ - @Async - @Scheduled(cron = "0 0 12 * * ?") - public void sendMsg() { - logger.info("限时活动参与提醒任务启动"); - WxActivity wxActivity = new WxActivity(); - wxActivity.setStatus(EnumActivityStatus.INJECT_CAMPAIGN.getCode()); - List wxActivitys = wxActivityMapper.queryNotify(wxActivity); - WxActivityJoin wxActivityJoin; - for (WxActivity activity : wxActivitys) { - wxActivityJoin = new WxActivityJoin(); - wxActivityJoin.updateTenantInfo(activity); - wxActivityJoin.setActivityId(activity.getId()); - wxActivityJoin.setStatus(EnumActivityJoinStatus.CONFIRMED.getCode()); - List list = wxActivityJoinMapper.findList(wxActivityJoin); - for (WxActivityJoin activityJoin : list) { - send(activity, activityJoin); - } - } - } - - private void send(WxActivity activity, WxActivityJoin activityJoin) { - logger.info("限时活动参与提醒短信发送开始"); - String phone = activityJoin.getPhone(); - String person = activityJoin.getName(); - person = StringUtils.isNotEmpty(person) ? person : ""; - String time = DateUtils.date2String(activity.getActivityStartTime()); - String party = activity.getTitle(); - WxMsgRecord wxMsgRecord = new WxMsgRecord(); - wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); - wxMsgRecord.setModelType(EnumMsgModel.TIME_LIMIT_CAMPAIGN_NOTIFY.getCode()); - wxMsgRecord.setReceiver(phone); - wxMsgRecord.updateTenantInfo(activityJoin); - Map map = new HashedMap(); - map.put("person", person); - map.put("party", party); - map.put("time", time); - wxMsgRecord.setDynamicContentMap(map); - mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); - logger.info("限时活动参与提醒短信发送结束"); - - } - - /** - * 5分钟一次 - */ - @Async - @Scheduled(cron = "0 */5 * * * ?") - public void activityExipred() { - logger.info("活动报名结束任务"); - WxActivity activity = new WxActivity(); -// activity.setStatus(EnumActivityStatus.INJECT_CAMPAIGN.getCode()); - activity.setIsExpired(EnumActivityExpired.YES.getCode()); - activity.setUpdateTime(new Date()); - wxActivityMapper.activityExipred(activity); - wxActivityJoinMapper.activityExpired(); - } +// /** +// * 每天12点执行 +// */ +// @Async +// @Scheduled(cron = "0 0 12 * * ?") +// public void sendMsg() { +// logger.info("限时活动参与提醒任务启动"); +// WxActivity wxActivity = new WxActivity(); +// wxActivity.setStatus(EnumActivityStatus.INJECT_CAMPAIGN.getCode()); +// List wxActivitys = wxActivityMapper.queryNotify(wxActivity); +// WxActivityJoin wxActivityJoin; +// for (WxActivity activity : wxActivitys) { +// wxActivityJoin = new WxActivityJoin(); +// wxActivityJoin.updateTenantInfo(activity); +// wxActivityJoin.setActivityId(activity.getId()); +// wxActivityJoin.setStatus(EnumActivityJoinStatus.CONFIRMED.getCode()); +// List list = wxActivityJoinMapper.findList(wxActivityJoin); +// for (WxActivityJoin activityJoin : list) { +// send(activity, activityJoin); +// } +// } +// } +// +// private void send(WxActivity activity, WxActivityJoin activityJoin) { +// logger.info("限时活动参与提醒短信发送开始"); +// String phone = activityJoin.getPhone(); +// String person = activityJoin.getName(); +// person = StringUtils.isNotEmpty(person) ? person : ""; +// String time = DateUtils.date2String(activity.getActivityStartTime()); +// String party = activity.getTitle(); +// WxMsgRecord wxMsgRecord = new WxMsgRecord(); +// wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); +// wxMsgRecord.setModelType(EnumMsgModel.TIME_LIMIT_CAMPAIGN_NOTIFY.getCode()); +// wxMsgRecord.setReceiver(phone); +// wxMsgRecord.updateTenantInfo(activityJoin); +// Map map = new HashedMap(); +// map.put("person", person); +// map.put("party", party); +// map.put("time", time); +// wxMsgRecord.setDynamicContentMap(map); +// mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); +// logger.info("限时活动参与提醒短信发送结束"); +// +// } +// +// /** +// * 5分钟一次 +// */ +// @Async +// @Scheduled(cron = "0 */5 * * * ?") +// public void activityExipred() { +// logger.info("活动报名结束任务"); +// WxActivity activity = new WxActivity(); +//// activity.setStatus(EnumActivityStatus.INJECT_CAMPAIGN.getCode()); +// activity.setIsExpired(EnumActivityExpired.YES.getCode()); +// activity.setUpdateTime(new Date()); +// wxActivityMapper.activityExipred(activity); +// wxActivityJoinMapper.activityExpired(); +// } /** * 5分钟一次 diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/BillNotificationSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/BillNotificationSchedule.java index d73f54e3c..7c50d22af 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/BillNotificationSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/BillNotificationSchedule.java @@ -37,19 +37,19 @@ public class BillNotificationSchedule { @Autowired WxBillAllService wxBillAllService; - /** - * 每天9点执行 - */ - @Async - @Scheduled(cron = "0 0 14 * * ?") - public void sendMsgFromBill() { - logger.info("账单通知任务启动"); - sendWaitPayBill(); - wxBillAllService.sendWaitPayBillEmail(); - sendOweBill(); - wxBillAllService.sendOweBillForEmail(); - logger.info("账单通知任务结束"); - } +// /** +// * 每天9点执行 +// */ +// @Async +// @Scheduled(cron = "0 0 14 * * ?") +// public void sendMsgFromBill() { +// logger.info("账单通知任务启动"); +// sendWaitPayBill(); +// wxBillAllService.sendWaitPayBillEmail(); +// sendOweBill(); +// wxBillAllService.sendOweBillForEmail(); +// logger.info("账单通知任务结束"); +// } private void sendOweBill() { logger.info("查询欠缴账单数据"); diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/BillSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/BillSchedule.java deleted file mode 100644 index 64fadd8aa..000000000 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/BillSchedule.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.iformall.schedule; - -import com.iformall.domain.vo.WxBillAll; -import com.iformall.mapper.WxBillSettleScheduleMapper; -import com.iformall.service.WxBillAllService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import java.util.List; - -@Component -public class BillSchedule { - - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - WxBillAllService wxBillAllService; - - @Autowired - WxBillSettleScheduleMapper wxBillSettleScheduleMapper; - - /** - * 每天1点执行 - * 结算账单 - */ - @Async - @Scheduled(cron = "0 0 1 * * ?") - public void settleBill() { - WxBillAll wxBillAll = new WxBillAll(); - //wxBillAll.updateTenantInfo(wxBillAll); - List settleBillIdList = wxBillSettleScheduleMapper.listToSettleBillIdList(wxBillAll); - if (null != settleBillIdList && settleBillIdList.size() > 0 ) { - for (int i = 0 ; i < settleBillIdList.size(); i ++) { - Long settleId = settleBillIdList.get(i); - try { - Double pay = wxBillAllService.calcuteSettleBillReceivePay(settleId); - wxBillAllService.createBillSettleSchedule(settleId, pay); - }catch(Exception e) { - logger.error("settleBill error.",e); - } - } - } - - } - -} \ No newline at end of file diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/BillStatusSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/BillStatusSchedule.java deleted file mode 100644 index 304050212..000000000 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/BillStatusSchedule.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.iformall.schedule; - -import com.iformall.domain.po.WxMall; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillAll; -import com.iformall.mapper.WxMallMapper; -import com.iformall.service.WxBillAllService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author gongbiao - */ -@Component -public class BillStatusSchedule { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - private WxBillAllService wxBillAllService; - - @Autowired - private WxMallMapper wxMallMapper; - - /** - * 每天1点执行 - */ -// @Async -// @Scheduled(cron = "0 0 1 * * ?") -// public void updateBillStatus() { -// logger.info("账单状态更新开始"); -// -// List wxMalls = wxMallMapper.findList(null); -// for (WxMall wxMall : wxMalls) { -// TenantEntity tenantEntity = wxMall.getTenantInfo(); -// WxBillAll wxBillAll = new WxBillAll(); -// wxBillAll.updateTenantInfo(tenantEntity); -// wxBillAllService.updateBillStatus(wxBillAll); -// } -// -// logger.info("账单状态更新结束"); -// } - - -} \ No newline at end of file diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/LatePayBillActionSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/LatePayBillActionSchedule.java deleted file mode 100644 index c068e0b7f..000000000 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/LatePayBillActionSchedule.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.iformall.schedule; - -import com.iformall.mapper.WxBillPropertyMapper; -import com.iformall.mapper.WxBillRentMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -/** - * @author luozukai - */ -@Component -public class LatePayBillActionSchedule { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - @Autowired - private WxBillRentMapper wxBillRentMapper; - @Autowired - private WxBillPropertyMapper wxBillPropertyMapper; -// /** -// * 每天凌晨1点执行 -// */ -// @Async -// @Scheduled(cron = "0 0 1 * * ?") -// public void updateBillStatus() { -// try { -// logger.info("账单滞纳金更新开始"); -// wxBillRentMapper.insertBillAction(); -// wxBillPropertyMapper.insertBillAction(); -// -// wxBillRentMapper.autoAddLatePayPrice(); -// wxBillPropertyMapper.autoAddLatePayPrice(); -// -// //修改欠缴 -// //wxBillRentMapper.updateOwe(); -// //wxBillPropertyMapper.updateOwe(); -// -// logger.info("账单滞纳金更新结束"); -// }catch (Exception e){ -// logger.error("LatePayBillActionSchedule error! message:{}",e.getMessage()); -// logger.error("LatePayBillActionSchedule error!",e); -// } -// } - - -} \ No newline at end of file diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/PowerBillAutoBuildSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/PowerBillAutoBuildSchedule.java index 70bb16a20..153d6e758 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/PowerBillAutoBuildSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/PowerBillAutoBuildSchedule.java @@ -11,7 +11,6 @@ import com.iformall.mapper.KwMerchantMeterMapper; import com.iformall.mapper.WxMerchantPowerBillConfigMapper; import com.iformall.mapper.WxMerchantShopMapper; import com.iformall.mapper.WxPowerBillAutoConfigMapper; -import com.iformall.service.WxBillDailyService; import com.iformall.service.kw.KwMeterDataService; import com.iformall.utils.Constant; @@ -46,9 +45,6 @@ public class PowerBillAutoBuildSchedule { @Autowired private WxMerchantPowerBillConfigMapper wxMerchantPowerBillConfigMapper; - @Autowired - private WxBillDailyService wxBillDailyService; - @Autowired private WxMerchantShopMapper wxMerchantShopMapper; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java b/mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java index 2fe45aabc..8ccb5e772 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java @@ -64,7 +64,9 @@ public class WxAllBill extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="创建用户名称",name="createBy") public String updateByName; - + @io.swagger.annotations.ApiModelProperty(value="费用说明",name="priceDetail") + public String priceDetail; + @io.swagger.annotations.ApiModelProperty(value="应收金额(最初应收)",name="needPay") public String needPay; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillAdvance.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillAdvance.java deleted file mode 100644 index 3b9acbc7a..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillAdvance.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.iformall.domain.po; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.iformall.enums.EnumBillAllType; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -/** - */ -@TableName(value = "wx_bill_advance") -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class WxBillAdvance extends WxAllBill { - - private static final long serialVersionUID = -4337916787670692258L; - - @io.swagger.annotations.ApiModelProperty(value="应收金额(最初应收)",name="needPay") - private String remark; - -// @Override -// public String getBillRemark() { -// return remark; -// } -// -// @Override -// public String getReturnPay() { -// return "0"; -// } -// -// @Override -// public String getBillLatePay() { -// return "0"; -// } -// -// @Override -// public String getBillServicePay() { -// return "0"; -// } - - @TableField(exist = false) - private String totalFee; - public void calcuteTotalFee(Integer decimalSize) { - this.totalFee = receivePay; - } - - - -} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java deleted file mode 100644 index 9ac423963..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.iformall.domain.po; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.iformall.common.SortColumn; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumBillAllType; -import com.iformall.enums.EnumBillDailyType; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import javax.validation.constraints.NotNull; -import java.util.Date; -import java.util.List; - -/** - * @author gongbiao - */ -@TableName(value = "wx_bill_daily") -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class WxBillDaily extends WxAllBill { - /** - * - */ - private static final long serialVersionUID = 5004263718907992977L; - - - @Excel(name = "费用类型*", replace = {"水费_1", "电费_2" , "空调费_3"}, width = 20, orderNum = "2") - @NotNull - @io.swagger.annotations.ApiModelProperty(value="账单类型EnumBillDailyType",name="type") - private Integer type; - - //@Excel(name = "缴款截止日期*", orderNum = "5", width = 20, format = "yyyy-MM-dd") - @NotNull - @io.swagger.annotations.ApiModelProperty(value="截止收款日期",name="receiveDate") - private Date receiveDate; - - @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") - private Long expiredDay; - - @io.swagger.annotations.ApiModelProperty(value = "账单审核状态EnumBillRentApplyStatus", name = "applyStatus") - private Integer applyStatus; - @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyPayImg") - private String applyPayImg; - @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyUpdateTime") - private Date applyUpdateTime; - @io.swagger.annotations.ApiModelProperty(value="删除 是1否0",name="isDel") - private Integer isDel; - @io.swagger.annotations.ApiModelProperty(value="账号ID",name="userId") - private Long userId; - @io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId") - private Long shopId; - @io.swagger.annotations.ApiModelProperty(value="商铺",name="shopName") - private String shopName; - @Override - public String getShopNumber() { - return shopName; - } - - @io.swagger.annotations.ApiModelProperty(value = "费用明细", name = "priceDetail") - private String priceDetail; - - @TableField(exist = false) - private Integer allPeriod; - - @TableField(exist = false) - private String needPay; - - @TableField(exist = false) - private String latePayPrice; - - @TableField(exist = false) - @SortColumn(column = "period") - private Integer period; - - @TableField(exist = false) - private WxMerchant merchant; - - @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") - private Integer freeze; - - @io.swagger.annotations.ApiModelProperty(value = "创建方式1手动2自动3导入EnumBillDailyBuildWay", name = "buildWay") - private Integer buildWay; - - @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") - private String serviceChargePay; - - @io.swagger.annotations.ApiModelProperty(value = "备注", name = "serviceChargePay") - private String remark; - - @io.swagger.annotations.ApiModelProperty(value = "能源抄表计算ID", name = "energyReadingCalcuteId") - private Long energyReadingCalcuteId; - - @io.swagger.annotations.ApiModelProperty(value = "能源抄表ID", name = "energyReadingId") - private Long energyReadingId; - - @TableField(exist = false) - private String serviceChargePayBefore; - @TableField(exist = false) - private String serviceChargePayUpdate; - @TableField(exist = false) - private List merchantIds; - @TableField(exist = false) - private List notInIds; - -// @Override -// public String getBillRemark() { -// return remark; -// } -// -// @Override -// public String getReturnPay() { -// return "0"; -// } -// -// @Override -// public String getBillLatePay() { -// return "0"; -// } -// -// @Override -// public String getBillServicePay() { -// return serviceChargePay; -// } -} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java deleted file mode 100644 index fffaac3bb..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.iformall.domain.po; - -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; -import com.iformall.enums.EnumBillAllType; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; - -/** - * @author gongbiao - */ -@TableName(value = "wx_bill_rent_deposit") -@Data -@EqualsAndHashCode(callSuper = true) -public class WxBillDeposit extends WxAllBill { - - @Excel(name = "租金合同ID", width = 20, orderNum = "1") - @io.swagger.annotations.ApiModelProperty(value="租金合同ID",name="rentContractId") - private Long rentContractId; - @io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate") - private Date receiveDate; - @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") - private Long expiredDay; - @io.swagger.annotations.ApiModelProperty(value = "账单审核状态EnumBillRentApplyStatus", name = "applyStatus") - private Integer applyStatus; - @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyPayImg") - private String applyPayImg; - @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyUpdateTime") - private Date applyUpdateTime; - @io.swagger.annotations.ApiModelProperty(value="是否删除 是1否0 未到期不显示",name="isDel") - private Integer isDel; - @io.swagger.annotations.ApiModelProperty(value="账号ID",name="userId") - private Long userId; - @io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId") - private Long shopId; - - @io.swagger.annotations.ApiModelProperty(value = "退还金额", name = "returnPrice") - private String returnPrice; - - @io.swagger.annotations.ApiModelProperty(value = "商铺信息", name = "shopInfo") - private String shopInfo; - - @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") - private Integer freeze; - - @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") - private String serviceChargePay; - -// @io.swagger.annotations.ApiModelProperty(value = "合同押金详细", name = "contractDepoistDetail") -// private String contractDepoistDetail; - - @TableField(exist = false) - private String serviceChargePayBefore; - @TableField(exist = false) - private String serviceChargePayUpdate; - @TableField(exist = false) - private List rentContractIdList; - @TableField(exist = false) - private List merchantIds; - - @Override - public Integer getBillType() { - return EnumBillAllType.RENT_DEPOSIT.getCode(); - } - - @Override - public String getBillTypeName() { - return EnumBillAllType.RENT_DEPOSIT.getMessage(); - } - -// @Override -// public String getBillRemark() { -// return ""; -// } -// -// @Override -// public String getReturnPay() { -// return this.returnPrice; -// } -// -// @Override -// public String getBillLatePay() { -// return "0"; -// } -// -// @Override -// public String getBillServicePay() { -// return serviceChargePay; -// } -} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillOther.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillOther.java deleted file mode 100644 index ab783f9a1..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillOther.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.iformall.domain.po; - -import cn.afterturn.easypoi.excel.annotation.Excel; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.iformall.common.SortColumn; -import com.iformall.enums.EnumBillAllType; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -/** - * @author gongbiao - */ -@TableName(value = "wx_bill_other") -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class WxBillOther extends WxAllBill { - - /** - * - */ - private static final long serialVersionUID = -5919107280859407195L; - - @Excel(name = "其他费用名称", width = 20, orderNum = "3") - @io.swagger.annotations.ApiModelProperty(value="账单名称",name="name") - private String name; - - @Excel(name = "备注", orderNum = "11", width = 20) - @io.swagger.annotations.ApiModelProperty(value="账单备注",name="comments") - private String comments; - - //@Excel(name = "缴款截止日期", orderNum = "7", width = 20, format = "yyyy-MM-dd") - @io.swagger.annotations.ApiModelProperty(value="截止收款日期",name="receiveDate") - private Date receiveDate; - - //@Excel(name = "逾期(天)", orderNum = "10", width = 20) - @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") - private Long expiredDay; - - @io.swagger.annotations.ApiModelProperty(value = "账单审核状态EnumBillRentApplyStatus", name = "applyStatus") - private Integer applyStatus; - @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyPayImg") - private String applyPayImg; - @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyUpdateTime") - private Date applyUpdateTime; - @io.swagger.annotations.ApiModelProperty(value="删除 是1否0",name="isDel") - private Integer isDel; - @io.swagger.annotations.ApiModelProperty(value="账号ID",name="userId") - private Long userId; - @io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId") - private Long shopId; - - @TableField(exist = false) - private Integer allPeriod; - - @TableField(exist = false) - private Long latePayPrice; - - @TableField(exist = false) - @SortColumn(column = "period") - private Integer period; - - @Excel(name = "商铺号", width = 20, orderNum = "1") - private String shopName; - - @TableField(exist = false) - private WxMerchant merchant; - - - @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") - private Integer freeze; - - @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") - private String serviceChargePay; - - @TableField(exist = false) - private String serviceChargePayBefore; - @TableField(exist = false) - private String serviceChargePayUpdate; - - @TableField(exist = false) - private List merchantIds; - - @TableField(exist = false) - private List notInIds; - -// @Override -// public String getBillRemark() { -// return StringUtils.trimToEmpty(name)+StringUtils.trimToEmpty(comments); -// } -// -// @Override -// public String getReturnPay() { -// return "0"; -// } -// -// @Override -// public String getBillLatePay() { -// return "0"; -// } -// -// @Override -// public String getBillServicePay() { -// return serviceChargePay; -// } -} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillOtherDeposit.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillOtherDeposit.java deleted file mode 100644 index 21ecfeedd..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillOtherDeposit.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.iformall.domain.po; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.iformall.common.SortColumn; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumBillAllType; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; - -/** - * @author gongbiao - */ -@TableName(value = "wx_bill_other_deposit") -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class WxBillOtherDeposit extends WxAllBill { - - @io.swagger.annotations.ApiModelProperty(value = "账单名称", name = "name") - private String name; - - @Excel(name = "押金描述", width = 20, orderNum = "3") - @io.swagger.annotations.ApiModelProperty(value = "账单备注", name = "comments") - private String comments; - - @io.swagger.annotations.ApiModelProperty(value = "截止收款日期", name = "receiveDate") - private Date receiveDate; - - @io.swagger.annotations.ApiModelProperty(value = "逾期天数", name = "expiredDay") - private Long expiredDay; - - @io.swagger.annotations.ApiModelProperty(value = "账单审核状态EnumBillRentApplyStatus", name = "applyStatus") - private Integer applyStatus; - @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyPayImg") - private String applyPayImg; - @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyUpdateTime") - private Date applyUpdateTime; - @io.swagger.annotations.ApiModelProperty(value = "删除 是1否0", name = "isDel") - private Integer isDel; - @io.swagger.annotations.ApiModelProperty(value = "账号ID", name = "userId") - private Long userId; - @io.swagger.annotations.ApiModelProperty(value = "商铺ID", name = "shopId") - private Long shopId; - - @io.swagger.annotations.ApiModelProperty(value = "退还金额", name = "returnPrice") - private String returnPrice; - @TableField(exist = false) - private String remainReturnPrice;//剩余待退回金额 - public String getRemainReturnPrice() { - if (StringUtils.isBlank(returnPrice)) { - returnPrice = "0"; - } - return new BigDecimal(getOwe()).subtract(new BigDecimal(returnPrice)).toPlainString(); - } - - @TableField(exist = false) - private Integer allPeriod; - - @TableField(exist = false) - private Long latePayPrice; - - @TableField(exist = false) - @SortColumn(column = "period") - private Integer period; - - @Excel(name = "商铺号", width = 20, orderNum = "1") - private String shopName; - - public Date getReturnDate() { - if (status == null) { - return null; - } - return status == 5 ? updatetime : null; - } - - @TableField(exist = false) - @Excel(name = "退款日", orderNum = "7", width = 20, format = "yyyy-MM-dd") - private Date returnDate; - - @TableField(exist = false) - private WxMerchant merchant; - - @TableField(exist = false) - private List> shops; - - @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") - private Integer freeze; - - @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") - private String serviceChargePay; - - @TableField(exist = false) - private String serviceChargePayBefore; - @TableField(exist = false) - private String serviceChargePayUpdate; - - @TableField(exist = false) - private List merchantIds; - - @TableField(exist = false) - private List notInIds; - -// @Override -// public String getBillRemark() { -// return StringUtils.trimToEmpty(name)+StringUtils.trimToEmpty(comments); -// } -// -// @Override -// public String getReturnPay() { -// return this.returnPrice; -// } -// -// @Override -// public String getBillLatePay() { -// return "0"; -// } -// -// @Override -// public String getBillServicePay() { -// return serviceChargePay; -// } - -} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java deleted file mode 100644 index 7a64328ec..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.iformall.domain.po; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.iformall.common.SortColumn; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillFeesStandardsListVo; -import com.iformall.enums.EnumBillAllType; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.Date; -import java.util.List; - -/** - */ -@TableName(value = "wx_bill_property") -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class WxBillProperty extends WxAllBill { - - /** - * - */ - private static final long serialVersionUID = -4019665043805504986L; - - //@Excel(name = "缴款截止日期", format = "yyyy-MM-dd", width = 20, orderNum = "10") - @io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate") - private Date receiveDate; - - //@Excel(name = "逾期(天) ", width = 20, orderNum = "13") - @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") - private Long expiredDay; - @io.swagger.annotations.ApiModelProperty(value = "账单审核状态EnumBillRentApplyStatus", name = "applyStatus") - private Integer applyStatus; - @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyPayImg") - private String applyPayImg; - @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyUpdateTime") - private Date applyUpdateTime; - @io.swagger.annotations.ApiModelProperty(value="是否删除 是1否0 未到期不显示",name="isDel") - private Integer isDel; - - @io.swagger.annotations.ApiModelProperty(value="账号ID",name="userId") - private Long userId; - - @io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId") - private Long shopId; - - @io.swagger.annotations.ApiModelProperty(value = "营业额", name = "revenue") - private String revenue; - - @io.swagger.annotations.ApiModelProperty(value = "滞纳金费率", name = "latePayRatio") - private Integer latePayRatio; - - @io.swagger.annotations.ApiModelProperty(value = "滞纳金时间", name = "latePayTime") - private Date latePayTime; - - @Excel(name = "滞纳金(元)", width = 20, orderNum = "12") - @io.swagger.annotations.ApiModelProperty(value = "滞纳金总额", name = "latePayPrice") - private String latePayPrice; - - @io.swagger.annotations.ApiModelProperty(value = "账期", name = "period") - private Integer period; - - @io.swagger.annotations.ApiModelProperty(value = "预览账单0否1是", name = "isPreview") - private Integer isPreview; - - @io.swagger.annotations.ApiModelProperty(value = "商铺信息", name = "shopInfo") - private String shopInfo; - - @io.swagger.annotations.ApiModelProperty(value = "滞纳金状态", name = "latePayStatus") - private Integer latePayStatus; - - @io.swagger.annotations.ApiModelProperty(value = "备注", name = "comments") - private String comments; - - - @TableField(exist = false) - private Integer allPeriod; - - //@Excel(name = "押金状态", replace = {"欠缴_1", "待缴_2", "已结清_3", "未到期_4", "已退还_5", "失效_6", "无押金_0"}, width = 20, orderNum = "3") - @TableField(exist = false) - private Integer depositStatus; - - @TableField(exist = false) - private String deposit; - - @TableField(exist = false) - private Integer limitStart; - @TableField(exist = false) - private Integer limitEnd; - - @io.swagger.annotations.ApiModelProperty(value = "n日后开始计算滞纳金", name = "latePayRatio") - @TableField(exist = false) - private Integer latePayDay; - - - @TableField(exist = false) - private String latePayMoneyBefore; - @TableField(exist = false) - private String latePayMoneyUpdate; - - @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") - private Integer freeze; - - @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") - private String serviceChargePay; - - @TableField(exist = false) - private String serviceChargePayBefore; - @TableField(exist = false) - private String serviceChargePayUpdate; - - @TableField(exist = false) - private List propertyContractIds; - - @TableField(exist = false) - private List merchantIds; - -// @Override -// public Integer getBillType() { -// return EnumBillAllType.PROPERTY.getCode(); -// } -// -// @Override -// public String getBillTypeName() { -// return EnumBillAllType.PROPERTY.getMessage(); -// } -// -// @Override -// public String getBillRemark() { -// return comments; -// } -// -// @Override -// public String getReturnPay() { -// return "0"; -// } -// -// @Override -// public String getBillLatePay() { -// return latePayPrice; -// } -// -// @Override -// public String getBillServicePay() { -// return serviceChargePay; -// } - - @TableField(exist = false) - private String totalFee; - - - @TableField(exist = false) - List unFixedbillFeesStandardsList; - - @TableField(exist = false) - private Integer hasParentBillId; - @TableField(exist = false) - private Integer hasFeesStardarsId; - -} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java deleted file mode 100644 index c45a20393..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java +++ /dev/null @@ -1,120 +0,0 @@ -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; -import com.iformall.enums.EnumBillAllType; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -/** - * @author gongbiao - */ -@TableName(value = "wx_bill_property_deposit") -@Data -@EqualsAndHashCode(callSuper = true) -public class WxBillPropertyDeposit extends WxAllBill { - - @Excel(name = "物业合同ID", width = 20, orderNum = "1") - @io.swagger.annotations.ApiModelProperty(value="物业合同ID",name="propertyContractId") - private Long propertyContractId; - @io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate") - private Date receiveDate; - @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") - private Long expiredDay; - @io.swagger.annotations.ApiModelProperty(value = "账单审核状态EnumBillRentApplyStatus", name = "applyStatus") - private Integer applyStatus; - @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyPayImg") - private String applyPayImg; - @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyUpdateTime") - private Date applyUpdateTime; - @io.swagger.annotations.ApiModelProperty(value="是否删除 是1否0 未到期不显示",name="isDel") - private Integer isDel; - @io.swagger.annotations.ApiModelProperty(value="账号ID",name="userId") - private Long userId; - @io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId") - private Long shopId; - - @io.swagger.annotations.ApiModelProperty(value = "退还金额", name = "returnPrice") - private String returnPrice; - @TableField(exist = false) - private String remainReturnPrice;//剩余待退回金额 - public String getRemainReturnPrice() { - if (StringUtils.isBlank(returnPrice)) { - returnPrice = "0"; - } - return new BigDecimal(getOwe()).subtract(new BigDecimal(returnPrice)).toPlainString(); - } - - - @io.swagger.annotations.ApiModelProperty(value = "商铺信息", name = "shopInfo") - private String shopInfo; - - @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") - private Integer freeze; - - @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") - private String serviceChargePay; - - @TableField(exist = false) - private String serviceChargePayBefore; - @TableField(exist = false) - private String serviceChargePayUpdate; - @TableField(exist = false) - private List propertyContractIdList; - @TableField(exist = false) - private List merchantIds; - - public String getShopNumberByShopInfo() { - StringBuffer sb = new StringBuffer(""); - String rentInfo = this.getShopInfo(); - if (!StringUtils.isBlank(rentInfo)) { - JSONObject rentInfoObject = JSONArray.parseObject(rentInfo); - for (Iterator it = rentInfoObject.keySet().iterator();it.hasNext();) { - sb.append(it.next()).append(","); - } - } - return sb.toString(); - } - -// @Override -// public Integer getBillType() { -// return EnumBillAllType.PROPERTY_DEPOSIT.getCode(); -// } -// -// @Override -// public String getBillTypeName() { -// return EnumBillAllType.PROPERTY_DEPOSIT.getMessage(); -// } -// -// @Override -// public String getBillRemark() { -// return ""; -// } -// -// @Override -// public String getReturnPay() { -// return this.returnPrice; -// } -// -// @Override -// public String getBillLatePay() { -// return "0"; -// } -// -// @Override -// public String getBillServicePay() { -// return serviceChargePay; -// } - -} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java deleted file mode 100644 index b7232b3c4..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.iformall.domain.po; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.iformall.common.SortColumn; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumBillAllType; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; -import org.apache.commons.lang3.StringUtils; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.Date; -import java.util.List; - -/** - * @author gongbiao - */ -@TableName(value = "wx_bill_rent") -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class WxBillRent extends WxAllBill { - - - //@Excel(name = "缴款截止日期", format = "yyyy-MM-dd", width = 20, orderNum = "13") -// @io.swagger.annotations.ApiModelProperty(value="收款截止日期,过了有手续费",name="receiveDate") -// private Date receiveDate; - - //@Excel(name = "逾期(天) ", width = 20, orderNum = "14") -// @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") -// private Long expiredDay; - -// @io.swagger.annotations.ApiModelProperty(value = "账单审核状态EnumBillRentApplyStatus", name = "applyStatus") -// private Integer applyStatus; -// @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyPayImg") -// private String applyPayImg; -// @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyUpdateTime") -// private Date applyUpdateTime; - -// @io.swagger.annotations.ApiModelProperty(value="是否删除 是1否0 未到期不显示",name="isDel") -// private Integer isDel; - -// @io.swagger.annotations.ApiModelProperty(value="原合同应收金额",name="contractNeedPay") -// @Excel(name = "原合同应收金额(元)", width = 20, orderNum = "6") -// private String contractNeedPay; - - -// @io.swagger.annotations.ApiModelProperty(value = "合同应收明细", name = "rentPriceInfo") -// private String rentPriceInfo; -// -// @Excel(name = "原合同应收金额明细(元)", width = 20, height = 30, orderNum = "7") -// @TableField(exist = false) -// private String rentPriceInfoStr; -// public String getRentPriceInfoStr() { -// String infoStr = ""; -// if(StringUtils.isNotBlank(this.getRentPriceInfo())){ -// JSONObject jsonObject = JSONObject.parseObject(this.getRentPriceInfo()); -// String rentPrice1 = jsonObject.getString("rentPrice"); -// infoStr += "租金:" + (StringUtils.isBlank(rentPrice1) ? "0":rentPrice1) + "\n"; -// String siteMoney1 = jsonObject.getString("siteMoney"); -// infoStr += "场地费:" + (StringUtils.isBlank(siteMoney1) ? "0":siteMoney1) + "\n"; -// String facilityMoney1 = jsonObject.getString("facilityMoney"); -// infoStr += "设备费:" + (StringUtils.isBlank(facilityMoney1) ? "0":facilityMoney1) + "\n"; -// //String administratorMoney1 = jsonObject.getString("administratorMoney"); -// //infoStr += "商业管理费:" + (StringUtils.isBlank(administratorMoney1) ? "0":administratorMoney1); -// -// } -// return infoStr; -// } - -// -// @Override -// public String getBillRemark() { -// return ""; -// } -// -// @Override -// public String getReturnPay() { -// return "0"; -// } -// -// @Override -// public String getBillLatePay() { -// return latePayPrice; -// } - -// @Override -// public String getBillServicePay() { -// return serviceChargePay; -// } - -// @io.swagger.annotations.ApiModelProperty(value="账号ID",name="userId") -// private Long userId; - -// @io.swagger.annotations.ApiModelProperty(value = "营业额", name = "revenue") -// private String revenue; - -// @io.swagger.annotations.ApiModelProperty(value = "滞纳金费率", name = "latePayRatio") -// private Integer latePayRatio; -// -// @io.swagger.annotations.ApiModelProperty(value = "滞纳金时间", name = "latePayTime") -// private Date latePayTime; -// -// @io.swagger.annotations.ApiModelProperty(value = "滞纳金总额", name = "latePayPrice") -// private String latePayPrice; - -// public String getLatePayPriceStr() { -// return new BigDecimal(latePayPrice == null ? 0 : latePayPrice).divide(new BigDecimal(100)).toPlainString(); -// } - -// @Excel(name = "滞纳金(元)", width = 20, orderNum = "12") -// @TableField(exist = false) -// private String latePayPriceStr; - -// @io.swagger.annotations.ApiModelProperty(value = "滞纳金状态", name = "latePayStatus") -// private Integer latePayStatus; - -// @io.swagger.annotations.ApiModelProperty(value = "备注", name = "comments") -// private String comments; - -// @TableField(exist = false) -// private Integer allPeriod; -// -// //@Excel(name = "押金状态", replace = {"欠缴_1", "待缴_2", "已结清_3", "未到期_4", "已退还_5", "失效_6", "无押金_0"}, width = 20, orderNum = "3") -// @TableField(exist = false) -// private Integer depositStatus; -// -// @TableField(exist = false) -// private Integer rentType; -// -// @TableField(exist = false) -// private String deposit; -// -//// @io.swagger.annotations.ApiModelProperty(value = "联营费率", name = "payRatio") -//// private String payRatio; -// -// @TableField(exist = false) -// private Integer limitStart; -// @TableField(exist = false) -// private Integer limitEnd; -// -// @io.swagger.annotations.ApiModelProperty(value = "n日后开始计算滞纳金", name = "latePayRatio") -// @TableField(exist = false) -// private Integer latePayDay; -// -// @TableField(exist = false) -// private String latePayMoneyBefore; -// @TableField(exist = false) -// private String latePayMoneyUpdate; -//// private String busDiscountRatio; -// -//// @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") -//// private Integer freeze; -// -//// @io.swagger.annotations.ApiModelProperty(value = "联营租金", name = "joinRentPrice") -//// private String joinRentPrice; -// -// @TableField(exist = false) -// private String serviceChargePayBefore; -// @TableField(exist = false) -// private String serviceChargePayUpdate; -// -//// @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") -//// private String serviceChargePay; -// -// @TableField(exist = false) -// private List rentContractIdList; -// -} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillRentManage.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillRentManage.java deleted file mode 100644 index e8a60ab70..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillRentManage.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.iformall.domain.po; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.iformall.common.SortColumn; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumBillAllType; -import com.iformall.enums.EnumRentContractManageFeeType; -import com.iformall.utils.Constant; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; - -/** - * @author gongbiao - */ -@TableName(value = "wx_bill_rent_manage") -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class WxBillRentManage extends WxAllBill { - - @io.swagger.annotations.ApiModelProperty(value="租金合同ID",name="rentContractId") - private Long rentContractId; - - //@Excel(name = "缴款截止日期", format = "yyyy-MM-dd", width = 20, orderNum = "13") - @io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate") - private Date receiveDate; - - //@Excel(name = "逾期(天) ", width = 20, orderNum = "14") - @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") - private Long expiredDay; - - @io.swagger.annotations.ApiModelProperty(value = "账单审核状态EnumBillRentApplyStatus", name = "applyStatus") - private Integer applyStatus; - @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyPayImg") - private String applyPayImg; - @io.swagger.annotations.ApiModelProperty(value = "付款截图", name = "applyUpdateTime") - private Date applyUpdateTime; - - @io.swagger.annotations.ApiModelProperty(value = "预览账单0否1是", name = "isPreview") - private Integer isPreview; - - @io.swagger.annotations.ApiModelProperty(value="是否删除 是1否0 未到期不显示",name="isDel") - private Integer isDel; - - @io.swagger.annotations.ApiModelProperty(value="账号ID",name="userId") - private Long userId; - - @io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId") - private Long shopId; - - @io.swagger.annotations.ApiModelProperty(value = "滞纳金费率", name = "latePayRatio") - private Integer latePayRatio; - - @io.swagger.annotations.ApiModelProperty(value = "滞纳金时间", name = "latePayTime") - private Date latePayTime; - - @io.swagger.annotations.ApiModelProperty(value = "滞纳金总额", name = "latePayPrice") - @Excel(name = "滞纳金(元)", width = 20, orderNum = "12") - private String latePayPrice; - -// public String getLatePayPriceStr() { -// return new BigDecimal(latePayPrice == null ? 0 : latePayPrice).divide(new BigDecimal(100)).toPlainString(); -// } -// -// @Excel(name = "滞纳金(元)", width = 20, orderNum = "12") -// @TableField(exist = false) -// private String latePayPriceStr; - - @SortColumn(column = "period") - @io.swagger.annotations.ApiModelProperty(value = "账期", name = "period") - private Integer period; - - @io.swagger.annotations.ApiModelProperty(value = "商铺信息", name = "shopInfo") - private String shopInfo; - - @io.swagger.annotations.ApiModelProperty(value = "滞纳金状态", name = "latePayStatus") - private Integer latePayStatus; - - @TableField(exist = false) - private Integer limitStart; - @TableField(exist = false) - private Integer limitEnd; - - @TableField(exist = false) - private String latePayMoneyBefore; - @TableField(exist = false) - private String latePayMoneyUpdate; - - @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") - private Integer freeze; - - @TableField(exist = false) - private String serviceChargePayBefore; - @TableField(exist = false) - private String serviceChargePayUpdate; - - @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") - private String serviceChargePay; - -// @io.swagger.annotations.ApiModelProperty(value="管理费类型,EnumRentContractManageFeeType",name="manageFeeType") -// private Integer manageFeeType; - - public void initByBillRent(WxBillRent billRent) { - this.rentContractId = billRent.getRentContractId(); - this.pay = billRent.getPay(); - this.starttime = billRent.getStarttime(); - this.endtime = billRent.getEndtime(); - //this.receiveDate = billRent.getReceiveDate(); - //截止收租日在当前时间之前 - Date date = new Date(); - this.updateTenantInfo(billRent); - //this.isDel = billRent.getIsDel(); - this.isPreview = billRent.getIsPreview(); - this.merchantId = billRent.getMerchantId(); - //this.userId = billRent.getUserId(); - //this.shopId = billRent.getShopId(); - this.createtime = billRent.getCreatetime(); - this.createBy = billRent.getCreateBy(); - this.createByName = billRent.getCreateByName(); - this.updatetime = billRent.getUpdatetime(); - this.updateBy = billRent.getUpdateBy(); - this.updateByName = billRent.getUpdateByName(); - this.rentShopType = billRent.getRentShopType(); - //this.period = billRent.getPeriod(); - //this.shopInfo = billRent.getShopInfo(); - //this.latePayRatio = billRent.getLatePayRatio(); - } - -// @Override -// public String getBillRemark() { -// return ""; -// } -// -// @Override -// public String getReturnPay() { -// return "0"; -// } -// -// @Override -// public String getBillLatePay() { -// return latePayPrice; -// } - -// @Override -// public String getBillServicePay() { -// return serviceChargePay; -// } - - @TableField(exist = false) - private List merchantIds; - @TableField(exist = false) - private Integer hasMerchant; -} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyMeterReading.java b/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyMeterReading.java index 5377ac6d8..101279716 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyMeterReading.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxEnergyMeterReading.java @@ -185,8 +185,8 @@ public class WxEnergyMeterReading extends TenantEntity { return excelObject; } - private WxBillDaily generateBill(WxEnergyReadingCalcute calcute,WxMerchant merchant,MallUserInfo user,String needPay,String detail,String remark) { - WxBillDaily daily = new WxBillDaily(); + private WxAllBill generateBill(WxEnergyReadingCalcute calcute,WxMerchant merchant,MallUserInfo user,String needPay,String detail,String remark) { + WxAllBill daily = new WxAllBill(); final IdWorker idWorker = IdWorker.get(); daily.setId(idWorker.nextId()); daily.updateTenantInfo(this); @@ -204,24 +204,18 @@ public class WxEnergyMeterReading extends TenantEntity { daily.setEndtime(this.endTime); daily.setOwe(needPay); daily.setStatus(EnumBillStatus.WAIT_PAY.getCode()); - daily.setReceiveDate(this.startTime); - daily.setApplyStatus(EnumBillRentApplyStatus.NO_APPLY.getCode()); - daily.setIsDel(EnumYesOrNo.NO.getCode()); - daily.setUserId(user.getId()); daily.setShopId(this.shopId); - daily.setShopName(this.shopNumber); - daily.setType(EnumEnergyMeterType.getEnum(meterType).getBillDailyType()); + daily.setShopNumber(this.shopNumber); + daily.setBillType(EnumEnergyMeterType.getEnum(meterType).getBillDailyType()); daily.setPriceDetail(detail); - daily.setFreeze(EnumYesOrNo.NO.getCode()); - daily.setBuildWay(EnumBillDailyBuildWay.AUTO.getCode()); daily.setServiceChargePay("0"); - daily.setRemark(remark); + daily.setBillRemark(remark); daily.setEnergyReadingCalcuteId(calcute.getId()); daily.setEnergyReadingId(id); return daily; } - public WxBillDaily generateUserBill(WxEnergyReadingCalcute calcute,WxMerchant merchant,MallUserInfo user,WxEnergyMeter meter) { + public WxAllBill generateUserBill(WxEnergyReadingCalcute calcute,WxMerchant merchant,MallUserInfo user,WxEnergyMeter meter) { BigDecimal dx = new BigDecimal(this.curNumber).subtract(new BigDecimal(this.preNumber)); BigDecimal needPay = new BigDecimal(this.price).multiply(dx).divide(new BigDecimal(meter.getRate())).setScale(2,RoundingMode.HALF_UP); if (needPay.compareTo(new BigDecimal(0)) <= 0 ) { @@ -231,7 +225,7 @@ public class WxEnergyMeterReading extends TenantEntity { return generateBill(calcute,merchant, user, needPay.toPlainString(), detail, "抄表计算自动生成"); } - public WxBillDaily generatePublicBill(WxEnergyReadingCalcute calcute,WxMerchant merchant,MallUserInfo user,String needPay) { + public WxAllBill generatePublicBill(WxEnergyReadingCalcute calcute,WxMerchant merchant,MallUserInfo user,String needPay) { if (new BigDecimal(needPay).compareTo(new BigDecimal(0)) <= 0 ) { return null; } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java index 465b39cc8..9fe6bedd8 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java @@ -169,7 +169,7 @@ public class WxPropertyContract extends TenantEntity { @TableField(exist = false) @io.swagger.annotations.ApiModelProperty(value = "物业预账单列表", name = "previewBillRentList") - private List previewBillRentList; + private List previewBillRentList; @io.swagger.annotations.ApiModelProperty(value = "租金信息", name = "rentInfo") private String rentInfo; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java index 572735f2e..b488eea65 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -355,11 +355,11 @@ public class WxRentContract extends TenantEntity { @TableField(exist = false) @io.swagger.annotations.ApiModelProperty(value = "租赁合同预账单列表", name = "previewBillRentList") - private List previewBillRentList; + private List previewBillRentList; @TableField(exist = false) @io.swagger.annotations.ApiModelProperty(value = "物业合同预账单列表", name = "reviewBillPropertyPList") - private List reviewBillPropertyPList; + private List reviewBillPropertyPList; @TableField(exist = false) @io.swagger.annotations.ApiModelProperty(value = "审批说明", name = "remark") diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillDailyVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillDailyVo.java deleted file mode 100644 index 27e043255..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillDailyVo.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.iformall.domain.vo; - - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.iformall.domain.po.WxBillDaily; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import javax.validation.constraints.Digits; -import javax.validation.constraints.NotNull; - -/** - * @author gongbiao - */ -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class WxBillDailyVo extends WxBillDaily { - - @Excel(name = "商铺号*", width = 20, orderNum = "1") - @NotNull - @io.swagger.annotations.ApiModelProperty(value = "商铺号", name = "shopNumber") - private String shopNumber; - - @Excel(name = "实际应收金额(元)*", orderNum = "3", width = 20, numFormat = "#.##", type = 10) - @NotNull - @Digits(integer = 10, fraction = 2) - @io.swagger.annotations.ApiModelProperty(value = "实际应收金额", name = "receivePayStr") - private String receivePayStr; - - @Excel(name = "实收金额(元)*", orderNum = "4", width = 20, numFormat = "#.##", type = 10) - @NotNull - @Digits(integer = 10, fraction = 2) - @io.swagger.annotations.ApiModelProperty(value = "实收金额", name = "payStr") - private String payStr; - -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxAllBillMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxAllBillMapper.java index ce2147aab..3e3e39bf1 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxAllBillMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxAllBillMapper.java @@ -35,5 +35,7 @@ public interface WxAllBillMapper extends CommonMapper { WxAllBill selectById(@Param("id")Long id,@Param("tenantId")String tenantId); void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); + + void deleteEnergyReadingBills(@Param("energyReadingCalcuteId")Long energyReadingCalcuteId,@Param("tenantId")String tenantId); } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillAdvanceMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillAdvanceMapper.java deleted file mode 100644 index 7bd5d445f..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxBillAdvanceMapper.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxBillAdvance; -import org.apache.ibatis.annotations.Param; -import java.util.List; - -/** - */ -public interface WxBillAdvanceMapper extends CommonMapper { - - List queryBillList(WxBillAdvance record); - - List findList(WxBillAdvance wxBillRent); - - List getMerchantIdList(WxBillAdvance wxBillRent); - - WxBillAdvance selectById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); - -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillDailyMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillDailyMapper.java deleted file mode 100644 index 6340bd1b2..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxBillDailyMapper.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxBillDaily; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; - -import java.util.List; -import java.util.Map; - -import org.apache.ibatis.annotations.Param; - -/** - * @author gongbiao - */ -public interface WxBillDailyMapper extends CommonMapper { - - List findList(WxBillDaily wxBillDaily); - - void updateNotPaidStatus(Map params); - - void updateWaitPayStatus(Map params); - - List queryBillDailyList(WxBillDaily record); - - List getBillNotifyList(WxBillDaily record); - - WxBillSum getBillMonthSum(WxBillDaily record); - - List getMerchantIdList(WxBillDaily record); - - WxBillHotNotify getBillHotNotify(WxBillDaily record); - - WxBillDaily selectById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void insertBills(@Param("tenantId")String tenantId, @Param("list")List resultList); - - void deleteEnergyReadingBills(@Param("energyReadingCalcuteId")Long energyReadingCalcuteId,@Param("tenantId")String tenantId); - - void deleteNoNeedPayBill(WxBillDaily wxBillRent); - -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillDepositMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillDepositMapper.java deleted file mode 100644 index 4a8f1db49..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxBillDepositMapper.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.iformall.mapper; - - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxBillDeposit; -import com.iformall.domain.po.WxRentContract; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; - -import java.util.List; -import java.util.Map; - -import org.apache.ibatis.annotations.Param; - -/** - * @author gongbiao - */ -public interface WxBillDepositMapper extends CommonMapper { - - List findList(WxBillDeposit wxBillDeposit); - List findRentContractIds(WxBillDeposit wxBillDeposit); - - List queryBillDepositList(WxBillDeposit record); - - List getBillNotifyList(WxBillDeposit record); - - Map queryPayInfo(Map params); - - Map queryOweInfoAll(Map params); - - Map queryPayInfoAllTotal(Map params); - - void updateNotPaidStatus(Map params); - - void updateWaitPayStatus(Map params); - - long queryOweCount(WxRentContract wxRentContract); - - WxBillSum getBillMonthSum(WxBillDeposit wxBillDeposit); - - List getMerchantIdList(WxBillDeposit wxBillDeposit); - - WxBillHotNotify getBillHotNotify(WxBillDeposit wxBillDeposit); - - WxBillDeposit selectById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void insertBills(@Param("tenantId")String tenantId, @Param("list") List resultList); - - void deleteNoNeedPayBill(WxBillDeposit wxBillRent); - -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillOtherDepositMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillOtherDepositMapper.java deleted file mode 100644 index 58831e2d3..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxBillOtherDepositMapper.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxBillOtherDeposit; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; - -import java.util.List; -import java.util.Map; - -import org.apache.ibatis.annotations.Param; - -/** - * @author gongbiao - */ -public interface WxBillOtherDepositMapper extends CommonMapper { - - List findList(WxBillOtherDeposit record); - - void updateNotPaidStatus(Map params); - - void updateWaitPayStatus(Map params); - - List queryBillList(WxBillOtherDeposit record); - - List getBillNotifyList(WxBillOtherDeposit record); - - WxBillSum getBillMonthSum(WxBillOtherDeposit record); - - List getMerchantIdList(WxBillOtherDeposit record); - - WxBillHotNotify getBillHotNotify(WxBillOtherDeposit record); - - WxBillOtherDeposit selectById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void deleteNoNeedPayBill(WxBillOtherDeposit wxBillRent); -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillOtherMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillOtherMapper.java deleted file mode 100644 index 98b618d1c..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxBillOtherMapper.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxBillOther; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; - -import java.util.List; -import java.util.Map; - -import org.apache.ibatis.annotations.Param; - -/** - * @author gongbiao - */ -public interface WxBillOtherMapper extends CommonMapper { - - List findList(WxBillOther wxBillDaily); - - void updateNotPaidStatus(Map params); - - void updateWaitPayStatus(Map params); - - List queryBillList(WxBillOther record); - - List getBillNotifyList(WxBillOther record); - - Map queryPayInfoTotal(Map params); - - Map queryOweInfo(Map params); - - WxBillSum getBillMonthSum(WxBillOther record); - - List getMerchantIdList(WxBillOther record); - - WxBillHotNotify getBillHotNotify(WxBillOther record); - - WxBillOther selectById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void deleteNoNeedPayBill(WxBillOther wxBillRent); -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyDepositMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyDepositMapper.java deleted file mode 100644 index 8f00b67c9..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyDepositMapper.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxBillPropertyDeposit; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxPropertyContract; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; - -import java.util.List; -import java.util.Map; - -import org.apache.ibatis.annotations.Param; - -/** - * @author gongbiao - */ -public interface WxBillPropertyDepositMapper extends CommonMapper { - - List findList(WxBillPropertyDeposit wxBillPropertyDeposit); - - List findPropertyContractIds(WxBillPropertyDeposit wxBillPropertyDeposit); - - List queryBillDepositList(WxBillPropertyDeposit record); - - List getBillNotifyList(WxBillPropertyDeposit record); - - Map queryPayInfo(Map params); - - void updateNotPaidStatus(Map params); - - void updateWaitPayStatus(Map params); - - long queryOweCount(WxPropertyContract wxPropertyContract); - - WxBillSum getBillMonthSum(WxBillPropertyDeposit wxBillPropertyDeposit); - - List getMerchantIdList(WxBillPropertyDeposit wxBillPropertyDeposit); - - WxBillHotNotify getBillHotNotify(WxBillPropertyDeposit wxBillPropertyDeposit); - - WxBillPropertyDeposit selectById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void deleteNoNeedPayBill(WxBillPropertyDeposit wxBillRent); -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java deleted file mode 100644 index 58f36b294..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxBillProperty; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.domain.po.WxPropertyContract; -import com.iformall.domain.po.WxRentContract; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; - -import java.util.List; -import java.util.Map; - -import org.apache.ibatis.annotations.Param; - -/** - * @author gongbiao - */ -public interface WxBillPropertyMapper extends CommonMapper { - - List findList(WxBillProperty wxBillProperty); - - List queryBillPropertyList(WxBillProperty record); - - List getBillNotifyList(WxBillProperty record); - - List queryPropertyContractIdList(WxBillProperty record); - - Map queryPayInfo(Map params); - - Map queryPayInfoTotal(Map params); - - Map queryOweInfo(Map params); - - void updateNotPaidStatus(Map params); - - void updateWaitPayStatus(Map params); - - void updateInvalidStatus(WxBillProperty wxBillProperty); - - void updateInvalidStatusByRent(WxRentContract wxRentContract); - - void deleteBillByContract(WxPropertyContract wxPropertyContract); - void deletePreviewBill(WxBillProperty wxBillProperty); - void deleteNoNeedPayBill(WxBillProperty wxBillProperty); - - void updateForReceivePay(WxBillProperty record); - - void updatePreviewStatus(WxBillProperty record); - - Long oweBillCount(Long contractId); - - void updateBills(List resultList); - - void insertBills(@Param("tenantId")String tenantId, @Param("list") List resultList); - - WxBillProperty selectBillOne(WxBillProperty propertyQuery); - - /** - * 累加每一天的滞纳金 - */ - //void autoAddLatePayPrice(); - - /** - * 保存billAction - */ - //void insertBillAction(); - - //void updateServiceCharge(WxPayAccountBill tenantId); - - //void updateOwe(); - - WxBillSum getBillMonthSum(WxBillProperty propertyQuery); - - List getMerchantIdList(WxBillProperty propertyQuery); - - WxBillHotNotify getBillHotNotify(WxBillProperty propertyQuery); - - WxBillProperty selectById(@Param("id")Long id,@Param("tenantId")String tenantId); - void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); - -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillRentManageMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillRentManageMapper.java deleted file mode 100644 index 4adace40f..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxBillRentManageMapper.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxBillRentManage; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; - -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - -/** - * @author gongbiao - */ -public interface WxBillRentManageMapper extends CommonMapper { - - List findList(WxBillRentManage wxBillRentManage); - - List queryBillManageList(WxBillRentManage wxBillRentManage); - List queryRentContractIds(WxBillRentManage wxBillRentManage); - - List getBillNotifyList(WxBillRentManage record); - - Map queryPayInfoTotal(Map params); - - void updateNotPaidStatus(Map params); - - void updateWaitPayStatus(Map params); - - void deletePreviewBill(WxBillRentManage wxBillRentManage); - void deleteNoNeedPayBill(WxBillRentManage wxBillRentManage); - - long oweBillCount(@Param("contractId") Long contractId); - - void insertBills(@Param("tenantId")String tenantId, @Param("list")List resultList); - - WxBillSum getBillMonthSum(WxBillRentManage wxBillRentManage); - - List getMerchantIdList(WxBillRentManage wxBillRentManage); - - WxBillHotNotify getBillHotNotify(WxBillRentManage wxBillRentManage); - - WxBillRentManage selectById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void updatePreviewStatus(WxBillRentManage wxBillRentManage); - -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java deleted file mode 100644 index 1e9bd100b..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.domain.po.WxRentContract; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; - -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - -/** - * @author gongbiao - */ -public interface WxBillRentMapper extends CommonMapper { - - List findList(WxBillRent wxBillRent); - - List queryBillRentList(WxBillRent record); - List queryBillRentContractIdList(WxBillRent record); - - List getBillNotifyList(WxBillRent record); - - Map queryPayInfo(Map params); - - Map queryPayInfoTotal(Map params); - - Map queryOweInfo(Map params); - - void updateNotPaidStatus(Map params); - - void updateWaitPayStatus(Map params); - - void updateInvalidStatus(WxBillRent wxBillRent); - - void deleteBillByContract(WxRentContract wxRentContract); - void deletePreviewBill(WxBillRent wxBillRent); - void deleteNoNeedPayBill(WxBillRent wxBillRent); - - - void updateForReceiverPay(WxBillRent record); - - void updatePreviewStatus(WxBillRent record); - - Long oweBillCount(Long contractId); - - void insertBills(@Param("tenantId")String tenantId, @Param("list")List resultList); - - void updateBills(@Param("bills") List resultList); - - WxBillRent selectBillOne(WxBillRent rentQuery); - - /** - * 累加每一天的滞纳金 - */ - //void autoAddLatePayPrice(); - - /** - * 保存billAction - */ - //void insertBillAction(); - - //void updateServiceCharge(WxPayAccountBill record); - - //void updateOwe(); - - WxBillSum getBillMonthSum(WxBillRent wxBillRent); - - List getMerchantIdList(WxBillRent wxBillRent); - - WxBillHotNotify getBillHotNotify(WxBillRent wxBillRent); - - WxBillRent selectById(@Param("id")Long id,@Param("tenantId")String tenantId); - - void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); - -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillSettleScheduleMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillSettleScheduleMapper.java deleted file mode 100644 index 5f2f4d861..000000000 --- a/mallinkService/src/main/java/com/iformall/mapper/WxBillSettleScheduleMapper.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.*; -import com.iformall.domain.vo.WxBillAll; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * @author luozukai - */ -public interface WxBillSettleScheduleMapper extends CommonMapper { - - void createScheduleFromBillSettle(@Param("id") Long id,@Param("settleReceivePay") Double settleReceivePay); - - List listToSettleBillIdList(WxBillAll wxBillAll); - List listBillSettleBillBillId(@Param("settleId")Long settleId, @Param("type")Integer type); - Double calculteRentRecivePay(WxBillRent billRent); - Double calculteRentDepositRecivePay(WxBillRent billRent); - Double calcultePropertyRecivePay(WxBillProperty billProperty); - Double calcultePropertyDepositRecivePay(WxBillProperty billProperty); - Double calculteDailyRecivePay(WxBillDaily billDaily); - Double calculteOtherRecivePay0(WxBillOther billOther); - Double calculteOtherRecivePay1(WxBillOther billOther); - Double calculteOtherDepositRecivePay0(WxBillOther billOther); - Double calculteMerchantSubsidyRecivePay1(WxMerchantSubsidy merchantSubsidy); - -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java index 575a2d678..404940a24 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxPropertyContractMapper.java @@ -1,7 +1,7 @@ package com.iformall.mapper; import com.iformall.common.CommonMapper; -import com.iformall.domain.po.WxBillProperty; +import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxPropertyContract; import com.iformall.domain.po.WxRentContract; @@ -50,7 +50,7 @@ public interface WxPropertyContractMapper extends CommonMapper List listContractVo(WxRentPropertyContractVo record); - WxRentContract getByBill(WxBillRent billRent); + WxRentContract getByBill(WxAllBill billRent); int getShopCountMax(); diff --git a/mallinkService/src/main/java/com/iformall/service/WxAllBillService.java b/mallinkService/src/main/java/com/iformall/service/WxAllBillService.java index bde0b3e1c..22a9a32f0 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxAllBillService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxAllBillService.java @@ -6,7 +6,6 @@ import com.iformall.domain.dto.WxBillPayDTO; import com.iformall.domain.dto.WxBillReceiveUpdateDTO; import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxAllBill; -import com.iformall.domain.po.WxBillRent; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxMerchantBUser; import com.iformall.domain.po.WxPropertyContract; @@ -29,24 +28,43 @@ public interface WxAllBillService { WxBillSum getBillMonthSum(WxAllBill wxBillRent); + PageInfo listAsPage(WxAllBill record, Integer pageIndex, Integer pageSize); + List getMerchantIds(WxAllBill wxBillRent); + List getBillHotNotify(WxAllBill wxBillRent); + WxAllBill getById(TenantEntity tenantEntity,Long id); + void notify(WxBillPayDTO dto,MallUserInfo user); + void updateReceivePay(WxBillReceiveUpdateDTO dto,MallUserInfo user,boolean forcePaid); + void updatePay(WxBillPayDTO dto,MallUserInfo user); + void updatePayByMerchant(WxBillPayDTO dto,WxMerchantBUser user,boolean isOnline); + void returnDeposit(WxBillPayDTO dto, MallUserInfo user); + void bad(WxBillPayDTO dto,MallUserInfo user); + void completeBill(EnumBillStatus status,WxMerchant wxMerchant,MallUserInfo user); + List list(WxAllBill record); + List notifyList(WxAllBill record); + void backPay(WxBillPayDTO dto,MallUserInfo user); + void rentContractStop(WxRentContract rentContract,MallUserInfo user); + void propertyContractStop(WxPropertyContract propertyContract,MallUserInfo user); + void stopMerchantBills(WxMerchant wxMerchant,MallUserInfo userInfo); + void insertBills(String tenantId,List bills); + ResultData saveOrUpdate(WxAllBill record, MallUserInfo user); @@ -54,6 +72,8 @@ public interface WxAllBillService { void exportBill(HttpServletRequest request, HttpServletResponse response, WxAllBill wxBillRent); + void deleteEnergyReadingBills(WxAllBill wxBillDaily); + diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillAdvanceService.java b/mallinkService/src/main/java/com/iformall/service/WxBillAdvanceService.java deleted file mode 100644 index 44968c3d1..000000000 --- a/mallinkService/src/main/java/com/iformall/service/WxBillAdvanceService.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.iformall.service; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillAdvance; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.base.TenantEntity; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author gongbiao - */ -public interface WxBillAdvanceService { - - /** - * 根据实体查询列表 - * @param record - * @param pageIndex - * @param pageSize - * @return - */ - PageInfo listAsPage(WxBillAdvance record, Integer pageIndex, Integer pageSize); - - /** - * 根据Id获得实体 - * - * @param id - * @return - */ - WxBillAdvance getById(TenantEntity tenantEntity,Long id); - - /** - * 保存或更新实体 - * - * @param record - * @param user - */ - ResultData saveOrUpdate(WxBillAdvance record, MallUserInfo user); - - /** - * 根据Id删除实体 - * - * @param id - */ - void deleteById(TenantEntity tenantEntity,Long id); - - List getMerchantIds(WxBillAdvance wxBillRent); - - void updateReceivePay(WxBillReceiveUpdateDTO dto,MallUserInfo user,boolean forcePaid); - void backPay(WxBillPayDTO dto,MallUserInfo user); - void updatePay(WxBillPayDTO dto,MallUserInfo user); - void updatePayByMerchant(WxBillPayDTO dto,WxMerchantBUser user,boolean isOnline); - void bad(WxBillPayDTO dto,MallUserInfo user); -// void rentContractStop(WxRentContract rentContract,MallUserInfo user); -// void completeBill(EnumBillStatus status,WxMerchant wxMerchant,MallUserInfo user); -} diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillAllService.java b/mallinkService/src/main/java/com/iformall/service/WxBillAllService.java index 66faf0e8f..7186b0b47 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxBillAllService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxBillAllService.java @@ -22,74 +22,74 @@ import java.util.Map; @Deprecated public interface WxBillAllService { - List allDepositList(WxBillAll wxBillAll); - - Map listAsPage(WxBillAll wxBillAll, Integer pageNum, Integer pageSize); - - //List> listBillOweAndWaitPay(WxBillAll wxBillAll); - - ResultData pageListBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasShop,boolean hasPayBill,boolean hasReceivePay); - List> listBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasSet,boolean hasShop,boolean hasPayBill,boolean hasReceivePay); - - Map detail(Long id,Integer type); - - void updateBill(Map bill); - - void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll); - - //Object getBillInfo(WxBillAll wxBillAll); - - Long hasOweBill(Long contractId, Integer type); - - /** - * 发送待缴通知邮件 - */ - void sendWaitPayBillEmail(); - - /** - * 发送欠缴通知邮件 - */ - void sendOweBillForEmail(); - - /** - * 欠缴商户分页列表 - * - * @return - */ - Map getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize); - - - /** - * 应收和承付商户分页列表 - * - * @return - */ - PageInfo getReceiveAndPayBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize); - - void exportReceiveAndPayBillAsPage(WxBillAll record, HttpServletRequest request, HttpServletResponse response); - - void exportOweMerchant(WxBillAll record, HttpServletRequest request, HttpServletResponse response); - - void exportWaitMerchant(WxBillAll record, HttpServletRequest request, HttpServletResponse response); - - void updateBillStatus(WxBillAll record); - - void exportOweBill(WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response); - - void exportSettleBill(WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response); - - ResultData updateReceivePay(WxBillAll wxBillAll, MallUserInfo user,boolean forcePaid); - - void addBillAction(EnumBillAction billAction, Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo); - - void exportTemplate(WxBillExcelTemplate wxBillExcelTemplate, HttpServletRequest request, HttpServletResponse response); - - void importBill(String importKey, WxBillExcelTemplate bill, MallUserInfo user); - - void importBillOther(String importKey, WxBillExcelTemplateOther bill, MallUserInfo user); - - Double calcuteSettleBillReceivePay(Long settleId); - - void createBillSettleSchedule(Long settleId,Double settleReceivePay); +// List allDepositList(WxBillAll wxBillAll); +// +// Map listAsPage(WxBillAll wxBillAll, Integer pageNum, Integer pageSize); +// +// //List> listBillOweAndWaitPay(WxBillAll wxBillAll); +// +// ResultData pageListBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasShop,boolean hasPayBill,boolean hasReceivePay); +// List> listBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasSet,boolean hasShop,boolean hasPayBill,boolean hasReceivePay); +// +// Map detail(Long id,Integer type); +// +// void updateBill(Map bill); +// +// void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll); +// +// //Object getBillInfo(WxBillAll wxBillAll); +// +// Long hasOweBill(Long contractId, Integer type); +// +// /** +// * 发送待缴通知邮件 +// */ +// void sendWaitPayBillEmail(); +// +// /** +// * 发送欠缴通知邮件 +// */ +// void sendOweBillForEmail(); +// +// /** +// * 欠缴商户分页列表 +// * +// * @return +// */ +// Map getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize); +// +// +// /** +// * 应收和承付商户分页列表 +// * +// * @return +// */ +// PageInfo getReceiveAndPayBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize); +// +// void exportReceiveAndPayBillAsPage(WxBillAll record, HttpServletRequest request, HttpServletResponse response); +// +// void exportOweMerchant(WxBillAll record, HttpServletRequest request, HttpServletResponse response); +// +// void exportWaitMerchant(WxBillAll record, HttpServletRequest request, HttpServletResponse response); +// +// void updateBillStatus(WxBillAll record); +// +// void exportOweBill(WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response); +// +// void exportSettleBill(WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response); +// +// ResultData updateReceivePay(WxBillAll wxBillAll, MallUserInfo user,boolean forcePaid); +// +// void addBillAction(EnumBillAction billAction, Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo); +// +// void exportTemplate(WxBillExcelTemplate wxBillExcelTemplate, HttpServletRequest request, HttpServletResponse response); +// +// void importBill(String importKey, WxBillExcelTemplate bill, MallUserInfo user); +// +// void importBillOther(String importKey, WxBillExcelTemplateOther bill, MallUserInfo user); +// +// Double calcuteSettleBillReceivePay(Long settleId); +// +// void createBillSettleSchedule(Long settleId,Double settleReceivePay); } \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillDailyService.java b/mallinkService/src/main/java/com/iformall/service/WxBillDailyService.java deleted file mode 100644 index 3696384d4..000000000 --- a/mallinkService/src/main/java/com/iformall/service/WxBillDailyService.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.iformall.service; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillDaily; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillDailyVo; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillStatus; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author gongbiao - */ -public interface WxBillDailyService { - - /** - * 根据实体查询分页列表 - * - * @param record - * @param pageIndex - * @param pageSize - * @return - */ - PageInfo listAsPage(WxBillDaily record, Integer pageIndex, Integer pageSize); - List list(WxBillDaily record); - List notifyList(WxBillDaily record); - - void updateBillStatus(WxBillDaily record); - - /** - * 根据Id获得实体 - * - * @param id - * @return - */ - WxBillDaily getById(TenantEntity tenantEntity,Long id); - - /** - * 保存或更新实体 - * - * @param record - * @param user - */ - ResultData saveOrUpdate(WxBillDaily record, MallUserInfo user); - - /** - * 根据Id删除实体 - * - * @param id - */ - void deleteById(TenantEntity tenantEntity,Long id); - - - //ResultData updatePaid(Long id); - - void exportTemplate(HttpServletRequest request, HttpServletResponse response, MallUserInfo user); - - void insertData(WxBillDailyVo billDaily, String importKey, MallUserInfo user); - - void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillDaily wxBillDaily); - - WxBillSum getBillMonthSum(WxBillDaily wxBillDaily); - - List getMerchantIds(WxBillDaily wxBillDaily); - - WxBillHotNotify getBillHotNotify(WxBillDaily wxBillDaily); - - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid); - - public void notify(WxBillPayDTO dto, MallUserInfo user); - void backPay(WxBillPayDTO dto,MallUserInfo user); - public void updatePay(WxBillPayDTO dto, MallUserInfo user); - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline); - public void bad(WxBillPayDTO dto,MallUserInfo user); - public void stopMerchantBills(WxMerchant wxMerchant,MallUserInfo userInfo); - public void completeBill(EnumBillStatus status,WxMerchant wxMerchant,MallUserInfo user); - - public void insertBills(TenantEntity tenantEntity,List list); - public void deleteEnergyReadingBills(WxBillDaily wxBillDaily); - -} diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillDepositService.java b/mallinkService/src/main/java/com/iformall/service/WxBillDepositService.java deleted file mode 100644 index 8b1cefe0d..000000000 --- a/mallinkService/src/main/java/com/iformall/service/WxBillDepositService.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.iformall.service; - -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillDeposit; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.domain.po.WxRentContract; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillStatus; - -public interface WxBillDepositService { - - /** - * 根据实体查询分页列表 - * - * @param offset - * @param limit - * @param record - * @return - */ - PageInfo listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize); - List list(WxBillDeposit record); - List notifyList(WxBillDeposit record); - - void updateBillStatus(WxBillDeposit record); - - /** - * 根据Id获得实体 - * - * @param id - * @return - */ - WxBillDeposit getById(TenantEntity tenantEntity,Long id); - - Map detail(TenantEntity tenantEntity,Long id); - - /** - * 保存或更新实体 - * - * @param record - * @param user - */ - ResultData saveOrUpdate(WxBillDeposit record, MallUserInfo user); - - /** - * 根据Id删除实体 - * - * @param id - */ - void deleteById(TenantEntity tenantEntity,Long id); - - //ResultData updatePaid(Long id); - - - //ResultData returnDeposit(WxBillDeposit wxBillDeposit, MallUserInfo user); - - //ResultData adjustDeposit(WxBillDeposit wxBillDeposit); - - void computeTotalMoney(Integer decimalSize,WxPayAccountBill wxPayAccountBill, WxBillDeposit deposit); - - WxBillSum getBillMonthSum(WxBillDeposit wxBillDeposit); - - List getMerchantIds(WxBillDeposit wxBillDeposit); - - WxBillHotNotify getBillHotNotify(WxBillDeposit wxBillDeposit); - - void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillDeposit wxBillDeposit); - - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid); - - public void notify(WxBillPayDTO dto, MallUserInfo user); - void backPay(WxBillPayDTO dto,MallUserInfo user); - public void updatePay(WxBillPayDTO dto, MallUserInfo user); - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline); - public void returnDeposit(WxBillPayDTO dto, MallUserInfo user); - public void bad(WxBillPayDTO dto,MallUserInfo user); - public void rentContractStop(WxRentContract rentContract,MallUserInfo user); - public void completeBill(EnumBillStatus status,WxMerchant wxMerchant,MallUserInfo user); - -} diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillOtherDepositService.java b/mallinkService/src/main/java/com/iformall/service/WxBillOtherDepositService.java deleted file mode 100644 index 36f358a05..000000000 --- a/mallinkService/src/main/java/com/iformall/service/WxBillOtherDepositService.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.iformall.service; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillOtherDeposit; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillStatus; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author gongbiao - */ -public interface WxBillOtherDepositService { - - /** - * 根据实体查询分页列表 - * - * @param offset - * @param limit - * @param record - * @return - */ - PageInfo listAsPage(WxBillOtherDeposit record, Integer pageIndex, Integer pageSize); - List list(WxBillOtherDeposit record); - List notifyList(WxBillOtherDeposit record); - - void updateBillStatus(WxBillOtherDeposit record); - - /** - * 根据Id获得实体 - * - * @param id - * @return - */ - WxBillOtherDeposit getById(TenantEntity tenantEntity,Long id); - - /** - * 保存或更新实体 - * - * @param record - * @param user - */ - ResultData saveOrUpdate(WxBillOtherDeposit record, MallUserInfo user); - - /** - * 根据Id删除实体 - * - * @param id - */ - void deleteById(TenantEntity tenantEntity,Long id); - - - //ResultData updatePaid(Long id); - - //ResultData returnDeposit(WxBillOtherDeposit wxBillDeposit, MallUserInfo user); - - //ResultData adjustDeposit(WxBillOtherDeposit wxBillDeposit); - - void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillOtherDeposit wxBillDeposit); - - WxBillSum getBillMonthSum(WxBillOtherDeposit wxBillDeposit); - - List getMerchantIds(WxBillOtherDeposit wxBillDeposit); - - WxBillHotNotify getBillHotNotify(WxBillOtherDeposit wxBillDeposit); - - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid); - - public void notify(WxBillPayDTO dto, MallUserInfo user); - void backPay(WxBillPayDTO dto,MallUserInfo user); - public void updatePay(WxBillPayDTO dto, MallUserInfo user); - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline); - public void returnDeposit(WxBillPayDTO dto, MallUserInfo user); - public void bad(WxBillPayDTO dto,MallUserInfo user); - public void stopMerchantBills(WxMerchant wxMerchant,MallUserInfo userInfo); - public void completeBill(EnumBillStatus status,WxMerchant wxMerchant,MallUserInfo user); -} diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillOtherService.java b/mallinkService/src/main/java/com/iformall/service/WxBillOtherService.java deleted file mode 100644 index 81cc068a2..000000000 --- a/mallinkService/src/main/java/com/iformall/service/WxBillOtherService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.iformall.service; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillOther; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillStatus; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author gongbiao - */ -public interface WxBillOtherService { - - /** - * 根据实体查询分页列表 - * - * @param offset - * @param limit - * @param record - * @return - */ - PageInfo listAsPage(WxBillOther record, Integer pageIndex, Integer pageSize); - List list(WxBillOther record); - List notifyList(WxBillOther record); - - void updateBillStatus(WxBillOther record); - - /** - * 根据Id获得实体 - * - * @param id - * @return - */ - WxBillOther getById(TenantEntity tenantEntity,Long id); - - /** - * 保存或更新实体 - * - * @param record - * @param user - */ - ResultData saveOrUpdate(WxBillOther record, MallUserInfo user); - - /** - * 根据Id删除实体 - * - * @param id - */ - void deleteById(TenantEntity tenantEntity,Long id); - - - //ResultData updatePaid(Long id); - - void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillOther wxBillOther); - - WxBillSum getBillMonthSum(WxBillOther wxBillOther); - - List getMerchantIds(WxBillOther wxBillOther); - - WxBillHotNotify getBillHotNotify(WxBillOther wxBillOther); - - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid) ; - - public void notify(WxBillPayDTO dto, MallUserInfo user); - void backPay(WxBillPayDTO dto,MallUserInfo user); - public void updatePay(WxBillPayDTO dto, MallUserInfo user); - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user ,boolean isOnline); - public void bad(WxBillPayDTO dto,MallUserInfo user); - public void stopMerchantBills(WxMerchant wxMerchant,MallUserInfo userInfo); - public void completeBill(EnumBillStatus status,WxMerchant wxMerchant,MallUserInfo user); - -} diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillPropertyDepositService.java b/mallinkService/src/main/java/com/iformall/service/WxBillPropertyDepositService.java deleted file mode 100644 index 09cee35cb..000000000 --- a/mallinkService/src/main/java/com/iformall/service/WxBillPropertyDepositService.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.iformall.service; - -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillPropertyDeposit; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.domain.po.WxPropertyContract; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillStatus; - -/** - * @author gongbiao - */ -public interface WxBillPropertyDepositService { - - /** - * 根据实体查询分页列表 - * - * @param offset - * @param limit - * @param record - * @return - */ - PageInfo listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize); - List list(WxBillPropertyDeposit record); - List notifyList(WxBillPropertyDeposit record); - - void updateBillStatus(WxBillPropertyDeposit record); - - /** - * 根据Id获得实体 - * - * @param id - * @return - */ - WxBillPropertyDeposit getById(TenantEntity tenantEntity ,Long id); - Map detail(TenantEntity tenantEntity ,Long id); - - /** - * 保存或更新实体 - * - * @param record - * @param user - */ - ResultData saveOrUpdate(WxBillPropertyDeposit record, MallUserInfo user); - - /** - * 根据Id删除实体 - * - * @param id - */ - void deleteById(TenantEntity tenantEntity ,Long id); - - //ResultData updatePaid(Long id); - - - //ResultData returnDeposit(WxBillPropertyDeposit wxBillPropertyDeposit, MallUserInfo user); - - //ResultData adjustDeposit(WxBillPropertyDeposit wxBillPropertyDeposit); - - void computeTotalMoney(Integer decimalSize,WxPayAccountBill wxPayAccountBill, WxBillPropertyDeposit deposit); - - WxBillSum getBillMonthSum(WxBillPropertyDeposit deposit); - - List getMerchantIds(WxBillPropertyDeposit deposit); - - WxBillHotNotify getBillHotNotify(WxBillPropertyDeposit deposit); - - public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillPropertyDeposit deposit) ; - - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid); - - public void notify(WxBillPayDTO dto, MallUserInfo user); - void backPay(WxBillPayDTO dto,MallUserInfo user); - public void updatePay(WxBillPayDTO dto, MallUserInfo user); - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline); - public void returnDeposit(WxBillPayDTO dto, MallUserInfo user); - public void bad(WxBillPayDTO dto,MallUserInfo user); - public void propertyContractStop(WxPropertyContract propertyContract,MallUserInfo user); - public void completeBill(EnumBillStatus status,WxMerchant wxMerchant,MallUserInfo user); -} diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillPropertyService.java b/mallinkService/src/main/java/com/iformall/service/WxBillPropertyService.java deleted file mode 100644 index c8ac9d4d3..000000000 --- a/mallinkService/src/main/java/com/iformall/service/WxBillPropertyService.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.iformall.service; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillProperty; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxPropertyContract; -import com.iformall.domain.po.WxRentContract; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillStatus; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author gongbiao - */ -public interface WxBillPropertyService { - - - /** - * 根据实体查询分页列表 - * - * @param offset - * @param limit - * @param record - * @return - */ - PageInfo listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize); - List list(WxBillProperty record); - List notifyList(WxBillProperty record); - - void updateBillStatus(WxBillProperty record); - - /** - * 根据Id获得实体 - * - * @param id - * @return - */ - WxBillProperty getById(TenantEntity tenantEntity,Long id); - - /** - * 保存或更新实体 - * - * @param record - * @param user - */ - ResultData saveOrUpdate(WxBillProperty record, MallUserInfo user); - - /** - * 修改滞纳金 - * - * @param record - * @param user - */ - ResultData updateLatePayMoney(WxBillProperty record, MallUserInfo user); - - /** - * 根据Id删除实体 - * - * @param id - */ - void deleteById(TenantEntity tenantEntity,Long id); - - - PageInfo findByPropertyContractId(Long id, TenantEntity tenantEntity, Integer pageIndex, Integer pageSize); - - //ResultData updatePaid(Long id); - - Object detail(TenantEntity tenantEntity,Long id); - - ResultData updateLatePayStatus(WxBillProperty wxBillProperty); - - void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillProperty wxBillProperty); - - WxBillSum getBillMonthSum(WxBillProperty wxBillProperty); - - List getMerchantIds(WxBillProperty wxBillProperty); - - WxBillHotNotify getBillHotNotify(WxBillProperty wxBillProperty); - - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid); - - public void notify(WxBillPayDTO dto, MallUserInfo user); - void backPay(WxBillPayDTO dto,MallUserInfo user); - public void updatePay(WxBillPayDTO dto, MallUserInfo user); - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline); - public void bad(WxBillPayDTO dto,MallUserInfo user); - public void propertyContractStop(WxPropertyContract propertyContract,MallUserInfo user); - public void completeBill(EnumBillStatus status,WxMerchant wxMerchant,MallUserInfo user); -} diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillRentManageService.java b/mallinkService/src/main/java/com/iformall/service/WxBillRentManageService.java deleted file mode 100644 index 6fce5281c..000000000 --- a/mallinkService/src/main/java/com/iformall/service/WxBillRentManageService.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.iformall.service; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxBillRentManage; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.domain.po.WxRentContract; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillStatus; - -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public interface WxBillRentManageService { - - /** - * 根据实体查询分页列表 - * - * @param offset - * @param limit - * @param record - * @return - */ - PageInfo listAsPage(WxBillRentManage wxBillRentManage, Integer pageIndex, Integer pageSize); - List list(WxBillRentManage wxBillRentManage); - List notifyList(WxBillRentManage wxBillRentManage); - - void updateBillStatus(WxBillRentManage record); - - /** - * 根据Id获得实体 - * - * @param id - * @return - */ - WxBillRentManage getById(TenantEntity tenantEntity,Long id); - - Map detail(TenantEntity tenantEntity,Long id); - - PageInfo findByRentContractId(WxBillRentManage record, Integer pageIndex, Integer pageSize); - - /** - * 保存或更新实体 - * - * @param record - * @param user - */ - ResultData saveOrUpdate(WxBillRentManage record, MallUserInfo user); - - /** - * 修改滞纳金 - * @param record - * @param user - * @return - */ - ResultData updateLatePayMoney(WxBillRentManage record, MallUserInfo user); - - /** - * 根据Id删除实体 - * - * @param id - */ - void deleteById(TenantEntity tenantEntity,Long id); - - //ResultData updatePaid(Long id); - - - void computeTotalMoney(Integer decimalSize,WxPayAccountBill wxPayAccountBill, WxBillRentManage deposit); - - ResultData updateLatePayStatus(WxBillRentManage wxBillRent); - - void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillRentManage wxBillRentManage); - - WxBillSum getBillMonthSum(WxBillRentManage wxBillRentManage); - - List getMerchantIds(WxBillRentManage wxBillRentManage); - - WxBillHotNotify getBillHotNotify(WxBillRentManage wxBillRentManage); - - void updateReceivePay(WxBillReceiveUpdateDTO dto,MallUserInfo user,boolean forcePaid); - - public void notify(WxBillPayDTO dto, MallUserInfo user); - void backPay(WxBillPayDTO dto,MallUserInfo user); - public void updatePay(WxBillPayDTO dto, MallUserInfo user); - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline); - public void bad(WxBillPayDTO dto,MallUserInfo user); - public void rentContractStop(WxRentContract rentContract,MallUserInfo user); - void completeBill(EnumBillStatus status,WxMerchant wxMerchant,MallUserInfo user); -} diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillRentService.java b/mallinkService/src/main/java/com/iformall/service/WxBillRentService.java deleted file mode 100644 index 78dc78c9e..000000000 --- a/mallinkService/src/main/java/com/iformall/service/WxBillRentService.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.iformall.service; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxRentContract; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillAction; -import com.iformall.enums.EnumBillStatus; - -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author gongbiao - */ -public interface WxBillRentService { - - /** - * 根据实体查询列表 - * @param record - * @param pageIndex - * @param pageSize - * @return - */ - PageInfo listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize); - List list(WxBillRent record); - List notifyList(WxBillRent record); - - void updateBillStatus(WxBillRent record); - - /** - * 根据Id获得实体 - * - * @param id - * @return - */ - WxBillRent getById(TenantEntity tenantEntity,Long id); - - /** - * 保存或更新实体 - * - * @param record - * @param user - */ - ResultData saveOrUpdate(WxBillRent record, MallUserInfo user); - - /** - * 修改滞纳金 - * @param record - * @param user - * @return - */ - ResultData updateLatePayMoney(WxBillRent record, MallUserInfo user); - - /** - * 根据Id删除实体 - * - * @param id - */ - void deleteById(TenantEntity tenantEntity,Long id); - - - PageInfo findByRentContractId(WxBillRent record, Integer pageIndex, Integer pageSize); - - //ResultData updatePaid(Long id); - - Object detail(TenantEntity tenantEntity,Long id); - - ResultData updateRevenue(WxBillRent wxBillRent, MallUserInfo user); - - - ResultData updateLatePayStatus(WxBillRent wxBillRent); - - void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillRent wxBillRent); - - WxBillSum getBillMonthSum(WxBillRent wxBillRent); - - List getMerchantIds(WxBillRent wxBillRent); - - WxBillHotNotify getBillHotNotify(WxBillRent wxBillRent); - - void updateReceivePay(WxBillReceiveUpdateDTO dto,MallUserInfo user,boolean forcePaid); - - void notify(WxBillPayDTO dto,MallUserInfo user); - void backPay(WxBillPayDTO dto,MallUserInfo user); - void updatePay(WxBillPayDTO dto,MallUserInfo user); - void updatePayByMerchant(WxBillPayDTO dto,WxMerchantBUser user,boolean isOnline); - void bad(WxBillPayDTO dto,MallUserInfo user); - void rentContractStop(WxRentContract rentContract,MallUserInfo user); - void completeBill(EnumBillStatus status,WxMerchant wxMerchant,MallUserInfo user); -} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/DataTowerServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/DataTowerServiceImpl.java index 661bc28ea..b0737c995 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/DataTowerServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/DataTowerServiceImpl.java @@ -55,9 +55,6 @@ public class DataTowerServiceImpl implements DataTowerService { @Autowired WxWiwideInfoMapper wxWiwideInfoMapper; - @Autowired - WxBillRentMapper wxBillRentMapper; - @Autowired WxCouponOrderMapper wxCouponOrderMapper; @@ -140,7 +137,8 @@ public class DataTowerServiceImpl implements DataTowerService { String enddate = DateUtils.getSystemTime("yyyy-MM-dd HH:mm:ss"); params.put("startdate", startdate); params.put("enddate", enddate); - Map payinfo = wxBillRentMapper.queryPayInfo(params); + //Map payinfo = wxBillRentMapper.queryPayInfo(params); + Map payinfo = null; if (payinfo != null) { BigDecimal receivableAmount = (BigDecimal) payinfo.get("receivepay"); BigDecimal receivedAmount = (BigDecimal) payinfo.get("pay"); @@ -474,8 +472,8 @@ public class DataTowerServiceImpl implements DataTowerService { if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { params.put("parentTenantId", tenantEntity.getParentTenantId()); } - Map payinfo = wxBillRentMapper.queryPayInfo(params); - + //Map payinfo = wxBillRentMapper.queryPayInfo(params); + Map payinfo = null; HashMap datamap = new HashMap<>(); if (payinfo != null) { BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxAllBillServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxAllBillServiceImpl.java index b54c6ead4..cd5c61ebc 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxAllBillServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxAllBillServiceImpl.java @@ -24,25 +24,14 @@ import com.iformall.domain.vo.WxBillNotify; import com.iformall.domain.vo.WxBillSum; import com.iformall.enums.EnumBillAction; import com.iformall.enums.EnumBillStatus; -import com.iformall.enums.EnumBusRatioTime; -import com.iformall.enums.EnumDelStatus; -import com.iformall.enums.EnumGetRatioFrom; -import com.iformall.enums.EnumMissTimeType; -import com.iformall.enums.EnumRentContractType; import com.iformall.enums.EnumRentShopType; import com.iformall.enums.EnumYesOrNo; import com.iformall.exception.MallinkException; import com.iformall.mapper.WxAllBillMapper; -import com.iformall.mapper.WxBillActionMapper; -import com.iformall.mapper.WxBillDepositMapper; -import com.iformall.mapper.WxBillRentManageMapper; -import com.iformall.mapper.WxBillRentMapper; import com.iformall.mapper.WxRentContractMapper; import com.iformall.service.ExcelService; import com.iformall.service.WxAllBillService; import com.iformall.service.WxBillActionService; -import com.iformall.service.WxBillDepositService; -import com.iformall.service.WxBillRentService; import com.iformall.service.WxFinanceService; import com.iformall.service.WxMerchantService; import com.iformall.service.WxMerchantTradeDailyService; @@ -736,6 +725,16 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill } excelService.exportExcel(datalist, null, billName, WxAllBill.class, billName + ".xlsx", response, false); } + + @Override + public void insertBills(String tenantId, List bills) { + wxAllBillMapper.insertBills(tenantId, bills); + } + + @Override + public void deleteEnergyReadingBills(WxAllBill wxBillDaily) { + wxAllBillMapper.deleteEnergyReadingBills(wxBillDaily.getEnergyReadingCalcuteId(), wxBillDaily.getTenantId()); + } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAdvanceServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAdvanceServiceImpl.java deleted file mode 100644 index 07d54434d..000000000 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAdvanceServiceImpl.java +++ /dev/null @@ -1,440 +0,0 @@ -package com.iformall.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillAction; -import com.iformall.domain.po.WxBillAdvance; -import com.iformall.domain.po.WxBillDeposit; -import com.iformall.domain.po.WxBillPayWay; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.domain.po.WxRentContract; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.RatioVo; -import com.iformall.enums.EnumBillAction; -import com.iformall.enums.EnumBillStatus; -import com.iformall.enums.EnumBusRatioTime; -import com.iformall.enums.EnumDelStatus; -import com.iformall.enums.EnumGetRatioFrom; -import com.iformall.enums.EnumMissTimeType; -import com.iformall.enums.EnumRentContractType; -import com.iformall.enums.EnumRentShopType; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.WxBillActionMapper; -import com.iformall.mapper.WxBillAdvanceMapper; -import com.iformall.mapper.WxBillDepositMapper; -import com.iformall.mapper.WxBillRentManageMapper; -import com.iformall.mapper.WxBillRentMapper; -import com.iformall.mapper.WxRentContractMapper; -import com.iformall.service.ExcelService; -import com.iformall.service.WxBillActionService; -import com.iformall.service.WxBillAdvanceService; -import com.iformall.service.WxBillDepositService; -import com.iformall.service.WxBillRentService; -import com.iformall.service.WxFinanceService; -import com.iformall.service.WxMerchantService; -import com.iformall.service.WxMerchantTradeDailyService; -import com.iformall.service.WxPayAccountBillService; -import com.iformall.service.WxShopService; -import com.iformall.service.helper.WxBillAllHelper; -import com.iformall.utils.Constant; -import com.iformall.utils.DateUtils; - -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.joda.time.DateTime; -import org.joda.time.Months; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * @author gongbiao - */ -@Service -public class WxBillAdvanceServiceImpl extends WxBillBaseService implements WxBillAdvanceService { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - WxBillAdvanceMapper wxBillAdvanceMapper; - @Autowired - WxBillActionService wxBillActionService; - @Autowired - ExcelService excelService; - @Autowired - WxPayAccountBillService wxPayAccountBillService; - - @Lazy - @Autowired - WxMerchantService wxMerchantService; - @Lazy - @Autowired - WxShopService wxShopService; - - @Lazy - @Autowired - WxBillAllHelper wxBillAllHelper; - - @Lazy - @Autowired - WxFinanceService wxFinanceService; - - @Override - public PageInfo listAsPage(WxBillAdvance record, Integer pageIndex, Integer pageSize) { - return getBillRentPropertyList(pageIndex,pageSize,record); - } - - private PageInfo getBillRentPropertyList(Integer pageIndex, Integer pageSize,WxBillAdvance wxBillRent) { - updateQueryParam(wxBillRent); - PageInfo billRentList = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillAdvanceMapper.queryBillList(wxBillRent)); - if (null == billRentList) { - return null; - } - if (null != billRentList.getList()) { - WxMerchant wq = new WxMerchant(); - wq.updateTenantInfo(wxBillRent); - Map merchantMap = wxMerchantService.findMerchantMap(wq); - Map shopNumberMap = wxShopService.getMerchantShopNumberMap(wq, null, null); - for (int i = 0 ; i < billRentList.getList().size() ; i ++) { - WxBillAdvance e = billRentList.getList().get(i); - if (null != e.getMerchantId() && null != merchantMap) { - WxMerchant m = merchantMap.get(e.getMerchantId()); - if (null != m) { - e.setMerchantName(m.getName()); - } - String shopNumber = shopNumberMap.get(e.getMerchantId()); - e.setShopNumber(shopNumber); - } - } - } - return billRentList; - } - - private void updateQueryParam(WxBillAdvance wxBillRent) { - if (null != wxBillRent.getFloorForRule() || null != wxBillRent.getFloor() || null != wxBillRent.getBuilding()) { - List merchantIds = wxMerchantService.getFloorBuildMerchantIds(wxBillRent, wxBillRent.getFloorForRule(), wxBillRent.getBuilding(), wxBillRent.getFloor(), 0, 0); - if (null != merchantIds) { - wxBillRent.setMerchantIdList(merchantIds); - }else { - wxBillRent.setId(-1L); - } - } - - if (StringUtils.isNotBlank(wxBillRent.getMerchantName())) { - WxMerchant mq = new WxMerchant(); - mq.updateTenantInfo(wxBillRent); - mq.setName(StringUtils.trimToNull(wxBillRent.getMerchantName())); - List mids = wxMerchantService.findIdList(mq); - if (null != mids && mids.size() > 0 ) { - if (null != wxBillRent.getMerchantIdList()) { - List _mids = (List) CollectionUtils.intersection(mids, wxBillRent.getMerchantIdList()); - if (null == _mids || _mids.size() <= 0) { - wxBillRent.setId(-1L); - }else { - wxBillRent.setMerchantIdList(_mids); - } - }else { - wxBillRent.setMerchantIdList(mids); - } - }else { - wxBillRent.setId(-1L); - } - } - } - - @Override - public WxBillAdvance getById(TenantEntity tenantEntity,Long id) { - WxBillAdvance record = new WxBillAdvance(); - record.setId(id); - record.updateTenantInfo(tenantEntity); - PageInfo rp = getBillRentPropertyList(1,1,record); - WxBillAdvance rent = rp.getList().get(0); - return rent; - } - - @Override - public ResultData saveOrUpdate(WxBillAdvance record, MallUserInfo user) { - //String receivepay = StringUtils.isBlank(record.getRealReceivePay()) ? "0" : record.getRealReceivePay(); - String receivepay = StringUtils.isBlank(record.getReceivePay()) ? "0" : record.getReceivePay(); - String pay = StringUtils.isBlank(record.getPay()) ? "0" : record.getPay(); - if(new BigDecimal(pay).compareTo(new BigDecimal(receivepay)) > 0 ){ - return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "抵扣金额不能大于实际预收总金额"); - } - Date date = new Date(); - if (record.getId() == null) { - logger.info("新增租赁账单"); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreatetime(date); - record.setUpdatetime(date); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - record.setCreateBy(user.getId()); - record.setCreateByName(user.getName()); - record.updateTenantInfo(user); - try { - wxBillAdvanceMapper.insert(record); - } catch (Exception e) { - logger.error("保存租赁账单失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - return new ResultData(Result.SUCCESS, "保存租赁账单成功"); - } else { - return new ResultData(); - } - } - - @Override - public void deleteById(TenantEntity tenantEntity,Long id) { - wxBillAdvanceMapper.deleteById(id,tenantEntity.getTenantId()); - } - - - @Override - public List getMerchantIds(WxBillAdvance wxBillRent) { - updateQueryParam(wxBillRent); - return wxBillAdvanceMapper.getMerchantIdList(wxBillRent); - } - - - @Override - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid) { - WxBillAdvance dbBill = wxBillAdvanceMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillAdvance wxBillRent = new WxBillAdvance(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - if (forcePaid) { - wxBillRent.setReceivePay(dbBill.getPay()); - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - wxBillAdvanceMapper.updateById(wxBillRent); - String remark = StringUtils.trimToEmpty(dto.getRemark())+ ";【系统】账单被强制为结清。"; - this.addBillAction(EnumBillAction.OFFLINE_PAY, dto.getBillTypeValue(),dto.getId(), dbBill.getPay(), dbBill.getPay(),null,null,null,remark,null,null, user); - }else { -// if (StringUtils.isNotBlank(dto.getOldLatePrice()) && StringUtils.isNotBlank(dto.getNewLatePrice())) { -// wxBillRent.setLatePayPrice(dto.getNewLatePrice()); -// wxBillRentMapper.updateById(wxBillRent); -// this.addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, dto.getBillTypeValue(), dto.getId(), -// dto.getOldLatePrice(), dto.getNewLatePrice(),null,null,dto.getRemark(),null,null, user); -// }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,null,dto.getRemark(),null,null, user); -// }else { - //租赁账单更新 - wxBillRent.setReceivePay(dto.getNewPrice()); - Date payDate = null; - WxBillPayWay payWay = null; - String remark = StringUtils.trimToEmpty(dto.getRemark()); - if (new BigDecimal(dto.getNewPrice()).compareTo(new BigDecimal(dbBill.getPay())) <= 0) { - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - payDate = new Date(); - payWay = wxFinanceService.getPayWayById(dto, Constant.bill_pay_way_system); - remark = remark + ";【系统】账单预收金额调整至小于等于已冲抵金额,自动归结为结清。"; - } - wxBillAdvanceMapper.updateById(wxBillRent); - //账单日志 - this.addBillAction(EnumBillAction.OFFLINE_PAY, dto.getBillTypeValue(),dto.getId(), - dto.getOldPrice(), dto.getNewPrice(),null,payDate,payWay,remark,null,null, user); - // } - } - } - - @Override - public void backPay(WxBillPayDTO dto, MallUserInfo user) { - WxBillAdvance dbBill = wxBillAdvanceMapper.selectById(dto.getId(),dto.getTenantId()); - BigDecimal oldpay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - oldpay = new BigDecimal(dbBill.getPay()); - } - BigDecimal oldsetoff = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getSetOff())) { - oldsetoff = new BigDecimal(dbBill.getSetOff()); - } - WxBillAdvance wxBillRent = new WxBillAdvance(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); - wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); - if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { - if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { - wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); - } - } - wxBillAdvanceMapper.updateById(wxBillRent); - EnumBillAction action = EnumBillAction.RETURN; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void updatePay(WxBillPayDTO dto, MallUserInfo user) { - WxBillAdvance wxBillRent = updateBillPay(dto); - EnumBillAction action = EnumBillAction.OFFLINE_PAY; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - private WxBillAdvance updateBillPay(WxBillPayDTO dto) { - WxBillAdvance dbBill = wxBillAdvanceMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillAdvance wxBillRent = new WxBillAdvance(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - BigDecimal opay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - opay = new BigDecimal(dbBill.getPay()); - } - - opay = opay.add(new BigDecimal(dto.getAddpay())); - wxBillRent.setPay(opay.toPlainString()); - if (opay.compareTo(new BigDecimal(dbBill.getOwe())) >= 0 ) { - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - dto.setRemark("【系统】账单冲抵金额已大于等于预收金额,自动归结为结清。"); - } - wxBillRent.setPayDate(new Date()); - wxBillRent.setPayWay(dto.getPayWayObject().getId()); - wxBillAdvanceMapper.updateById(wxBillRent); - return wxBillRent; - } - - @Override - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline) { - WxBillAdvance wxBillRent = updateBillPay(dto); - EnumBillAction action = null; - if (isOnline) { - action = EnumBillAction.SELF_SERVICE_PAY; - }else { - action = EnumBillAction.OFFLINE_PAY; - } - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void bad(WxBillPayDTO dto, MallUserInfo user) { - WxBillAdvance dbBill = wxBillAdvanceMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillAdvance wxBillRent = new WxBillAdvance(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setStatus(EnumBillStatus.BAD.getCode()); - wxBillAdvanceMapper.updateById(wxBillRent); - String badMoney = dbBill.getOwe(); - this.addBillAction(EnumBillAction.BAD, dto.getBillTypeValue(),dto.getId(), - badMoney, badMoney,null,null,null,dto.getRemark(),null,null, user); - } - -// @Override -// public void rentContractStop(WxRentContract rentContract,MallUserInfo user) { -// //删除草稿状态的账单 -// WxBillRent brDel = new WxBillRent(); -// brDel.setRentContractId(rentContract.getId()); -// brDel.updateTenantInfo(rentContract); -// brDel.setIsPreview(EnumYesOrNo.YES.getCode()); -// wxBillRentMapper.deletePreviewBill(brDel); -// -// WxBillRent br = new WxBillRent(); -// br.setRentContractId(rentContract.getId()); -// br.updateTenantInfo(rentContract); -// br.setIsPreview(EnumYesOrNo.NO.getCode()); -// List brList = wxBillRentMapper.findList(br); -// List realRentList = new ArrayList(); -// List actionList = new ArrayList(); -// if (null != brList && brList.size() > 0 ) { -// for (int i = 0 ; i < brList.size() ; i ++ ) { -// WxBillRent brent = brList.get(i); -// WxBillAction action = new WxBillAction(); -// boolean isUpdate = wxBillAllHelper.billEndCalcute(rentContract.getDecimalSize(),rentContract.getEndContractTime(), brent, action, false); -// if (isUpdate) { -// realRentList.add(brent); -// actionList.add(action); -// } -// } -// } -// -// for (int i = 0 ; i < realRentList.size() ; i ++) { -// WxBillRent rbrent = realRentList.get(i); -// wxBillRentMapper.updateById(rbrent); -// } -// -// for (int i = 0 ; i < actionList.size() ; i ++) { -// WxBillAction ba = actionList.get(i); -// this.addBillAction(ba, user); -// } -// } -// -// @Override -// public void completeBill(EnumBillStatus status, WxMerchant wxMerchant, MallUserInfo user) { -// WxBillRent bill = new WxBillRent(); -// bill.updateTenantInfo(wxMerchant); -// bill.setFloorForRule(wxMerchant.getFloorForRule()); -// bill.setBusinessForRule(wxMerchant.getBusinessForRule()); -// bill.setBuilding(wxMerchant.getBuilding()); -// bill.setFloor(wxMerchant.getFloor()); -// bill.setMerchantId(wxMerchant.getId()); -// bill.setStatus(status.getCode()); -// updateQueryParam(bill); -// PageInfo bpage = this.listAsPage(bill, 1, 100); -// if (null != bpage && null != bpage.getList()) { -// for (int i = 0 ; i < bpage.getList().size() ; i++ ) { -// WxBillRent b = bpage.getList().get(i); -// -// WxBillRent bu = new WxBillRent(); -// bu.setId(b.getId()); -// bu.updateTenantInfo(b); -// bu.setStatus(EnumBillStatus.INVALID.getCode()); -// bu.setUpdatetime(new Date()); -// bu.setUpdateBy(user.getId()); -// bu.setUpdateByName(user.getName()); -// wxBillRentMapper.updateById(bu); -// -// WxBillAction wxBillAction = new WxBillAction(); -// wxBillAction.setBillId(b.getId()); -// wxBillAction.setBillType(b.getBillType()); -// wxBillAction.setAction(EnumBillAction.STATUS_CHANGE.getCode()); -// wxBillAction.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null,null,EnumBillStatus.getEnum(b.getStatus()),EnumBillStatus.INVALID)); -// wxBillAction.setRemark(wxMerchant.getBillCompleteRemark()); -// this.addBillAction(wxBillAction, user); -// } -// } -// -// } - -} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index 7e217162b..b46e718a3 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -50,2216 +50,2216 @@ import java.util.stream.Collectors; public class WxBillAllServiceImpl implements WxBillAllService { private Logger logger = LoggerFactory.getLogger(this.getClass()); - @Autowired - WxBillAllMapper wxBillAllMapper; - - @Lazy - @Autowired - WxBillDailyService wxBillDailyService; - - @Lazy - @Autowired - WxBillDepositService wxBillDepositService; - - @Lazy - @Autowired - WxBillPropertyDepositService wxBillPropertyDepositService; - - @Lazy - @Autowired - WxBillPropertyService wxBillPropertyService; - - @Lazy - @Autowired - WxBillRentService wxBillRentService; - - @Lazy - @Autowired - WxBillOtherService wxBillOtherService; - - @Lazy - @Autowired - WxBillOtherDepositService wxBillOtherDepositService; - - @Autowired - WxBillDailyMapper wxBillDailyMapper; - - @Autowired - WxBillDepositMapper wxBillDepositMapper; - - @Autowired - WxBillPropertyDepositMapper wxBillPropertyDepositMapper; - - @Autowired - WxBillPropertyMapper wxBillPropertyMapper; - - @Autowired - WxBillRentMapper wxBillRentMapper; - - @Autowired - WxBillOtherMapper wxBillOtherMapper; - - @Autowired - WxBillOtherDepositMapper wxBillOtherDepositMapper; - - @Autowired - ExcelService excelService; - - @Autowired - MqBaseProducer mqBaseProducer; - - @Lazy - @Autowired - WxBillActionService wxBillActionService; - - @Autowired - WxMerchantBUserMapper wxMerchantBUserMapper; - - @Autowired - WxMallMapper wxMallMapper; - - @Autowired - WxMerchantService wxMerchantService; - - @Autowired - private String fmUploadDir; - - @Autowired - private WxBillSettleMapper wxBillSettleMapper; - - @Autowired - private WxPayAccountBillMapper wxPayAccountBillMapper; - - @Autowired - WxMerchantShopMapper wxMerchantShopMapper; - - @Autowired - StringRedisTemplate stringRedisTemplate; - - @Lazy - @Autowired - WxBillSettleRecordService wxBillSettleRecordService; - - @Lazy - @Autowired - WxBillSettleService wxBillSettleService; - - @Autowired - WxBillSettleRecordMapper wxBillSettleRecordMapper; - - @Lazy - @Autowired - WxPayAccountBillService wxPayAccountBillService; - - @Autowired - WxBillSettleScheduleMapper wxBillSettleScheduleMapper; - - @Autowired - WxShopMapper wxShopMapper; - - @Autowired - WxPayBillMapper wxPayBillMapper; - - @Autowired - WxMerchantMapper wxMerchantMapper; - - @Autowired - WxBillRentManageMapper wxBillRentManageMapper; - - @Lazy - @Autowired - WxBillRentManageService wxBillRentManageService; - - @Override - public Map listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - - if (StringUtils.isNotEmpty(record.getTypeStr())) { - List typeList = JSONArray.parseArray(record.getTypeStr(), Integer.class); - record.setTypeList(typeList); - } - PageHelper.startPage(pageIndex, pageSize); - PageInfo pageInfo = new PageInfo<>(list(record)); - - //手续费 = 合同应收+手续费+滞纳金 - pageInfo.getList().stream().forEach(e -> { - //手续费 = 合同应收+手续费+滞纳金 - cmputeTotalMoney(wxPayAccountBill, e); - }); - - Map result = new HashMap<>(); - result.put("pageInfo", pageInfo); - return result; - } - - private List list(WxBillAll wxBillAll) { - List retList = null; - wxBillAll.setBillTypeValue(EnumBillQueryType.getRealType(wxBillAll.getBillTypeValue())); - if (!StringUtils.isBlank(wxBillAll.getMerchantName())) { - WxMerchant wxMerchantQ = new WxMerchant(); - wxMerchantQ.setName(StringUtils.trimToNull(wxBillAll.getMerchantName())); - List mids = wxMerchantMapper.findIdList(wxMerchantQ); - if (null != mids && mids.size() > 0 ) { - wxBillAll.setMerchantIdList(mids); - } - } - if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.RENT.getCode()); - retList = wxBillAllMapper.listRentBill(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT_DEPOSIT.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_DEPOSIT.getCode()); - retList = wxBillAllMapper.listRentDepositBill(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.PROPERTY.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY.getCode()); - retList = wxBillAllMapper.listPropertyBill(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.PROPERTY_DEPOSIT.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY_DEPOSIT.getCode()); - retList = wxBillAllMapper.listPropertyDepositBill(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.WATER_POWER_AIR.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.WATER_POWER_AIR.getCode()); - retList = wxBillAllMapper.listDailyBill(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.OTHER.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER.getCode()); - retList = wxBillAllMapper.listOtherBill(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.OTHER_DEPOSIT.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER_DEPOSIT.getCode()); - retList = wxBillAllMapper.listOtherDepositBill(wxBillAll); - }else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT_BUSSINESS_MANAGE.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_BUSSINESS_MANAGE.getCode()); - wxBillAll.setManageFeeType(EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE.getCode()); - wxBillAll.setBillTypeName(EnumBillQueryType.RENT_BUSSINESS_MANAGE.getMessage()); - retList = wxBillAllMapper.listRentManageBill(wxBillAll); - }else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT_OPERATING_MANAGE.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_OPERATING_MANAGE.getCode()); - wxBillAll.setManageFeeType(EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE.getCode()); - wxBillAll.setBillTypeName(EnumBillQueryType.RENT_OPERATING_MANAGE.getMessage()); - retList = wxBillAllMapper.listRentManageBill(wxBillAll); - } else { - logger.info("账单不存在"); - } - if (null != retList && retList.size() > 0 ){ - for (int i = 0 ; i < retList.size(); i ++) { - WxBillAllVo vo = retList.get(i); - if( null!= vo.getMerchantId() ) { - WxMerchant wxMerchantQ = new WxMerchant(); - wxMerchantQ.setId(vo.getMerchantId()); - List mlist = wxMerchantMapper.findIdNameList(wxMerchantQ); - if (null != mlist && mlist.size() > 0 ) { - vo.setMerchantName(mlist.get(0).getName()); - } - } - if (null != vo.getShopId()) { - Map param = new HashMap(); - param.put("id", vo.getShopId()); - Map shop = wxShopMapper.getMerchantShopByShopId(param); - if ( null != shop) { - vo.setShopNumber((String)shop.get("shopNumber")); - vo.setManager((String)shop.get("manager")); - vo.setManagerPhone((String)shop.get("managerPhone")); - } - } - } - } - return retList; - } - - public void cmputeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillAllVo e) { -// if (e.getReceivePay() != null) { -// if (e.getLatePayPrice() == null) { -// e.setLatePayPrice(0L); -// } -// BigDecimal servicePay; -// if (e.getServiceChargePay() != null) { -// servicePay = new BigDecimal(e.getServiceChargePay()); -// } else { -// servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); -// } -// Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); -// e.setRealReceivePay(realReceivePay); -// e.setServiceChargePay(servicePay.intValue()); -// if (!e.getStatus().equals(EnumBillStatus.NOT_PAID.getCode()) && -// !e.getStatus().equals(EnumBillStatus.WAIT_PAY.getCode())) { -// e.setOwe(0L); -// } else { -// e.setOwe(realReceivePay - e.getPay()); -// } -// } - } - +// @Autowired +// WxBillAllMapper wxBillAllMapper; +// +// @Lazy +// @Autowired +// WxBillDailyService wxBillDailyService; +// +// @Lazy +// @Autowired +// WxBillDepositService wxBillDepositService; +// +// @Lazy +// @Autowired +// WxBillPropertyDepositService wxBillPropertyDepositService; +// +// @Lazy +// @Autowired +// WxBillPropertyService wxBillPropertyService; +// +// @Lazy +// @Autowired +// WxBillRentService wxBillRentService; +// +// @Lazy +// @Autowired +// WxBillOtherService wxBillOtherService; +// +// @Lazy +// @Autowired +// WxBillOtherDepositService wxBillOtherDepositService; +// +// @Autowired +// WxBillDailyMapper wxBillDailyMapper; +// +// @Autowired +// WxBillDepositMapper wxBillDepositMapper; +// +// @Autowired +// WxBillPropertyDepositMapper wxBillPropertyDepositMapper; +// +// @Autowired +// WxBillPropertyMapper wxBillPropertyMapper; +// +// @Autowired +// WxBillRentMapper wxBillRentMapper; +// +// @Autowired +// WxBillOtherMapper wxBillOtherMapper; +// +// @Autowired +// WxBillOtherDepositMapper wxBillOtherDepositMapper; +// +// @Autowired +// ExcelService excelService; +// +// @Autowired +// MqBaseProducer mqBaseProducer; +// +// @Lazy +// @Autowired +// WxBillActionService wxBillActionService; +// +// @Autowired +// WxMerchantBUserMapper wxMerchantBUserMapper; +// +// @Autowired +// WxMallMapper wxMallMapper; +// +// @Autowired +// WxMerchantService wxMerchantService; +// +// @Autowired +// private String fmUploadDir; +// +// @Autowired +// private WxBillSettleMapper wxBillSettleMapper; +// +// @Autowired +// private WxPayAccountBillMapper wxPayAccountBillMapper; +// +// @Autowired +// WxMerchantShopMapper wxMerchantShopMapper; +// +// @Autowired +// StringRedisTemplate stringRedisTemplate; +// +// @Lazy +// @Autowired +// WxBillSettleRecordService wxBillSettleRecordService; +// +// @Lazy +// @Autowired +// WxBillSettleService wxBillSettleService; +// +// @Autowired +// WxBillSettleRecordMapper wxBillSettleRecordMapper; +// +// @Lazy +// @Autowired +// WxPayAccountBillService wxPayAccountBillService; +// +// @Autowired +// WxBillSettleScheduleMapper wxBillSettleScheduleMapper; +// +// @Autowired +// WxShopMapper wxShopMapper; +// +// @Autowired +// WxPayBillMapper wxPayBillMapper; +// +// @Autowired +// WxMerchantMapper wxMerchantMapper; +// +// @Autowired +// WxBillRentManageMapper wxBillRentManageMapper; +// +// @Lazy +// @Autowired +// WxBillRentManageService wxBillRentManageService; +// // @Override -// public List> listBillOweAndWaitPay(WxBillAll wxBillAll) { -// //更新各账单状态 -// //updateBillStatus(wxBillAll); -// ArrayList statusList = new ArrayList<>(); -// statusList.add(EnumBillRentStatus.NOT_PAID.getCode()); -// statusList.add(EnumBillRentStatus.WAIT_PAY.getCode()); -// wxBillAll.setStatusList(statusList); -// return wxBillAllMapper.listData(wxBillAll); -// } - - @Override - public ResultData pageListBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasShop,boolean hasPayBill,boolean hasReceivePay) { - //更新各账单状态 - //updateBillStatus(wxBillAll); - PageHelper.startPage(wxBillAll.getPageIndex(), wxBillAll.getPageSize()); - PageInfo> pageInfo = new PageInfo<>(listBill(wxBillAll, wxMerchant,true, hasShop, hasPayBill, hasReceivePay)); - return new ResultData(pageInfo); - } - - @Override - public List> listBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasSet,boolean hasShop,boolean hasPayBill,boolean hasReceivePay){ - List> maps = null; - //账单类型 - wxBillAll.setBillTypeValue(EnumBillQueryType.getRealType(wxBillAll.getBillTypeValue())); - wxBillAll.setMerchantId(wxMerchant.getId()); - if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.RENT.getCode()); - maps = wxBillAllMapper.listRentBillData(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT_DEPOSIT.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_DEPOSIT.getCode()); - maps = wxBillAllMapper.listRentDepositBillData(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.PROPERTY.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY.getCode()); - maps = wxBillAllMapper.listPropertyBillData(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.PROPERTY_DEPOSIT.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY_DEPOSIT.getCode()); - maps = wxBillAllMapper.listPropertyDepositBillData(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.WATER_POWER_AIR.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.WATER_POWER_AIR.getCode()); - maps = wxBillAllMapper.listDailyBillData(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.OTHER.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER.getCode()); - maps = wxBillAllMapper.listOtherBillData(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.OTHER_DEPOSIT.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER_DEPOSIT.getCode()); - maps = wxBillAllMapper.listOtherDepositBillData(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.SETTLE.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.SETTLE.getCode()); - maps = wxBillAllMapper.listSettleBillData(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT_BUSSINESS_MANAGE.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_BUSSINESS_MANAGE.getCode()); - wxBillAll.setBillTypeName(EnumBillQueryType.RENT_BUSSINESS_MANAGE.getMessage()); - wxBillAll.setManageFeeType(EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE.getCode()); - maps = wxBillAllMapper.listRentManageBillData(wxBillAll); - } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT_OPERATING_MANAGE.getCode())) { - wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_OPERATING_MANAGE.getCode()); - wxBillAll.setBillTypeName(EnumBillQueryType.RENT_OPERATING_MANAGE.getMessage()); - wxBillAll.setManageFeeType(EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE.getCode()); - maps = wxBillAllMapper.listRentManageBillData(wxBillAll); - } else { - logger.info("账单不存在"); - } - if (null != maps && hasSet) { - for (Map map : maps) { - - Integer billType = ((Long) map.get("billTypeValue")).intValue(); - if (EnumBillType.SETTLE.getCode().equals(billType)) { - Long id = (Long) map.get("id"); - WxBillSettle settle = wxBillSettleService.getById(id, EnumFilterSettle.YES.getCode()); - map.put("owe", settle.getBalance()); - if (hasReceivePay) { - settle = wxBillSettleService.getById(id, EnumFilterSettle.NO.getCode()); - map.put("receivePay", settle.getBalance()); - } - } - map.put("merchantName", wxMerchant.getName()); - if (hasShop) { - Long shopId = (Long) map.get("shopId"); - if (null != shopId) { - Map param = new HashMap(); - param.put("id", shopId); - Map shopResult = wxShopMapper.getMerchantShopByShopId(param); - if (null != shopResult) { - map.put("shopNumber", shopResult.get("shopNumber")); - } - } - } - if (hasPayBill) { - Long billId = (Long) map.get("id"); - WxPayBill wxPayBill = new WxPayBill(); - wxPayBill.updateTenantInfo(wxMerchant); - wxPayBill.setBillId(billId); - List payBillList = wxPayBillMapper.findList(wxPayBill); - if (null != payBillList && payBillList.size() > 0 ) { - WxPayBill pb = payBillList.get(0); - map.put("payBillStatus", pb.getPayBillStatus()); - map.put("tradeTime", pb.getPayTimeEnd()); - map.put("transactionId", pb.getTransactionId()); - map.put("payAmount", pb.getPayAmount()); - } - } - } - } - return maps; - } - - @Override - public Map detail(Long id,Integer type) { - if (type.equals(EnumBillQueryType.RENT.getCode())) { - return wxBillAllMapper.detailRentBillData(id); - } else if (type.equals(EnumBillQueryType.RENT_DEPOSIT.getCode())) { - return wxBillAllMapper.detailRentDepositBillData(id); - } else if (type.equals(EnumBillQueryType.PROPERTY.getCode())) { - return wxBillAllMapper.detailPropertyBillData(id); - } else if (type.equals(EnumBillQueryType.PROPERTY_DEPOSIT.getCode())) { - return wxBillAllMapper.detailPropertyDepositBillData(id); - } else if (type.equals(EnumBillQueryType.WATER_POWER_AIR.getCode())) { - return wxBillAllMapper.detailDailyBillData(id); - } else if (type.equals(EnumBillQueryType.OTHER.getCode())) { - return wxBillAllMapper.detailOtherBillData(id); - } else if (type.equals(EnumBillQueryType.OTHER_DEPOSIT.getCode())) { - return wxBillAllMapper.detailOtherDepositBillData(id); - } - return null; - } - - - @Override - public void updateBill(Map bill) { -// int billTypeValue = ((Long) bill.get("billTypeValue")).intValue(); -// logger.info(">>>>>>>>>>>>>>>>>>>>账单回调修改数据:" + JSONObject.toJSONString(bill)); -// if (billTypeValue == EnumBillTypeParam.RENT.getCode().intValue()) { -// logger.info("更新租金账单"); -// WxBillRent billRent = wxBillRentMapper.selectById((Long) bill.get("id")); -// if (billRent != null && !billRent.getStatus().equals(EnumBillStatus.PAID.getCode())) { -// updateBillRent(bill); -// } -// } else if (billTypeValue == EnumBillTypeParam.RENT_DEPOSIT.getCode().intValue()) { -// logger.info("更新租金押金账单"); -// WxBillDeposit billDeposit = wxBillDepositMapper.selectById((Long) bill.get("id")); -// if (billDeposit != null && !billDeposit.getStatus().equals(EnumBillStatus.PAID.getCode())) { -// updateBillRentDeposit(bill); -// } -// } else if (billTypeValue == EnumBillTypeParam.PROPERTY.getCode().intValue()) { -// logger.info("更新物业账单"); -// WxBillProperty property = wxBillPropertyMapper.selectById((Long) bill.get("id")); -// if (property != null && !property.getStatus().equals(EnumBillStatus.PAID.getCode())) { -// updateBillProperty(bill); -// } -// } else if (billTypeValue == EnumBillTypeParam.PROPERTY_DEPOSIT.getCode().intValue()) { -// logger.info("更新物业押金账单"); -// WxBillPropertyDeposit wxBillPropertyDeposit = wxBillPropertyDepositMapper.selectById((Long) bill.get("id")); -// if (wxBillPropertyDeposit != null && !wxBillPropertyDeposit.getStatus().equals(EnumBillStatus.PAID.getCode())) { -// updateBillPropertyDeposit(bill); -// } -// } else if (billTypeValue == EnumBillTypeParam.WATER.getCode().intValue()) { -// logger.info("更新水费账单"); -// WxBillDaily wxBillDaily = wxBillDailyMapper.selectById((Long) bill.get("id")); -// if (wxBillDaily != null && !wxBillDaily.getStatus().equals(EnumBillStatus.PAID.getCode())) { -// updateBillDaily(bill); -// } -// } else if (billTypeValue == EnumBillTypeParam.POWER.getCode().intValue()) { -// logger.info("更新电费账单"); -// WxBillDaily wxBillDaily = wxBillDailyMapper.selectById((Long) bill.get("id")); -// if (wxBillDaily != null && !wxBillDaily.getStatus().equals(EnumBillStatus.PAID.getCode())) { -// updateBillDaily(bill); -// } -// } else if (billTypeValue == EnumBillTypeParam.AIR_CONDITIONING.getCode().intValue()) { -// logger.info("更新空调费账单"); -// WxBillDaily wxBillDaily = wxBillDailyMapper.selectById((Long) bill.get("id")); -// if (wxBillDaily != null && !wxBillDaily.getStatus().equals(EnumBillStatus.PAID.getCode())) { -// updateBillDaily(bill); -// } -// } else if (billTypeValue == EnumBillTypeParam.ROUTINE.getCode().intValue()) { -// logger.info("更新其他账单"); -// WxBillOther wxBillOther = wxBillOtherMapper.selectById((Long) bill.get("id")); -// if (wxBillOther != null && !wxBillOther.getStatus().equals(EnumBillStatus.PAID.getCode())) { -// updateBillOther(bill); -// } -// } else if (billTypeValue == EnumBillTypeParam.ATHER_DEPOSIT.getCode().intValue()) { -// logger.info("更新其他押金账单"); -// WxBillOtherDeposit wxBillOtherDeposit = wxBillOtherDepositMapper.selectById((Long) bill.get("id")); -// if (wxBillOtherDeposit != null && !wxBillOtherDeposit.getStatus().equals(EnumBillStatus.PAID.getCode())) { -// updateBillOtherDeposit(bill); -// } -// } else if (billTypeValue == EnumBillTypeParam.SETTLE.getCode().intValue()) { -// try { -// logger.info("更新结算单id:{}", JsonUtil.obj2Json(bill)); -// -// WxBillSettle wxBillSettle = wxBillSettleService.getById((Long) bill.get("id"), EnumFilterSettle.YES.getCode()); -// -// WxBillSettleRecord settleRecord = new WxBillSettleRecord(); -// settleRecord.setSettleId((Long) bill.get("id")); -// settleRecord.setSettleMoney(wxBillSettle.getBalance()); -// settleRecord.setSettleTime(new Date()); -// settleRecord.setSettleWay(EnumSettleRecordWay.WEBCAT.getCode()); -// settleRecord.updateTenantInfo(wxBillSettle); -// -// BigDecimal money = new BigDecimal(settleRecord.getSettleMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); -// settleRecord.setDetail(EnumSettleRecordWay.getEnum(settleRecord.getSettleWay()).getMessage() + "收款" + money.toString() + "元"); -// wxBillSettleRecordService.saveOrUpdate(settleRecord, null, (Long) bill.get("userId")); -// -// wxBillSettle.setUpdatetime(new Date()); -// wxBillSettle.setStatus(EnumSettleStatus.FINISH.getCode()); -// wxBillSettleMapper.updateById(wxBillSettle); -// -// logger.info("更新结算单success"); -// } catch (Exception e) { -// logger.error("结算单error", e); -// e.printStackTrace(); -// } +// public Map listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { +// WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); // -// } else { -// logger.info("账单类型不存在"); -// } - } - - @Override - public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll) { -// Map> collect = list(wxBillAll) -// .stream().filter(b -> null != b.getMerchantId()) -// .collect(Collectors.groupingBy(WxBillAllVo::getMerchantId)); -// Set>> entries = collect.entrySet(); -// List datalist = new ArrayList<>(); -// for (Map.Entry> entry : entries) { -// List list = entry.getValue(); -// for (WxBillAllVo wxBillAllVo : list) { -// String shopNumber = wxBillAllVo.getShopNumber(); -// if (StringUtils.isEmpty(shopNumber)) { -// String shopInfo = wxBillAllVo.getShopInfo(); -// if (StringUtils.isNotEmpty(shopInfo) && !shopInfo.equals("[]")) { -// JSONObject jsonObject = JSONObject.parseObject(shopInfo); -// StringBuffer sb = new StringBuffer(); -// Set> sets = jsonObject.entrySet(); -// sets.forEach(x -> sb.append(x.getKey()).append(",")); -// if(StringUtils.isNotBlank(sb)){ -// wxBillAllVo.setShopNumber(sb.deleteCharAt(sb.length() - 1).toString()); -// } -// } -// } -// wxBillAllVo.setPayDateStr(DateUtils.format(wxBillAllVo.getPayDate())); -// wxBillAllVo.setRentStartTime(DateUtils.format(wxBillAllVo.getStarttime())); -// wxBillAllVo.setRentEndTime(DateUtils.format(wxBillAllVo.getEndtime())); -// -// //status不是欠缴,都展示0,与前端保持一致 -// if (!EnumBillStatus.NOT_PAID.getCode().equals(wxBillAllVo.getStatus())) { -// wxBillAllVo.setOwe(0L); -// wxBillAllVo.setOweStr("0"); -// } -// datalist.add(wxBillAllVo); -// } +// if (StringUtils.isNotEmpty(record.getTypeStr())) { +// List typeList = JSONArray.parseArray(record.getTypeStr(), Integer.class); +// record.setTypeList(typeList); // } -// WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillAll); -// datalist.stream().forEach(e -> { +// PageHelper.startPage(pageIndex, pageSize); +// PageInfo pageInfo = new PageInfo<>(list(record)); +// +// //手续费 = 合同应收+手续费+滞纳金 +// pageInfo.getList().stream().forEach(e -> { // //手续费 = 合同应收+手续费+滞纳金 // cmputeTotalMoney(wxPayAccountBill, e); // }); -// excelService.exportExcel(datalist, null, "账单数据", WxBillAllVo.class, "账单数据.xlsx", response, false); - } - - private int updateBillOtherDeposit(Map bill) { -// logger.info("updateBillOtherDeposit params:" + bill.toString()); -// Object id = bill.get("id"); -// WxBillOtherDeposit wxBillOtherDeposit = wxBillOtherDepositMapper.selectById((Long) id); -// if (wxBillOtherDeposit == null) { -// return 0; -// } -// Date date = new Date(); -// wxBillOtherDeposit.setPayDate(date); -// Long owe = (Long) bill.get("owe"); -// wxBillOtherDeposit.setPay(wxBillOtherDeposit.getPay() + owe); -// //wxBillOtherDeposit.setOwe("0"); -// wxBillOtherDeposit.setStatus(EnumBillStatus.PAID.getCode()); -// wxBillOtherDeposit.setPayDate(date); -// wxBillOtherDeposit.setUpdatetime(date); -// wxBillOtherDeposit.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); -// int count = 0; -// try { -// count = wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); -// } catch (Exception e) { -// logger.error("更新其他押金账单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// //日志 -// WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById((Long) 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.updateTenantInfo(wxMerchantBUser); -// wxBillAction.setPayDate(date); -// 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; - return 0; - } - - private int updateBillOther(Map bill) { -// logger.info("updateBillOther params:" + bill.toString()); -// Object id = bill.get("id"); -// WxBillOther wxBillOther = wxBillOtherMapper.selectById((Long) id); -// if (wxBillOther == null) { -// return 0; -// } -// Date date = new Date(); -// wxBillOther.setPayDate(date); -// Long owe = (Long) bill.get("owe"); -// wxBillOther.setPay(wxBillOther.getPay() + owe); -// //wxBillOther.setOwe("0"); -// wxBillOther.setStatus(EnumBillStatus.PAID.getCode()); -// wxBillOther.setPayDate(date); -// wxBillOther.setUpdatetime(date); -// wxBillOther.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); -// int count = 0; -// try { -// count = wxBillOtherMapper.updateById(wxBillOther); -// } catch (Exception e) { -// logger.error("更新其他账单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// //日志 -// WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById((Long) 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.updateTenantInfo(wxMerchantBUser); -// wxBillAction.setPayDate(date); -// 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; - return 0; - } - - private int updateBillDaily(Map bill) { -// logger.info("updateBillDaily params:" + bill.toString()); -// Object id = bill.get("id"); -// WxBillDaily wxBillDaily = wxBillDailyMapper.selectById((Long) id); -// if (wxBillDaily == null) { -// return 0; -// } -// Date date = new Date(); -// wxBillDaily.setPayDate(date); -// Long owe = (Long) bill.get("owe"); -// wxBillDaily.setPay(wxBillDaily.getPay() + owe); -// //wxBillDaily.setOwe("0"); -// wxBillDaily.setStatus(EnumBillStatus.PAID.getCode()); -// wxBillDaily.setPayDate(date); -// wxBillDaily.setUpdatetime(date); -// wxBillDaily.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); -// -// int count = 0; -// try { -// count = wxBillDailyMapper.updateById(wxBillDaily); -// } catch (Exception e) { -// logger.error("更新日常账单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// //日志 -// WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById((Long) 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.updateTenantInfo(wxMerchantBUser); -// wxBillAction.setPayDate(date); -// 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; - return 0; - } - - private int updateBillPropertyDeposit(Map bill) { -// logger.info("updateBillPropertyDeposit params:" + bill.toString()); -// Object id = bill.get("id"); -// WxBillPropertyDeposit wxBillPropertyDeposit = wxBillPropertyDepositMapper.selectById((Long) id); -// if (wxBillPropertyDeposit == null) { -// return 0; -// } -// Date date = new Date(); -// wxBillPropertyDeposit.setPayDate(date); -// String owe = (String) bill.get("owe"); -// wxBillPropertyDeposit.setPay(new BigDecimal(wxBillPropertyDeposit.getPay()).add(new BigDecimal(owe)).toPlainString()); -// //wxBillPropertyDeposit.setOwe("0"); -// wxBillPropertyDeposit.setStatus(EnumBillStatus.PAID.getCode()); -// wxBillPropertyDeposit.setPayDate(date); -// wxBillPropertyDeposit.setUpdatetime(date); -// wxBillPropertyDeposit.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); -// -// int count = 0; -// try { -// count = wxBillPropertyDepositMapper.updateById(wxBillPropertyDeposit); -// } catch (Exception e) { -// logger.error("更新物业押金账单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// //日志 -// WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById((Long) 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.updateTenantInfo(wxMerchantBUser); -// wxBillAction.setPayDate(date); -// 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; - return 0; - } - - private int updateBillProperty(Map bill) { -// logger.info("updateBillProperty params:" + bill.toString()); -// Object id = bill.get("id"); -// WxBillProperty property = wxBillPropertyMapper.selectById((Long) id); -// if (property == null) { -// return 0; -// } -// Date date = new Date(); -// property.setPayDate(date); -// String owe = (String) bill.get("owe"); -// property.setPay(new BigDecimal(property.getPay()).add(new BigDecimal(owe)).toPlainString()); -// //property.setOwe("0"); -// property.setStatus(EnumBillStatus.PAID.getCode()); -// property.setPayDate(date); -// property.setUpdatetime(date); -// property.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); -// -// int count = 0; -// try { -// count = wxBillPropertyMapper.updateById(property); -// } catch (Exception e) { -// logger.error("更新物业账单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// //日志 -// WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById((Long) 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.updateTenantInfo(wxMerchantBUser); -// wxBillAction.setPayDate(date); -// 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; - return 0; - } - - private int updateBillRentDeposit(Map bill) { -// logger.info("updateBillRentDeposit params:" + bill.toString()); -// Object id = bill.get("id"); -// WxBillDeposit wxBillDeposit = wxBillDepositMapper.selectById((Long) id); -// if (wxBillDeposit == null) { -// return 0; -// } -// Date date = new Date(); -// wxBillDeposit.setPayDate(date); -// Long owe = (Long) bill.get("owe"); -// wxBillDeposit.setPay(wxBillDeposit.getPay() + owe); -// //wxBillDeposit.setOwe("0"); -// wxBillDeposit.setStatus(EnumBillStatus.PAID.getCode()); -// wxBillDeposit.setPayDate(date); -// wxBillDeposit.setUpdatetime(date); -// wxBillDeposit.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); -// -// int count = 0; -// try { -// count = wxBillDepositMapper.updateById(wxBillDeposit); -// } catch (Exception e) { -// logger.error("更新租赁押金账单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// //日志 -// WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById((Long) 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.updateTenantInfo(wxMerchantBUser); -// wxBillAction.setPayDate(date); -// 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; - return 0; - } - - private int updateBillRent(Map bill) { -// logger.info("updateBillRentDeposit params:" + bill.toString()); -// Object id = bill.get("id"); -// WxBillRent wxBillRent = wxBillRentMapper.selectById((Long) id); -// if (wxBillRent == null) { -// return 0; -// } -// Date date = new Date(); -// wxBillRent.setPayDate(date); -// Long owe = (Long) bill.get("owe"); -// wxBillRent.setPay(wxBillRent.getPay() + owe); -// //wxBillRent.setOwe("0"); -// wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); -// wxBillRent.setPayDate(date); -// wxBillRent.setUpdatetime(date); -// wxBillRent.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); -// -// int count = 0; -// try { -// count = wxBillRentMapper.updateById(wxBillRent); -// } catch (Exception e) { -// logger.error("更新租金账单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// //日志 -// WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById((Long) 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.updateTenantInfo(wxMerchantBUser); -// wxBillAction.setPayDate(date); -// 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; - return 0; - } - - @Override - public void updateBillStatus(WxBillAll record) { - logger.info("更新各账单状态开始"); - //更新其他押金账单 - //WxBillOtherDeposit wxBillOtherDeposit = new WxBillOtherDeposit(); - //wxBillOtherDeposit.setTenantId(record.getTenantId()); - //wxBillOtherDepositService.updateBillStatus(wxBillOtherDeposit); - //更新其他账单 - WxBillOther wxBillOther = new WxBillOther(); - wxBillOther.updateTenantInfo(record); - wxBillOtherService.updateBillStatus(wxBillOther); - //更新日常账单状态 - WxBillDaily wxBillDaily = new WxBillDaily(); - wxBillDaily.updateTenantInfo(record); - 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.updateTenantInfo(record); - wxBillPropertyService.updateBillStatus(wxBillProperty); - //更新租赁账单状态 - WxBillRent wxBillRent = new WxBillRent(); - wxBillRent.updateTenantInfo(record); - wxBillRentService.updateBillStatus(wxBillRent); - //更新管理费账单状态 - WxBillRentManage wxBillRentManage = new WxBillRentManage(); - wxBillRentManage.updateTenantInfo(record); - wxBillRentManageService.updateBillStatus(wxBillRentManage); - - logger.info("更新各账单状态结束"); - } - - @Override - public void exportOweBill(WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response) { -// //商场名称 -//// WxMall q = new WxMall(); -//// q.setTenantInfo(wxBillAll); -// WxMall wxMall = wxMallMapper.getByTenantInfo(wxBillAll); -// //映射结果 -// Map result = new HashMap<>(); -// result.put("mall", wxMall.getName()); // -// //付款方式 -// WxPayAccountBill wxPayAccountBill = new WxPayAccountBill(); -// wxPayAccountBill.updateTenantInfo(wxBillAll); -// WxPayAccountBill payAccountBill = wxPayAccountBillMapper.selectOne(new QueryWrapper(wxPayAccountBill)); -// if (payAccountBill != null) { -// String bankCardId = payAccountBill.getBankCardId(); -// String bankAccountName = payAccountBill.getBankAccountName(); -// result.put("accountNumber", StringUtils.isNotEmpty(bankCardId) ? bankCardId : " "); -// result.put("accountName", StringUtils.isNotEmpty(bankAccountName) ? bankAccountName : " "); +// Map result = new HashMap<>(); +// result.put("pageInfo", pageInfo); +// return result; +// } +// +// private List list(WxBillAll wxBillAll) { +// List retList = null; +// wxBillAll.setBillTypeValue(EnumBillQueryType.getRealType(wxBillAll.getBillTypeValue())); +// if (!StringUtils.isBlank(wxBillAll.getMerchantName())) { +// WxMerchant wxMerchantQ = new WxMerchant(); +// wxMerchantQ.setName(StringUtils.trimToNull(wxBillAll.getMerchantName())); +// List mids = wxMerchantMapper.findIdList(wxMerchantQ); +// if (null != mids && mids.size() > 0 ) { +// wxBillAll.setMerchantIdList(mids); +// } +// } +// if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT.getCode()); +// retList = wxBillAllMapper.listRentBill(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT_DEPOSIT.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_DEPOSIT.getCode()); +// retList = wxBillAllMapper.listRentDepositBill(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.PROPERTY.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY.getCode()); +// retList = wxBillAllMapper.listPropertyBill(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.PROPERTY_DEPOSIT.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY_DEPOSIT.getCode()); +// retList = wxBillAllMapper.listPropertyDepositBill(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.WATER_POWER_AIR.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.WATER_POWER_AIR.getCode()); +// retList = wxBillAllMapper.listDailyBill(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.OTHER.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER.getCode()); +// retList = wxBillAllMapper.listOtherBill(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.OTHER_DEPOSIT.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER_DEPOSIT.getCode()); +// retList = wxBillAllMapper.listOtherDepositBill(wxBillAll); +// }else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT_BUSSINESS_MANAGE.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_BUSSINESS_MANAGE.getCode()); +// wxBillAll.setManageFeeType(EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE.getCode()); +// wxBillAll.setBillTypeName(EnumBillQueryType.RENT_BUSSINESS_MANAGE.getMessage()); +// retList = wxBillAllMapper.listRentManageBill(wxBillAll); +// }else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT_OPERATING_MANAGE.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_OPERATING_MANAGE.getCode()); +// wxBillAll.setManageFeeType(EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE.getCode()); +// wxBillAll.setBillTypeName(EnumBillQueryType.RENT_OPERATING_MANAGE.getMessage()); +// retList = wxBillAllMapper.listRentManageBill(wxBillAll); // } else { -// result.put("accountNumber", " "); -// result.put("accountName", " "); +// logger.info("账单不存在"); // } +// if (null != retList && retList.size() > 0 ){ +// for (int i = 0 ; i < retList.size(); i ++) { +// WxBillAllVo vo = retList.get(i); +// if( null!= vo.getMerchantId() ) { +// WxMerchant wxMerchantQ = new WxMerchant(); +// wxMerchantQ.setId(vo.getMerchantId()); +// List mlist = wxMerchantMapper.findIdNameList(wxMerchantQ); +// if (null != mlist && mlist.size() > 0 ) { +// vo.setMerchantName(mlist.get(0).getName()); +// } +// } +// if (null != vo.getShopId()) { +// Map param = new HashMap(); +// param.put("id", vo.getShopId()); +// Map shop = wxShopMapper.getMerchantShopByShopId(param); +// if ( null != shop) { +// vo.setShopNumber((String)shop.get("shopNumber")); +// vo.setManager((String)shop.get("manager")); +// vo.setManagerPhone((String)shop.get("managerPhone")); +// } +// } +// } +// } +// return retList; +// } +// +// public void cmputeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillAllVo e) { +//// if (e.getReceivePay() != null) { +//// if (e.getLatePayPrice() == null) { +//// e.setLatePayPrice(0L); +//// } +//// BigDecimal servicePay; +//// if (e.getServiceChargePay() != null) { +//// servicePay = new BigDecimal(e.getServiceChargePay()); +//// } else { +//// servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); +//// } +//// Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); +//// e.setRealReceivePay(realReceivePay); +//// e.setServiceChargePay(servicePay.intValue()); +//// if (!e.getStatus().equals(EnumBillStatus.NOT_PAID.getCode()) && +//// !e.getStatus().equals(EnumBillStatus.WAIT_PAY.getCode())) { +//// e.setOwe(0L); +//// } else { +//// e.setOwe(realReceivePay - e.getPay()); +//// } +//// } +// } // -// //编号 -// String number = "JF" + DateUtils.getSystemTime("yyyyMMddHHmmss"); -// result.put("number", number); -// //数据 -// Integer status = wxBillAll.getStatus(); -// if (status == null) { -// List statusList = new ArrayList<>(); -// statusList.add(EnumBillStatus.NOT_PAID.getCode()); -// statusList.add(EnumBillStatus.WAIT_PAY.getCode()); -// statusList.add(EnumBillStatus.NOT_EXPIRED.getCode()); -// wxBillAll.setStatusList(statusList); -// //账单时间段 -// result.put("starttime", wxBillAll.getStarttime()); -// result.put("endtime", wxBillAll.getEndtime().substring(0, 10)); +//// @Override +//// public List> listBillOweAndWaitPay(WxBillAll wxBillAll) { +//// //更新各账单状态 +//// //updateBillStatus(wxBillAll); +//// ArrayList statusList = new ArrayList<>(); +//// statusList.add(EnumBillRentStatus.NOT_PAID.getCode()); +//// statusList.add(EnumBillRentStatus.WAIT_PAY.getCode()); +//// wxBillAll.setStatusList(statusList); +//// return wxBillAllMapper.listData(wxBillAll); +//// } +// +// @Override +// public ResultData pageListBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasShop,boolean hasPayBill,boolean hasReceivePay) { +// //更新各账单状态 +// //updateBillStatus(wxBillAll); +// PageHelper.startPage(wxBillAll.getPageIndex(), wxBillAll.getPageSize()); +// PageInfo> pageInfo = new PageInfo<>(listBill(wxBillAll, wxMerchant,true, hasShop, hasPayBill, hasReceivePay)); +// return new ResultData(pageInfo); +// } +// +// @Override +// public List> listBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasSet,boolean hasShop,boolean hasPayBill,boolean hasReceivePay){ +// List> maps = null; +// //账单类型 +// wxBillAll.setBillTypeValue(EnumBillQueryType.getRealType(wxBillAll.getBillTypeValue())); +// wxBillAll.setMerchantId(wxMerchant.getId()); +// if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT.getCode()); +// maps = wxBillAllMapper.listRentBillData(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT_DEPOSIT.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_DEPOSIT.getCode()); +// maps = wxBillAllMapper.listRentDepositBillData(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.PROPERTY.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY.getCode()); +// maps = wxBillAllMapper.listPropertyBillData(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.PROPERTY_DEPOSIT.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY_DEPOSIT.getCode()); +// maps = wxBillAllMapper.listPropertyDepositBillData(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.WATER_POWER_AIR.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.WATER_POWER_AIR.getCode()); +// maps = wxBillAllMapper.listDailyBillData(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.OTHER.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER.getCode()); +// maps = wxBillAllMapper.listOtherBillData(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.OTHER_DEPOSIT.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER_DEPOSIT.getCode()); +// maps = wxBillAllMapper.listOtherDepositBillData(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.SETTLE.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.SETTLE.getCode()); +// maps = wxBillAllMapper.listSettleBillData(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT_BUSSINESS_MANAGE.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_BUSSINESS_MANAGE.getCode()); +// wxBillAll.setBillTypeName(EnumBillQueryType.RENT_BUSSINESS_MANAGE.getMessage()); +// wxBillAll.setManageFeeType(EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE.getCode()); +// maps = wxBillAllMapper.listRentManageBillData(wxBillAll); +// } else if (wxBillAll.getBillTypeValue().equals(EnumBillQueryType.RENT_OPERATING_MANAGE.getCode())) { +// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_OPERATING_MANAGE.getCode()); +// wxBillAll.setBillTypeName(EnumBillQueryType.RENT_OPERATING_MANAGE.getMessage()); +// wxBillAll.setManageFeeType(EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE.getCode()); +// maps = wxBillAllMapper.listRentManageBillData(wxBillAll); // } else { -// result.put("starttime", " "); -// result.put("endtime", " "); +// logger.info("账单不存在"); // } -// Integer filterHasPay = wxBillAll.getFilterHasPay(); -// -// //租金 -// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT.getCode()); -// List rentList = this.list(wxBillAll); -// Long rentSum = 0l; -// if(!rentList.isEmpty()){ -// rentSum = rentList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); -// } -// //商业管理费 -// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_BUSSINESS_MANAGE.getCode()); -// List bmList = this.list(wxBillAll); -// Long bussinessManageSum = 0L; -// if(!bmList.isEmpty()){ -// bussinessManageSum = bmList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); -// } -// //营业管理费 -// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_OPERATING_MANAGE.getCode()); -// List omList = this.list(wxBillAll); -// Long operatingManageSum = 0L; -// if(!omList.isEmpty()){ -// operatingManageSum = omList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); +// if (null != maps && hasSet) { +// for (Map map : maps) { +// +// Integer billType = ((Long) map.get("billTypeValue")).intValue(); +// if (EnumBillType.SETTLE.getCode().equals(billType)) { +// Long id = (Long) map.get("id"); +// WxBillSettle settle = wxBillSettleService.getById(id, EnumFilterSettle.YES.getCode()); +// map.put("owe", settle.getBalance()); +// if (hasReceivePay) { +// settle = wxBillSettleService.getById(id, EnumFilterSettle.NO.getCode()); +// map.put("receivePay", settle.getBalance()); +// } +// } +// map.put("merchantName", wxMerchant.getName()); +// if (hasShop) { +// Long shopId = (Long) map.get("shopId"); +// if (null != shopId) { +// Map param = new HashMap(); +// param.put("id", shopId); +// Map shopResult = wxShopMapper.getMerchantShopByShopId(param); +// if (null != shopResult) { +// map.put("shopNumber", shopResult.get("shopNumber")); +// } +// } +// } +// if (hasPayBill) { +// Long billId = (Long) map.get("id"); +// WxPayBill wxPayBill = new WxPayBill(); +// wxPayBill.updateTenantInfo(wxMerchant); +// wxPayBill.setBillId(billId); +// List payBillList = wxPayBillMapper.findList(wxPayBill); +// if (null != payBillList && payBillList.size() > 0 ) { +// WxPayBill pb = payBillList.get(0); +// map.put("payBillStatus", pb.getPayBillStatus()); +// map.put("tradeTime", pb.getPayTimeEnd()); +// map.put("transactionId", pb.getTransactionId()); +// map.put("payAmount", pb.getPayAmount()); +// } +// } +// } // } +// return maps; +// } +// +// @Override +// public Map detail(Long id,Integer type) { +// if (type.equals(EnumBillQueryType.RENT.getCode())) { +// return wxBillAllMapper.detailRentBillData(id); +// } else if (type.equals(EnumBillQueryType.RENT_DEPOSIT.getCode())) { +// return wxBillAllMapper.detailRentDepositBillData(id); +// } else if (type.equals(EnumBillQueryType.PROPERTY.getCode())) { +// return wxBillAllMapper.detailPropertyBillData(id); +// } else if (type.equals(EnumBillQueryType.PROPERTY_DEPOSIT.getCode())) { +// return wxBillAllMapper.detailPropertyDepositBillData(id); +// } else if (type.equals(EnumBillQueryType.WATER_POWER_AIR.getCode())) { +// return wxBillAllMapper.detailDailyBillData(id); +// } else if (type.equals(EnumBillQueryType.OTHER.getCode())) { +// return wxBillAllMapper.detailOtherBillData(id); +// } else if (type.equals(EnumBillQueryType.OTHER_DEPOSIT.getCode())) { +// return wxBillAllMapper.detailOtherDepositBillData(id); +// } +// return null; +// } +// +// +// @Override +// public void updateBill(Map bill) { +//// int billTypeValue = ((Long) bill.get("billTypeValue")).intValue(); +//// logger.info(">>>>>>>>>>>>>>>>>>>>账单回调修改数据:" + JSONObject.toJSONString(bill)); +//// if (billTypeValue == EnumBillTypeParam.RENT.getCode().intValue()) { +//// logger.info("更新租金账单"); +//// WxBillRent billRent = wxBillRentMapper.selectById((Long) bill.get("id")); +//// if (billRent != null && !billRent.getStatus().equals(EnumBillStatus.PAID.getCode())) { +//// updateBillRent(bill); +//// } +//// } else if (billTypeValue == EnumBillTypeParam.RENT_DEPOSIT.getCode().intValue()) { +//// logger.info("更新租金押金账单"); +//// WxBillDeposit billDeposit = wxBillDepositMapper.selectById((Long) bill.get("id")); +//// if (billDeposit != null && !billDeposit.getStatus().equals(EnumBillStatus.PAID.getCode())) { +//// updateBillRentDeposit(bill); +//// } +//// } else if (billTypeValue == EnumBillTypeParam.PROPERTY.getCode().intValue()) { +//// logger.info("更新物业账单"); +//// WxBillProperty property = wxBillPropertyMapper.selectById((Long) bill.get("id")); +//// if (property != null && !property.getStatus().equals(EnumBillStatus.PAID.getCode())) { +//// updateBillProperty(bill); +//// } +//// } else if (billTypeValue == EnumBillTypeParam.PROPERTY_DEPOSIT.getCode().intValue()) { +//// logger.info("更新物业押金账单"); +//// WxBillPropertyDeposit wxBillPropertyDeposit = wxBillPropertyDepositMapper.selectById((Long) bill.get("id")); +//// if (wxBillPropertyDeposit != null && !wxBillPropertyDeposit.getStatus().equals(EnumBillStatus.PAID.getCode())) { +//// updateBillPropertyDeposit(bill); +//// } +//// } else if (billTypeValue == EnumBillTypeParam.WATER.getCode().intValue()) { +//// logger.info("更新水费账单"); +//// WxBillDaily wxBillDaily = wxBillDailyMapper.selectById((Long) bill.get("id")); +//// if (wxBillDaily != null && !wxBillDaily.getStatus().equals(EnumBillStatus.PAID.getCode())) { +//// updateBillDaily(bill); +//// } +//// } else if (billTypeValue == EnumBillTypeParam.POWER.getCode().intValue()) { +//// logger.info("更新电费账单"); +//// WxBillDaily wxBillDaily = wxBillDailyMapper.selectById((Long) bill.get("id")); +//// if (wxBillDaily != null && !wxBillDaily.getStatus().equals(EnumBillStatus.PAID.getCode())) { +//// updateBillDaily(bill); +//// } +//// } else if (billTypeValue == EnumBillTypeParam.AIR_CONDITIONING.getCode().intValue()) { +//// logger.info("更新空调费账单"); +//// WxBillDaily wxBillDaily = wxBillDailyMapper.selectById((Long) bill.get("id")); +//// if (wxBillDaily != null && !wxBillDaily.getStatus().equals(EnumBillStatus.PAID.getCode())) { +//// updateBillDaily(bill); +//// } +//// } else if (billTypeValue == EnumBillTypeParam.ROUTINE.getCode().intValue()) { +//// logger.info("更新其他账单"); +//// WxBillOther wxBillOther = wxBillOtherMapper.selectById((Long) bill.get("id")); +//// if (wxBillOther != null && !wxBillOther.getStatus().equals(EnumBillStatus.PAID.getCode())) { +//// updateBillOther(bill); +//// } +//// } else if (billTypeValue == EnumBillTypeParam.ATHER_DEPOSIT.getCode().intValue()) { +//// logger.info("更新其他押金账单"); +//// WxBillOtherDeposit wxBillOtherDeposit = wxBillOtherDepositMapper.selectById((Long) bill.get("id")); +//// if (wxBillOtherDeposit != null && !wxBillOtherDeposit.getStatus().equals(EnumBillStatus.PAID.getCode())) { +//// updateBillOtherDeposit(bill); +//// } +//// } else if (billTypeValue == EnumBillTypeParam.SETTLE.getCode().intValue()) { +//// try { +//// logger.info("更新结算单id:{}", JsonUtil.obj2Json(bill)); +//// +//// WxBillSettle wxBillSettle = wxBillSettleService.getById((Long) bill.get("id"), EnumFilterSettle.YES.getCode()); +//// +//// WxBillSettleRecord settleRecord = new WxBillSettleRecord(); +//// settleRecord.setSettleId((Long) bill.get("id")); +//// settleRecord.setSettleMoney(wxBillSettle.getBalance()); +//// settleRecord.setSettleTime(new Date()); +//// settleRecord.setSettleWay(EnumSettleRecordWay.WEBCAT.getCode()); +//// settleRecord.updateTenantInfo(wxBillSettle); +//// +//// BigDecimal money = new BigDecimal(settleRecord.getSettleMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); +//// settleRecord.setDetail(EnumSettleRecordWay.getEnum(settleRecord.getSettleWay()).getMessage() + "收款" + money.toString() + "元"); +//// wxBillSettleRecordService.saveOrUpdate(settleRecord, null, (Long) bill.get("userId")); +//// +//// wxBillSettle.setUpdatetime(new Date()); +//// wxBillSettle.setStatus(EnumSettleStatus.FINISH.getCode()); +//// wxBillSettleMapper.updateById(wxBillSettle); +//// +//// logger.info("更新结算单success"); +//// } catch (Exception e) { +//// logger.error("结算单error", e); +//// e.printStackTrace(); +//// } +//// +//// } else { +//// logger.info("账单类型不存在"); +//// } +// } +// +// @Override +// public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll) { +//// Map> collect = list(wxBillAll) +//// .stream().filter(b -> null != b.getMerchantId()) +//// .collect(Collectors.groupingBy(WxBillAllVo::getMerchantId)); +//// Set>> entries = collect.entrySet(); +//// List datalist = new ArrayList<>(); +//// for (Map.Entry> entry : entries) { +//// List list = entry.getValue(); +//// for (WxBillAllVo wxBillAllVo : list) { +//// String shopNumber = wxBillAllVo.getShopNumber(); +//// if (StringUtils.isEmpty(shopNumber)) { +//// String shopInfo = wxBillAllVo.getShopInfo(); +//// if (StringUtils.isNotEmpty(shopInfo) && !shopInfo.equals("[]")) { +//// JSONObject jsonObject = JSONObject.parseObject(shopInfo); +//// StringBuffer sb = new StringBuffer(); +//// Set> sets = jsonObject.entrySet(); +//// sets.forEach(x -> sb.append(x.getKey()).append(",")); +//// if(StringUtils.isNotBlank(sb)){ +//// wxBillAllVo.setShopNumber(sb.deleteCharAt(sb.length() - 1).toString()); +//// } +//// } +//// } +//// wxBillAllVo.setPayDateStr(DateUtils.format(wxBillAllVo.getPayDate())); +//// wxBillAllVo.setRentStartTime(DateUtils.format(wxBillAllVo.getStarttime())); +//// wxBillAllVo.setRentEndTime(DateUtils.format(wxBillAllVo.getEndtime())); +//// +//// //status不是欠缴,都展示0,与前端保持一致 +//// if (!EnumBillStatus.NOT_PAID.getCode().equals(wxBillAllVo.getStatus())) { +//// wxBillAllVo.setOwe(0L); +//// wxBillAllVo.setOweStr("0"); +//// } +//// datalist.add(wxBillAllVo); +//// } +//// } +//// WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillAll); +//// datalist.stream().forEach(e -> { +//// //手续费 = 合同应收+手续费+滞纳金 +//// cmputeTotalMoney(wxPayAccountBill, e); +//// }); +//// excelService.exportExcel(datalist, null, "账单数据", WxBillAllVo.class, "账单数据.xlsx", response, false); +// } +// +// private int updateBillOtherDeposit(Map bill) { +//// logger.info("updateBillOtherDeposit params:" + bill.toString()); +//// Object id = bill.get("id"); +//// WxBillOtherDeposit wxBillOtherDeposit = wxBillOtherDepositMapper.selectById((Long) id); +//// if (wxBillOtherDeposit == null) { +//// return 0; +//// } +//// Date date = new Date(); +//// wxBillOtherDeposit.setPayDate(date); +//// Long owe = (Long) bill.get("owe"); +//// wxBillOtherDeposit.setPay(wxBillOtherDeposit.getPay() + owe); +//// //wxBillOtherDeposit.setOwe("0"); +//// wxBillOtherDeposit.setStatus(EnumBillStatus.PAID.getCode()); +//// wxBillOtherDeposit.setPayDate(date); +//// wxBillOtherDeposit.setUpdatetime(date); +//// wxBillOtherDeposit.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); +//// int count = 0; +//// try { +//// count = wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); +//// } catch (Exception e) { +//// logger.error("更新其他押金账单失败,e:" + e.getMessage()); +//// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); +//// } +//// //日志 +//// WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById((Long) 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.updateTenantInfo(wxMerchantBUser); +//// wxBillAction.setPayDate(date); +//// 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; +// return 0; +// } +// +// private int updateBillOther(Map bill) { +//// logger.info("updateBillOther params:" + bill.toString()); +//// Object id = bill.get("id"); +//// WxBillOther wxBillOther = wxBillOtherMapper.selectById((Long) id); +//// if (wxBillOther == null) { +//// return 0; +//// } +//// Date date = new Date(); +//// wxBillOther.setPayDate(date); +//// Long owe = (Long) bill.get("owe"); +//// wxBillOther.setPay(wxBillOther.getPay() + owe); +//// //wxBillOther.setOwe("0"); +//// wxBillOther.setStatus(EnumBillStatus.PAID.getCode()); +//// wxBillOther.setPayDate(date); +//// wxBillOther.setUpdatetime(date); +//// wxBillOther.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); +//// int count = 0; +//// try { +//// count = wxBillOtherMapper.updateById(wxBillOther); +//// } catch (Exception e) { +//// logger.error("更新其他账单失败,e:" + e.getMessage()); +//// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); +//// } +//// //日志 +//// WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById((Long) 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.updateTenantInfo(wxMerchantBUser); +//// wxBillAction.setPayDate(date); +//// 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; +// return 0; +// } +// +// private int updateBillDaily(Map bill) { +//// logger.info("updateBillDaily params:" + bill.toString()); +//// Object id = bill.get("id"); +//// WxBillDaily wxBillDaily = wxBillDailyMapper.selectById((Long) id); +//// if (wxBillDaily == null) { +//// return 0; +//// } +//// Date date = new Date(); +//// wxBillDaily.setPayDate(date); +//// Long owe = (Long) bill.get("owe"); +//// wxBillDaily.setPay(wxBillDaily.getPay() + owe); +//// //wxBillDaily.setOwe("0"); +//// wxBillDaily.setStatus(EnumBillStatus.PAID.getCode()); +//// wxBillDaily.setPayDate(date); +//// wxBillDaily.setUpdatetime(date); +//// wxBillDaily.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); +//// +//// int count = 0; +//// try { +//// count = wxBillDailyMapper.updateById(wxBillDaily); +//// } catch (Exception e) { +//// logger.error("更新日常账单失败,e:" + e.getMessage()); +//// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); +//// } +//// //日志 +//// WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById((Long) 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.updateTenantInfo(wxMerchantBUser); +//// wxBillAction.setPayDate(date); +//// 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; +// return 0; +// } +// +// private int updateBillPropertyDeposit(Map bill) { +//// logger.info("updateBillPropertyDeposit params:" + bill.toString()); +//// Object id = bill.get("id"); +//// WxBillPropertyDeposit wxBillPropertyDeposit = wxBillPropertyDepositMapper.selectById((Long) id); +//// if (wxBillPropertyDeposit == null) { +//// return 0; +//// } +//// Date date = new Date(); +//// wxBillPropertyDeposit.setPayDate(date); +//// String owe = (String) bill.get("owe"); +//// wxBillPropertyDeposit.setPay(new BigDecimal(wxBillPropertyDeposit.getPay()).add(new BigDecimal(owe)).toPlainString()); +//// //wxBillPropertyDeposit.setOwe("0"); +//// wxBillPropertyDeposit.setStatus(EnumBillStatus.PAID.getCode()); +//// wxBillPropertyDeposit.setPayDate(date); +//// wxBillPropertyDeposit.setUpdatetime(date); +//// wxBillPropertyDeposit.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); +//// +//// int count = 0; +//// try { +//// count = wxBillPropertyDepositMapper.updateById(wxBillPropertyDeposit); +//// } catch (Exception e) { +//// logger.error("更新物业押金账单失败,e:" + e.getMessage()); +//// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); +//// } +//// //日志 +//// WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById((Long) 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.updateTenantInfo(wxMerchantBUser); +//// wxBillAction.setPayDate(date); +//// 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; +// return 0; +// } +// +// private int updateBillProperty(Map bill) { +//// logger.info("updateBillProperty params:" + bill.toString()); +//// Object id = bill.get("id"); +//// WxBillProperty property = wxBillPropertyMapper.selectById((Long) id); +//// if (property == null) { +//// return 0; +//// } +//// Date date = new Date(); +//// property.setPayDate(date); +//// String owe = (String) bill.get("owe"); +//// property.setPay(new BigDecimal(property.getPay()).add(new BigDecimal(owe)).toPlainString()); +//// //property.setOwe("0"); +//// property.setStatus(EnumBillStatus.PAID.getCode()); +//// property.setPayDate(date); +//// property.setUpdatetime(date); +//// property.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); +//// +//// int count = 0; +//// try { +//// count = wxBillPropertyMapper.updateById(property); +//// } catch (Exception e) { +//// logger.error("更新物业账单失败,e:" + e.getMessage()); +//// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); +//// } +//// //日志 +//// WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById((Long) 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.updateTenantInfo(wxMerchantBUser); +//// wxBillAction.setPayDate(date); +//// 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; +// return 0; +// } +// +// private int updateBillRentDeposit(Map bill) { +//// logger.info("updateBillRentDeposit params:" + bill.toString()); +//// Object id = bill.get("id"); +//// WxBillDeposit wxBillDeposit = wxBillDepositMapper.selectById((Long) id); +//// if (wxBillDeposit == null) { +//// return 0; +//// } +//// Date date = new Date(); +//// wxBillDeposit.setPayDate(date); +//// Long owe = (Long) bill.get("owe"); +//// wxBillDeposit.setPay(wxBillDeposit.getPay() + owe); +//// //wxBillDeposit.setOwe("0"); +//// wxBillDeposit.setStatus(EnumBillStatus.PAID.getCode()); +//// wxBillDeposit.setPayDate(date); +//// wxBillDeposit.setUpdatetime(date); +//// wxBillDeposit.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); +//// +//// int count = 0; +//// try { +//// count = wxBillDepositMapper.updateById(wxBillDeposit); +//// } catch (Exception e) { +//// logger.error("更新租赁押金账单失败,e:" + e.getMessage()); +//// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); +//// } +//// //日志 +//// WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById((Long) 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.updateTenantInfo(wxMerchantBUser); +//// wxBillAction.setPayDate(date); +//// 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; +// return 0; +// } +// +// private int updateBillRent(Map bill) { +//// logger.info("updateBillRentDeposit params:" + bill.toString()); +//// Object id = bill.get("id"); +//// WxBillRent wxBillRent = wxBillRentMapper.selectById((Long) id); +//// if (wxBillRent == null) { +//// return 0; +//// } +//// Date date = new Date(); +//// wxBillRent.setPayDate(date); +//// Long owe = (Long) bill.get("owe"); +//// wxBillRent.setPay(wxBillRent.getPay() + owe); +//// //wxBillRent.setOwe("0"); +//// wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); +//// wxBillRent.setPayDate(date); +//// wxBillRent.setUpdatetime(date); +//// wxBillRent.setPayWay(EnumBillPayWay.WECHAT_PAY.getCode()); +//// +//// int count = 0; +//// try { +//// count = wxBillRentMapper.updateById(wxBillRent); +//// } catch (Exception e) { +//// logger.error("更新租金账单失败,e:" + e.getMessage()); +//// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); +//// } +//// //日志 +//// WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById((Long) 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.updateTenantInfo(wxMerchantBUser); +//// wxBillAction.setPayDate(date); +//// 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; +// return 0; +// } +// +// @Override +// public void updateBillStatus(WxBillAll record) { +// logger.info("更新各账单状态开始"); +// //更新其他押金账单 +// //WxBillOtherDeposit wxBillOtherDeposit = new WxBillOtherDeposit(); +// //wxBillOtherDeposit.setTenantId(record.getTenantId()); +// //wxBillOtherDepositService.updateBillStatus(wxBillOtherDeposit); +// //更新其他账单 +// WxBillOther wxBillOther = new WxBillOther(); +// wxBillOther.updateTenantInfo(record); +// wxBillOtherService.updateBillStatus(wxBillOther); +// //更新日常账单状态 +// WxBillDaily wxBillDaily = new WxBillDaily(); +// wxBillDaily.updateTenantInfo(record); +// 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.updateTenantInfo(record); +// wxBillPropertyService.updateBillStatus(wxBillProperty); +// //更新租赁账单状态 +// WxBillRent wxBillRent = new WxBillRent(); +// wxBillRent.updateTenantInfo(record); +// wxBillRentService.updateBillStatus(wxBillRent); +// //更新管理费账单状态 +// WxBillRentManage wxBillRentManage = new WxBillRentManage(); +// wxBillRentManage.updateTenantInfo(record); +// wxBillRentManageService.updateBillStatus(wxBillRentManage); // -// wxBillAll.setManageFeeType(null); -// //物业 -// wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY.getCode()); -// List propertyList = this.list(wxBillAll); -// Long propertySum = 0l; -// if(!propertyList.isEmpty()){ -// propertySum = propertyList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); -// } -// //押金 -// List depositList = new ArrayList<>(); -// //租赁押金 -// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_DEPOSIT.getCode()); -// List rentDepositList = this.list(wxBillAll); -// depositList.addAll(rentDepositList); -// //物业押金 -// wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY_DEPOSIT.getCode()); -// List propertyDepositList = this.list(wxBillAll); -// depositList.addAll(propertyDepositList); -// //其他押金 -// wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER_DEPOSIT.getCode()); -// List otherDepositList = this.list(wxBillAll); -// depositList.addAll(otherDepositList); -// -// Long depositSum = 0l; -// StringBuffer depositDetail = new StringBuffer();//押金明细 -// if(!depositList.isEmpty()){ -// depositSum = depositList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); -// depositList.stream().forEach(b -> { -// BigDecimal owe = new BigDecimal(status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); -// depositDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); -// }); -// } -// //水电空调费 -// wxBillAll.setBillTypeValue(EnumBillQueryType.WATER_POWER_AIR.getCode()); -// List waterPowerAirList = this.list(wxBillAll); -// Long waterSum = 0l, powerSum = 0l, airConditioningSum = 0l; -// if (!waterPowerAirList.isEmpty()) { -// waterSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.WATER.getCode())) -// .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); -// powerSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.POWER.getCode())) -// .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); -// airConditioningSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) -// .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); -// } -// //其他费用 -// wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER.getCode()); -// List otherList = this.list(wxBillAll); -// Long otherSum = 0l; -// StringBuffer otherDetail = new StringBuffer();//其他费用明细 -// if(!otherList.isEmpty()){ -// otherSum = otherList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); -// otherList.stream().forEach(b -> { -// BigDecimal owe = new BigDecimal(status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); -// otherDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); -// }); +// logger.info("更新各账单状态结束"); +// } +// +// @Override +// public void exportOweBill(WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response) { +//// //商场名称 +////// WxMall q = new WxMall(); +////// q.setTenantInfo(wxBillAll); +//// WxMall wxMall = wxMallMapper.getByTenantInfo(wxBillAll); +//// //映射结果 +//// Map result = new HashMap<>(); +//// result.put("mall", wxMall.getName()); +//// +//// //付款方式 +//// WxPayAccountBill wxPayAccountBill = new WxPayAccountBill(); +//// wxPayAccountBill.updateTenantInfo(wxBillAll); +//// WxPayAccountBill payAccountBill = wxPayAccountBillMapper.selectOne(new QueryWrapper(wxPayAccountBill)); +//// if (payAccountBill != null) { +//// String bankCardId = payAccountBill.getBankCardId(); +//// String bankAccountName = payAccountBill.getBankAccountName(); +//// result.put("accountNumber", StringUtils.isNotEmpty(bankCardId) ? bankCardId : " "); +//// result.put("accountName", StringUtils.isNotEmpty(bankAccountName) ? bankAccountName : " "); +//// } else { +//// result.put("accountNumber", " "); +//// result.put("accountName", " "); +//// } +//// +//// //编号 +//// String number = "JF" + DateUtils.getSystemTime("yyyyMMddHHmmss"); +//// result.put("number", number); +//// //数据 +//// Integer status = wxBillAll.getStatus(); +//// if (status == null) { +//// List statusList = new ArrayList<>(); +//// statusList.add(EnumBillStatus.NOT_PAID.getCode()); +//// statusList.add(EnumBillStatus.WAIT_PAY.getCode()); +//// statusList.add(EnumBillStatus.NOT_EXPIRED.getCode()); +//// wxBillAll.setStatusList(statusList); +//// //账单时间段 +//// result.put("starttime", wxBillAll.getStarttime()); +//// result.put("endtime", wxBillAll.getEndtime().substring(0, 10)); +//// } else { +//// result.put("starttime", " "); +//// result.put("endtime", " "); +//// } +//// Integer filterHasPay = wxBillAll.getFilterHasPay(); +//// +//// //租金 +//// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT.getCode()); +//// List rentList = this.list(wxBillAll); +//// Long rentSum = 0l; +//// if(!rentList.isEmpty()){ +//// rentSum = rentList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); +//// } +//// //商业管理费 +//// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_BUSSINESS_MANAGE.getCode()); +//// List bmList = this.list(wxBillAll); +//// Long bussinessManageSum = 0L; +//// if(!bmList.isEmpty()){ +//// bussinessManageSum = bmList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); +//// } +//// //营业管理费 +//// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_OPERATING_MANAGE.getCode()); +//// List omList = this.list(wxBillAll); +//// Long operatingManageSum = 0L; +//// if(!omList.isEmpty()){ +//// operatingManageSum = omList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); +//// } +//// +//// wxBillAll.setManageFeeType(null); +//// //物业 +//// wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY.getCode()); +//// List propertyList = this.list(wxBillAll); +//// Long propertySum = 0l; +//// if(!propertyList.isEmpty()){ +//// propertySum = propertyList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); +//// } +//// //押金 +//// List depositList = new ArrayList<>(); +//// //租赁押金 +//// wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_DEPOSIT.getCode()); +//// List rentDepositList = this.list(wxBillAll); +//// depositList.addAll(rentDepositList); +//// //物业押金 +//// wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY_DEPOSIT.getCode()); +//// List propertyDepositList = this.list(wxBillAll); +//// depositList.addAll(propertyDepositList); +//// //其他押金 +//// wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER_DEPOSIT.getCode()); +//// List otherDepositList = this.list(wxBillAll); +//// depositList.addAll(otherDepositList); +//// +//// Long depositSum = 0l; +//// StringBuffer depositDetail = new StringBuffer();//押金明细 +//// if(!depositList.isEmpty()){ +//// depositSum = depositList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); +//// depositList.stream().forEach(b -> { +//// BigDecimal owe = new BigDecimal(status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); +//// depositDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); +//// }); +//// } +//// //水电空调费 +//// wxBillAll.setBillTypeValue(EnumBillQueryType.WATER_POWER_AIR.getCode()); +//// List waterPowerAirList = this.list(wxBillAll); +//// Long waterSum = 0l, powerSum = 0l, airConditioningSum = 0l; +//// if (!waterPowerAirList.isEmpty()) { +//// waterSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.WATER.getCode())) +//// .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); +//// powerSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.POWER.getCode())) +//// .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); +//// airConditioningSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) +//// .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); +//// } +//// //其他费用 +//// wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER.getCode()); +//// List otherList = this.list(wxBillAll); +//// Long otherSum = 0l; +//// StringBuffer otherDetail = new StringBuffer();//其他费用明细 +//// if(!otherList.isEmpty()){ +//// otherSum = otherList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); +//// otherList.stream().forEach(b -> { +//// BigDecimal owe = new BigDecimal(status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); +//// otherDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); +//// }); +//// } +//// //总计 +//// Long summarySum = rentSum + bussinessManageSum + operatingManageSum + propertySum + depositSum + waterSum + powerSum + airConditioningSum + otherSum; +//// BigDecimal rent = new BigDecimal(rentSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); +//// BigDecimal bussinessManage = new BigDecimal(bussinessManageSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); +//// BigDecimal operatingManage = new BigDecimal(operatingManageSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); +//// +//// BigDecimal property = new BigDecimal(propertySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); +//// BigDecimal deposit = new BigDecimal(depositSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); +//// BigDecimal water = new BigDecimal(waterSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); +//// BigDecimal power = new BigDecimal(powerSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); +//// BigDecimal airConditioning = new BigDecimal(airConditioningSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); +//// BigDecimal other = new BigDecimal(otherSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); +//// BigDecimal summary = new BigDecimal(summarySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); +//// String summaryUpper = PriceUtil.number2CNMontrayUnit(summary); +//// +//// result.put("rent", rent.toPlainString()); +//// result.put("bussinessManage", bussinessManage.toPlainString()); +//// result.put("operatingManage", operatingManage.toPlainString()); +//// result.put("property", property.toPlainString()); +//// result.put("deposit", deposit.toPlainString()); +//// result.put("water", water.toPlainString()); +//// result.put("power", power.toPlainString()); +//// result.put("airConditioning", airConditioning.toPlainString()); +//// result.put("other", other.toPlainString()); +//// result.put("summary", summary.toPlainString()); +//// result.put("summaryUpper", summaryUpper); +//// +//// result.put("depositDetail", StringUtils.isNotEmpty(depositDetail.toString()) ? depositDetail.toString() : " "); +//// result.put("otherDetail", StringUtils.isNotEmpty(otherDetail.toString()) ? otherDetail.toString() : " "); +//// +//// WxMerchantDto wxMerchantDto = new WxMerchantDto(); +//// wxMerchantDto.setId(wxBillAll.getMerchantId()); +//// wxMerchantDto.updateTenantInfo(wxMall); +//// PageInfo pageInfo = wxMerchantService.listAsPageCVo(wxMerchantDto,1,1,true); +//// List listCVo = pageInfo.getList(); +//// WxMerchantVo wxMerchantVo = listCVo.get(0); +//// result.put("merchant", wxMerchantVo.getMerchantName()); +//// WxShopVo wxShopVo = wxMerchantVo.getShopVoList().stream() +//// .filter(s -> StringUtils.isNotEmpty(s.getLinkPhone()) || StringUtils.isNotEmpty(s.getLinkPerson())).findFirst().orElse(null); +//// if (wxShopVo != null) { +//// String linkPerson = wxShopVo.getLinkPerson(); +//// String linkPhone = wxShopVo.getLinkPhone(); +//// result.put("linkPerson", StringUtils.isNotEmpty(linkPerson) ? linkPerson : " "); +//// result.put("linkPhone", StringUtils.isNotEmpty(linkPhone) ? linkPhone : " "); +//// } else { +//// result.put("linkPerson", " "); +//// result.put("linkPhone", " "); +//// } +//// +//// String createtime = DateUtils.getSystemTime("yyyy-MM-dd"); +//// result.put("createtime", createtime); +//// +//// String templatePath = "contract-word-template/bill_owe.docx"; +//// String filepath = fmUploadDir; +//// String filename = UUID.randomUUID() + ".docx"; +//// String exportFileName = "催缴单.docx"; +//// WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response, null); +// } +// +// +// @Override +// public void exportSettleBill(WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response) { +// wxBillSettle = wxBillSettleService.getById(wxBillSettle.getId(), EnumFilterSettle.NO.getCode()); +// if (wxBillSettle.getReceiveBillIds() == null) { +// wxBillSettle.setReceiveBillIds(new ArrayList<>()); // } -// //总计 -// Long summarySum = rentSum + bussinessManageSum + operatingManageSum + propertySum + depositSum + waterSum + powerSum + airConditioningSum + otherSum; -// BigDecimal rent = new BigDecimal(rentSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); -// BigDecimal bussinessManage = new BigDecimal(bussinessManageSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); -// BigDecimal operatingManage = new BigDecimal(operatingManageSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); -// -// BigDecimal property = new BigDecimal(propertySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); -// BigDecimal deposit = new BigDecimal(depositSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); -// BigDecimal water = new BigDecimal(waterSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); -// BigDecimal power = new BigDecimal(powerSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); -// BigDecimal airConditioning = new BigDecimal(airConditioningSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); -// BigDecimal other = new BigDecimal(otherSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); -// BigDecimal summary = new BigDecimal(summarySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); -// String summaryUpper = PriceUtil.number2CNMontrayUnit(summary); -// -// result.put("rent", rent.toPlainString()); -// result.put("bussinessManage", bussinessManage.toPlainString()); -// result.put("operatingManage", operatingManage.toPlainString()); -// result.put("property", property.toPlainString()); -// result.put("deposit", deposit.toPlainString()); -// result.put("water", water.toPlainString()); -// result.put("power", power.toPlainString()); -// result.put("airConditioning", airConditioning.toPlainString()); -// result.put("other", other.toPlainString()); -// result.put("summary", summary.toPlainString()); -// result.put("summaryUpper", summaryUpper); -// -// result.put("depositDetail", StringUtils.isNotEmpty(depositDetail.toString()) ? depositDetail.toString() : " "); -// result.put("otherDetail", StringUtils.isNotEmpty(otherDetail.toString()) ? otherDetail.toString() : " "); -// -// WxMerchantDto wxMerchantDto = new WxMerchantDto(); -// wxMerchantDto.setId(wxBillAll.getMerchantId()); -// wxMerchantDto.updateTenantInfo(wxMall); -// PageInfo pageInfo = wxMerchantService.listAsPageCVo(wxMerchantDto,1,1,true); -// List listCVo = pageInfo.getList(); -// WxMerchantVo wxMerchantVo = listCVo.get(0); -// result.put("merchant", wxMerchantVo.getMerchantName()); -// WxShopVo wxShopVo = wxMerchantVo.getShopVoList().stream() -// .filter(s -> StringUtils.isNotEmpty(s.getLinkPhone()) || StringUtils.isNotEmpty(s.getLinkPerson())).findFirst().orElse(null); -// if (wxShopVo != null) { -// String linkPerson = wxShopVo.getLinkPerson(); -// String linkPhone = wxShopVo.getLinkPhone(); -// result.put("linkPerson", StringUtils.isNotEmpty(linkPerson) ? linkPerson : " "); -// result.put("linkPhone", StringUtils.isNotEmpty(linkPhone) ? linkPhone : " "); -// } else { -// result.put("linkPerson", " "); -// result.put("linkPhone", " "); +// if (wxBillSettle.getPayBillIds() == null) { +// wxBillSettle.setPayBillIds(new ArrayList<>()); // } // -// String createtime = DateUtils.getSystemTime("yyyy-MM-dd"); -// result.put("createtime", createtime); +// //映射结果 +// Map result = new HashMap<>(); // -// String templatePath = "contract-word-template/bill_owe.docx"; -// String filepath = fmUploadDir; -// String filename = UUID.randomUUID() + ".docx"; -// String exportFileName = "催缴单.docx"; -// WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response, null); - } - - - @Override - public void exportSettleBill(WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response) { - wxBillSettle = wxBillSettleService.getById(wxBillSettle.getId(), EnumFilterSettle.NO.getCode()); - if (wxBillSettle.getReceiveBillIds() == null) { - wxBillSettle.setReceiveBillIds(new ArrayList<>()); - } - if (wxBillSettle.getPayBillIds() == null) { - wxBillSettle.setPayBillIds(new ArrayList<>()); - } - - //映射结果 - Map result = new HashMap<>(); - -// WxMall q = new WxMall(); -// q.setTenantInfo(wxBillSettle); - WxMall wxMall = wxMallMapper.getByTenantInfo(wxBillSettle); - result.put("mall", wxMall.getName()); - result.put("merchant", wxMerchantService.selectById(wxBillSettle.getMerchantId()).getName()); - result.put("num", wxBillSettle.getSettleNumber()); - result.put("cdate", DateUtils.format(wxBillSettle.getCreatetime())); - - BigDecimal receiveM = (new BigDecimal(wxBillSettle.getReceiveMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); - BigDecimal payM = (new BigDecimal(wxBillSettle.getPayMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); - BigDecimal bM = (new BigDecimal(wxBillSettle.getBalance()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); - result.put("receiveM", receiveM.toString() + "元"); - result.put("payM", payM.toString() + "元"); - result.put("bM", bM.toString() + "元"); - result.put("receiveMU", PriceUtil.digitUppercase(receiveM.doubleValue())); - result.put("payMU", PriceUtil.digitUppercase(payM.doubleValue())); - result.put("bMU", PriceUtil.digitUppercase(bM.doubleValue())); - - WordDocTableVo wordDocTableVo = new WordDocTableVo(); - List> rowsParams = new ArrayList<>(); - int size = wxBillSettle.getReceiveBillIds().size() > wxBillSettle.getPayBillIds().size() ? wxBillSettle.getReceiveBillIds().size() : wxBillSettle.getPayBillIds().size(); - int count = 1; - for (int i = 0; i < size; i++) { - WxBillSettleBill bill = i > wxBillSettle.getReceiveBillIds().size() - 1 ? null : wxBillSettle.getReceiveBillIds().get(i); - List cellList = new ArrayList<>(); - cellList.add(count + ""); - - if (bill != null) { - cellList.add(bill.getBillName()); - cellList.add(new BigDecimal(bill.getReceivePay()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toString()); - } else { - cellList.add(""); - cellList.add(""); - } - cellList.add(count + ""); - WxBillSettleBill payBill = i > wxBillSettle.getPayBillIds().size() - 1 ? null : wxBillSettle.getPayBillIds().get(i); - if (payBill != null) { - cellList.add(payBill.getBillName()); - cellList.add(new BigDecimal(payBill.getReceivePay()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toString()); - } else { - cellList.add(""); - cellList.add(""); - } - rowsParams.add(cellList); - count++; - } - wordDocTableVo.setParams(rowsParams); - wordDocTableVo.setTableIndex(0); - wordDocTableVo.setRowIndex(2); - - String templatePath = "contract-word-template/settle.docx"; - String filepath = fmUploadDir; - String filename = UUID.randomUUID() + ".docx"; - String exportFileName = "结算单.docx"; - WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response, wordDocTableVo); - - } - - @Override - public ResultData updateReceivePay(WxBillAll wxBillAll, MallUserInfo user,boolean forcePaid) { -// Integer billType = wxBillAll.getBillTypeValue(); -// Long oldPrice = wxBillAll.getOldPrice(); -// Long newPrice = wxBillAll.getNewPrice(); -// Long oldLatePrice = wxBillAll.getOldLatePrice(); -// Long newLatePrice = wxBillAll.getNewLatePrice(); -// Long id = wxBillAll.getId(); -// Date updateDate = new Date(); -// if (billType.equals(EnumBillTypeParam.RENT.getCode())) { -// WxBillRent dbBill = wxBillRentMapper.selectById(id); -// WxBillRent wxBillRent = new WxBillRent(); -// wxBillRent.setId(id); -// wxBillRent.setUpdatetime(updateDate); -// if (forcePaid) { -// wxBillRent.setReceivePay(dbBill.getPay()); -// wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); -// wxBillRent.setOwe("0"); -// wxBillRentMapper.updateById(wxBillRent); -// addBillAction(EnumBillAction.UPDATE_BILL, id, dbBill.getPay(), dbBill.getPay(), user); -// }else { -// if (oldLatePrice != null) { -// wxBillRent.setLatePayPrice(newLatePrice); -// wxBillRent.setOwe(dbBill.getReceivePay() + dbBill.getServiceChargePay() + newLatePrice - dbBill.getPay()); -// wxBillRentMapper.updateById(wxBillRent); -// addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, id, oldLatePrice, newLatePrice, user); -// } else { -// //租赁账单更新 -// wxBillRent.setReceivePay(newPrice); -// long latePayPrice = dbBill.getLatePayPrice() == null ? 0 : dbBill.getLatePayPrice(); -// wxBillRent.setOwe(newPrice + dbBill.getServiceChargePay() + latePayPrice - dbBill.getPay()); -// if (newPrice.equals(dbBill.getPay())) { -// wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); -// } -// wxBillRentMapper.updateById(wxBillRent); -// //账单日志 -// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); -// } -// } -// } else if (billType.equals(EnumBillTypeParam.RENT_DEPOSIT.getCode())) { -// WxBillDeposit dbBill = wxBillDepositMapper.selectById(id); -// if (dbBill != null) { -// WxBillDeposit wxBillDeposit = new WxBillDeposit(); -// wxBillDeposit.setId(id); -// Long billDepositOldPrce = oldPrice; -// Long billDepositNewPrce = newPrice; -// //租赁押金账单更新 -// if (forcePaid) { -// wxBillDeposit.setReceivePay(dbBill.getPay()); -// wxBillDeposit.setOwe(0L); -// wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); -// billDepositOldPrce = dbBill.getPay(); -// billDepositNewPrce = dbBill.getPay(); -// }else { -// wxBillDeposit.setReceivePay(newPrice); -// wxBillDeposit.setOwe(newPrice - dbBill.getPay()); -// if (newPrice.equals(dbBill.getPay())) { -// wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); -// } -// wxBillDeposit.setUpdatetime(updateDate); -// } -// wxBillDepositMapper.updateById(wxBillDeposit); -// //账单日志 -// addBillAction(EnumBillAction.DEPOSIT_MODIFY, id, billDepositOldPrce, billDepositNewPrce, user); -// } +//// WxMall q = new WxMall(); +//// q.setTenantInfo(wxBillSettle); +// WxMall wxMall = wxMallMapper.getByTenantInfo(wxBillSettle); +// result.put("mall", wxMall.getName()); +// result.put("merchant", wxMerchantService.selectById(wxBillSettle.getMerchantId()).getName()); +// result.put("num", wxBillSettle.getSettleNumber()); +// result.put("cdate", DateUtils.format(wxBillSettle.getCreatetime())); // -// WxBillPropertyDeposit propertyDeposit = wxBillPropertyDepositMapper.selectById(id); -// if (propertyDeposit != null) { -// //物业押金账单更新 -// WxBillPropertyDeposit wxBillPropertyDeposit = new WxBillPropertyDeposit(); -// wxBillPropertyDeposit.setId(id); -// Long billPropertyDepositOldPrce = oldPrice; -// Long billPropertyDepositNewPrce = newPrice; -// if (forcePaid) { -// wxBillPropertyDeposit.setReceivePay(propertyDeposit.getPay()); -// wxBillPropertyDeposit.setOwe(0L); -// wxBillPropertyDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); -// billPropertyDepositOldPrce = propertyDeposit.getPay(); -// billPropertyDepositNewPrce = propertyDeposit.getPay(); -// }else { -// wxBillPropertyDeposit.setReceivePay(newPrice); -// wxBillPropertyDeposit.setOwe(newPrice - propertyDeposit.getPay()); -// if (newPrice.equals(propertyDeposit.getPay())) { -// wxBillPropertyDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); -// } -// } -// wxBillPropertyDeposit.setUpdatetime(updateDate); -// wxBillPropertyDepositMapper.updateById(wxBillPropertyDeposit); -// //账单日志 -// addBillAction(EnumBillAction.UPDATE_BILL, id, billPropertyDepositOldPrce, billPropertyDepositNewPrce, user); -// } -// } else if (billType.equals(EnumBillTypeParam.PROPERTY.getCode())) { -// WxBillProperty dbBill = wxBillPropertyMapper.selectById(id); -// //物业账单更新 -// WxBillProperty wxBillProperty = new WxBillProperty(); -// wxBillProperty.setId(id); -// wxBillProperty.setUpdatetime(updateDate); -// if (forcePaid) { -// wxBillProperty.setReceivePay(dbBill.getPay()); -// wxBillProperty.setOwe(0L); -// wxBillProperty.setStatus(EnumBillRentStatus.PAID.getCode()); -// wxBillPropertyMapper.updateById(wxBillProperty); -// addBillAction(EnumBillAction.UPDATE_BILL, id, dbBill.getPay(), dbBill.getPay(), user); -// }else { -// if (oldLatePrice != null) { -// wxBillProperty.setLatePayPrice(newLatePrice); -// wxBillProperty.setOwe(dbBill.getReceivePay() + dbBill.getServiceChargePay() + newLatePrice - dbBill.getPay()); -// wxBillPropertyMapper.updateById(wxBillProperty); -// addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, id, oldLatePrice, newLatePrice, user); -// } else { -// wxBillProperty.setReceivePay(newPrice); -// long latePayPrice = dbBill.getLatePayPrice() == null ? 0 : dbBill.getLatePayPrice(); -// wxBillProperty.setOwe(newPrice + dbBill.getServiceChargePay() + latePayPrice - dbBill.getPay()); -// if (newPrice.equals(dbBill.getPay())) { -// wxBillProperty.setStatus(EnumBillRentStatus.PAID.getCode()); -// } -// wxBillPropertyMapper.updateById(wxBillProperty); -// //账单日志 -// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); -// } -// } -// } else if (billType.equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode())) { -// WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectById(id); -// //物业押金账单更新 -// WxBillPropertyDeposit wxBillPropertyDeposit = new WxBillPropertyDeposit(); -// wxBillPropertyDeposit.setId(id); -// Long billPropertyDepositOldPrce = oldPrice; -// Long billPropertyDepositNewPrce = newPrice; -// if (forcePaid) { -// wxBillPropertyDeposit.setReceivePay(dbBill.getPay()); -// wxBillPropertyDeposit.setOwe(0L); -// wxBillPropertyDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); -// billPropertyDepositOldPrce = dbBill.getPay(); -// billPropertyDepositNewPrce = dbBill.getPay(); -// }else { -// wxBillPropertyDeposit.setReceivePay(newPrice); -// wxBillPropertyDeposit.setOwe(newPrice - dbBill.getPay()); -// if (newPrice.equals(dbBill.getPay())) { -// wxBillPropertyDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); -// } -// } -// wxBillPropertyDeposit.setUpdatetime(updateDate); -// wxBillPropertyDepositMapper.updateById(wxBillPropertyDeposit); -// //账单日志 -// addBillAction(EnumBillAction.UPDATE_BILL, id, billPropertyDepositOldPrce, billPropertyDepositNewPrce, user); -// -// } else if (billType.equals(EnumBillTypeParam.WATER.getCode())) { -// //水费账单更新 -// updateDailyBill(id, newPrice, updateDate,forcePaid); -// //账单日志 -// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); -// } else if (billType.equals(EnumBillTypeParam.POWER.getCode())) { -// //电费账单更新 -// updateDailyBill(id, newPrice, updateDate,forcePaid); -// //账单日志 -// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); -// } else if (billType.equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) { -// //空调费账单更新 -// updateDailyBill(id, newPrice, updateDate,forcePaid); -// //账单日志 -// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); -// } else if (billType.equals(EnumBillTypeParam.ROUTINE.getCode())) { -// WxBillOther dbBill = wxBillOtherMapper.selectById(id); -// //其他费用账单更新 -// WxBillOther wxBillOther = new WxBillOther(); -// wxBillOther.setId(id); -// if (forcePaid) { -// wxBillOther.setReceivePay(dbBill.getPay()); -// wxBillOther.setOwe(0L); -// wxBillOther.setStatus(EnumBillRentStatus.PAID.getCode()); -// }else { -// wxBillOther.setReceivePay(newPrice); -// wxBillOther.setOwe(newPrice + dbBill.getServiceChargePay() - dbBill.getPay()); -// if (newPrice.equals(dbBill.getPay())) { -// wxBillOther.setStatus(EnumBillRentStatus.PAID.getCode()); -// } -// } -// wxBillOther.setUpdatetime(updateDate); -// wxBillOtherMapper.updateById(wxBillOther); -// //账单日志 -// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); -// } else if (billType.equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) { -// WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectById(id); -// //其他押金账单更新 -// WxBillOtherDeposit wxBillOtherDeposit = new WxBillOtherDeposit(); -// wxBillOtherDeposit.setId(id); -// if (forcePaid) { -// wxBillOtherDeposit.setReceivePay(dbBill.getPay()); -// wxBillOtherDeposit.setOwe(0L); -// wxBillOtherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); -// }else { -// wxBillOtherDeposit.setReceivePay(newPrice); -// wxBillOtherDeposit.setOwe(newPrice + dbBill.getServiceChargePay() - dbBill.getPay()); -// if (newPrice.equals(dbBill.getPay())) { -// wxBillOtherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); -// } +// BigDecimal receiveM = (new BigDecimal(wxBillSettle.getReceiveMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); +// BigDecimal payM = (new BigDecimal(wxBillSettle.getPayMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); +// BigDecimal bM = (new BigDecimal(wxBillSettle.getBalance()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); +// result.put("receiveM", receiveM.toString() + "元"); +// result.put("payM", payM.toString() + "元"); +// result.put("bM", bM.toString() + "元"); +// result.put("receiveMU", PriceUtil.digitUppercase(receiveM.doubleValue())); +// result.put("payMU", PriceUtil.digitUppercase(payM.doubleValue())); +// result.put("bMU", PriceUtil.digitUppercase(bM.doubleValue())); +// +// WordDocTableVo wordDocTableVo = new WordDocTableVo(); +// List> rowsParams = new ArrayList<>(); +// int size = wxBillSettle.getReceiveBillIds().size() > wxBillSettle.getPayBillIds().size() ? wxBillSettle.getReceiveBillIds().size() : wxBillSettle.getPayBillIds().size(); +// int count = 1; +// for (int i = 0; i < size; i++) { +// WxBillSettleBill bill = i > wxBillSettle.getReceiveBillIds().size() - 1 ? null : wxBillSettle.getReceiveBillIds().get(i); +// List cellList = new ArrayList<>(); +// cellList.add(count + ""); +// +// if (bill != null) { +// cellList.add(bill.getBillName()); +// cellList.add(new BigDecimal(bill.getReceivePay()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toString()); +// } else { +// cellList.add(""); +// cellList.add(""); // } -// wxBillOtherDeposit.setUpdatetime(updateDate); -// wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); -// //账单日志 -// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); -// }if (billType.equals(EnumBillTypeParam.RENT_BUSSINESS_MANAGE.getCode()) || billType.equals(EnumBillTypeParam.RENT_OPERATING_MANAGE.getCode())) { -// WxBillRentManage dbBill = wxBillRentManageMapper.selectById(id); -// WxBillRentManage wxBillRent = new WxBillRentManage(); -// wxBillRent.setId(id); -// wxBillRent.setUpdatetime(updateDate); -// if (forcePaid) { -// wxBillRent.setReceivePay(dbBill.getPay()); -// wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); -// wxBillRent.setOwe(0L); -// wxBillRentManageMapper.updateById(wxBillRent); -// addBillAction(EnumBillAction.UPDATE_BILL, id, dbBill.getPay(), dbBill.getPay(), user); -// }else { -// if (oldLatePrice != null) { -// wxBillRent.setLatePayPrice(newLatePrice); -// wxBillRent.setOwe(dbBill.getReceivePay() + dbBill.getServiceChargePay() + newLatePrice - dbBill.getPay()); -// wxBillRentManageMapper.updateById(wxBillRent); -// addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, id, oldLatePrice, newLatePrice, user); -// } else { -// //租赁账单更新 -// wxBillRent.setReceivePay(newPrice); -// long latePayPrice = dbBill.getLatePayPrice() == null ? 0 : dbBill.getLatePayPrice(); -// wxBillRent.setOwe(newPrice + dbBill.getServiceChargePay() + latePayPrice - dbBill.getPay()); -// if (newPrice.equals(dbBill.getPay())) { -// wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); -// } -// wxBillRentManageMapper.updateById(wxBillRent); -// //账单日志 -// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); -// } +// cellList.add(count + ""); +// WxBillSettleBill payBill = i > wxBillSettle.getPayBillIds().size() - 1 ? null : wxBillSettle.getPayBillIds().get(i); +// if (payBill != null) { +// cellList.add(payBill.getBillName()); +// cellList.add(new BigDecimal(payBill.getReceivePay()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toString()); +// } else { +// cellList.add(""); +// cellList.add(""); // } -// } else { -// logger.info("未找到账单类型"); +// rowsParams.add(cellList); +// count++; // } - return new ResultData(); - } - - @Override - public void addBillAction(EnumBillAction billAction, Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo) { - WxBillAction wxBillAction = new WxBillAction(); - wxBillAction.setBillId(billId); - String oldPriceStr = new BigDecimal(oldPrice).divide(new BigDecimal(100)).toPlainString(); - String newPriceStr = new BigDecimal(newPrice).divide(new BigDecimal(100)).toPlainString(); - wxBillAction.setDetails(oldPriceStr + "元变更成" + newPriceStr + "元"); - wxBillAction.setAction(billAction.getCode()); - wxBillActionService.modifyBill(wxBillAction, mallUserInfo); - } - - - @Override - public void exportTemplate(WxBillExcelTemplate WxBillExcelTemplate, HttpServletRequest request, HttpServletResponse response) { - List datalist = new ArrayList<>(); - List otherDatalist = new ArrayList<>(); - - Integer billType = WxBillExcelTemplate.getBillType(); - if (billType.equals(EnumBillExcelTemplate.DAILY.getCode())) { - WxBillExcelTemplateOther one = new WxBillExcelTemplateOther(); - Date date = new Date(); - one.setMerchantName("商户1"); - one.setBillType(billType); - one.setBillAttr("水费"); - one.setStarttime(date); - one.setEndtime(date); - one.setReceivePayStr("1000"); - one.setPayStr("1000"); - one.setPayDate(date); - one.setReceiveDate(date); - one.setPayWay("微信"); - otherDatalist.add(one); - - WxBillExcelTemplateOther two = new WxBillExcelTemplateOther(); - two.setMerchantName("商户2"); - two.setBillType(billType); - two.setBillAttr("电费"); - two.setStarttime(date); - two.setEndtime(date); - two.setReceivePayStr("2000.50"); - two.setPayStr("2000.50"); - two.setPayDate(date); - two.setReceiveDate(date); - two.setPayWay("支付宝"); - otherDatalist.add(two); - - WxBillExcelTemplateOther three = new WxBillExcelTemplateOther(); - three.setMerchantName("商户3"); - three.setBillType(billType); - three.setBillAttr("空调费"); - three.setStarttime(date); - three.setEndtime(date); - three.setReceivePayStr("3333"); - three.setPayStr("3333"); - three.setPayDate(date); - three.setReceiveDate(date); - three.setPayWay("其他"); - otherDatalist.add(three); - excelService.exportExcel(otherDatalist, null, "账单模板", WxBillExcelTemplateOther.class, "账单模板.xlsx", response, true); - } else if (billType.equals(EnumBillExcelTemplate.SHOP_RENT.getCode()) || billType.equals(EnumBillExcelTemplate.POINT_RENT.getCode())) { - WxBillExcelTemplate one = new WxBillExcelTemplate(); - Date date = new Date(); - one.setMerchantName("商户"); - one.setBillType(billType); - one.setBillAttr("租金"); - one.setStarttime(date); - one.setEndtime(date); - one.setPayStr("2000.50"); - one.setReceiveDate(date); - one.setPayDate(date); - one.setPayWay("微信"); - datalist.add(one); - excelService.exportExcel(datalist, null, "账单模板", WxBillExcelTemplate.class, "账单模板.xlsx", response, true); - } else if (billType.equals(EnumBillExcelTemplate.SHOP_PROPERTY.getCode()) || billType.equals(EnumBillExcelTemplate.POINT_PROPERTY.getCode())) { - WxBillExcelTemplate one = new WxBillExcelTemplate(); - Date date = new Date(); - one.setMerchantName("商户"); - one.setBillType(billType); - one.setBillAttr("物业费"); - one.setStarttime(date); - one.setEndtime(date); - one.setPayStr("2000.50"); - one.setReceiveDate(date); - one.setPayDate(date); - one.setPayWay("微信"); - datalist.add(one); - excelService.exportExcel(datalist, null, "账单模板", WxBillExcelTemplate.class, "账单模板.xlsx", response, true); - } else if (billType.equals(EnumBillExcelTemplate.OTHER.getCode())) { - WxBillExcelTemplateOther one = new WxBillExcelTemplateOther(); - Date date = new Date(); - one.setMerchantName("商户"); - one.setBillType(billType); - one.setBillAttr("其他费用"); - one.setStarttime(date); - one.setEndtime(date); - one.setReceivePayStr("2000.50"); - one.setPayStr("2000.50"); - one.setReceiveDate(date); - one.setPayDate(date); - one.setPayWay("微信"); - otherDatalist.add(one); - excelService.exportExcel(otherDatalist, null, "账单模板", WxBillExcelTemplateOther.class, "账单模板.xlsx", response, true); - } else { - WxBillExcelTemplateOther one = new WxBillExcelTemplateOther(); - Date date = new Date(); - one.setMerchantName("商户"); - one.setBillType(billType); - one.setBillAttr("其他押金"); - one.setStarttime(date); - one.setEndtime(date); - one.setReceivePayStr("2000.50"); - one.setPayStr("2000.50"); - one.setReceiveDate(date); - one.setPayDate(date); - one.setPayWay("微信"); - otherDatalist.add(one); - excelService.exportExcel(otherDatalist, null, "账单模板", WxBillExcelTemplateOther.class, "账单模板.xlsx", response, true); - } - } - - @Override - public void importBillOther(String importKey, WxBillExcelTemplateOther bill, MallUserInfo user) { -// Integer billType = bill.getBillType(); -// long receivePay = new BigDecimal(bill.getReceivePayStr()).multiply(new BigDecimal(100)).longValueExact(); -// long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); +// wordDocTableVo.setParams(rowsParams); +// wordDocTableVo.setTableIndex(0); +// wordDocTableVo.setRowIndex(2); +// +// String templatePath = "contract-word-template/settle.docx"; +// String filepath = fmUploadDir; +// String filename = UUID.randomUUID() + ".docx"; +// String exportFileName = "结算单.docx"; +// WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response, wordDocTableVo); +// +// } +// +// @Override +// public ResultData updateReceivePay(WxBillAll wxBillAll, MallUserInfo user,boolean forcePaid) { +//// Integer billType = wxBillAll.getBillTypeValue(); +//// Long oldPrice = wxBillAll.getOldPrice(); +//// Long newPrice = wxBillAll.getNewPrice(); +//// Long oldLatePrice = wxBillAll.getOldLatePrice(); +//// Long newLatePrice = wxBillAll.getNewLatePrice(); +//// Long id = wxBillAll.getId(); +//// Date updateDate = new Date(); +//// if (billType.equals(EnumBillTypeParam.RENT.getCode())) { +//// WxBillRent dbBill = wxBillRentMapper.selectById(id); +//// WxBillRent wxBillRent = new WxBillRent(); +//// wxBillRent.setId(id); +//// wxBillRent.setUpdatetime(updateDate); +//// if (forcePaid) { +//// wxBillRent.setReceivePay(dbBill.getPay()); +//// wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); +//// wxBillRent.setOwe("0"); +//// wxBillRentMapper.updateById(wxBillRent); +//// addBillAction(EnumBillAction.UPDATE_BILL, id, dbBill.getPay(), dbBill.getPay(), user); +//// }else { +//// if (oldLatePrice != null) { +//// wxBillRent.setLatePayPrice(newLatePrice); +//// wxBillRent.setOwe(dbBill.getReceivePay() + dbBill.getServiceChargePay() + newLatePrice - dbBill.getPay()); +//// wxBillRentMapper.updateById(wxBillRent); +//// addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, id, oldLatePrice, newLatePrice, user); +//// } else { +//// //租赁账单更新 +//// wxBillRent.setReceivePay(newPrice); +//// long latePayPrice = dbBill.getLatePayPrice() == null ? 0 : dbBill.getLatePayPrice(); +//// wxBillRent.setOwe(newPrice + dbBill.getServiceChargePay() + latePayPrice - dbBill.getPay()); +//// if (newPrice.equals(dbBill.getPay())) { +//// wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); +//// } +//// wxBillRentMapper.updateById(wxBillRent); +//// //账单日志 +//// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); +//// } +//// } +//// } else if (billType.equals(EnumBillTypeParam.RENT_DEPOSIT.getCode())) { +//// WxBillDeposit dbBill = wxBillDepositMapper.selectById(id); +//// if (dbBill != null) { +//// WxBillDeposit wxBillDeposit = new WxBillDeposit(); +//// wxBillDeposit.setId(id); +//// Long billDepositOldPrce = oldPrice; +//// Long billDepositNewPrce = newPrice; +//// //租赁押金账单更新 +//// if (forcePaid) { +//// wxBillDeposit.setReceivePay(dbBill.getPay()); +//// wxBillDeposit.setOwe(0L); +//// wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); +//// billDepositOldPrce = dbBill.getPay(); +//// billDepositNewPrce = dbBill.getPay(); +//// }else { +//// wxBillDeposit.setReceivePay(newPrice); +//// wxBillDeposit.setOwe(newPrice - dbBill.getPay()); +//// if (newPrice.equals(dbBill.getPay())) { +//// wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); +//// } +//// wxBillDeposit.setUpdatetime(updateDate); +//// } +//// wxBillDepositMapper.updateById(wxBillDeposit); +//// //账单日志 +//// addBillAction(EnumBillAction.DEPOSIT_MODIFY, id, billDepositOldPrce, billDepositNewPrce, user); +//// } +//// +//// WxBillPropertyDeposit propertyDeposit = wxBillPropertyDepositMapper.selectById(id); +//// if (propertyDeposit != null) { +//// //物业押金账单更新 +//// WxBillPropertyDeposit wxBillPropertyDeposit = new WxBillPropertyDeposit(); +//// wxBillPropertyDeposit.setId(id); +//// Long billPropertyDepositOldPrce = oldPrice; +//// Long billPropertyDepositNewPrce = newPrice; +//// if (forcePaid) { +//// wxBillPropertyDeposit.setReceivePay(propertyDeposit.getPay()); +//// wxBillPropertyDeposit.setOwe(0L); +//// wxBillPropertyDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); +//// billPropertyDepositOldPrce = propertyDeposit.getPay(); +//// billPropertyDepositNewPrce = propertyDeposit.getPay(); +//// }else { +//// wxBillPropertyDeposit.setReceivePay(newPrice); +//// wxBillPropertyDeposit.setOwe(newPrice - propertyDeposit.getPay()); +//// if (newPrice.equals(propertyDeposit.getPay())) { +//// wxBillPropertyDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); +//// } +//// } +//// wxBillPropertyDeposit.setUpdatetime(updateDate); +//// wxBillPropertyDepositMapper.updateById(wxBillPropertyDeposit); +//// //账单日志 +//// addBillAction(EnumBillAction.UPDATE_BILL, id, billPropertyDepositOldPrce, billPropertyDepositNewPrce, user); +//// } +//// } else if (billType.equals(EnumBillTypeParam.PROPERTY.getCode())) { +//// WxBillProperty dbBill = wxBillPropertyMapper.selectById(id); +//// //物业账单更新 +//// WxBillProperty wxBillProperty = new WxBillProperty(); +//// wxBillProperty.setId(id); +//// wxBillProperty.setUpdatetime(updateDate); +//// if (forcePaid) { +//// wxBillProperty.setReceivePay(dbBill.getPay()); +//// wxBillProperty.setOwe(0L); +//// wxBillProperty.setStatus(EnumBillRentStatus.PAID.getCode()); +//// wxBillPropertyMapper.updateById(wxBillProperty); +//// addBillAction(EnumBillAction.UPDATE_BILL, id, dbBill.getPay(), dbBill.getPay(), user); +//// }else { +//// if (oldLatePrice != null) { +//// wxBillProperty.setLatePayPrice(newLatePrice); +//// wxBillProperty.setOwe(dbBill.getReceivePay() + dbBill.getServiceChargePay() + newLatePrice - dbBill.getPay()); +//// wxBillPropertyMapper.updateById(wxBillProperty); +//// addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, id, oldLatePrice, newLatePrice, user); +//// } else { +//// wxBillProperty.setReceivePay(newPrice); +//// long latePayPrice = dbBill.getLatePayPrice() == null ? 0 : dbBill.getLatePayPrice(); +//// wxBillProperty.setOwe(newPrice + dbBill.getServiceChargePay() + latePayPrice - dbBill.getPay()); +//// if (newPrice.equals(dbBill.getPay())) { +//// wxBillProperty.setStatus(EnumBillRentStatus.PAID.getCode()); +//// } +//// wxBillPropertyMapper.updateById(wxBillProperty); +//// //账单日志 +//// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); +//// } +//// } +//// } else if (billType.equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode())) { +//// WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectById(id); +//// //物业押金账单更新 +//// WxBillPropertyDeposit wxBillPropertyDeposit = new WxBillPropertyDeposit(); +//// wxBillPropertyDeposit.setId(id); +//// Long billPropertyDepositOldPrce = oldPrice; +//// Long billPropertyDepositNewPrce = newPrice; +//// if (forcePaid) { +//// wxBillPropertyDeposit.setReceivePay(dbBill.getPay()); +//// wxBillPropertyDeposit.setOwe(0L); +//// wxBillPropertyDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); +//// billPropertyDepositOldPrce = dbBill.getPay(); +//// billPropertyDepositNewPrce = dbBill.getPay(); +//// }else { +//// wxBillPropertyDeposit.setReceivePay(newPrice); +//// wxBillPropertyDeposit.setOwe(newPrice - dbBill.getPay()); +//// if (newPrice.equals(dbBill.getPay())) { +//// wxBillPropertyDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); +//// } +//// } +//// wxBillPropertyDeposit.setUpdatetime(updateDate); +//// wxBillPropertyDepositMapper.updateById(wxBillPropertyDeposit); +//// //账单日志 +//// addBillAction(EnumBillAction.UPDATE_BILL, id, billPropertyDepositOldPrce, billPropertyDepositNewPrce, user); +//// +//// } else if (billType.equals(EnumBillTypeParam.WATER.getCode())) { +//// //水费账单更新 +//// updateDailyBill(id, newPrice, updateDate,forcePaid); +//// //账单日志 +//// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); +//// } else if (billType.equals(EnumBillTypeParam.POWER.getCode())) { +//// //电费账单更新 +//// updateDailyBill(id, newPrice, updateDate,forcePaid); +//// //账单日志 +//// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); +//// } else if (billType.equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) { +//// //空调费账单更新 +//// updateDailyBill(id, newPrice, updateDate,forcePaid); +//// //账单日志 +//// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); +//// } else if (billType.equals(EnumBillTypeParam.ROUTINE.getCode())) { +//// WxBillOther dbBill = wxBillOtherMapper.selectById(id); +//// //其他费用账单更新 +//// WxBillOther wxBillOther = new WxBillOther(); +//// wxBillOther.setId(id); +//// if (forcePaid) { +//// wxBillOther.setReceivePay(dbBill.getPay()); +//// wxBillOther.setOwe(0L); +//// wxBillOther.setStatus(EnumBillRentStatus.PAID.getCode()); +//// }else { +//// wxBillOther.setReceivePay(newPrice); +//// wxBillOther.setOwe(newPrice + dbBill.getServiceChargePay() - dbBill.getPay()); +//// if (newPrice.equals(dbBill.getPay())) { +//// wxBillOther.setStatus(EnumBillRentStatus.PAID.getCode()); +//// } +//// } +//// wxBillOther.setUpdatetime(updateDate); +//// wxBillOtherMapper.updateById(wxBillOther); +//// //账单日志 +//// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); +//// } else if (billType.equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) { +//// WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectById(id); +//// //其他押金账单更新 +//// WxBillOtherDeposit wxBillOtherDeposit = new WxBillOtherDeposit(); +//// wxBillOtherDeposit.setId(id); +//// if (forcePaid) { +//// wxBillOtherDeposit.setReceivePay(dbBill.getPay()); +//// wxBillOtherDeposit.setOwe(0L); +//// wxBillOtherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); +//// }else { +//// wxBillOtherDeposit.setReceivePay(newPrice); +//// wxBillOtherDeposit.setOwe(newPrice + dbBill.getServiceChargePay() - dbBill.getPay()); +//// if (newPrice.equals(dbBill.getPay())) { +//// wxBillOtherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); +//// } +//// } +//// wxBillOtherDeposit.setUpdatetime(updateDate); +//// wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); +//// //账单日志 +//// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); +//// }if (billType.equals(EnumBillTypeParam.RENT_BUSSINESS_MANAGE.getCode()) || billType.equals(EnumBillTypeParam.RENT_OPERATING_MANAGE.getCode())) { +//// WxBillRentManage dbBill = wxBillRentManageMapper.selectById(id); +//// WxBillRentManage wxBillRent = new WxBillRentManage(); +//// wxBillRent.setId(id); +//// wxBillRent.setUpdatetime(updateDate); +//// if (forcePaid) { +//// wxBillRent.setReceivePay(dbBill.getPay()); +//// wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); +//// wxBillRent.setOwe(0L); +//// wxBillRentManageMapper.updateById(wxBillRent); +//// addBillAction(EnumBillAction.UPDATE_BILL, id, dbBill.getPay(), dbBill.getPay(), user); +//// }else { +//// if (oldLatePrice != null) { +//// wxBillRent.setLatePayPrice(newLatePrice); +//// wxBillRent.setOwe(dbBill.getReceivePay() + dbBill.getServiceChargePay() + newLatePrice - dbBill.getPay()); +//// wxBillRentManageMapper.updateById(wxBillRent); +//// addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, id, oldLatePrice, newLatePrice, user); +//// } else { +//// //租赁账单更新 +//// wxBillRent.setReceivePay(newPrice); +//// long latePayPrice = dbBill.getLatePayPrice() == null ? 0 : dbBill.getLatePayPrice(); +//// wxBillRent.setOwe(newPrice + dbBill.getServiceChargePay() + latePayPrice - dbBill.getPay()); +//// if (newPrice.equals(dbBill.getPay())) { +//// wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); +//// } +//// wxBillRentManageMapper.updateById(wxBillRent); +//// //账单日志 +//// addBillAction(EnumBillAction.UPDATE_BILL, id, oldPrice, newPrice, user); +//// } +//// } +//// } else { +//// logger.info("未找到账单类型"); +//// } +// return new ResultData(); +// } +// +// @Override +// public void addBillAction(EnumBillAction billAction, Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo) { +// WxBillAction wxBillAction = new WxBillAction(); +// wxBillAction.setBillId(billId); +// String oldPriceStr = new BigDecimal(oldPrice).divide(new BigDecimal(100)).toPlainString(); +// String newPriceStr = new BigDecimal(newPrice).divide(new BigDecimal(100)).toPlainString(); +// wxBillAction.setDetails(oldPriceStr + "元变更成" + newPriceStr + "元"); +// wxBillAction.setAction(billAction.getCode()); +// wxBillActionService.modifyBill(wxBillAction, mallUserInfo); +// } +// +// +// @Override +// public void exportTemplate(WxBillExcelTemplate WxBillExcelTemplate, HttpServletRequest request, HttpServletResponse response) { +// List datalist = new ArrayList<>(); +// List otherDatalist = new ArrayList<>(); +// +// Integer billType = WxBillExcelTemplate.getBillType(); // if (billType.equals(EnumBillExcelTemplate.DAILY.getCode())) { -// WxBillDaily dailyQuery = new WxBillDaily(); -// String billAttrStr = StringUtils.trim(bill.getBillAttr()); -// if (billAttrStr.equals(EnumBillExcelTemplateDaily.WATER.getMessage())) { -// dailyQuery.setType(EnumBillDailyType.WATER.getCode()); -// } -// if (billAttrStr.equals(EnumBillExcelTemplateDaily.POWER.getMessage())) { -// dailyQuery.setType(EnumBillDailyType.POWER.getCode()); -// } -// if (billAttrStr.equals(EnumBillExcelTemplateDaily.AIR_CONDITIONING.getMessage())) { -// dailyQuery.setType(EnumBillDailyType.AIR_CONDITIONING.getCode()); -// } -// dailyQuery.updateTenantInfo(user); -// dailyQuery.setMerchantId(bill.getMerchantId()); -// dailyQuery.setReceiveDate(bill.getReceiveDate()); -// dailyQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); -// WxBillDaily daily = wxBillDailyMapper.selectOne(new QueryWrapper(dailyQuery)); -// if (daily != null && pay > 0) { -// if (!daily.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { -// long allPay = new BigDecimal(daily.getPay()).add(new BigDecimal(pay)).longValueExact(); -// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, allPay, false); -// daily.setExpiredDay(expiredDayAndStatus.getExpiredDay()); -// daily.setStatus(expiredDayAndStatus.getStatus()); -// daily.setReceivePay(receivePay); -// daily.setPay(allPay); -// daily.setOwe(0L); -// long owe = daily.getReceivePay() - daily.getPay(); -// if (owe > 0) { -// daily.setOwe(owe); -// } -// daily.setPayDate(bill.getPayDate()); -// daily.setReceiveDate(bill.getReceiveDate()); -// wxBillDailyMapper.updateById(daily); -// addActionImport(daily.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); -// } -// } else { -// WxMerchantShop wxMerchantShop = new WxMerchantShop(); -// wxMerchantShop.updateTenantInfo(user); -// wxMerchantShop.setMerchantId(bill.getMerchantId()); -// wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); -// List select = wxMerchantShopMapper.selectList(new QueryWrapper<>(wxMerchantShop)); -// if (!select.isEmpty()) { -// daily = new WxBillDaily(); -// final IdWorker idWorker = IdWorker.get(); -// daily.setId(idWorker.nextId()); -// daily.setReceivePay(receivePay); -// daily.setReceiveDate(bill.getReceiveDate()); -// daily.setPay(pay); -// daily.setType(dailyQuery.getType()); -// daily.updateTenantInfo(user); -// daily.setMerchantId(bill.getMerchantId()); -// daily.setShopId(select.get(0).getShopId()); -// daily.setRentShopType(bill.getMerchantType()); -// daily.setPayDate(bill.getPayDate()); -// Date date = new Date(); -// daily.setCreatetime(date); -// daily.setUpdatetime(date); -// daily.setOwe(receivePay - pay); -// daily.setIsDel(EnumDelStatus.NOT_DEL.getCode()); -// daily.setStarttime(bill.getStarttime()); -// daily.setEndtime(bill.getEndtime()); -// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, pay, false); -// daily.setExpiredDay(expiredDayAndStatus.getExpiredDay()); -// daily.setStatus(expiredDayAndStatus.getStatus()); -// daily.setBuildWay(EnumBillDailyBuildWay.IMPORT.getCode()); -// JSONArray priceDetals = new JSONArray(); -// JSONObject priceDetal = new JSONObject(); -// priceDetal.put("key", "price"); -// priceDetal.put("value", 1); -// priceDetals.add(priceDetal); -// priceDetal = new JSONObject(); -// priceDetal.put("key", "way"); -// priceDetal.put("value", 1); -// priceDetals.add(priceDetal); -// priceDetal = new JSONObject(); -// priceDetal.put("key", "unit"); -// priceDetal.put("value", 1); -// priceDetals.add(priceDetal); -// daily.setPriceDetail(JSONArray.toJSONString(priceDetals)); -// wxBillDailyMapper.insert(daily); -// if (pay > 0) { -// addActionImport(daily.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); -// } -// } -// } +// WxBillExcelTemplateOther one = new WxBillExcelTemplateOther(); +// Date date = new Date(); +// one.setMerchantName("商户1"); +// one.setBillType(billType); +// one.setBillAttr("水费"); +// one.setStarttime(date); +// one.setEndtime(date); +// one.setReceivePayStr("1000"); +// one.setPayStr("1000"); +// one.setPayDate(date); +// one.setReceiveDate(date); +// one.setPayWay("微信"); +// otherDatalist.add(one); +// +// WxBillExcelTemplateOther two = new WxBillExcelTemplateOther(); +// two.setMerchantName("商户2"); +// two.setBillType(billType); +// two.setBillAttr("电费"); +// two.setStarttime(date); +// two.setEndtime(date); +// two.setReceivePayStr("2000.50"); +// two.setPayStr("2000.50"); +// two.setPayDate(date); +// two.setReceiveDate(date); +// two.setPayWay("支付宝"); +// otherDatalist.add(two); +// +// WxBillExcelTemplateOther three = new WxBillExcelTemplateOther(); +// three.setMerchantName("商户3"); +// three.setBillType(billType); +// three.setBillAttr("空调费"); +// three.setStarttime(date); +// three.setEndtime(date); +// three.setReceivePayStr("3333"); +// three.setPayStr("3333"); +// three.setPayDate(date); +// three.setReceiveDate(date); +// three.setPayWay("其他"); +// otherDatalist.add(three); +// excelService.exportExcel(otherDatalist, null, "账单模板", WxBillExcelTemplateOther.class, "账单模板.xlsx", response, true); +// } else if (billType.equals(EnumBillExcelTemplate.SHOP_RENT.getCode()) || billType.equals(EnumBillExcelTemplate.POINT_RENT.getCode())) { +// WxBillExcelTemplate one = new WxBillExcelTemplate(); +// Date date = new Date(); +// one.setMerchantName("商户"); +// one.setBillType(billType); +// one.setBillAttr("租金"); +// one.setStarttime(date); +// one.setEndtime(date); +// one.setPayStr("2000.50"); +// one.setReceiveDate(date); +// one.setPayDate(date); +// one.setPayWay("微信"); +// datalist.add(one); +// excelService.exportExcel(datalist, null, "账单模板", WxBillExcelTemplate.class, "账单模板.xlsx", response, true); +// } else if (billType.equals(EnumBillExcelTemplate.SHOP_PROPERTY.getCode()) || billType.equals(EnumBillExcelTemplate.POINT_PROPERTY.getCode())) { +// WxBillExcelTemplate one = new WxBillExcelTemplate(); +// Date date = new Date(); +// one.setMerchantName("商户"); +// one.setBillType(billType); +// one.setBillAttr("物业费"); +// one.setStarttime(date); +// one.setEndtime(date); +// one.setPayStr("2000.50"); +// one.setReceiveDate(date); +// one.setPayDate(date); +// one.setPayWay("微信"); +// datalist.add(one); +// excelService.exportExcel(datalist, null, "账单模板", WxBillExcelTemplate.class, "账单模板.xlsx", response, true); // } else if (billType.equals(EnumBillExcelTemplate.OTHER.getCode())) { -// WxBillOther otherQuery = new WxBillOther(); -// otherQuery.updateTenantInfo(user); -// otherQuery.setMerchantId(bill.getMerchantId()); -// otherQuery.setReceiveDate(bill.getReceiveDate()); -// otherQuery.setName(bill.getBillAttr()); -// otherQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); -// WxBillOther other = wxBillOtherMapper.selectOne(new QueryWrapper(otherQuery)); -// if (other != null && pay > 0) { -// if (!other.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { -// long allPay = new BigDecimal(other.getPay()).add(new BigDecimal(pay)).longValueExact(); -// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, allPay, false); -// other.setExpiredDay(expiredDayAndStatus.getExpiredDay()); -// other.setStatus(expiredDayAndStatus.getStatus()); -// other.setReceivePay(receivePay); -// other.setName(bill.getBillAttr()); -// other.setComments(bill.getBillAttr()); -// other.setPay(allPay); -// other.setOwe(0L); -// long owe = other.getReceivePay() - other.getPay(); -// if (owe > 0) { -// other.setOwe(owe); -// } -// other.setPayDate(bill.getPayDate()); -// other.setReceiveDate(bill.getReceiveDate()); -// wxBillOtherMapper.updateById(other); -// addActionImport(other.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); -// } -// } else { -// WxMerchantShop wxMerchantShop = new WxMerchantShop(); -// wxMerchantShop.updateTenantInfo(user); -// wxMerchantShop.setMerchantId(bill.getMerchantId()); -// wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); -// List select = wxMerchantShopMapper.selectList(new QueryWrapper(wxMerchantShop)); -// if (!select.isEmpty()) { -// other = new WxBillOther(); -// final IdWorker idWorker = IdWorker.get(); -// other.setId(idWorker.nextId()); -// other.setName(bill.getBillAttr()); -// other.setComments(bill.getBillAttr()); -// other.setReceivePay(receivePay); -// other.setReceiveDate(bill.getReceiveDate()); -// other.setPay(pay); -// other.updateTenantInfo(user); -// other.setMerchantId(bill.getMerchantId()); -// other.setShopId(select.get(0).getShopId()); -// other.setRentShopType(bill.getMerchantType()); -// other.setPayDate(bill.getPayDate()); -// Date date = new Date(); -// other.setCreatetime(date); -// other.setUpdatetime(date); -// other.setOwe(receivePay - pay); -// other.setIsDel(EnumDelStatus.NOT_DEL.getCode()); -// other.setStarttime(bill.getStarttime()); -// other.setEndtime(bill.getEndtime()); -// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, pay, false); -// other.setExpiredDay(expiredDayAndStatus.getExpiredDay()); -// other.setStatus(expiredDayAndStatus.getStatus()); -// wxBillOtherMapper.insert(other); -// if (pay > 0) { -// addActionImport(other.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); -// } -// } -// } -// } else if (billType.equals(EnumBillExcelTemplate.OTHER_DEPOSIT.getCode())) { -// WxBillOtherDeposit otherDepositQuery = new WxBillOtherDeposit(); -// otherDepositQuery.updateTenantInfo(user); -// otherDepositQuery.setMerchantId(bill.getMerchantId()); -// otherDepositQuery.setReceiveDate(bill.getReceiveDate()); -// otherDepositQuery.setComments(bill.getBillAttr()); -// otherDepositQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); -// WxBillOtherDeposit otherDeposit = wxBillOtherDepositMapper.selectOne(new QueryWrapper(otherDepositQuery)); -// if (otherDeposit != null && pay > 0) { -// if (!otherDeposit.getStatus().equals(EnumBillRentStatus.PAID.getCode()) && !otherDeposit.getStatus().equals(EnumBillRentStatus.RETURN.getCode())) { -// long allPay = new BigDecimal(otherDeposit.getPay()).add(new BigDecimal(pay)).longValueExact(); -// otherDeposit.setExpiredDay(0L); -// if (allPay >= receivePay) { -// otherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); -// } else { -// otherDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); -// } -// otherDeposit.setReceivePay(receivePay); -// otherDeposit.setPay(allPay); -// otherDeposit.setOwe(0L); -// long owe = otherDeposit.getReceivePay() - otherDeposit.getPay(); -// if (owe > 0) { -// otherDeposit.setOwe(owe); -// } -// otherDeposit.setPayDate(bill.getPayDate()); -// otherDeposit.setReceiveDate(bill.getReceiveDate()); -// wxBillOtherDepositMapper.updateById(otherDeposit); -// addActionImport(otherDeposit.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); -// } -// } else { -// WxMerchantShop wxMerchantShop = new WxMerchantShop(); -// wxMerchantShop.updateTenantInfo(user); -// wxMerchantShop.setMerchantId(bill.getMerchantId()); -// otherDepositQuery.setReceiveDate(bill.getReceiveDate()); -// wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); -// List select = wxMerchantShopMapper.selectList(new QueryWrapper(wxMerchantShop)); -// if (!select.isEmpty()) { -// otherDeposit = new WxBillOtherDeposit(); -// final IdWorker idWorker = IdWorker.get(); -// otherDeposit.setId(idWorker.nextId()); -// otherDeposit.setName(bill.getBillAttr()); -// otherDeposit.setComments(bill.getBillAttr()); -// otherDeposit.setReceivePay(receivePay); -// otherDeposit.setReceiveDate(bill.getReceiveDate()); -// otherDeposit.setPay(pay); -// otherDeposit.updateTenantInfo(user); -// otherDeposit.setMerchantId(bill.getMerchantId()); -// otherDeposit.setShopId(select.get(0).getShopId()); -// otherDeposit.setRentShopType(bill.getMerchantType()); -// otherDeposit.setPayDate(bill.getPayDate()); -// Date date = new Date(); -// otherDeposit.setCreatetime(date); -// otherDeposit.setUpdatetime(date); -// otherDeposit.setExpiredDay(0L); -// otherDeposit.setOwe(receivePay - pay); -// otherDeposit.setIsDel(EnumDelStatus.NOT_DEL.getCode()); -// otherDeposit.setStarttime(bill.getStarttime()); -// otherDeposit.setEndtime(bill.getEndtime()); -// if (receivePay <= pay) { -// otherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); -// } else { -// otherDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); -// } -// wxBillOtherDepositMapper.insert(otherDeposit); -// if (pay > 0) { -// addActionImport(otherDeposit.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); -// } -// } -// } +// WxBillExcelTemplateOther one = new WxBillExcelTemplateOther(); +// Date date = new Date(); +// one.setMerchantName("商户"); +// one.setBillType(billType); +// one.setBillAttr("其他费用"); +// one.setStarttime(date); +// one.setEndtime(date); +// one.setReceivePayStr("2000.50"); +// one.setPayStr("2000.50"); +// one.setReceiveDate(date); +// one.setPayDate(date); +// one.setPayWay("微信"); +// otherDatalist.add(one); +// excelService.exportExcel(otherDatalist, null, "账单模板", WxBillExcelTemplateOther.class, "账单模板.xlsx", response, true); // } else { -// logger.error("账单导入失败"); -// } -// //记数 -// stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); -// stringRedisTemplate.expire(importKey, 10, TimeUnit.SECONDS); - } - -// public WxBillRent getExpiredDayAndStatus(Date startDate, Date endDate, Long owe, Long pay, boolean flag) { -// WxBillRent rent = new WxBillRent(); -// rent.setExpiredDay(0L); -// if (owe <= pay) { -// rent.setStatus(EnumBillStatus.PAID.getCode()); -// int expiredDay = DateUtils.daysBetween(startDate, endDate); -// int timePeriod = 0; -// if (expiredDay > timePeriod) { -// rent.setExpiredDay((long) expiredDay); -// } -// return rent; -// } -// Date now = new Date(); -// int day = DateUtils.daysBetween(startDate, now); -// int timePeriod = 0; -// if (day > timePeriod) { -// rent.setStatus(EnumBillStatus.NOT_PAID.getCode()); -// rent.setExpiredDay((long) day); -// return rent; +// WxBillExcelTemplateOther one = new WxBillExcelTemplateOther(); +// Date date = new Date(); +// one.setMerchantName("商户"); +// one.setBillType(billType); +// one.setBillAttr("其他押金"); +// one.setStarttime(date); +// one.setEndtime(date); +// one.setReceivePayStr("2000.50"); +// one.setPayStr("2000.50"); +// one.setReceiveDate(date); +// one.setPayDate(date); +// one.setPayWay("微信"); +// otherDatalist.add(one); +// excelService.exportExcel(otherDatalist, null, "账单模板", WxBillExcelTemplateOther.class, "账单模板.xlsx", response, true); // } -// if (flag) { -// timePeriod = 30; -// long expiredDay = Long.valueOf(Math.abs(day)); -// if (expiredDay > timePeriod) { -// rent.setStatus(EnumBillStatus.NOT_EXPIRED.getCode()); -// } else { -// rent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); +// } +// +// @Override +// public void importBillOther(String importKey, WxBillExcelTemplateOther bill, MallUserInfo user) { +//// Integer billType = bill.getBillType(); +//// long receivePay = new BigDecimal(bill.getReceivePayStr()).multiply(new BigDecimal(100)).longValueExact(); +//// long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); +//// if (billType.equals(EnumBillExcelTemplate.DAILY.getCode())) { +//// WxBillDaily dailyQuery = new WxBillDaily(); +//// String billAttrStr = StringUtils.trim(bill.getBillAttr()); +//// if (billAttrStr.equals(EnumBillExcelTemplateDaily.WATER.getMessage())) { +//// dailyQuery.setType(EnumBillDailyType.WATER.getCode()); +//// } +//// if (billAttrStr.equals(EnumBillExcelTemplateDaily.POWER.getMessage())) { +//// dailyQuery.setType(EnumBillDailyType.POWER.getCode()); +//// } +//// if (billAttrStr.equals(EnumBillExcelTemplateDaily.AIR_CONDITIONING.getMessage())) { +//// dailyQuery.setType(EnumBillDailyType.AIR_CONDITIONING.getCode()); +//// } +//// dailyQuery.updateTenantInfo(user); +//// dailyQuery.setMerchantId(bill.getMerchantId()); +//// dailyQuery.setReceiveDate(bill.getReceiveDate()); +//// dailyQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +//// WxBillDaily daily = wxBillDailyMapper.selectOne(new QueryWrapper(dailyQuery)); +//// if (daily != null && pay > 0) { +//// if (!daily.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { +//// long allPay = new BigDecimal(daily.getPay()).add(new BigDecimal(pay)).longValueExact(); +//// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, allPay, false); +//// daily.setExpiredDay(expiredDayAndStatus.getExpiredDay()); +//// daily.setStatus(expiredDayAndStatus.getStatus()); +//// daily.setReceivePay(receivePay); +//// daily.setPay(allPay); +//// daily.setOwe(0L); +//// long owe = daily.getReceivePay() - daily.getPay(); +//// if (owe > 0) { +//// daily.setOwe(owe); +//// } +//// daily.setPayDate(bill.getPayDate()); +//// daily.setReceiveDate(bill.getReceiveDate()); +//// wxBillDailyMapper.updateById(daily); +//// addActionImport(daily.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +//// } +//// } else { +//// WxMerchantShop wxMerchantShop = new WxMerchantShop(); +//// wxMerchantShop.updateTenantInfo(user); +//// wxMerchantShop.setMerchantId(bill.getMerchantId()); +//// wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +//// List select = wxMerchantShopMapper.selectList(new QueryWrapper<>(wxMerchantShop)); +//// if (!select.isEmpty()) { +//// daily = new WxBillDaily(); +//// final IdWorker idWorker = IdWorker.get(); +//// daily.setId(idWorker.nextId()); +//// daily.setReceivePay(receivePay); +//// daily.setReceiveDate(bill.getReceiveDate()); +//// daily.setPay(pay); +//// daily.setType(dailyQuery.getType()); +//// daily.updateTenantInfo(user); +//// daily.setMerchantId(bill.getMerchantId()); +//// daily.setShopId(select.get(0).getShopId()); +//// daily.setRentShopType(bill.getMerchantType()); +//// daily.setPayDate(bill.getPayDate()); +//// Date date = new Date(); +//// daily.setCreatetime(date); +//// daily.setUpdatetime(date); +//// daily.setOwe(receivePay - pay); +//// daily.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +//// daily.setStarttime(bill.getStarttime()); +//// daily.setEndtime(bill.getEndtime()); +//// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, pay, false); +//// daily.setExpiredDay(expiredDayAndStatus.getExpiredDay()); +//// daily.setStatus(expiredDayAndStatus.getStatus()); +//// daily.setBuildWay(EnumBillDailyBuildWay.IMPORT.getCode()); +//// JSONArray priceDetals = new JSONArray(); +//// JSONObject priceDetal = new JSONObject(); +//// priceDetal.put("key", "price"); +//// priceDetal.put("value", 1); +//// priceDetals.add(priceDetal); +//// priceDetal = new JSONObject(); +//// priceDetal.put("key", "way"); +//// priceDetal.put("value", 1); +//// priceDetals.add(priceDetal); +//// priceDetal = new JSONObject(); +//// priceDetal.put("key", "unit"); +//// priceDetal.put("value", 1); +//// priceDetals.add(priceDetal); +//// daily.setPriceDetail(JSONArray.toJSONString(priceDetals)); +//// wxBillDailyMapper.insert(daily); +//// if (pay > 0) { +//// addActionImport(daily.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +//// } +//// } +//// } +//// } else if (billType.equals(EnumBillExcelTemplate.OTHER.getCode())) { +//// WxBillOther otherQuery = new WxBillOther(); +//// otherQuery.updateTenantInfo(user); +//// otherQuery.setMerchantId(bill.getMerchantId()); +//// otherQuery.setReceiveDate(bill.getReceiveDate()); +//// otherQuery.setName(bill.getBillAttr()); +//// otherQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +//// WxBillOther other = wxBillOtherMapper.selectOne(new QueryWrapper(otherQuery)); +//// if (other != null && pay > 0) { +//// if (!other.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { +//// long allPay = new BigDecimal(other.getPay()).add(new BigDecimal(pay)).longValueExact(); +//// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, allPay, false); +//// other.setExpiredDay(expiredDayAndStatus.getExpiredDay()); +//// other.setStatus(expiredDayAndStatus.getStatus()); +//// other.setReceivePay(receivePay); +//// other.setName(bill.getBillAttr()); +//// other.setComments(bill.getBillAttr()); +//// other.setPay(allPay); +//// other.setOwe(0L); +//// long owe = other.getReceivePay() - other.getPay(); +//// if (owe > 0) { +//// other.setOwe(owe); +//// } +//// other.setPayDate(bill.getPayDate()); +//// other.setReceiveDate(bill.getReceiveDate()); +//// wxBillOtherMapper.updateById(other); +//// addActionImport(other.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +//// } +//// } else { +//// WxMerchantShop wxMerchantShop = new WxMerchantShop(); +//// wxMerchantShop.updateTenantInfo(user); +//// wxMerchantShop.setMerchantId(bill.getMerchantId()); +//// wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +//// List select = wxMerchantShopMapper.selectList(new QueryWrapper(wxMerchantShop)); +//// if (!select.isEmpty()) { +//// other = new WxBillOther(); +//// final IdWorker idWorker = IdWorker.get(); +//// other.setId(idWorker.nextId()); +//// other.setName(bill.getBillAttr()); +//// other.setComments(bill.getBillAttr()); +//// other.setReceivePay(receivePay); +//// other.setReceiveDate(bill.getReceiveDate()); +//// other.setPay(pay); +//// other.updateTenantInfo(user); +//// other.setMerchantId(bill.getMerchantId()); +//// other.setShopId(select.get(0).getShopId()); +//// other.setRentShopType(bill.getMerchantType()); +//// other.setPayDate(bill.getPayDate()); +//// Date date = new Date(); +//// other.setCreatetime(date); +//// other.setUpdatetime(date); +//// other.setOwe(receivePay - pay); +//// other.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +//// other.setStarttime(bill.getStarttime()); +//// other.setEndtime(bill.getEndtime()); +//// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, pay, false); +//// other.setExpiredDay(expiredDayAndStatus.getExpiredDay()); +//// other.setStatus(expiredDayAndStatus.getStatus()); +//// wxBillOtherMapper.insert(other); +//// if (pay > 0) { +//// addActionImport(other.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +//// } +//// } +//// } +//// } else if (billType.equals(EnumBillExcelTemplate.OTHER_DEPOSIT.getCode())) { +//// WxBillOtherDeposit otherDepositQuery = new WxBillOtherDeposit(); +//// otherDepositQuery.updateTenantInfo(user); +//// otherDepositQuery.setMerchantId(bill.getMerchantId()); +//// otherDepositQuery.setReceiveDate(bill.getReceiveDate()); +//// otherDepositQuery.setComments(bill.getBillAttr()); +//// otherDepositQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +//// WxBillOtherDeposit otherDeposit = wxBillOtherDepositMapper.selectOne(new QueryWrapper(otherDepositQuery)); +//// if (otherDeposit != null && pay > 0) { +//// if (!otherDeposit.getStatus().equals(EnumBillRentStatus.PAID.getCode()) && !otherDeposit.getStatus().equals(EnumBillRentStatus.RETURN.getCode())) { +//// long allPay = new BigDecimal(otherDeposit.getPay()).add(new BigDecimal(pay)).longValueExact(); +//// otherDeposit.setExpiredDay(0L); +//// if (allPay >= receivePay) { +//// otherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); +//// } else { +//// otherDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); +//// } +//// otherDeposit.setReceivePay(receivePay); +//// otherDeposit.setPay(allPay); +//// otherDeposit.setOwe(0L); +//// long owe = otherDeposit.getReceivePay() - otherDeposit.getPay(); +//// if (owe > 0) { +//// otherDeposit.setOwe(owe); +//// } +//// otherDeposit.setPayDate(bill.getPayDate()); +//// otherDeposit.setReceiveDate(bill.getReceiveDate()); +//// wxBillOtherDepositMapper.updateById(otherDeposit); +//// addActionImport(otherDeposit.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +//// } +//// } else { +//// WxMerchantShop wxMerchantShop = new WxMerchantShop(); +//// wxMerchantShop.updateTenantInfo(user); +//// wxMerchantShop.setMerchantId(bill.getMerchantId()); +//// otherDepositQuery.setReceiveDate(bill.getReceiveDate()); +//// wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +//// List select = wxMerchantShopMapper.selectList(new QueryWrapper(wxMerchantShop)); +//// if (!select.isEmpty()) { +//// otherDeposit = new WxBillOtherDeposit(); +//// final IdWorker idWorker = IdWorker.get(); +//// otherDeposit.setId(idWorker.nextId()); +//// otherDeposit.setName(bill.getBillAttr()); +//// otherDeposit.setComments(bill.getBillAttr()); +//// otherDeposit.setReceivePay(receivePay); +//// otherDeposit.setReceiveDate(bill.getReceiveDate()); +//// otherDeposit.setPay(pay); +//// otherDeposit.updateTenantInfo(user); +//// otherDeposit.setMerchantId(bill.getMerchantId()); +//// otherDeposit.setShopId(select.get(0).getShopId()); +//// otherDeposit.setRentShopType(bill.getMerchantType()); +//// otherDeposit.setPayDate(bill.getPayDate()); +//// Date date = new Date(); +//// otherDeposit.setCreatetime(date); +//// otherDeposit.setUpdatetime(date); +//// otherDeposit.setExpiredDay(0L); +//// otherDeposit.setOwe(receivePay - pay); +//// otherDeposit.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +//// otherDeposit.setStarttime(bill.getStarttime()); +//// otherDeposit.setEndtime(bill.getEndtime()); +//// if (receivePay <= pay) { +//// otherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); +//// } else { +//// otherDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); +//// } +//// wxBillOtherDepositMapper.insert(otherDeposit); +//// if (pay > 0) { +//// addActionImport(otherDeposit.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +//// } +//// } +//// } +//// } else { +//// logger.error("账单导入失败"); +//// } +//// //记数 +//// stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); +//// stringRedisTemplate.expire(importKey, 10, TimeUnit.SECONDS); +// } +// +//// public WxBillRent getExpiredDayAndStatus(Date startDate, Date endDate, Long owe, Long pay, boolean flag) { +//// WxBillRent rent = new WxBillRent(); +//// rent.setExpiredDay(0L); +//// if (owe <= pay) { +//// rent.setStatus(EnumBillStatus.PAID.getCode()); +//// int expiredDay = DateUtils.daysBetween(startDate, endDate); +//// int timePeriod = 0; +//// if (expiredDay > timePeriod) { +//// rent.setExpiredDay((long) expiredDay); +//// } +//// return rent; +//// } +//// Date now = new Date(); +//// int day = DateUtils.daysBetween(startDate, now); +//// int timePeriod = 0; +//// if (day > timePeriod) { +//// rent.setStatus(EnumBillStatus.NOT_PAID.getCode()); +//// rent.setExpiredDay((long) day); +//// return rent; +//// } +//// if (flag) { +//// timePeriod = 30; +//// long expiredDay = Long.valueOf(Math.abs(day)); +//// if (expiredDay > timePeriod) { +//// rent.setStatus(EnumBillStatus.NOT_EXPIRED.getCode()); +//// } else { +//// rent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); +//// } +//// } else { +//// rent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); +//// } +//// return rent; +//// } +// +// @Override +// public void importBill(String importKey, WxBillExcelTemplate bill, MallUserInfo user) { +//// //租金 +//// Integer billType = bill.getBillType(); +//// if (billType.equals(EnumBillExcelTemplate.SHOP_RENT.getCode()) || billType.equals(EnumBillExcelTemplate.POINT_RENT.getCode())) { +//// WxBillRent rentQuery = new WxBillRent(); +//// rentQuery.updateTenantInfo(user); +//// rentQuery.setMerchantId(bill.getMerchantId()); +//// rentQuery.setStarttime(bill.getStarttime()); +//// rentQuery.setEndtime(bill.getEndtime()); +//// if (billType.equals(EnumBillExcelTemplate.SHOP_RENT.getCode())) { +//// rentQuery.setRentShopType(EnumRentShopType.SHOP.getCode()); +//// } else { +//// rentQuery.setRentShopType(EnumRentShopType.POINT.getCode()); +//// } +//// rentQuery.setIsPreview(EnumIsPreview.NO.getCode()); +//// WxBillRent rent = wxBillRentMapper.selectBillOne(rentQuery); +//// if (rent != null && !rent.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { +//// long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); +//// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), rent.getOwe(), pay, true); +//// rent.setExpiredDay(expiredDayAndStatus.getExpiredDay()); +//// rent.setStatus(expiredDayAndStatus.getStatus()); +//// rent.setPay(rent.getPay() + pay); +//// rent.setOwe(rent.getOwe() - pay); +//// rent.setPayDate(bill.getPayDate()); +//// rent.setReceiveDate(bill.getReceiveDate()); +//// wxBillRentMapper.updateById(rent); +//// if (pay > 0) { +//// addActionImport(rent.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +//// } +//// } +//// } else if (billType.equals(EnumBillExcelTemplate.SHOP_PROPERTY.getCode()) || billType.equals(EnumBillExcelTemplate.POINT_PROPERTY.getCode())) { +//// WxBillProperty propertyQuery = new WxBillProperty(); +//// propertyQuery.updateTenantInfo(user); +//// propertyQuery.setMerchantId(bill.getMerchantId()); +//// propertyQuery.setStarttime(bill.getStarttime()); +//// propertyQuery.setEndtime(bill.getEndtime()); +//// if (billType.equals(EnumBillExcelTemplate.SHOP_PROPERTY.getCode())) { +//// propertyQuery.setRentShopType(EnumRentShopType.SHOP.getCode()); +//// } else { +//// propertyQuery.setRentShopType(EnumRentShopType.POINT.getCode()); +//// } +//// propertyQuery.setIsPreview(EnumIsPreview.NO.getCode()); +//// WxBillProperty property = wxBillPropertyMapper.selectBillOne(propertyQuery); +//// if (property != null && !property.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { +//// long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); +//// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), property.getOwe(), pay, true); +//// property.setExpiredDay(expiredDayAndStatus.getExpiredDay()); +//// property.setStatus(expiredDayAndStatus.getStatus()); +//// property.setPay(property.getPay() + pay); +//// property.setOwe(property.getOwe() - pay); +//// property.setPayDate(bill.getPayDate()); +//// property.setReceiveDate(bill.getReceiveDate()); +//// wxBillPropertyMapper.updateById(property); +//// if (pay > 0) { +//// addActionImport(property.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +//// } +//// } +//// } else { +//// logger.error("账单导入失败"); +//// } +//// //记数 +//// stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); +//// stringRedisTemplate.expire(importKey, 10, TimeUnit.SECONDS); +// } +// +//// public void addActionImport(Long billId, String payWay, Date payDate, MallUserInfo user, String pay) { +//// WxBillAction wxBillAction = new WxBillAction(); +//// wxBillAction.setBillId(billId); +//// String details = StringUtils.isEmpty(payWay) ? "其他缴费" : payWay + "缴费"; +//// wxBillAction.setDetails(details + pay + "元"); +//// wxBillAction.setAction(EnumBillAction.IMPORT_PAY.getCode()); +//// wxBillAction.setPayDate(payDate); +//// wxBillActionService.modifyBill(wxBillAction, user); +//// } +// +// public void updateDailyBill(Long businessId, String newPrice, Date updateDate,boolean forcePaid) { +//// WxBillDaily dbBill = wxBillDailyMapper.selectById(businessId); +//// WxBillDaily wxBillDaily = new WxBillDaily(); +//// wxBillDaily.setId(businessId); +//// if (forcePaid) { +//// wxBillDaily.setReceivePay(dbBill.getPay()); +//// wxBillDaily.setStatus(EnumBillStatus.PAID.getCode()); +//// //wxBillDaily.setOwe("0"); +//// }else { +//// wxBillDaily.setReceivePay(newPrice); +//// //wxBillDaily.setOwe(new BigDecimal(newPrice).add(new BigDecimal(dbBill.getServiceChargePay())).subtract(new BigDecimal(dbBill.getPay())).toPlainString()); +//// //wxBillDaily.setOwe(new BigDecimal(newPrice).subtract(new BigDecimal(dbBill.getPay())).toPlainString()); +//// if (newPrice.equals(dbBill.getPay())) { +//// wxBillDaily.setStatus(EnumBillStatus.PAID.getCode()); +//// } +//// } +//// wxBillDaily.setUpdatetime(updateDate); +//// wxBillDailyMapper.updateById(wxBillDaily); +// } +// +//// @Override +//// public Object getBillInfo(WxBillAll record) { +//// +//// record.setRentShopType(EnumRentShopType.SHOP.getCode()); +//// record.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); +//// Map oweInfoForShop = wxBillAllMapper.queryOweInfo(record); +//// record.setStatus(EnumBillRentStatus.PAID.getCode()); +//// Map paidInfoForShop = wxBillAllMapper.queryPaidInfo(record); +//// +//// record.setRentShopType(EnumRentShopType.POINT.getCode()); +//// record.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); +//// Map oweInfoForPoint = wxBillAllMapper.queryOweInfo(record); +//// record.setStatus(EnumBillRentStatus.PAID.getCode()); +//// Map paidInfoForPoint = wxBillAllMapper.queryPaidInfo(record); +//// +//// Map result = new HashMap<>(4); +//// result.put("oweInfoForShop", oweInfoForShop); +//// result.put("paidInfoForShop", paidInfoForShop); +//// result.put("oweInfoForPoint", oweInfoForPoint); +//// result.put("paidInfoForPoint", paidInfoForPoint); +//// return result; +//// } +// +// @Override +// public Long hasOweBill(Long contractId, Integer type) { +//// if (type.intValue() == 1) { +//// return wxBillRentMapper.oweBillCount(contractId); +//// } else if (type.intValue() == 2) { +//// return wxBillPropertyMapper.oweBillCount(contractId); +//// } +// return 0L; +// } +// +// public Map>> toMap(List> mapList) { +// Map>> result = new HashMap<>(); +// for (Map bill : mapList) { +// Long merchantId = (Long) bill.get("merchantId"); +// List> currList = result.get(merchantId); +// if (currList == null) { +// currList = new ArrayList<>(); // } -// } else { -// rent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); +// currList.add(bill); +// result.put(merchantId, currList); // } -// return rent; +// return result; // } - - @Override - public void importBill(String importKey, WxBillExcelTemplate bill, MallUserInfo user) { -// //租金 -// Integer billType = bill.getBillType(); -// if (billType.equals(EnumBillExcelTemplate.SHOP_RENT.getCode()) || billType.equals(EnumBillExcelTemplate.POINT_RENT.getCode())) { -// WxBillRent rentQuery = new WxBillRent(); -// rentQuery.updateTenantInfo(user); -// rentQuery.setMerchantId(bill.getMerchantId()); -// rentQuery.setStarttime(bill.getStarttime()); -// rentQuery.setEndtime(bill.getEndtime()); -// if (billType.equals(EnumBillExcelTemplate.SHOP_RENT.getCode())) { -// rentQuery.setRentShopType(EnumRentShopType.SHOP.getCode()); -// } else { -// rentQuery.setRentShopType(EnumRentShopType.POINT.getCode()); -// } -// rentQuery.setIsPreview(EnumIsPreview.NO.getCode()); -// WxBillRent rent = wxBillRentMapper.selectBillOne(rentQuery); -// if (rent != null && !rent.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { -// long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); -// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), rent.getOwe(), pay, true); -// rent.setExpiredDay(expiredDayAndStatus.getExpiredDay()); -// rent.setStatus(expiredDayAndStatus.getStatus()); -// rent.setPay(rent.getPay() + pay); -// rent.setOwe(rent.getOwe() - pay); -// rent.setPayDate(bill.getPayDate()); -// rent.setReceiveDate(bill.getReceiveDate()); -// wxBillRentMapper.updateById(rent); -// if (pay > 0) { -// addActionImport(rent.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +// +// @Override +// public void sendWaitPayBillEmail() { +// List> waitBillListForEmail = wxBillAllMapper.getWaitPayBillForEmail(); +// +// if (CollectionUtils.isNotEmpty(waitBillListForEmail)) { +// Map>> merchantMap = toMap(waitBillListForEmail); +// for (Long merchantId : merchantMap.keySet()) { +// List> mapList = merchantMap.get(merchantId); +// if (CollectionUtils.isNotEmpty(mapList)) { +// String email = (String) mapList.get(0).get("email"); +// if (StringUtils.isBlank(email)) { +// continue; +// } +// String tenantId = (String) mapList.get(0).get("tenantId"); +// String parentTenantId = (String) mapList.get(0).get("parentTenantId"); +// String receiveDate = (String) mapList.get(0).get("receiveDate"); +// String manager = (String) mapList.get(0).get("manager"); +// String managerPhone = (String) mapList.get(0).get("managerPhone"); +// +// TenantEntity tenantEntity = new TenantEntity(); +// tenantEntity.setTenantId(tenantId); +// tenantEntity.setParentTenantId(parentTenantId); +// +// String billListStr = ""; +// BigDecimal sumNeedPay = new BigDecimal(0); +// for (Map bill : mapList) { +// String billType = bill.get("billType").toString(); +// BigDecimal needPay = (BigDecimal) bill.get("needPay"); +// BigDecimal price = needPay.divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); +// +// sumNeedPay = sumNeedPay.add(price); +// billListStr += "
"; +// billListStr += "
" + billType + "
"; +// billListStr += "
" + price + "
"; +// billListStr += "
" + receiveDate + "
"; +// billListStr += "
"; +// } +// //发邮件 +// Map map = new HashedMap(); +// map.put("price", sumNeedPay.toString()); +// map.put("date", receiveDate); +// map.put("billList", billListStr); +// map.put("linkName", manager == null ? "" : manager); +// map.put("linkPhone", managerPhone == null ? "" : managerPhone); +// MailMsg mailMsg = new MailMsg(); +// mailMsg.setSubject("待缴账单通知"); +// mailMsg.setHtml(true); +// mailMsg.setMsgType(EnumMsgRecordType.EMAIL.getCode()); +// mailMsg.setModelType(EnumMailMsgModel.MAIL_BILL_WAIT_PAY.getCode()); +// mailMsg.setModelId(EnumMsgModelId.MAIL_MSG_FLOW.getCode()); +// mailMsg.setTo(new String[]{email}); +// mailMsg.updateTenantInfo(tenantEntity); +// mailMsg.setDynamicContentMap(map); +// mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); // } // } -// } else if (billType.equals(EnumBillExcelTemplate.SHOP_PROPERTY.getCode()) || billType.equals(EnumBillExcelTemplate.POINT_PROPERTY.getCode())) { -// WxBillProperty propertyQuery = new WxBillProperty(); -// propertyQuery.updateTenantInfo(user); -// propertyQuery.setMerchantId(bill.getMerchantId()); -// propertyQuery.setStarttime(bill.getStarttime()); -// propertyQuery.setEndtime(bill.getEndtime()); -// if (billType.equals(EnumBillExcelTemplate.SHOP_PROPERTY.getCode())) { -// propertyQuery.setRentShopType(EnumRentShopType.SHOP.getCode()); -// } else { -// propertyQuery.setRentShopType(EnumRentShopType.POINT.getCode()); -// } -// propertyQuery.setIsPreview(EnumIsPreview.NO.getCode()); -// WxBillProperty property = wxBillPropertyMapper.selectBillOne(propertyQuery); -// if (property != null && !property.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { -// long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); -// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), property.getOwe(), pay, true); -// property.setExpiredDay(expiredDayAndStatus.getExpiredDay()); -// property.setStatus(expiredDayAndStatus.getStatus()); -// property.setPay(property.getPay() + pay); -// property.setOwe(property.getOwe() - pay); -// property.setPayDate(bill.getPayDate()); -// property.setReceiveDate(bill.getReceiveDate()); -// wxBillPropertyMapper.updateById(property); -// if (pay > 0) { -// addActionImport(property.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +// } +// } +// +// @Override +// public void sendOweBillForEmail() { +// List> oweBillForEmail = wxBillAllMapper.getOweBillForEmail(); +// +// if (CollectionUtils.isNotEmpty(oweBillForEmail)) { +// Map>> merchantMap = toMap(oweBillForEmail); +// for (Long merchantId : merchantMap.keySet()) { +// List> mapList = merchantMap.get(merchantId); +// if (CollectionUtils.isNotEmpty(mapList)) { +// String email = (String) mapList.get(0).get("email"); +// if (StringUtils.isBlank(email)) { +// continue; +// } +// String tenantId = (String) mapList.get(0).get("tenantId"); +// String parentTenantId = (String) mapList.get(0).get("parentTenantId"); +// String receiveDate = (String) mapList.get(0).get("receiveDate"); +// String manager = (String) mapList.get(0).get("manager"); +// String managerPhone = (String) mapList.get(0).get("managerPhone"); +// Long expiredDay = (Long) mapList.get(0).get("expiredDay"); +// +// TenantEntity tenantEntity = new TenantEntity(); +// tenantEntity.setTenantId(tenantId); +// tenantEntity.setParentTenantId(parentTenantId); +// +// String billListStr = ""; +// BigDecimal sumNeedPay = new BigDecimal(0); +// for (Map bill : mapList) { +// String billType = bill.get("billType").toString(); +// BigDecimal needPay = (BigDecimal) bill.get("owe"); +// BigDecimal price = needPay.divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); +// +// sumNeedPay = sumNeedPay.add(price); +// billListStr += "
"; +// billListStr += "
"; +// billListStr += "
" + billType + "
"; +// billListStr += "
" + price + "
"; +// billListStr += "
" + receiveDate + "
"; +// billListStr += "
" + expiredDay + "
"; +// billListStr += "
"; +// } +// //发邮件 +// Map map = new HashedMap(); +// map.put("price", sumNeedPay.toString()); +// map.put("date", receiveDate); +// map.put("billList", billListStr); +// map.put("linkName", manager == null ? "" : manager); +// map.put("linkPhone", managerPhone == null ? "" : managerPhone); +// MailMsg mailMsg = new MailMsg(); +// mailMsg.setSubject("欠缴账单通知"); +// mailMsg.setHtml(true); +// mailMsg.setMsgType(EnumMsgRecordType.EMAIL.getCode()); +// mailMsg.setModelId(EnumMsgModelId.MAIL_MSG_FLOW.getCode()); +// mailMsg.setModelType(EnumMailMsgModel.MAIL_BILL_OWE.getCode()); +// mailMsg.setTo(new String[]{email}); +// mailMsg.updateTenantInfo(tenantEntity); +// mailMsg.setDynamicContentMap(map); +// mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); // } // } -// } else { -// logger.error("账单导入失败"); // } -// //记数 -// stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); -// stringRedisTemplate.expire(importKey, 10, TimeUnit.SECONDS); - } - -// public void addActionImport(Long billId, String payWay, Date payDate, MallUserInfo user, String pay) { -// WxBillAction wxBillAction = new WxBillAction(); -// wxBillAction.setBillId(billId); -// String details = StringUtils.isEmpty(payWay) ? "其他缴费" : payWay + "缴费"; -// wxBillAction.setDetails(details + pay + "元"); -// wxBillAction.setAction(EnumBillAction.IMPORT_PAY.getCode()); -// wxBillAction.setPayDate(payDate); -// wxBillActionService.modifyBill(wxBillAction, user); +// // } - - public void updateDailyBill(Long businessId, String newPrice, Date updateDate,boolean forcePaid) { -// WxBillDaily dbBill = wxBillDailyMapper.selectById(businessId); -// WxBillDaily wxBillDaily = new WxBillDaily(); -// wxBillDaily.setId(businessId); -// if (forcePaid) { -// wxBillDaily.setReceivePay(dbBill.getPay()); -// wxBillDaily.setStatus(EnumBillStatus.PAID.getCode()); -// //wxBillDaily.setOwe("0"); -// }else { -// wxBillDaily.setReceivePay(newPrice); -// //wxBillDaily.setOwe(new BigDecimal(newPrice).add(new BigDecimal(dbBill.getServiceChargePay())).subtract(new BigDecimal(dbBill.getPay())).toPlainString()); -// //wxBillDaily.setOwe(new BigDecimal(newPrice).subtract(new BigDecimal(dbBill.getPay())).toPlainString()); -// if (newPrice.equals(dbBill.getPay())) { -// wxBillDaily.setStatus(EnumBillStatus.PAID.getCode()); -// } -// } -// wxBillDaily.setUpdatetime(updateDate); -// wxBillDailyMapper.updateById(wxBillDaily); - } - +// // @Override -// public Object getBillInfo(WxBillAll record) { -// -// record.setRentShopType(EnumRentShopType.SHOP.getCode()); -// record.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); -// Map oweInfoForShop = wxBillAllMapper.queryOweInfo(record); -// record.setStatus(EnumBillRentStatus.PAID.getCode()); -// Map paidInfoForShop = wxBillAllMapper.queryPaidInfo(record); -// -// record.setRentShopType(EnumRentShopType.POINT.getCode()); -// record.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); -// Map oweInfoForPoint = wxBillAllMapper.queryOweInfo(record); -// record.setStatus(EnumBillRentStatus.PAID.getCode()); -// Map paidInfoForPoint = wxBillAllMapper.queryPaidInfo(record); -// -// Map result = new HashMap<>(4); -// result.put("oweInfoForShop", oweInfoForShop); -// result.put("paidInfoForShop", paidInfoForShop); -// result.put("oweInfoForPoint", oweInfoForPoint); -// result.put("paidInfoForPoint", paidInfoForPoint); +// public Map getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { +// PageInfo> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxBillAllMapper.getOweBillAsPage(record)); +// List> list = pageInfo.getList(); +// for (Map map : list) { +// map.put("rentOwe", subZeroAndDot(map.get("rentOwe").toString())); +// map.put("bussinessManageOwe", subZeroAndDot(map.get("bussinessManageOwe").toString())); +// map.put("operatingManageOwe", subZeroAndDot(map.get("operatingManageOwe").toString())); +// map.put("propertyOwe", subZeroAndDot(map.get("propertyOwe").toString())); +// map.put("depositOwe", subZeroAndDot(map.get("depositOwe").toString())); +// map.put("otherOwe", subZeroAndDot(map.get("otherOwe").toString())); +// map.put("totalOwe", subZeroAndDot(map.get("totalOwe").toString())); +// } +// pageInfo.setList(list); +// Map result = new HashMap<>(); +// result.put("pageInfo", pageInfo); // return result; // } - - @Override - public Long hasOweBill(Long contractId, Integer type) { -// if (type.intValue() == 1) { -// return wxBillRentMapper.oweBillCount(contractId); -// } else if (type.intValue() == 2) { -// return wxBillPropertyMapper.oweBillCount(contractId); +// +//// @Override +//// public Map getReceiveAndPayBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { +//// Map result = new HashMap<>(); +//// record.setLimitStart(0); +//// record.setLimitEnd(Integer.MAX_VALUE); +//// List totalList = wxBillAllMapper.getReceiveAndPayBillAsPage(record); +//// if (CollectionUtils.isEmpty(totalList)) { +//// PageHelper.startPage(pageNum, pageSize); +//// PageInfo> pageInfo = new PageInfo(new ArrayList()); +//// pageInfo.setPages(0); +//// pageInfo.setTotal(0); +//// PageHelper.clearPage(); +//// result.put("pageInfo", pageInfo); +//// return result; +//// } +//// +//// int total = totalList.size(); +//// int pages; +//// if (total % pageSize == 0) { +//// pages = total / pageSize; +//// } else { +//// pages = total / pageSize + 1; +//// } +//// record.setLimitStart((pageNum - 1) * pageSize); +//// record.setLimitEnd(pageSize); +//// List> list = wxBillAllMapper.getReceiveAndPayBillAsPage(record); +//// +//// PageHelper.startPage(pageNum, pageSize); +//// PageInfo> pageInfo = new PageInfo(list); +//// pageInfo.setPages(pages); +//// pageInfo.setTotal(total); +//// PageHelper.clearPage(); +//// result.put("pageInfo", pageInfo); +//// return result; +//// } +// +// @Override +// public PageInfo getReceiveAndPayBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { +// PageInfo pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxBillAllMapper.getReceiveAndPayBillAsPage(record)); +// return pageInfo; +// } +// +// /** +// * 使用java正则表达式去掉多余的.与0 +// * +// * @param s +// * @return +// */ +// public static String subZeroAndDot(String s) { +// if (s.indexOf(".") > 0) { +// s = s.replaceAll("0+?$", "");//去掉多余的0 +// s = s.replaceAll("[.]$", "");//如最后一位是.则去掉 // } - return 0L; - } - - public Map>> toMap(List> mapList) { - Map>> result = new HashMap<>(); - for (Map bill : mapList) { - Long merchantId = (Long) bill.get("merchantId"); - List> currList = result.get(merchantId); - if (currList == null) { - currList = new ArrayList<>(); - } - currList.add(bill); - result.put(merchantId, currList); - } - return result; - } - - @Override - public void sendWaitPayBillEmail() { - List> waitBillListForEmail = wxBillAllMapper.getWaitPayBillForEmail(); - - if (CollectionUtils.isNotEmpty(waitBillListForEmail)) { - Map>> merchantMap = toMap(waitBillListForEmail); - for (Long merchantId : merchantMap.keySet()) { - List> mapList = merchantMap.get(merchantId); - if (CollectionUtils.isNotEmpty(mapList)) { - String email = (String) mapList.get(0).get("email"); - if (StringUtils.isBlank(email)) { - continue; - } - String tenantId = (String) mapList.get(0).get("tenantId"); - String parentTenantId = (String) mapList.get(0).get("parentTenantId"); - String receiveDate = (String) mapList.get(0).get("receiveDate"); - String manager = (String) mapList.get(0).get("manager"); - String managerPhone = (String) mapList.get(0).get("managerPhone"); - - TenantEntity tenantEntity = new TenantEntity(); - tenantEntity.setTenantId(tenantId); - tenantEntity.setParentTenantId(parentTenantId); - - String billListStr = ""; - BigDecimal sumNeedPay = new BigDecimal(0); - for (Map bill : mapList) { - String billType = bill.get("billType").toString(); - BigDecimal needPay = (BigDecimal) bill.get("needPay"); - BigDecimal price = needPay.divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); - - sumNeedPay = sumNeedPay.add(price); - billListStr += "
"; - billListStr += "
" + billType + "
"; - billListStr += "
" + price + "
"; - billListStr += "
" + receiveDate + "
"; - billListStr += "
"; - } - //发邮件 - Map map = new HashedMap(); - map.put("price", sumNeedPay.toString()); - map.put("date", receiveDate); - map.put("billList", billListStr); - map.put("linkName", manager == null ? "" : manager); - map.put("linkPhone", managerPhone == null ? "" : managerPhone); - MailMsg mailMsg = new MailMsg(); - mailMsg.setSubject("待缴账单通知"); - mailMsg.setHtml(true); - mailMsg.setMsgType(EnumMsgRecordType.EMAIL.getCode()); - mailMsg.setModelType(EnumMailMsgModel.MAIL_BILL_WAIT_PAY.getCode()); - mailMsg.setModelId(EnumMsgModelId.MAIL_MSG_FLOW.getCode()); - mailMsg.setTo(new String[]{email}); - mailMsg.updateTenantInfo(tenantEntity); - mailMsg.setDynamicContentMap(map); - mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); - } - } - } - } - - @Override - public void sendOweBillForEmail() { - List> oweBillForEmail = wxBillAllMapper.getOweBillForEmail(); - - if (CollectionUtils.isNotEmpty(oweBillForEmail)) { - Map>> merchantMap = toMap(oweBillForEmail); - for (Long merchantId : merchantMap.keySet()) { - List> mapList = merchantMap.get(merchantId); - if (CollectionUtils.isNotEmpty(mapList)) { - String email = (String) mapList.get(0).get("email"); - if (StringUtils.isBlank(email)) { - continue; - } - String tenantId = (String) mapList.get(0).get("tenantId"); - String parentTenantId = (String) mapList.get(0).get("parentTenantId"); - String receiveDate = (String) mapList.get(0).get("receiveDate"); - String manager = (String) mapList.get(0).get("manager"); - String managerPhone = (String) mapList.get(0).get("managerPhone"); - Long expiredDay = (Long) mapList.get(0).get("expiredDay"); - - TenantEntity tenantEntity = new TenantEntity(); - tenantEntity.setTenantId(tenantId); - tenantEntity.setParentTenantId(parentTenantId); - - String billListStr = ""; - BigDecimal sumNeedPay = new BigDecimal(0); - for (Map bill : mapList) { - String billType = bill.get("billType").toString(); - BigDecimal needPay = (BigDecimal) bill.get("owe"); - BigDecimal price = needPay.divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); - - sumNeedPay = sumNeedPay.add(price); - billListStr += "
"; - billListStr += "
"; - billListStr += "
" + billType + "
"; - billListStr += "
" + price + "
"; - billListStr += "
" + receiveDate + "
"; - billListStr += "
" + expiredDay + "
"; - billListStr += "
"; - } - //发邮件 - Map map = new HashedMap(); - map.put("price", sumNeedPay.toString()); - map.put("date", receiveDate); - map.put("billList", billListStr); - map.put("linkName", manager == null ? "" : manager); - map.put("linkPhone", managerPhone == null ? "" : managerPhone); - MailMsg mailMsg = new MailMsg(); - mailMsg.setSubject("欠缴账单通知"); - mailMsg.setHtml(true); - mailMsg.setMsgType(EnumMsgRecordType.EMAIL.getCode()); - mailMsg.setModelId(EnumMsgModelId.MAIL_MSG_FLOW.getCode()); - mailMsg.setModelType(EnumMailMsgModel.MAIL_BILL_OWE.getCode()); - mailMsg.setTo(new String[]{email}); - mailMsg.updateTenantInfo(tenantEntity); - mailMsg.setDynamicContentMap(map); - mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); - } - } - } - - } - - @Override - public Map getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { - PageInfo> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxBillAllMapper.getOweBillAsPage(record)); - List> list = pageInfo.getList(); - for (Map map : list) { - map.put("rentOwe", subZeroAndDot(map.get("rentOwe").toString())); - map.put("bussinessManageOwe", subZeroAndDot(map.get("bussinessManageOwe").toString())); - map.put("operatingManageOwe", subZeroAndDot(map.get("operatingManageOwe").toString())); - map.put("propertyOwe", subZeroAndDot(map.get("propertyOwe").toString())); - map.put("depositOwe", subZeroAndDot(map.get("depositOwe").toString())); - map.put("otherOwe", subZeroAndDot(map.get("otherOwe").toString())); - map.put("totalOwe", subZeroAndDot(map.get("totalOwe").toString())); - } - pageInfo.setList(list); - Map result = new HashMap<>(); - result.put("pageInfo", pageInfo); - return result; - } - +// return s; +// } +// // @Override -// public Map getReceiveAndPayBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { -// Map result = new HashMap<>(); -// record.setLimitStart(0); -// record.setLimitEnd(Integer.MAX_VALUE); -// List totalList = wxBillAllMapper.getReceiveAndPayBillAsPage(record); -// if (CollectionUtils.isEmpty(totalList)) { -// PageHelper.startPage(pageNum, pageSize); -// PageInfo> pageInfo = new PageInfo(new ArrayList()); -// pageInfo.setPages(0); -// pageInfo.setTotal(0); -// PageHelper.clearPage(); -// result.put("pageInfo", pageInfo); -// return result; +// public void exportOweMerchant(WxBillAll record, HttpServletRequest request, HttpServletResponse response) { +// List> data = wxBillAllMapper.getOweBillAsPage(record); +// List list = new ArrayList<>(); +// for (Map map : data) { +// OweMerchantVo oweMerchantVo = new OweMerchantVo(); +// oweMerchantVo.setLinkPerson((String) map.get("manager")); +// oweMerchantVo.setName((String) map.get("merchantName")); +// oweMerchantVo.setLinkPhone((String) map.get("managerPhone")); +// +// oweMerchantVo.setDepositOwe(new BigDecimal(subZeroAndDot(map.get("depositOwe").toString()))); +// oweMerchantVo.setOtherOwe(new BigDecimal(subZeroAndDot(map.get("otherOwe").toString()))); +// oweMerchantVo.setPropertyOwe(new BigDecimal(subZeroAndDot(map.get("propertyOwe").toString()))); +// oweMerchantVo.setRentOwe(new BigDecimal(subZeroAndDot(map.get("rentOwe").toString()))); +// oweMerchantVo.setBussinessManageOwe(new BigDecimal(subZeroAndDot(map.get("bussinessManageOwe").toString()))); +// oweMerchantVo.setOperatingManageOwe(new BigDecimal(subZeroAndDot(map.get("operatingManageOwe").toString()))); +// oweMerchantVo.setTotalOwe(new BigDecimal(subZeroAndDot(map.get("totalOwe").toString()))); +// list.add(oweMerchantVo); // } +// String name = "欠缴商户列表"; +// excelService.exportExcel(list, null, name, OweMerchantVo.class, name + ".xlsx", response, false); +// } // -// int total = totalList.size(); -// int pages; -// if (total % pageSize == 0) { -// pages = total / pageSize; -// } else { -// pages = total / pageSize + 1; +// @Override +// public void exportReceiveAndPayBillAsPage(WxBillAll record, HttpServletRequest request, HttpServletResponse response) { +// List> data = wxBillAllMapper.getReceiveAndPayBillAsPage(record); +// List list = new ArrayList<>(); +// for (Map map : data) { +// ReceivedAndPayVo oweMerchantVo = new ReceivedAndPayVo(); +// oweMerchantVo.setLinkPerson((String) map.get("linkPerson")); +// oweMerchantVo.setName((String) map.get("name")); +// oweMerchantVo.setLinkPhone((String) map.get("linkPhone")); +// oweMerchantVo.setShopNumber((String) map.get("shopNumber")); +// if (EnumRentShopType.POINT.getCode().equals(map.get("type"))) { +// oweMerchantVo.setShopType("多经点位"); +// } else if (EnumRentShopType.SHOP.getCode().equals(map.get("type"))) { +// oweMerchantVo.setShopType("商铺"); +// } +// oweMerchantVo.setReceivePay(map.get("receivePay") == null ? "0" : map.get("receivePay").toString()); +// oweMerchantVo.setPayOut(map.get("payOut") == null ? "0" : map.get("payOut").toString()); +// oweMerchantVo.setBalance(map.get("balance") == null ? "0" : map.get("balance").toString()); +// list.add(oweMerchantVo); // } -// record.setLimitStart((pageNum - 1) * pageSize); -// record.setLimitEnd(pageSize); -// List> list = wxBillAllMapper.getReceiveAndPayBillAsPage(record); -// -// PageHelper.startPage(pageNum, pageSize); -// PageInfo> pageInfo = new PageInfo(list); -// pageInfo.setPages(pages); -// pageInfo.setTotal(total); -// PageHelper.clearPage(); -// result.put("pageInfo", pageInfo); -// return result; +// String name = "商户账单列表"; +// excelService.exportExcel(list, null, name, ReceivedAndPayVo.class, name + ".xlsx", response, false); // } - - @Override - public PageInfo getReceiveAndPayBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { - PageInfo pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxBillAllMapper.getReceiveAndPayBillAsPage(record)); - return pageInfo; - } - - /** - * 使用java正则表达式去掉多余的.与0 - * - * @param s - * @return - */ - public static String subZeroAndDot(String s) { - if (s.indexOf(".") > 0) { - s = s.replaceAll("0+?$", "");//去掉多余的0 - s = s.replaceAll("[.]$", "");//如最后一位是.则去掉 - } - return s; - } - - @Override - public void exportOweMerchant(WxBillAll record, HttpServletRequest request, HttpServletResponse response) { - List> data = wxBillAllMapper.getOweBillAsPage(record); - List list = new ArrayList<>(); - for (Map map : data) { - OweMerchantVo oweMerchantVo = new OweMerchantVo(); - oweMerchantVo.setLinkPerson((String) map.get("manager")); - oweMerchantVo.setName((String) map.get("merchantName")); - oweMerchantVo.setLinkPhone((String) map.get("managerPhone")); - - oweMerchantVo.setDepositOwe(new BigDecimal(subZeroAndDot(map.get("depositOwe").toString()))); - oweMerchantVo.setOtherOwe(new BigDecimal(subZeroAndDot(map.get("otherOwe").toString()))); - oweMerchantVo.setPropertyOwe(new BigDecimal(subZeroAndDot(map.get("propertyOwe").toString()))); - oweMerchantVo.setRentOwe(new BigDecimal(subZeroAndDot(map.get("rentOwe").toString()))); - oweMerchantVo.setBussinessManageOwe(new BigDecimal(subZeroAndDot(map.get("bussinessManageOwe").toString()))); - oweMerchantVo.setOperatingManageOwe(new BigDecimal(subZeroAndDot(map.get("operatingManageOwe").toString()))); - oweMerchantVo.setTotalOwe(new BigDecimal(subZeroAndDot(map.get("totalOwe").toString()))); - list.add(oweMerchantVo); - } - String name = "欠缴商户列表"; - excelService.exportExcel(list, null, name, OweMerchantVo.class, name + ".xlsx", response, false); - } - - @Override - public void exportReceiveAndPayBillAsPage(WxBillAll record, HttpServletRequest request, HttpServletResponse response) { - List> data = wxBillAllMapper.getReceiveAndPayBillAsPage(record); - List list = new ArrayList<>(); - for (Map map : data) { - ReceivedAndPayVo oweMerchantVo = new ReceivedAndPayVo(); - oweMerchantVo.setLinkPerson((String) map.get("linkPerson")); - oweMerchantVo.setName((String) map.get("name")); - oweMerchantVo.setLinkPhone((String) map.get("linkPhone")); - oweMerchantVo.setShopNumber((String) map.get("shopNumber")); - if (EnumRentShopType.POINT.getCode().equals(map.get("type"))) { - oweMerchantVo.setShopType("多经点位"); - } else if (EnumRentShopType.SHOP.getCode().equals(map.get("type"))) { - oweMerchantVo.setShopType("商铺"); - } - oweMerchantVo.setReceivePay(map.get("receivePay") == null ? "0" : map.get("receivePay").toString()); - oweMerchantVo.setPayOut(map.get("payOut") == null ? "0" : map.get("payOut").toString()); - oweMerchantVo.setBalance(map.get("balance") == null ? "0" : map.get("balance").toString()); - list.add(oweMerchantVo); - } - String name = "商户账单列表"; - excelService.exportExcel(list, null, name, ReceivedAndPayVo.class, name + ".xlsx", response, false); - } - - @Override - public void exportWaitMerchant(WxBillAll record, HttpServletRequest request, HttpServletResponse response) { - List> data = wxBillAllMapper.getOweBillAsPage(record); - List list = new ArrayList<>(); - for (Map map : data) { - WaitMerchantVo oweMerchantVo = new WaitMerchantVo(); - oweMerchantVo.setLinkPerson((String) map.get("manager")); - oweMerchantVo.setName((String) map.get("merchantName")); - oweMerchantVo.setLinkPhone((String) map.get("managerPhone")); - - oweMerchantVo.setRentReceivePay(new BigDecimal(subZeroAndDot(map.get("rentReceivePay").toString()))); - oweMerchantVo.setPropertyReceivePay(new BigDecimal(subZeroAndDot(map.get("propertyReceivePay").toString()))); - oweMerchantVo.setDepositReceivePay(new BigDecimal(subZeroAndDot(map.get("depositReceivePay").toString()))); - oweMerchantVo.setOtherReceivePay(new BigDecimal(subZeroAndDot(map.get("otherReceivePay").toString()))); - oweMerchantVo.setTotalReceivePay(new BigDecimal(subZeroAndDot(map.get("totalReceivePay").toString()))); - list.add(oweMerchantVo); - } - String name = "待缴商户列表"; - excelService.exportExcel(list, null, name, WaitMerchantVo.class, name + ".xlsx", response, false); - } - - @Override - public List allDepositList(WxBillAll wxBillAll) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillAll); - List wxBillAllVos = wxBillAllMapper.allDepositList(wxBillAll); - wxBillAllVos.stream().forEach(e -> { - cmputeTotalMoney(wxPayAccountBill, e); - }); - return wxBillAllVos; - } - - @Override - public Double calcuteSettleBillReceivePay(Long settleId) { - List billIds0 = wxBillSettleScheduleMapper.listBillSettleBillBillId(settleId, 0); - Double pay0 = 0D; - if (null != billIds0 && billIds0.size() > 0 ) { - WxBillRent billRent = new WxBillRent(); - billRent.setIds(billIds0); - Double billRent0 = wxBillSettleScheduleMapper.calculteRentRecivePay(billRent);//租金 - Double billRentDeposit0 = wxBillSettleScheduleMapper.calculteRentDepositRecivePay(billRent);//租金押金 - - WxBillProperty billProperty = new WxBillProperty(); - billProperty.setIds(billIds0); - Double billProperty0 = wxBillSettleScheduleMapper.calcultePropertyRecivePay(billProperty);//物业 - Double billPropertyDeposit0 = wxBillSettleScheduleMapper.calcultePropertyDepositRecivePay(billProperty);//物业押金 - - WxBillDaily billDaily = new WxBillDaily(); - billDaily.setIds(billIds0); - Double billDaily0 = wxBillSettleScheduleMapper.calculteDailyRecivePay(billDaily); - - WxBillOther billOther = new WxBillOther(); - billOther.setIds(billIds0); - Double billOther0 = wxBillSettleScheduleMapper.calculteOtherRecivePay0(billOther); - Double billOtherDeposit0 = wxBillSettleScheduleMapper.calculteOtherDepositRecivePay0(billOther); - pay0 = billRent0+billRentDeposit0+billProperty0+billPropertyDeposit0+billDaily0+billOther0+billOtherDeposit0; - } - - List billIds1 = wxBillSettleScheduleMapper.listBillSettleBillBillId(settleId, 1); - Double pay1 = 0D; - if (null != billIds1 && billIds1.size() > 0 ) { - WxBillRent billRent = new WxBillRent(); - billRent.setIds(billIds1); - Double billRent1 = wxBillSettleScheduleMapper.calculteRentRecivePay(billRent);//租金 - Double billRentDeposit1 = wxBillSettleScheduleMapper.calculteRentDepositRecivePay(billRent);//租金押金 - - WxBillProperty billProperty = new WxBillProperty(); - billProperty.setIds(billIds1); - Double billProperty1 = wxBillSettleScheduleMapper.calcultePropertyRecivePay(billProperty);//物业 - Double billPropertyDeposit1 = wxBillSettleScheduleMapper.calcultePropertyDepositRecivePay(billProperty);//物业押金 - - WxBillDaily billDaily = new WxBillDaily(); - billDaily.setIds(billIds1); - Double billDaily1 = wxBillSettleScheduleMapper.calculteDailyRecivePay(billDaily); - - WxBillOther billOther = new WxBillOther(); - billOther.setIds(billIds1); - Double billOther1 = wxBillSettleScheduleMapper.calculteOtherRecivePay1(billOther); - Double billOtherDeposit1 = wxBillSettleScheduleMapper.calculteOtherDepositRecivePay0(billOther); - - WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); - merchantSubsidy.setIds(billIds1); - Double billMerchantSubsidy1 = wxBillSettleScheduleMapper.calculteMerchantSubsidyRecivePay1(merchantSubsidy); - - pay1 = billRent1+billRentDeposit1+billProperty1+billPropertyDeposit1+billDaily1+billOther1+billOtherDeposit1+billMerchantSubsidy1; - } - return pay0-pay1; - } - - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - @Override - public void createBillSettleSchedule(Long settleId, Double settleReceivePay) { - wxBillSettleScheduleMapper.createScheduleFromBillSettle(settleId, settleReceivePay); - wxBillSettleMapper.updateRecorded(settleId); - } +// +// @Override +// public void exportWaitMerchant(WxBillAll record, HttpServletRequest request, HttpServletResponse response) { +// List> data = wxBillAllMapper.getOweBillAsPage(record); +// List list = new ArrayList<>(); +// for (Map map : data) { +// WaitMerchantVo oweMerchantVo = new WaitMerchantVo(); +// oweMerchantVo.setLinkPerson((String) map.get("manager")); +// oweMerchantVo.setName((String) map.get("merchantName")); +// oweMerchantVo.setLinkPhone((String) map.get("managerPhone")); +// +// oweMerchantVo.setRentReceivePay(new BigDecimal(subZeroAndDot(map.get("rentReceivePay").toString()))); +// oweMerchantVo.setPropertyReceivePay(new BigDecimal(subZeroAndDot(map.get("propertyReceivePay").toString()))); +// oweMerchantVo.setDepositReceivePay(new BigDecimal(subZeroAndDot(map.get("depositReceivePay").toString()))); +// oweMerchantVo.setOtherReceivePay(new BigDecimal(subZeroAndDot(map.get("otherReceivePay").toString()))); +// oweMerchantVo.setTotalReceivePay(new BigDecimal(subZeroAndDot(map.get("totalReceivePay").toString()))); +// list.add(oweMerchantVo); +// } +// String name = "待缴商户列表"; +// excelService.exportExcel(list, null, name, WaitMerchantVo.class, name + ".xlsx", response, false); +// } +// +// @Override +// public List allDepositList(WxBillAll wxBillAll) { +// WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillAll); +// List wxBillAllVos = wxBillAllMapper.allDepositList(wxBillAll); +// wxBillAllVos.stream().forEach(e -> { +// cmputeTotalMoney(wxPayAccountBill, e); +// }); +// return wxBillAllVos; +// } +// +// @Override +// public Double calcuteSettleBillReceivePay(Long settleId) { +// List billIds0 = wxBillSettleScheduleMapper.listBillSettleBillBillId(settleId, 0); +// Double pay0 = 0D; +// if (null != billIds0 && billIds0.size() > 0 ) { +// WxBillRent billRent = new WxBillRent(); +// billRent.setIds(billIds0); +// Double billRent0 = wxBillSettleScheduleMapper.calculteRentRecivePay(billRent);//租金 +// Double billRentDeposit0 = wxBillSettleScheduleMapper.calculteRentDepositRecivePay(billRent);//租金押金 +// +// WxBillProperty billProperty = new WxBillProperty(); +// billProperty.setIds(billIds0); +// Double billProperty0 = wxBillSettleScheduleMapper.calcultePropertyRecivePay(billProperty);//物业 +// Double billPropertyDeposit0 = wxBillSettleScheduleMapper.calcultePropertyDepositRecivePay(billProperty);//物业押金 +// +// WxBillDaily billDaily = new WxBillDaily(); +// billDaily.setIds(billIds0); +// Double billDaily0 = wxBillSettleScheduleMapper.calculteDailyRecivePay(billDaily); +// +// WxBillOther billOther = new WxBillOther(); +// billOther.setIds(billIds0); +// Double billOther0 = wxBillSettleScheduleMapper.calculteOtherRecivePay0(billOther); +// Double billOtherDeposit0 = wxBillSettleScheduleMapper.calculteOtherDepositRecivePay0(billOther); +// pay0 = billRent0+billRentDeposit0+billProperty0+billPropertyDeposit0+billDaily0+billOther0+billOtherDeposit0; +// } +// +// List billIds1 = wxBillSettleScheduleMapper.listBillSettleBillBillId(settleId, 1); +// Double pay1 = 0D; +// if (null != billIds1 && billIds1.size() > 0 ) { +// WxBillRent billRent = new WxBillRent(); +// billRent.setIds(billIds1); +// Double billRent1 = wxBillSettleScheduleMapper.calculteRentRecivePay(billRent);//租金 +// Double billRentDeposit1 = wxBillSettleScheduleMapper.calculteRentDepositRecivePay(billRent);//租金押金 +// +// WxBillProperty billProperty = new WxBillProperty(); +// billProperty.setIds(billIds1); +// Double billProperty1 = wxBillSettleScheduleMapper.calcultePropertyRecivePay(billProperty);//物业 +// Double billPropertyDeposit1 = wxBillSettleScheduleMapper.calcultePropertyDepositRecivePay(billProperty);//物业押金 +// +// WxBillDaily billDaily = new WxBillDaily(); +// billDaily.setIds(billIds1); +// Double billDaily1 = wxBillSettleScheduleMapper.calculteDailyRecivePay(billDaily); +// +// WxBillOther billOther = new WxBillOther(); +// billOther.setIds(billIds1); +// Double billOther1 = wxBillSettleScheduleMapper.calculteOtherRecivePay1(billOther); +// Double billOtherDeposit1 = wxBillSettleScheduleMapper.calculteOtherDepositRecivePay0(billOther); +// +// WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); +// merchantSubsidy.setIds(billIds1); +// Double billMerchantSubsidy1 = wxBillSettleScheduleMapper.calculteMerchantSubsidyRecivePay1(merchantSubsidy); +// +// pay1 = billRent1+billRentDeposit1+billProperty1+billPropertyDeposit1+billDaily1+billOther1+billOtherDeposit1+billMerchantSubsidy1; +// } +// return pay0-pay1; +// } +// +// @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) +// @Override +// public void createBillSettleSchedule(Long settleId, Double settleReceivePay) { +// wxBillSettleScheduleMapper.createScheduleFromBillSettle(settleId, settleReceivePay); +// wxBillSettleMapper.updateRecorded(settleId); +// } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java deleted file mode 100644 index 4436958c7..000000000 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java +++ /dev/null @@ -1,772 +0,0 @@ -package com.iformall.service.impl; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillAction; -import com.iformall.domain.po.WxBillDaily; -import com.iformall.domain.po.WxBillPayWay; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.domain.po.WxShop; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillDailyExportVo; -import com.iformall.domain.vo.WxBillDailyVo; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillAction; -import com.iformall.enums.EnumBillStatus; -import com.iformall.enums.EnumDelStatus; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.WxBillDailyMapper; -import com.iformall.mapper.WxMerchantMapper; -import com.iformall.mapper.WxMerchantShopMapper; -import com.iformall.mapper.WxShopMapper; -import com.iformall.service.ExcelService; -import com.iformall.service.WxBillActionService; -import com.iformall.service.WxBillDailyService; -import com.iformall.service.WxFinanceService; -import com.iformall.service.WxMerchantService; -import com.iformall.service.WxPayAccountBillService; -import com.iformall.service.WxShopService; -import com.iformall.service.helper.WxBillAllHelper; -import com.iformall.utils.Constant; -import com.iformall.utils.DateUtils; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; - -/** - */ -@Service -public class WxBillDailyServiceImpl extends WxBillBaseService implements WxBillDailyService { - private Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - WxBillDailyMapper wxBillDailyMapper; - - @Autowired - WxShopMapper wxShopMapper; - @Autowired - WxBillActionService wxBillActionService; - @Autowired - ExcelService excelService; - @Autowired - StringRedisTemplate stringRedisTemplate; - @Autowired - WxMerchantShopMapper wxMerchantShopMapper; - @Autowired - WxMerchantMapper wxMerchantMapper; - @Autowired - WxPayAccountBillService wxPayAccountBillService; - - @Lazy - @Autowired - WxMerchantService wxMerchantService; - - @Lazy - @Autowired - WxBillAllHelper wxBillAllHelper; - - @Lazy - @Autowired - WxFinanceService wxFinanceService; - - @Lazy - @Autowired - WxShopService wxShopService; - - @Override - public PageInfo listAsPage(WxBillDaily record, Integer pageIndex, Integer pageSize) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - return getBillRentPropertyList(pageIndex, pageSize, record, wxPayAccountBill); - } - - @Override - public List list(WxBillDaily record) { - updateQueryParam(record); - return wxBillDailyMapper.queryBillDailyList(record); - } - - @Override - public List notifyList(WxBillDaily record) { - updateQueryParam(record); - return wxBillDailyMapper.getBillNotifyList(record); - } - - private void updateQueryParam(WxBillDaily record) { - if (null != record.getFloorForRule() || null != record.getFloor() || null != record.getBuilding()) { - List merchantIds = wxMerchantService.getFloorBuildMerchantIds(record, record.getFloorForRule(), record.getBuilding(), record.getFloor(), 0, 0); - if (null != merchantIds) { - record.setMerchantIds(merchantIds); - }else { - record.setId(-1L); - } - } - - if (StringUtils.isNotBlank(record.getMerchantName())) { - WxMerchant mq = new WxMerchant(); - mq.updateTenantInfo(record); - mq.setName(StringUtils.trimToNull(record.getMerchantName())); - List mids = wxMerchantService.findIdList(mq); - if (null != mids && mids.size() > 0 ) { - if (null != record.getMerchantIds()) { - List _mids = (List) CollectionUtils.intersection(mids, record.getMerchantIds()); - if (null == _mids || _mids.size() <= 0) { - record.setId(-1L); - }else { - record.setMerchantIds(_mids); - } - }else { - record.setMerchantIds(mids); - } - }else { - record.setId(-1L); - } - } - } - - private PageInfo getBillRentPropertyList(Integer pageIndex, Integer pageSize,WxBillDaily record,WxPayAccountBill wxPayAccountBill) { - updateQueryParam(record); - PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillDailyMapper.queryBillDailyList(record)); - if (null == page) { - return null; - } - - WxMerchant wq = new WxMerchant(); - wq.updateTenantInfo(record); - Map merchantMap = wxMerchantService.findMerchantMap(wq); - - if (null != page.getList()) { - for (int i = 0 ; i < page.getList().size() ; i ++) { - WxBillDaily e = page.getList().get(i); - //手续费 = 合同应收+手续费+滞纳金 - computeTotalMoney(wxPayAccountBill, e); - - if (null != e.getMerchantId() && null != merchantMap ) { - WxMerchant m = merchantMap.get(e.getMerchantId()); - if (null != m ) { - e.setMerchantName(m.getName()); - } - } - } - } - - return page; - } - - public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillDaily e) { - if (e.getReceivePay() != null) { - BigDecimal servicePay; - if (e.getServiceChargePay() != null) { - servicePay = new BigDecimal(e.getServiceChargePay()); - } else { - servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(100), Constant.default_long_decimal_size, BigDecimal.ROUND_HALF_UP); - } - BigDecimal realReceivePay = servicePay.add(new BigDecimal(e.getReceivePay())); - e.setRealReceivePay(realReceivePay.toPlainString()); - e.setServiceChargePay(servicePay.toPlainString()); -// if (!e.getStatus().equals(EnumBillStatus.NOT_PAID.getCode())) { -// //e.setOwe("0"); -// } else { -// //e.setOwe(realReceivePay.subtract(new BigDecimal(e.getPay())).toPlainString()); -// //e.setOwe(new BigDecimal(e.getReceivePay()).subtract(new BigDecimal(e.getPay())).toPlainString()); -// } - } - } - - @Override - public void updateBillStatus(WxBillDaily record) { -// logger.info("更新日常账单状态开始..."); -// //更新逾期天数及状态 -// updateNotPaidStatus(record); -// //更新待缴的状态 -// updateWaidPayStatus(record); -// logger.info("更新日常账单状态结束..."); - } - - @Transactional(rollbackFor = {Exception.class}) - public void updateWaidPayStatus(WxBillDaily record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// if (StringUtils.isNotBlank(record.getParentTenantId())) { -// params.put("parentTenantId", record.getParentTenantId()); -// } -// params.put("waitPay", EnumBillStatus.WAIT_PAY.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// try { -// wxBillDailyMapper.updateWaitPayStatus(params); -// } catch (Exception e) { -// logger.error("更新日常待缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } - } - - - @Transactional(rollbackFor = {Exception.class}) - public void updateNotPaidStatus(WxBillDaily record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// if (StringUtils.isNotBlank(record.getParentTenantId())) { -// params.put("parentTenantId", record.getParentTenantId()); -// } -// params.put("notPaid", EnumBillStatus.NOT_PAID.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// try { -// wxBillDailyMapper.updateNotPaidStatus(params); -// } catch (Exception e) { -// logger.error("更新日常欠缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } - } - - @Override - public WxBillDaily getById(TenantEntity tenantEntity,Long id) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(tenantEntity); - WxBillDaily record = new WxBillDaily(); - record.setId(id); - record.updateTenantInfo(tenantEntity); - WxBillDaily wxBillDaily = getBillRentPropertyList(1, 1, record, wxPayAccountBill).getList().get(0); - //wxBillDaily.setOwe(new BigDecimal(wxBillDaily.getRealReceivePay()).subtract(new BigDecimal(wxBillDaily.getPay())).toPlainString()); - //wxBillDaily.setOwe(new BigDecimal(wxBillDaily.getReceivePay()).subtract(new BigDecimal(wxBillDaily.getPay())).toPlainString()); - wxBillDaily.setMerchant(wxMerchantMapper.selectById(wxBillDaily.getMerchantId())); -// if (wxBillDaily.getShopId() != null) { -// WxShop shop = new WxShop(); -// shop.setId(wxBillDaily.getShopId()); -// List> shoplist = wxShopMapper.findListMap(shop); -// wxBillDaily.setShops(shoplist); -// }else{ -// wxBillDaily.setShops(Collections.EMPTY_LIST); -// } - return wxBillDaily; - } - - @Override - public ResultData saveOrUpdate(WxBillDaily record, MallUserInfo user) { - //String receivepay = StringUtils.isBlank(record.getRealReceivePay()) ? "0" : record.getRealReceivePay(); - String receivepay = StringUtils.isBlank(record.getReceivePay()) ? "0" : record.getReceivePay(); - String pay = StringUtils.isBlank(record.getPay()) ? "0" : record.getPay(); - if(new BigDecimal(pay).compareTo(new BigDecimal(receivepay)) > 0 ){ - return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "实收金额不能大于实际应收总金额"); - } - Date date = new Date(); - if (record.getId() == null) { - logger.info("新增日常账单"); - WxBillDaily dailyQuery = new WxBillDaily(); - dailyQuery.setType(record.getType()); - dailyQuery.updateTenantInfo(user); - dailyQuery.setMerchantId(record.getMerchantId()); - //dailyQuery.setReceiveDate(record.getReceiveDate()); - dailyQuery.setStarttime(record.getStarttime()); - dailyQuery.setEndtime(record.getEndtime()); - dailyQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - List dailyList = wxBillDailyMapper.findList(dailyQuery); - if (null != dailyList && dailyList.size() > 0 ) { - return new ResultData(ErrorCode.BILL_IS_FOUND.getCode(),"商户已存在包含该时间端的费用账单"); - } - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - //record.setStatus(record.getReceiveDate().after(date)?EnumBillStatus.WAIT_PAY.getCode():EnumBillStatus.NOT_PAID.getCode()); - record.setStatus(EnumBillStatus.WAIT_PAY.getCode()); - record.setCreatetime(date); - record.setCreateBy(user.getId()); - record.setCreateByName(user.getName()); - record.setUpdatetime(date); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - record.setExpiredDay(0L); - record.updateTenantInfo(user); - //record.setOwe(new BigDecimal(record.getRealReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); - //record.setOwe(new BigDecimal(record.getReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); - record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - try { - wxBillDailyMapper.insert(record); - } catch (Exception e) { - logger.error("保存日常账单失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - return new ResultData(Result.SUCCESS, "保存日常账单成功"); - } else { - WxBillDaily wxBillDaily = wxBillDailyMapper.selectById(record.getId(),user.getTenantId()); - if(wxBillDaily==null){ - return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); - } - WxBillDaily dailyQuery = new WxBillDaily(); - dailyQuery.setType(record.getType()); - dailyQuery.updateTenantInfo(user); - dailyQuery.setMerchantId(record.getMerchantId()); - //dailyQuery.setReceiveDate(record.getReceiveDate()); - dailyQuery.setStarttime(record.getStarttime()); - dailyQuery.setEndtime(record.getEndtime()); - dailyQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - List notinidlist = new ArrayList(); - notinidlist.add(record.getId()); - dailyQuery.setNotInIds(notinidlist); - List dailyList = wxBillDailyMapper.findList(dailyQuery); - if (null != dailyList && dailyList.size() > 0 ) { - return new ResultData(ErrorCode.BILL_IS_FOUND.getCode(),"商户已存在其他包含该时间端的费用账单"); - } - wxBillDaily.setUpdatetime(date); - wxBillDaily.setUpdateBy(user.getId()); - wxBillDaily.setRemark(record.getRemark()); - wxBillDailyMapper.updateById(wxBillDaily); - return new ResultData(Result.SUCCESS, "更新日常账单成功"); - } - } - - @Override - public void deleteById(TenantEntity tenantEntity,Long id) { - wxBillDailyMapper.deleteById(id,tenantEntity.getTenantId()); - } - -// @Transactional(rollbackFor = {Exception.class}) -// @Override -// public ResultData updatePaid(Long id) { -// WxBillDaily wxBillDaily = wxBillDailyMapper.selectById(id); -// if(wxBillDaily==null){ -// return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); -// } -// wxBillDaily.setStatus(EnumBillStatus.PAID.getCode()); -// Date d =new Date(); -// wxBillDaily.setPayDate(d); -// wxBillDaily.setUpdatetime(d); -// try { -// wxBillDailyMapper.updateById(wxBillDaily); -// } catch (Exception e) { -// logger.error("日常账单结单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(),e.getMessage()); -// } -// return new ResultData(Result.SUCCESS, "日常账单结单成功"); -// } - - @Override - public void exportTemplate(HttpServletRequest request, HttpServletResponse response, MallUserInfo user) { - List list = new ArrayList<>(); - WxBillDailyVo v1 = new WxBillDailyVo(); - WxBillDailyVo v2 = new WxBillDailyVo(); - - v1.setShopNumber("A0001"); - v1.setType(1); - v1.setReceivePayStr("1"); - v1.setPayStr("0"); - v1.setReceiveDate(new Date()); - v1.setExpiredDay(0L); - v1.setRentShopType(1); - list.add(v1); - - v2.setShopNumber("A0002"); - v2.setType(2); - v2.setReceivePayStr("1000"); - v2.setPayStr("0"); - v2.setReceiveDate(new Date()); - v2.setExpiredDay(0L); - v2.setRentShopType(2); - list.add(v2); - - excelService.exportExcel(list, null, "水电费模板", WxBillDailyVo.class, "水电费模板.xlsx", response, true); - - } - - @Override - public void insertData(WxBillDailyVo billDaily, String importKey, MallUserInfo user) { -// Integer type = billDaily.getType(); -// WxBillDaily wxBillDaily = new WxBillDaily(); -// String receivePay = billDaily.getReceivePay(); -// wxBillDaily.setReceivePay(receivePay); -// String pay = billDaily.getPay(); -// wxBillDaily.setPay(pay); -// //wxBillDaily.setOwe(new BigDecimal(receivePay).subtract(new BigDecimal(pay)).toPlainString()); -// wxBillDaily.setType(type); -// Date receiveDate = billDaily.getReceiveDate(); -// wxBillDaily.setReceiveDate(receiveDate); -// Date date = new Date(); -// if (new BigDecimal(pay).compareTo(new BigDecimal(0)) > 0) { -// wxBillDaily.setPayDate(date); -// } -// int expiredDay = DateUtils.daysBetween(receiveDate, date); -// wxBillDaily.setExpiredDay(0L); -// if (expiredDay > 0) { -// wxBillDaily.setStatus(EnumBillStatus.NOT_PAID.getCode()); -// wxBillDaily.setExpiredDay((long) expiredDay); -// } else { -// wxBillDaily.setStatus(EnumBillStatus.WAIT_PAY.getCode()); -// } -// if (receivePay.equals(pay)) { -// wxBillDaily.setStatus(EnumBillStatus.PAID.getCode()); -// } -// -// wxBillDaily.setUserId(user.getId()); -// wxBillDaily.setShopId(billDaily.getShopId()); -// wxBillDaily.setRentShopType(billDaily.getRentShopType()); -// -// wxBillDaily.setPayWay(EnumBillPayWay.OTHER.getCode()); -// wxBillDaily.setCreatetime(date); -// wxBillDaily.setUpdatetime(date); -// wxBillDaily.setIsDel(EnumDelStatus.NOT_DEL.getCode()); -// wxBillDaily.updateTenantInfo(user); -// //商户 -// WxMerchantShop merchantShop = new WxMerchantShop(); -// merchantShop.setShopId(billDaily.getShopId()); -// merchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); -// WxMerchantShop wxMerchantShop = wxMerchantShopMapper.selectOne(new QueryWrapper<>(merchantShop)); -// wxBillDaily.setMerchantId(wxMerchantShop.getMerchantId()); -// -// final IdWorker idWorker = IdWorker.get(); -// wxBillDaily.setId(idWorker.nextId()); -// wxBillDailyMapper.insert(wxBillDaily); -// -// //记数 -// stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); -// stringRedisTemplate.expire(importKey, 10, TimeUnit.SECONDS); - } - - @Override - public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillDaily record) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - PageInfo billDailyList = getBillRentPropertyList(1, 10000, record, wxPayAccountBill); - List datalist = new ArrayList<>(); - if (null != billDailyList && null != billDailyList.getList()) { - WxBillDailyExportVo wxBillDailyExportVo; - for (int i = 0, size = billDailyList.getList().size(); i < size; i++) { - WxBillDaily b = billDailyList.getList().get(i); - wxBillDailyExportVo = new WxBillDailyExportVo(); - wxBillDailyExportVo.setShopNumber(b.getShopName()); - wxBillDailyExportVo.setMerchantName(b.getMerchantName()); - wxBillDailyExportVo.setReceivePay(b.getRealReceivePay()); - wxBillDailyExportVo.setPay(b.getPay()); - //wxBillDailyExportVo.setOwe(b.getOwe()); - wxBillDailyExportVo.setReceiveDate(b.getReceiveDate()); - wxBillDailyExportVo.setPayDate(b.getPayDate()); - wxBillDailyExportVo.setExpiredDay(b.getExpiredDay()); - wxBillDailyExportVo.setStatus(b.getStatus()); - wxBillDailyExportVo.setType(b.getType()); - wxBillDailyExportVo.setCreatetime(b.getCreatetime()); - datalist.add(wxBillDailyExportVo); - } - } - - excelService.exportExcel(datalist, null, "日常费用账单", WxBillDailyExportVo.class, "日常费用账单.xlsx", response, false); - } - - @Override - public WxBillSum getBillMonthSum(WxBillDaily record) { - updateQueryParam(record); - return wxBillDailyMapper.getBillMonthSum(record); - } - - @Override - public List getMerchantIds(WxBillDaily record) { - updateQueryParam(record); - return wxBillDailyMapper.getMerchantIdList(record); - } - - @Override - public WxBillHotNotify getBillHotNotify(WxBillDaily record) { - updateQueryParam(record); - return wxBillDailyMapper.getBillHotNotify(record); - } - - @Override - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid) { - WxBillDaily dbBill = wxBillDailyMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillDaily wxBillDaily = new WxBillDaily(); - wxBillDaily.setId(dto.getId()); - wxBillDaily.updateTenantInfo(dto); - wxBillDaily.setUpdatetime(new Date()); - wxBillDaily.setUpdateBy(user.getId()); - wxBillDaily.setUpdateByName(user.getName()); - if (forcePaid) { - wxBillDaily.setReceivePay(dbBill.getPay()); - wxBillDaily.setStatus(EnumBillStatus.PAID.getCode()); - String remark = StringUtils.trimToEmpty(dto.getRemark())+ ";【系统】账单被强制为支付完成,自动归结为结清。"; - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), dbBill.getPay(), - dbBill.getPay(),null,null,null, remark,null,null, user); - }else { - if (StringUtils.isNotBlank(dto.getOldLatePrice()) && StringUtils.isNotBlank(dto.getNewLatePrice())) { - wxBillDaily.setLatePayPrice(dto.getNewLatePrice()); - wxBillDailyMapper.updateById(wxBillDaily); - this.addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, dto.getBillTypeValue(), dto.getId(), - dto.getOldLatePrice(), dto.getNewLatePrice(),null,null,null,dto.getRemark(),null,null, 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,null,null,dto.getRemark(),null,null, user); - } else { - //租赁账单更新 - wxBillDaily.setReceivePay(dto.getNewPrice()); - Date payDate = null; - WxBillPayWay payWay = null; - String remark = StringUtils.trimToEmpty(dto.getRemark()); - if (new BigDecimal(dto.getNewPrice()).compareTo(new BigDecimal(dbBill.getPay())) <= 0) { - wxBillDaily.setStatus(EnumBillStatus.PAID.getCode()); - payDate = new Date(); - payWay = wxFinanceService.getPayWayById(dto, Constant.bill_pay_way_system); - remark = remark + ";【系统】账单实际应付金额调整至小于等于已付金额,自动归结为结清。"; - } - wxBillDailyMapper.updateById(wxBillDaily); - //账单日志 - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), - dto.getOldPrice(), dto.getNewPrice(),null,payDate, payWay,remark,null,null, user); - } - } - } - - @Override - public void notify(WxBillPayDTO dto, MallUserInfo user) { - WxBillDaily wxBillRent = new WxBillDaily(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setLastOweCallTime(new Date()); - wxBillRent.setLastOweCallUser(user.getName()+"(账号:"+user.getUsername()+")"); - wxBillDailyMapper.updateById(wxBillRent); - this.addBillAction(EnumBillAction.NOTIFY, dto.getBillTypeValue(),dto.getId(), - null, null,null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void backPay(WxBillPayDTO dto, MallUserInfo user) { - WxBillDaily dbBill = wxBillDailyMapper.selectById(dto.getId(),dto.getTenantId()); - BigDecimal oldpay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - oldpay = new BigDecimal(dbBill.getPay()); - } - BigDecimal oldsetoff = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getSetOff())) { - oldsetoff = new BigDecimal(dbBill.getSetOff()); - } - WxBillDaily wxBillRent = new WxBillDaily(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); - wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); - if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { - if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { - wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); - } - } - wxBillDailyMapper.updateById(wxBillRent); - EnumBillAction action = EnumBillAction.RETURN; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void updatePay(WxBillPayDTO dto, MallUserInfo user) { - WxBillDaily wxBillRent = updateBillPay(dto); - EnumBillAction action = EnumBillAction.OFFLINE_PAY; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(), dto.getRemark(),null,null, user); - } - - private WxBillDaily updateBillPay(WxBillPayDTO dto) { - WxBillDaily dbBill = wxBillDailyMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillDaily wxBillRent = new WxBillDaily(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - BigDecimal opay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - opay = new BigDecimal(dbBill.getPay()); - } - - //支付的金额先扣除手续费和滞纳金,多余的再抵扣本金 - String servicePay = dbBill.getServiceChargePay(); - if (StringUtils.isBlank(servicePay)) { - servicePay = "0"; - } - StringBuffer sb = new StringBuffer(StringUtils.trimToEmpty(dto.getRemark())); - BigDecimal serviceLastMoney = new BigDecimal(dto.getAddpay()).add(new BigDecimal(dto.getSetOff())).subtract(new BigDecimal(servicePay)); - if (new BigDecimal(servicePay).compareTo(new BigDecimal(0)) > 0 ) { - if (serviceLastMoney.compareTo(new BigDecimal(0)) >= 0 ) { - wxBillRent.setServiceChargePay("0"); - sb.append(";手续费").append(servicePay).append("已结清"); - }else { - wxBillRent.setServiceChargePay(dto.getAddpay()); - sb.append(";手续费").append(servicePay).append("已支付").append(dto.getAddpay()); - } - } - - BigDecimal latePayLastMoney = new BigDecimal(0); - if (serviceLastMoney.compareTo(new BigDecimal(0)) > 0 ) { - String latePay = dbBill.getLatePayPrice(); - if (StringUtils.isBlank(latePay)) { - latePay = "0"; - } - latePayLastMoney = serviceLastMoney.subtract(new BigDecimal(latePay)); - if (new BigDecimal(latePay).compareTo(new BigDecimal(0)) > 0 ) { - if (latePayLastMoney.compareTo(new BigDecimal(0)) >= 0 ) { - wxBillRent.setLatePayPrice("0"); - sb.append(";滞纳金").append(latePay).append("已结清"); - }else { - String lp = new BigDecimal(latePay).subtract(serviceLastMoney).toPlainString(); - wxBillRent.setLatePayPrice(lp); - sb.append(";滞纳金").append(latePay).append("已支付").append(lp); - } - } - } - - if (latePayLastMoney.compareTo(new BigDecimal(0)) > 0 ) { - opay = opay.add(latePayLastMoney); - wxBillRent.setPay(opay.toPlainString()); - //如果付款金额做了扣除手续费/滞纳金,则需要将本金抵扣写到备注 - if (new BigDecimal(dto.getAddpay()).compareTo(latePayLastMoney) > 0 ) { - sb.append(";已付金额增加").append(latePayLastMoney.toPlainString()); - } - if (opay.compareTo(new BigDecimal(dbBill.getOwe())) >= 0 ) { - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - sb.append(";【系统】账单已付金额已大于等于实际应付金额,自动归结为结清。"); - } - } - String oldSetOff = dbBill.getSetOff(); - if (StringUtils.isBlank(oldSetOff)) { - oldSetOff = "0"; - } - wxBillRent.setSetOff(new BigDecimal(oldSetOff).add(new BigDecimal(dto.getSetOff())).toPlainString()); - wxBillRent.setPayDate(new Date()); - wxBillRent.setPayWay(dto.getPayWayObject().getId()); - wxBillDailyMapper.updateById(wxBillRent); - dto.setRemark(sb.toString()); - return wxBillRent; - } - - @Override - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline) { - WxBillDaily wxBillRent = updateBillPay(dto); - EnumBillAction action = null; - if (isOnline) { - action = EnumBillAction.SELF_SERVICE_PAY; - }else { - action = EnumBillAction.OFFLINE_PAY; - } - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void bad(WxBillPayDTO dto, MallUserInfo user) { - WxBillDaily dbBill = wxBillDailyMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillDaily wxBillRent = new WxBillDaily(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setStatus(EnumBillStatus.BAD.getCode()); - wxBillDailyMapper.updateById(wxBillRent); - String badMoney = dbBill.getOwe(); - this.addBillAction(EnumBillAction.BAD, dto.getBillTypeValue(),dto.getId(), - badMoney, badMoney,null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void stopMerchantBills(WxMerchant wxMerchant, MallUserInfo userInfo) { - WxBillDaily ddel = new WxBillDaily(); - ddel.setMerchantId(wxMerchant.getId()); - ddel.updateTenantInfo(wxMerchant); - ddel.setShopEndtime(new Date()); - wxBillDailyMapper.deleteNoNeedPayBill(ddel); - - - WxBillDaily wxBillRent = new WxBillDaily(); - wxBillRent.setMerchantId(wxMerchant.getId()); - wxBillRent.updateTenantInfo(wxMerchant); - List brList = wxBillDailyMapper.findList(wxBillRent); - List realRentList = new ArrayList(); - List actionList = new ArrayList(); - Date current = DateUtils.getDayEnd(new Date()); - if (null != brList && brList.size() > 0 ) { - for (int i = 0 ; i < brList.size() ; i ++ ) { - WxBillDaily brent = brList.get(i); - WxBillAction action = new WxBillAction(); - boolean isUpdate = wxBillAllHelper.billEndCalcute(2,current, brent, action, false); - if (isUpdate) { - realRentList.add(brent); - actionList.add(action); - } - } - } - - for (int i = 0 ; i < realRentList.size() ; i ++) { - WxBillDaily rbrent = realRentList.get(i); - wxBillDailyMapper.updateById(rbrent); - } - - for (int i = 0 ; i < actionList.size() ; i ++) { - WxBillAction ba = actionList.get(i); - this.addBillAction(ba, userInfo); - } - } - - @Override - public void completeBill(EnumBillStatus status, WxMerchant wxMerchant, MallUserInfo user) { - WxBillDaily bill = new WxBillDaily(); - bill.updateTenantInfo(wxMerchant); - bill.setFloorForRule(wxMerchant.getFloorForRule()); - bill.setBusinessForRule(wxMerchant.getBusinessForRule()); - bill.setBuilding(wxMerchant.getBuilding()); - bill.setFloor(wxMerchant.getFloor()); - bill.setMerchantId(wxMerchant.getId()); - bill.setStatus(status.getCode()); - updateQueryParam(bill); - PageInfo bpage = this.listAsPage(bill, 1, 100); - if (null != bpage && null != bpage.getList()) { - for (int i = 0 ; i < bpage.getList().size() ; i++ ) { - WxBillDaily b = bpage.getList().get(i); - - WxBillDaily bu = new WxBillDaily(); - bu.setId(b.getId()); - bu.updateTenantInfo(b); - bu.setStatus(EnumBillStatus.INVALID.getCode()); - bu.setUpdatetime(new Date()); - bu.setUpdateBy(user.getId()); - bu.setUpdateByName(user.getName()); - wxBillDailyMapper.updateById(bu); - - WxBillAction wxBillAction = new WxBillAction(); - wxBillAction.setBillId(b.getId()); - wxBillAction.setBillType(b.getBillType()); - wxBillAction.setAction(EnumBillAction.STATUS_CHANGE.getCode()); - wxBillAction.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null,null,null,EnumBillStatus.getEnum(b.getStatus()),EnumBillStatus.INVALID)); - wxBillAction.setRemark(wxMerchant.getBillCompleteRemark()); - this.addBillAction(wxBillAction, user); - } - } - - } - - @Override - public void insertBills(TenantEntity tenantEntity, List list) { - wxBillDailyMapper.insertBills(tenantEntity.getTenantId(), list); - } - - @Override - public void deleteEnergyReadingBills(WxBillDaily wxBillDaily) { - wxBillDailyMapper.deleteEnergyReadingBills(wxBillDaily.getEnergyReadingCalcuteId(), wxBillDaily.getTenantId()); - } - -} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java deleted file mode 100644 index 93eb281fa..000000000 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java +++ /dev/null @@ -1,684 +0,0 @@ -package com.iformall.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillAction; -import com.iformall.domain.po.WxBillDeposit; -import com.iformall.domain.po.WxBillOtherDeposit; -import com.iformall.domain.po.WxBillPayWay; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -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.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillAction; -import com.iformall.enums.EnumBillStatus; -import com.iformall.enums.EnumDelStatus; -import com.iformall.enums.EnumRentContractType; -import com.iformall.enums.EnumRentShopType; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.WxBillDepositMapper; -import com.iformall.mapper.WxRentContractMapper; -import com.iformall.service.ExcelService; -import com.iformall.service.WxBillActionService; -import com.iformall.service.WxBillDepositService; -import com.iformall.service.WxFinanceService; -import com.iformall.service.WxMerchantService; -import com.iformall.service.WxPayAccountBillService; -import com.iformall.service.WxShopService; -import com.iformall.service.helper.WxBillAllHelper; -import com.iformall.utils.Constant; -import com.iformall.utils.DateUtils; - -import org.apache.commons.collections.CollectionUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author gongbiao - */ -@Service -public class WxBillDepositServiceImpl extends WxBillBaseService implements WxBillDepositService { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - WxBillDepositMapper wxBillDepositMapper; - - @Autowired - WxBillActionService wxBillActionService; - - @Autowired - WxPayAccountBillService wxPayAccountBillService; - - @Lazy - @Autowired - WxMerchantService wxMerchantService; - - @Lazy - @Autowired - WxShopService wxShopService; - - @Autowired - ExcelService excelService; - - @Autowired - WxRentContractMapper wxRentContractMapper; - - @Lazy - @Autowired - WxBillAllHelper wxBillAllHelper; - - @Lazy - @Autowired - WxFinanceService wxFinanceService; - - @Override - public PageInfo listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - return getBillDepositPropertyList(wxPayAccountBill, record, pageIndex, pageSize); - } - - @Override - public List list(WxBillDeposit record) { - setQueryParam(record); - return wxBillDepositMapper.queryBillDepositList(record); - } - - @Override - public List notifyList(WxBillDeposit record) { - setQueryParam(record); - return wxBillDepositMapper.getBillNotifyList(record); - } - - private void setQueryParam(WxBillDeposit record) { - if (null != record.getFloorForRule() || null != record.getFloor() || null != record.getBuilding()) { - List merchantIds = wxMerchantService.getFloorBuildMerchantIds(record, record.getFloorForRule(), record.getBuilding(), record.getFloor(), 0, 0); - if (null != merchantIds) { - record.setMerchantIds(merchantIds); - }else { - record.setId(-1L); - } - } - - if (StringUtils.isNotBlank(record.getMerchantName())) { - WxMerchant mq = new WxMerchant(); - mq.updateTenantInfo(record); - mq.setName(StringUtils.trimToNull(record.getMerchantName())); - List mids = wxMerchantService.findIdList(mq); - if (null != mids && mids.size() > 0 ) { - if (null != record.getMerchantIds()) { - List _mids = (List) CollectionUtils.intersection(mids, record.getMerchantIds()); - if (null == _mids || _mids.size() <= 0) { - record.setId(-1L); - }else { - record.setMerchantIds(_mids); - } - }else { - record.setMerchantIds(mids); - } - }else { - record.setId(-1L); - } - } - } - - private PageInfo getBillDepositPropertyList(WxPayAccountBill wxPayAccountBill,WxBillDeposit record, Integer pageIndex, Integer pageSize) { - setQueryParam(record); - - PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillDepositMapper.queryBillDepositList(record)); - if (null == page) { - return null; - } - - WxMerchant wq = new WxMerchant(); - wq.updateTenantInfo(record); - Map merchantMap = wxMerchantService.findMerchantMap(wq); - - List rentContractIdList = wxBillDepositMapper.findRentContractIds(record); - Map rentContractMap = new HashMap(); - if ( null != rentContractIdList && rentContractIdList.size() > 0 ) { - WxRentContract rcq = new WxRentContract(); - rcq.updateTenantInfo(record); - rcq.setIds(rentContractIdList); - List rlist = wxRentContractMapper.findList(rcq); - if (null != rlist && rlist.size() > 0 ) { - for (int i = 0 ; i < rlist.size(); i++) { - WxRentContract rc = rlist.get(i); - rentContractMap.put(rc.getId(), rc); - } - } - } - - if (null != page.getList()) { - for (int i = 0 ; i < page.getList().size() ; i ++) { - WxBillDeposit e = page.getList().get(i); - //手续费 = 合同应收+手续费+滞纳金 - computeTotalMoney(Constant.default_long_decimal_size,wxPayAccountBill, e); - - if (null != e.getMerchantId()) { - WxMerchant m = merchantMap.get(e.getMerchantId()); - if (null != m ) { - e.setMerchantName(m.getName()); - } - } - - WxRentContract rent = rentContractMap.get(e.getRentContractId()); - if (null != rent) { - e.setShopNumber(rent.getRentInfoShopNumber()); - } - - } - } - return page; - } - - @Override - public void computeTotalMoney(Integer decimalSize,WxPayAccountBill wxPayAccountBill, WxBillDeposit deposit) { - if (deposit.getReceivePay() != null) { - String receivePayB = deposit.getReceivePay(); - BigDecimal servicePay; - if (deposit.getServiceChargePay() != null) { - servicePay = new BigDecimal(deposit.getServiceChargePay()); - } else { - servicePay = new BigDecimal(receivePayB).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(100), decimalSize, BigDecimal.ROUND_HALF_UP); - } - BigDecimal realReceivePay = servicePay.add(new BigDecimal(receivePayB)); - deposit.setRealReceivePay(realReceivePay.toPlainString()); - deposit.setServiceChargePay(servicePay.toPlainString()); - } - } - - @Override - public void updateBillStatus(WxBillDeposit record) { -// logger.info("更新租赁押金账单状态开始..."); -// //更新逾期天数及状态 -// updateNotPaidStatus(record); -// //更新待缴的状态 -// updateWaidPayStatus(record); -// logger.info("更新租赁押金账单状态结束..."); - } - -// @Transactional(rollbackFor = {Exception.class}) -// public void updateWaidPayStatus(WxBillDeposit record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// params.put("waitPay", EnumBillStatus.WAIT_PAY.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// -// try { -// wxBillDepositMapper.updateWaitPayStatus(params); -// } catch (Exception e) { -// logger.error("更新租赁押金待缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// } -// -// -// @Transactional(rollbackFor = {Exception.class}) -// public void updateNotPaidStatus(WxBillDeposit record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// params.put("notPaid", EnumBillStatus.NOT_PAID.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// try { -// wxBillDepositMapper.updateNotPaidStatus(params); -// } catch (Exception e) { -// logger.error("更新租赁押金欠缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// } - - @Override - public WxBillDeposit getById(TenantEntity tenantEntity,Long id) { - WxBillDeposit record = new WxBillDeposit(); - record.setId(id); - record.updateTenantInfo(tenantEntity); - 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 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 result = new HashMap<>(3); - result.put("despoit", deposit); - result.put("wxRentContract", wxRentContract); - return result; - } - - @Override - public ResultData saveOrUpdate(WxBillDeposit record, MallUserInfo user) { - String receivepay = StringUtils.isBlank(record.getReceivePay()) ? "0" : record.getReceivePay(); - String pay = StringUtils.isBlank(record.getPay()) ? "0":record.getPay(); - if(new BigDecimal(pay).compareTo(new BigDecimal(receivepay)) > 0){ - return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "实收金额不能大于实际应收金额"); - } - Date date = new Date(); - if (record.getId() == null) { - logger.info("新增租赁押金账单"); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreatetime(date); - record.setUpdatetime(date); - record.updateTenantInfo(user); - //record.setOwe(new BigDecimal(receivepay).subtract(new BigDecimal(pay)).toPlainString()); - record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - try { - wxBillDepositMapper.insert(record); - } catch (Exception e) { - logger.error("保存租赁押金账单失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - return new ResultData(Result.SUCCESS, "保存租赁押金账单成功"); - } else { - return new ResultData(); - } - } - - @Override - public void deleteById(TenantEntity tenantEntity,Long id) { - wxBillDepositMapper.deleteById(id,tenantEntity.getTenantId()); - } - -// @Transactional(rollbackFor = {Exception.class}) -// @Override -// public ResultData updatePaid(Long id) { -// WxBillDeposit wxBillDeposit = wxBillDepositMapper.selectById(id); -// if(wxBillDeposit==null){ -// return new ResultData(ErrorCode.BILL_RENT_DEPOSIT_IS_NOT_FOUND); -// } -// wxBillDeposit.setStatus(EnumBillStatus.PAID.getCode()); -// Date d =new Date(); -// wxBillDeposit.setPayDate(d); -// wxBillDeposit.setUpdatetime(d); -// try { -// wxBillDepositMapper.updateById(wxBillDeposit); -// } catch (Exception e) { -// logger.error("租赁押金结单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// return new ResultData(Result.SUCCESS, "租赁押金结单成功"); -// } - -// @Transactional(rollbackFor = {Exception.class}) -// @Override -// public ResultData returnDeposit(WxBillDeposit record, MallUserInfo user) { -// logger.info("租赁押金退还"); -// WxBillDeposit wxBillDeposit = wxBillDepositMapper.selectById(record.getId(),record.getTenantId()); -// if (wxBillDeposit == null) { -// return new ResultData(ErrorCode.BILL_RENT_DEPOSIT_IS_NOT_FOUND); -// } -// wxBillDeposit.setPayWay(record.getPayWay()); -// wxBillDeposit.setReturnPrice(record.getReturnPrice()); -// wxBillDeposit.setStatus(EnumBillStatus.RETURN.getCode()); -// wxBillDeposit.setUpdatetime(new Date()); -// 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.getReturnPrice()).divide(new BigDecimal(100)).toPlainString(); -// wxBillAction.setDetails(message + price + "元"); -// wxBillAction.setAction(EnumBillAction.DEPOSIT_RETURN.getCode()); -// wxBillAction.setUserId(user.getId()); -// wxBillAction.setUserName(user.getName()); -// wxBillAction.setPhone(user.getPhone()); -// wxBillAction.updateTenantInfo(wxBillDeposit); -// try { -// wxBillActionService.save(wxBillAction); -// } catch (Exception e) { -// logger.error("添加租赁押金账单行为日志,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// return new ResultData(Result.SUCCESS, "租赁押金退还成功", wxBillDeposit); -// } -// -// @Override -// public ResultData adjustDeposit(WxBillDeposit record) { -// logger.info("租赁押金调整"); -// WxBillDeposit wxBillDeposit = wxBillDepositMapper.selectById(record.getId(),record.getTenantId()); -// if (wxBillDeposit == null) { -// return new ResultData(ErrorCode.BILL_RENT_DEPOSIT_IS_NOT_FOUND); -// } -// wxBillDeposit.setReceivePay(record.getReceivePay()); -// //wxBillDeposit.setOwe(new BigDecimal(record.getReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); -// wxBillDeposit.setUpdatetime(new Date()); -// try { -// wxBillDepositMapper.updateById(wxBillDeposit); -// } catch (Exception e) { -// logger.error("租赁押金调整失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// return new ResultData(Result.SUCCESS, "租赁押金调整成功", wxBillDeposit); -// } - - @Override - public WxBillSum getBillMonthSum(WxBillDeposit wxBillDeposit) { - setQueryParam(wxBillDeposit); - return wxBillDepositMapper.getBillMonthSum(wxBillDeposit); - } - - @Override - public List getMerchantIds(WxBillDeposit wxBillDeposit) { - setQueryParam(wxBillDeposit); - return wxBillDepositMapper.getMerchantIdList(wxBillDeposit); - } - - @Override - public WxBillHotNotify getBillHotNotify(WxBillDeposit wxBillDeposit) { - setQueryParam(wxBillDeposit); - return wxBillDepositMapper.getBillHotNotify(wxBillDeposit); - } - - @Override - public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillDeposit wxBillDeposit) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillDeposit); - String billName = wxBillDeposit.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺租赁押金账单" : "多经点位租赁押金账单"; - PageInfo billRentList = getBillDepositPropertyList(wxPayAccountBill,wxBillDeposit,1,10000); - if (null == billRentList || null == billRentList.getList()) { - return ; - } - excelService.exportExcel(billRentList.getList(),null, billName, WxBillDeposit.class, billName + ".xlsx", response, false); - - } - - @Override - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid) { - WxBillDeposit dbBill = wxBillDepositMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillDeposit wxBillDeposit = new WxBillDeposit(); - wxBillDeposit.setId(dto.getId()); - wxBillDeposit.updateTenantInfo(dto); - wxBillDeposit.setUpdatetime(new Date()); - wxBillDeposit.setUpdateBy(user.getId()); - wxBillDeposit.setUpdateByName(user.getName()); - String billDepositOldPrce = dto.getOldPrice(); - String billDepositNewPrce = dto.getNewPrice(); - Date payDate = null; - if (forcePaid) { - wxBillDeposit.setReceivePay(dbBill.getPay()); - wxBillDeposit.setStatus(EnumBillStatus.PAID.getCode()); - billDepositOldPrce = dbBill.getPay(); - billDepositNewPrce = dbBill.getPay(); - wxBillDepositMapper.updateById(wxBillDeposit); - String remark = StringUtils.trimToEmpty(dto.getRemark())+ ";【系统】账单被强制为支付完成,自动归结为结清。"; - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), billDepositOldPrce, - billDepositNewPrce,null,payDate, null, remark,null,null,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,null,null,dto.getRemark(),null,null, user); - }else { - wxBillDeposit.setReceivePay(dto.getNewPrice()); - WxBillPayWay payWay = null; - String remark = StringUtils.trimToEmpty(dto.getRemark()); - if (new BigDecimal(dto.getNewPrice()).compareTo(new BigDecimal(dbBill.getPay())) <= 0) { - wxBillDeposit.setStatus(EnumBillStatus.PAID.getCode()); - payDate = new Date(); - payWay = wxFinanceService.getPayWayById(dto, Constant.bill_pay_way_system); - remark = remark + ";【系统】账单实际应付金额调整至小于等于已付金额,自动归结为结清。"; - } - wxBillDepositMapper.updateById(wxBillDeposit); - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), billDepositOldPrce, - billDepositNewPrce,null,payDate,payWay,remark,null,null, user); - - } - - } - - @Override - public void notify(WxBillPayDTO dto, MallUserInfo user) { - WxBillDeposit wxBillRent = new WxBillDeposit(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setLastOweCallTime(new Date()); - wxBillRent.setLastOweCallUser(user.getName()+"(账号:"+user.getUsername()+")"); - wxBillDepositMapper.updateById(wxBillRent); - this.addBillAction(EnumBillAction.NOTIFY, dto.getBillTypeValue(),dto.getId(), - null, null,null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void backPay(WxBillPayDTO dto, MallUserInfo user) { - WxBillDeposit dbBill = wxBillDepositMapper.selectById(dto.getId(),dto.getTenantId()); - BigDecimal oldpay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - oldpay = new BigDecimal(dbBill.getPay()); - } - BigDecimal oldsetoff = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getSetOff())) { - oldsetoff = new BigDecimal(dbBill.getSetOff()); - } - WxBillDeposit wxBillRent = new WxBillDeposit(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); - wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); - if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { - if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { - wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); - } - } - wxBillDepositMapper.updateById(wxBillRent); - EnumBillAction action = EnumBillAction.RETURN; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void updatePay(WxBillPayDTO dto, MallUserInfo user) { - WxBillDeposit wxBillRent = updateBillPay(dto); - EnumBillAction action = EnumBillAction.OFFLINE_PAY; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(), dto.getRemark(),null,null, user); - } - - private WxBillDeposit updateBillPay(WxBillPayDTO dto) { - WxBillDeposit dbBill = wxBillDepositMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillDeposit wxBillRent = new WxBillDeposit(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - BigDecimal opay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - opay = new BigDecimal(dbBill.getPay()); - } - - //支付的金额先扣除手续费和滞纳金,多余的再抵扣本金 - String servicePay = dbBill.getServiceChargePay(); - if (StringUtils.isBlank(servicePay)) { - servicePay = "0"; - } - StringBuffer sb = new StringBuffer(StringUtils.trimToEmpty(dto.getRemark())); - BigDecimal serviceLastMoney = new BigDecimal(dto.getAddpay()).add(new BigDecimal(dto.getSetOff())).subtract(new BigDecimal(servicePay)); - if (new BigDecimal(servicePay).compareTo(new BigDecimal(0)) > 0 ) { - if (serviceLastMoney.compareTo(new BigDecimal(0)) >= 0 ) { - wxBillRent.setServiceChargePay("0"); - sb.append(";手续费").append(servicePay).append("已结清"); - }else { - wxBillRent.setServiceChargePay(dto.getAddpay()); - sb.append(";手续费").append(servicePay).append("已支付").append(dto.getAddpay()); - } - } - - if (serviceLastMoney.compareTo(new BigDecimal(0)) > 0 ) { - opay = opay.add(serviceLastMoney); - wxBillRent.setPay(opay.toPlainString()); - //如果付款金额做了扣除手续费/滞纳金,则需要将本金抵扣写到备注 - if (new BigDecimal(dto.getAddpay()).compareTo(serviceLastMoney) > 0 ) { - sb.append(";已付金额增加").append(serviceLastMoney.toPlainString()); - } - if (opay.compareTo(new BigDecimal(dbBill.getOwe())) >= 0 ) { - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - sb.append(";【系统】账单已付金额已大于等于实际应付金额,自动归结为结清。"); - } - } - String oldSetOff = dbBill.getSetOff(); - if (StringUtils.isBlank(oldSetOff)) { - oldSetOff = "0"; - } - wxBillRent.setSetOff(new BigDecimal(oldSetOff).add(new BigDecimal(dto.getSetOff())).toPlainString()); - wxBillRent.setPayDate(new Date()); - wxBillRent.setPayWay(dto.getPayWayObject().getId()); - wxBillDepositMapper.updateById(wxBillRent); - dto.setRemark(sb.toString()); - return wxBillRent; - } - - @Override - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline) { - WxBillDeposit wxBillRent = updateBillPay(dto); - EnumBillAction action = null; - if (isOnline) { - action = EnumBillAction.SELF_SERVICE_PAY; - }else { - action = EnumBillAction.OFFLINE_PAY; - } - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - - - @Override - public void bad(WxBillPayDTO dto, MallUserInfo user) { - WxBillDeposit dbBill = wxBillDepositMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillDeposit wxBillRent = new WxBillDeposit(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setStatus(EnumBillStatus.BAD.getCode()); - wxBillDepositMapper.updateById(wxBillRent); - String badMoney = dbBill.getOwe(); - this.addBillAction(EnumBillAction.BAD, dto.getBillTypeValue(),dto.getId(), - badMoney, badMoney,null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void rentContractStop(WxRentContract rentContract, MallUserInfo user) { - WxBillDeposit brDel = new WxBillDeposit(); - brDel.setRentContractId(rentContract.getId()); - brDel.updateTenantInfo(rentContract); - brDel.setShopEndtime(rentContract.getEndContractTime()); - wxBillDepositMapper.deleteNoNeedPayBill(brDel);; - - WxBillDeposit br = new WxBillDeposit(); - br.setRentContractId(rentContract.getId()); - br.updateTenantInfo(rentContract); - List brList = wxBillDepositMapper.findList(br); - List realRentList = new ArrayList(); - List actionList = new ArrayList(); - if (null != brList && brList.size() > 0 ) { - for (int i = 0 ; i < brList.size() ; i ++ ) { - WxBillDeposit brent = brList.get(i); - WxBillAction action = new WxBillAction(); - boolean isUpdate = wxBillAllHelper.billEndCalcute(rentContract.getDecimalSize(),rentContract.getEndContractTime(), brent, action, true); - if (isUpdate) { - realRentList.add(brent); - actionList.add(action); - } - } - } - - for (int i = 0 ; i < realRentList.size() ; i ++) { - WxBillDeposit rbrent = realRentList.get(i); - wxBillDepositMapper.updateById(rbrent); - } - - for (int i = 0 ; i < actionList.size() ; i ++) { - WxBillAction ba = actionList.get(i); - this.addBillAction(ba, user); - } - } - - @Override - public void completeBill(EnumBillStatus status, WxMerchant wxMerchant, MallUserInfo user) { - WxBillDeposit bill = new WxBillDeposit(); - bill.updateTenantInfo(wxMerchant); - bill.setFloorForRule(wxMerchant.getFloorForRule()); - bill.setBusinessForRule(wxMerchant.getBusinessForRule()); - bill.setBuilding(wxMerchant.getBuilding()); - bill.setFloor(wxMerchant.getFloor()); - bill.setMerchantId(wxMerchant.getId()); - bill.setStatus(status.getCode()); - setQueryParam(bill); - PageInfo bpage = this.listAsPage(bill, 1, 100); - if (null != bpage && null != bpage.getList()) { - for (int i = 0 ; i < bpage.getList().size() ; i++ ) { - WxBillDeposit b = bpage.getList().get(i); - - WxBillDeposit bu = new WxBillDeposit(); - bu.setId(b.getId()); - bu.updateTenantInfo(b); - bu.setStatus(EnumBillStatus.INVALID.getCode()); - bu.setUpdatetime(new Date()); - wxBillDepositMapper.updateById(bu); - - WxBillAction wxBillAction = new WxBillAction(); - wxBillAction.setBillId(b.getId()); - wxBillAction.setBillType(b.getBillType()); - wxBillAction.setAction(EnumBillAction.STATUS_CHANGE.getCode()); - wxBillAction.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null,null,null,EnumBillStatus.getEnum(b.getStatus()),EnumBillStatus.INVALID)); - wxBillAction.setRemark(wxMerchant.getBillCompleteRemark()); - this.addBillAction(wxBillAction, user); - } - } - } - - @Override - public void returnDeposit(WxBillPayDTO dto, MallUserInfo user) { - - } - -} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillOtherDepositServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillOtherDepositServiceImpl.java deleted file mode 100644 index 3124e592f..000000000 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillOtherDepositServiceImpl.java +++ /dev/null @@ -1,713 +0,0 @@ -package com.iformall.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillAction; -import com.iformall.domain.po.WxBillDaily; -import com.iformall.domain.po.WxBillDeposit; -import com.iformall.domain.po.WxBillOtherDeposit; -import com.iformall.domain.po.WxBillPayWay; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillAction; -import com.iformall.enums.EnumBillStatus; -import com.iformall.enums.EnumDelStatus; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.WxBillOtherDepositMapper; -import com.iformall.mapper.WxMerchantMapper; -import com.iformall.mapper.WxShopMapper; -import com.iformall.service.ExcelService; -import com.iformall.service.WxBillActionService; -import com.iformall.service.WxBillOtherDepositService; -import com.iformall.service.WxFinanceService; -import com.iformall.service.WxMerchantService; -import com.iformall.service.WxPayAccountBillService; -import com.iformall.service.helper.WxBillAllHelper; -import com.iformall.utils.Constant; -import com.iformall.utils.DateUtils; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - */ -@Service -public class WxBillOtherDepositServiceImpl extends WxBillBaseService implements WxBillOtherDepositService { - private Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - WxBillOtherDepositMapper wxBillOtherDepositMapper; - - @Autowired - WxShopMapper wxShopMapper; - - @Autowired - WxMerchantMapper wxMerchantMapper; - - @Autowired - WxBillActionService wxBillActionService; - - @Autowired - ExcelService excelService; - - @Autowired - WxPayAccountBillService wxPayAccountBillService; - - @Lazy - @Autowired - WxMerchantService wxMerchantService; - - @Lazy - @Autowired - WxBillAllHelper wxBillAllHelper; - - @Lazy - @Autowired - WxFinanceService wxFinanceService; - - @Override - public PageInfo listAsPage(WxBillOtherDeposit record, Integer pageIndex, Integer pageSize) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - return getBillRentPropertyList(pageIndex, pageSize, record, wxPayAccountBill); - } - - @Override - public List list(WxBillOtherDeposit record) { - updateQueryParam(record); - return wxBillOtherDepositMapper.queryBillList(record); - } - - @Override - public List notifyList(WxBillOtherDeposit record) { - updateQueryParam(record); - return wxBillOtherDepositMapper.getBillNotifyList(record); - } - - private void updateQueryParam(WxBillOtherDeposit record) { - if (null != record.getFloorForRule() || null != record.getFloor() || null != record.getBuilding()) { - List merchantIds = wxMerchantService.getFloorBuildMerchantIds(record, record.getFloorForRule(), record.getBuilding(), record.getFloor(), 0, 0); - if (null != merchantIds) { - record.setMerchantIds(merchantIds); - }else { - record.setId(-1L); - } - } - - if (StringUtils.isNotBlank(record.getMerchantName())) { - WxMerchant mq = new WxMerchant(); - mq.updateTenantInfo(record); - mq.setName(StringUtils.trimToNull(record.getMerchantName())); - List mids = wxMerchantService.findIdList(mq); - if (null != mids && mids.size() > 0 ) { - if (null != record.getMerchantIds()) { - List _mids = (List) CollectionUtils.intersection(mids, record.getMerchantIds()); - if (null == _mids || _mids.size() <= 0) { - record.setId(-1L); - }else { - record.setMerchantIds(_mids); - } - }else { - record.setMerchantIds(mids); - } - }else { - record.setId(-1L); - } - } - } - - private PageInfo getBillRentPropertyList(Integer pageIndex, Integer pageSize,WxBillOtherDeposit record,WxPayAccountBill wxPayAccountBill) { - updateQueryParam(record); - PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillOtherDepositMapper.queryBillList(record)); - if (null == page) { - return null; - } - - WxMerchant wq = new WxMerchant(); - wq.updateTenantInfo(record); - Map merchantMap = wxMerchantService.findMerchantMap(wq); - - if (null != page.getList()) { - for (int i = 0 ; i < page.getList().size() ; i ++) { - WxBillOtherDeposit e = page.getList().get(i); - //手续费 = 合同应收+手续费+滞纳金 - computeTotalMoney(wxPayAccountBill, e); - - if (null != e.getMerchantId()) { - WxMerchant m = merchantMap.get(e.getMerchantId()); - if (null != m ) { - e.setMerchantName(m.getName()); - } - } - } - } - - return page; - } - - public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillOtherDeposit e) { - if (e.getReceivePay() != null) { - BigDecimal servicePay; - if (e.getServiceChargePay() != null) { - servicePay = new BigDecimal(e.getServiceChargePay()); - } else { - servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); - } - e.setRealReceivePay(servicePay.add(new BigDecimal(e.getReceivePay())).toPlainString()); - e.setServiceChargePay(servicePay.toPlainString()); -// if (!e.getStatus().equals(EnumBillStatus.NOT_PAID.getCode())) { -// //e.setOwe("0"); -// } else { -// //e.setOwe(servicePay.add(new BigDecimal(e.getReceivePay())).subtract(new BigDecimal(e.getPay())).toPlainString()); -// //e.setOwe(new BigDecimal(e.getReceivePay()).subtract(new BigDecimal(e.getPay())).toPlainString()); -// } - } - } - - @Override - public void updateBillStatus(WxBillOtherDeposit record) { -// logger.info("更新其他押金账单状态开始..."); -// //更新逾期天数及状态 -// updateNotPaidStatus(record); -// //更新待缴的状态 -// updateWaidPayStatus(record); -// logger.info("更新其他押金账单状态结束..."); - } - -// @Transactional(rollbackFor = {Exception.class}) -// public void updateWaidPayStatus(WxBillOtherDeposit record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// params.put("waitPay", EnumBillStatus.WAIT_PAY.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// try { -// wxBillOtherDepositMapper.updateWaitPayStatus(params); -// } catch (Exception e) { -// logger.error("更新其他待缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// } -// -// -// @Transactional(rollbackFor = {Exception.class}) -// public void updateNotPaidStatus(WxBillOtherDeposit record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// params.put("notPaid", EnumBillStatus.NOT_PAID.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// try { -// wxBillOtherDepositMapper.updateNotPaidStatus(params); -// } catch (Exception e) { -// logger.error("更新其他欠缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// } - - @Override - public WxBillOtherDeposit getById(TenantEntity tenantEntity,Long id) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(tenantEntity); - WxBillOtherDeposit record = new WxBillOtherDeposit(); - record.setId(id); - record.updateTenantInfo(tenantEntity); - WxBillOtherDeposit wxBillOther = getBillRentPropertyList(1, 10000, record, wxPayAccountBill).getList().get(0); - //wxBillOther.setOwe(new BigDecimal(wxBillOther.getRealReceivePay()).subtract(new BigDecimal(wxBillOther.getPay())).toPlainString()); - //wxBillOther.setOwe(new BigDecimal(wxBillOther.getReceivePay()).subtract(new BigDecimal(wxBillOther.getPay())).toPlainString()); - wxBillOther.setMerchant(wxMerchantMapper.selectById(wxBillOther.getMerchantId())); -// if (wxBillOther.getShopId() != null) { -// WxShop shop = new WxShop(); -// shop.setId(wxBillOther.getShopId()); -// List> shoplist = wxShopMapper.findListMap(shop); -// wxBillOther.setShops(shoplist); -// } else { -// wxBillOther.setShops(Collections.EMPTY_LIST); -// } - return wxBillOther; - } - - @Override - public ResultData saveOrUpdate(WxBillOtherDeposit record, MallUserInfo user) { - String receivepay = "0"; - if (StringUtils.isNotBlank(record.getRealReceivePay())) { - receivepay = record.getRealReceivePay(); - } - String pay = "0"; - if (StringUtils.isNotBlank(record.getPay())) { - pay = record.getPay(); - } - if (new BigDecimal(pay).compareTo(new BigDecimal(receivepay)) > 0 ) { - return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "实收金额不能大于实际应收总金额"); - } - Date date = new Date(); - if (record.getId() == null) { - logger.info("新增其他账单"); - - WxBillOtherDeposit otherDepositQuery = new WxBillOtherDeposit(); - otherDepositQuery.updateTenantInfo(user); - otherDepositQuery.setMerchantId(record.getMerchantId()); - //otherDepositQuery.setReceiveDate(record.getReceiveDate()); - otherDepositQuery.setStarttime(record.getStarttime()); - otherDepositQuery.setEndtime(record.getEndtime()); - otherDepositQuery.setComments(record.getComments()); - otherDepositQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - List otherDeposit = wxBillOtherDepositMapper.findList(otherDepositQuery); - if (otherDeposit != null && otherDeposit.size() > 0 ) { - return new ResultData(ErrorCode.BILL_IS_FOUND.getCode(),"商户已存在包含该时间端的费用账单"); - } - - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setStatus(EnumBillStatus.WAIT_PAY.getCode()); - record.setCreatetime(date); - record.setCreateBy(user.getId()); - record.setCreateByName(user.getName()); - record.setUpdatetime(date); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - record.setExpiredDay(0L); - //record.setOwe(new BigDecimal(record.getRealReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); - //record.setOwe(new BigDecimal(record.getReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); - record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - try { - wxBillOtherDepositMapper.insert(record); - } catch (Exception e) { - logger.error("保存其他账单失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - return new ResultData(Result.SUCCESS, "保存其他账单成功"); - } else { - logger.info("更新其他押金账单"); - WxBillOtherDeposit wxBillOtherDeposit = wxBillOtherDepositMapper.selectById(record.getId(),user.getTenantId()); - if (wxBillOtherDeposit == null) { - return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); - } - WxBillOtherDeposit otherDepositQuery = new WxBillOtherDeposit(); - otherDepositQuery.updateTenantInfo(user); - otherDepositQuery.setMerchantId(record.getMerchantId()); - //otherDepositQuery.setReceiveDate(record.getReceiveDate()); - otherDepositQuery.setStarttime(record.getStarttime()); - otherDepositQuery.setEndtime(record.getEndtime()); - otherDepositQuery.setComments(record.getComments()); - otherDepositQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - List notinidlist = new ArrayList(); - notinidlist.add(record.getId()); - otherDepositQuery.setNotInIds(notinidlist); - List otherDeposit = wxBillOtherDepositMapper.findList(otherDepositQuery); - if (otherDeposit != null && otherDeposit.size() > 0 ) { - return new ResultData(ErrorCode.BILL_IS_FOUND.getCode(),"商户已存在包含该时间端的费用账单"); - } - record.setUpdatetime(date); - record.setUpdateBy(user.getId()); - wxBillOtherDepositMapper.updateById(record); - return new ResultData(Result.SUCCESS, "更新其他账单成功"); - } - } - - - @Override - public void deleteById(TenantEntity tenantEntity,Long id) { - wxBillOtherDepositMapper.deleteById(id,tenantEntity.getTenantId()); - } - -// @Transactional(rollbackFor = {Exception.class}) -// @Override -// public ResultData updatePaid(Long id) { -// WxBillOtherDeposit wxBillOtherDeposit = wxBillOtherDepositMapper.selectById(id); -// if (wxBillOtherDeposit == null) { -// return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); -// } -// wxBillOtherDeposit.setStatus(EnumBillStatus.PAID.getCode()); -// Date d = new Date(); -// wxBillOtherDeposit.setPayDate(d); -// wxBillOtherDeposit.setUpdatetime(d); -// try { -// wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); -// } catch (Exception e) { -// logger.error("其他押金账单结单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), e.getMessage()); -// } -// return new ResultData(Result.SUCCESS, "其他押金账单结单成功"); -// } - -// @Override -// public ResultData returnDeposit(WxBillOtherDeposit record, MallUserInfo user) { -// logger.info("其他押金退还"); -// WxBillOtherDeposit wxBillDeposit = wxBillOtherDepositMapper.selectById(record.getId(),user.getTenantId()); -// if (wxBillDeposit == null) { -// return new ResultData(ErrorCode.BILL_OTHER_DEPOSIT_IS_NOT_FOUND); -// } -// wxBillDeposit.setReturnPrice(record.getReturnPrice()); -// wxBillDeposit.setStatus(EnumBillStatus.RETURN.getCode()); -// wxBillDeposit.setUpdatetime(new Date()); -// try { -// wxBillOtherDepositMapper.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()); -// wxBillAction.updateTenantInfo(user); -// String message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); -// String price = new BigDecimal(record.getReturnPrice()).divide(new BigDecimal(100)).toPlainString(); -// wxBillAction.setDetails(message + price + "元"); -// wxBillAction.setAction(EnumBillAction.DEPOSIT_RETURN.getCode()); -// wxBillAction.setUserId(user.getId()); -// wxBillAction.setUserName(user.getName()); -// wxBillAction.setPhone(user.getPhone()); -// wxBillAction.updateTenantInfo(user); -// try { -// wxBillActionService.save(wxBillAction); -// } catch (Exception e) { -// logger.error("添加其他押金账单行为日志,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// -// return new ResultData(Result.SUCCESS, "押金退还成功", wxBillDeposit); -// } -// -// @Override -// public ResultData adjustDeposit(WxBillOtherDeposit record) { -// logger.info("其他押金调整"); -// WxBillOtherDeposit wxBillDeposit = wxBillOtherDepositMapper.selectById(record.getId(),record.getTenantId()); -// if (wxBillDeposit == null) { -// return new ResultData(ErrorCode.BILL_OTHER_DEPOSIT_IS_NOT_FOUND); -// } -// wxBillDeposit.setReceivePay(record.getReceivePay()); -// //wxBillDeposit.setOwe(new BigDecimal(record.getReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); -// wxBillDeposit.setUpdatetime(new Date()); -// try { -// wxBillOtherDepositMapper.updateById(wxBillDeposit); -// } catch (Exception e) { -// logger.error("其他押金退还失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// return new ResultData(Result.SUCCESS, "其他押金调整成功", wxBillDeposit); -// } - - @Override - public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillOtherDeposit wxBillDeposit) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillDeposit); - PageInfo datalist = getBillRentPropertyList(1, 10000, wxBillDeposit, wxPayAccountBill); - List list = null; - if (null != datalist && null != datalist.getList()) { - list = datalist.getList(); - }else { - list = new ArrayList(); - } - excelService.exportExcel(list, null, "其他押金账单", WxBillOtherDeposit.class, "其他押金账单.xlsx", response, false); - } - - @Override - public WxBillSum getBillMonthSum(WxBillOtherDeposit wxBillDeposit) { - updateQueryParam(wxBillDeposit); - return wxBillOtherDepositMapper.getBillMonthSum(wxBillDeposit); - } - - @Override - public List getMerchantIds(WxBillOtherDeposit wxBillDeposit) { - updateQueryParam(wxBillDeposit); - return wxBillOtherDepositMapper.getMerchantIdList(wxBillDeposit); - } - - @Override - public WxBillHotNotify getBillHotNotify(WxBillOtherDeposit wxBillDeposit) { - updateQueryParam(wxBillDeposit); - return wxBillOtherDepositMapper.getBillHotNotify(wxBillDeposit); - } - - @Override - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid) { - WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillOtherDeposit wxBillOtherDeposit = new WxBillOtherDeposit(); - wxBillOtherDeposit.setId(dto.getId()); - wxBillOtherDeposit.updateTenantInfo(dto); - wxBillOtherDeposit.setUpdatetime(new Date()); - wxBillOtherDeposit.setUpdateBy(user.getId()); - wxBillOtherDeposit.setUpdateByName(user.getName()); - if (forcePaid) { - wxBillOtherDeposit.setReceivePay(dbBill.getPay()); - wxBillOtherDeposit.setStatus(EnumBillStatus.PAID.getCode()); - wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); - String remark = StringUtils.trimToEmpty(dto.getRemark())+ ";【系统】账单被强制为支付完成,自动归结为结清。"; - //账单日志 - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), - dto.getOldPrice(), dto.getNewPrice(),null,null,null, remark,null,null, 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,null,null,dto.getRemark(),null,null, user); - }else { - wxBillOtherDeposit.setReceivePay(dto.getNewPrice()); - Date payDate = null; - WxBillPayWay payWay = null; - String remark = StringUtils.trimToEmpty(dto.getRemark()); - if (new BigDecimal(dto.getNewPrice()).compareTo(new BigDecimal(dbBill.getPay())) <= 0) { - wxBillOtherDeposit.setStatus(EnumBillStatus.PAID.getCode()); - payDate = new Date(); - payWay = wxFinanceService.getPayWayById(dto, Constant.bill_pay_way_system); - remark = remark + ";【系统】账单实际应付金额调整至小于等于已付金额,自动归结为结清。"; - } - wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); - //账单日志 - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), - dto.getOldPrice(), dto.getNewPrice(),null,payDate, payWay,remark,null,null, user); - } - } - - @Override - public void notify(WxBillPayDTO dto, MallUserInfo user) { - WxBillOtherDeposit wxBillRent = new WxBillOtherDeposit(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setLastOweCallTime(new Date()); - wxBillRent.setLastOweCallUser(user.getName()+"(账号:"+user.getUsername()+")"); - wxBillOtherDepositMapper.updateById(wxBillRent); - this.addBillAction(EnumBillAction.NOTIFY, dto.getBillTypeValue(),dto.getId(), - null,null, null,null,null,dto.getRemark(), null,null,user); - } - - @Override - public void backPay(WxBillPayDTO dto, MallUserInfo user) { - WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectById(dto.getId(),dto.getTenantId()); - BigDecimal oldpay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - oldpay = new BigDecimal(dbBill.getPay()); - } - BigDecimal oldsetoff = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getSetOff())) { - oldsetoff = new BigDecimal(dbBill.getSetOff()); - } - WxBillOtherDeposit wxBillRent = new WxBillOtherDeposit(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); - wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); - if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { - if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { - wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); - } - } - wxBillOtherDepositMapper.updateById(wxBillRent); - EnumBillAction action = EnumBillAction.RETURN; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void updatePay(WxBillPayDTO dto, MallUserInfo user) { - WxBillOtherDeposit wxBillRent = updateBillPay(dto); - EnumBillAction action = EnumBillAction.OFFLINE_PAY; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(), dto.getRemark(), null,null,user); - } - - private WxBillOtherDeposit updateBillPay(WxBillPayDTO dto) { - WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillOtherDeposit wxBillRent = new WxBillOtherDeposit(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - - BigDecimal opay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - opay = new BigDecimal(dbBill.getPay()); - } - - //支付的金额先扣除手续费和滞纳金,多余的再抵扣本金 - String servicePay = dbBill.getServiceChargePay(); - if (StringUtils.isBlank(servicePay)) { - servicePay = "0"; - } - StringBuffer sb = new StringBuffer(StringUtils.trimToEmpty(dto.getRemark())); - BigDecimal serviceLastMoney = new BigDecimal(dto.getAddpay()).add(new BigDecimal(dto.getSetOff())).subtract(new BigDecimal(servicePay)); - if (new BigDecimal(servicePay).compareTo(new BigDecimal(0)) > 0 ) { - if (serviceLastMoney.compareTo(new BigDecimal(0)) >= 0 ) { - wxBillRent.setServiceChargePay("0"); - sb.append(";手续费").append(servicePay).append("已结清"); - }else { - wxBillRent.setServiceChargePay(dto.getAddpay()); - sb.append(";手续费").append(servicePay).append("已支付").append(dto.getAddpay()); - } - } - - if (serviceLastMoney.compareTo(new BigDecimal(0)) > 0 ) { - opay = opay.add(serviceLastMoney); - wxBillRent.setPay(opay.toPlainString()); - //如果付款金额做了扣除手续费/滞纳金,则需要将本金抵扣写到备注 - if (new BigDecimal(dto.getAddpay()).compareTo(serviceLastMoney) > 0 ) { - sb.append(";已付金额增加").append(serviceLastMoney.toPlainString()); - } - if (opay.compareTo(new BigDecimal(dbBill.getOwe())) >= 0 ) { - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - sb.append(";【系统】账单已付金额已大于等于实际应付金额,自动归结为结清。"); - } - } - String oldSetOff = dbBill.getSetOff(); - if (StringUtils.isBlank(oldSetOff)) { - oldSetOff = "0"; - } - wxBillRent.setSetOff(new BigDecimal(oldSetOff).add(new BigDecimal(dto.getSetOff())).toPlainString()); - wxBillRent.setPayDate(new Date()); - wxBillRent.setPayWay(dto.getPayWayObject().getId()); - wxBillOtherDepositMapper.updateById(wxBillRent); - dto.setRemark(sb.toString()); - return wxBillRent; - } - - @Override - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline) { - WxBillOtherDeposit wxBillRent = updateBillPay(dto); - EnumBillAction action = null; - if (isOnline) { - action = EnumBillAction.SELF_SERVICE_PAY; - }else { - action = EnumBillAction.OFFLINE_PAY; - } - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(), null,null,user); - } - - @Override - public void returnDeposit(WxBillPayDTO dto, MallUserInfo user) { - WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectById(dto.getId(),dto.getTenantId()); - BigDecimal oldpay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getReturnPrice())) { - oldpay = new BigDecimal(dbBill.getReturnPrice()); - } - WxBillOtherDeposit wxBillRent = new WxBillOtherDeposit(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setReturnPrice(oldpay.add(new BigDecimal(dto.getAddpay())).toPlainString()); - wxBillOtherDepositMapper.updateById(wxBillRent); - this.addBillAction(EnumBillAction.RETURN, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void bad(WxBillPayDTO dto, MallUserInfo user) { - WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillOtherDeposit wxBillRent = new WxBillOtherDeposit(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setStatus(EnumBillStatus.BAD.getCode()); - wxBillOtherDepositMapper.updateById(wxBillRent); - String badMoney = dbBill.getOwe(); - this.addBillAction(EnumBillAction.BAD, dto.getBillTypeValue(),dto.getId(), - badMoney, badMoney,null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void stopMerchantBills(WxMerchant wxMerchant, MallUserInfo userInfo) { - WxBillOtherDeposit bdel = new WxBillOtherDeposit(); - bdel.setMerchantId(wxMerchant.getId()); - bdel.updateTenantInfo(wxMerchant); - bdel.setShopEndtime(new Date()); - wxBillOtherDepositMapper.deleteNoNeedPayBill(bdel); - - WxBillOtherDeposit wxBillRent = new WxBillOtherDeposit(); - wxBillRent.setMerchantId(wxMerchant.getId()); - wxBillRent.updateTenantInfo(wxMerchant); - List brList = wxBillOtherDepositMapper.findList(wxBillRent); - List realRentList = new ArrayList(); - List actionList = new ArrayList(); - Date current = DateUtils.getDayEnd(new Date()); - if (null != brList && brList.size() > 0 ) { - for (int i = 0 ; i < brList.size() ; i ++ ) { - WxBillOtherDeposit brent = brList.get(i); - WxBillAction action = new WxBillAction(); - boolean isUpdate = wxBillAllHelper.billEndCalcute(2,current, brent, action, true); - if (isUpdate) { - realRentList.add(brent); - actionList.add(action); - } - } - } - - for (int i = 0 ; i < realRentList.size() ; i ++) { - WxBillOtherDeposit rbrent = realRentList.get(i); - wxBillOtherDepositMapper.updateById(rbrent); - } - - for (int i = 0 ; i < actionList.size() ; i ++) { - WxBillAction ba = actionList.get(i); - this.addBillAction(ba, userInfo); - } - } - - @Override - public void completeBill(EnumBillStatus status, WxMerchant wxMerchant, MallUserInfo user) { - WxBillOtherDeposit bill = new WxBillOtherDeposit(); - bill.updateTenantInfo(wxMerchant); - bill.setFloorForRule(wxMerchant.getFloorForRule()); - bill.setBusinessForRule(wxMerchant.getBusinessForRule()); - bill.setBuilding(wxMerchant.getBuilding()); - bill.setFloor(wxMerchant.getFloor()); - bill.setMerchantId(wxMerchant.getId()); - bill.setStatus(status.getCode()); - updateQueryParam(bill); - PageInfo bpage = this.listAsPage(bill, 1, 100); - if (null != bpage && null != bpage.getList()) { - for (int i = 0 ; i < bpage.getList().size() ; i++ ) { - WxBillOtherDeposit b = bpage.getList().get(i); - - WxBillOtherDeposit bu = new WxBillOtherDeposit(); - bu.setId(b.getId()); - bu.updateTenantInfo(b); - bu.setStatus(EnumBillStatus.INVALID.getCode()); - bu.setUpdatetime(new Date()); - bu.setUpdateBy(user.getId()); - bu.setUpdateByName(user.getName()); - wxBillOtherDepositMapper.updateById(bu); - - WxBillAction wxBillAction = new WxBillAction(); - wxBillAction.setBillId(b.getId()); - wxBillAction.setBillType(b.getBillType()); - wxBillAction.setAction(EnumBillAction.STATUS_CHANGE.getCode()); - wxBillAction.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null,null,null,EnumBillStatus.getEnum(b.getStatus()),EnumBillStatus.INVALID)); - wxBillAction.setRemark(wxMerchant.getBillCompleteRemark()); - this.addBillAction(wxBillAction, user); - } - } - - } - -} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillOtherServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillOtherServiceImpl.java deleted file mode 100644 index 1f2fa7c78..000000000 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillOtherServiceImpl.java +++ /dev/null @@ -1,636 +0,0 @@ -package com.iformall.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillAction; -import com.iformall.domain.po.WxBillDaily; -import com.iformall.domain.po.WxBillOther; -import com.iformall.domain.po.WxBillPayWay; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillAction; -import com.iformall.enums.EnumBillStatus; -import com.iformall.enums.EnumDelStatus; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.WxBillOtherMapper; -import com.iformall.mapper.WxMerchantMapper; -import com.iformall.mapper.WxShopMapper; -import com.iformall.service.ExcelService; -import com.iformall.service.WxBillActionService; -import com.iformall.service.WxBillOtherService; -import com.iformall.service.WxFinanceService; -import com.iformall.service.WxMerchantService; -import com.iformall.service.WxPayAccountBillService; -import com.iformall.service.helper.WxBillAllHelper; -import com.iformall.utils.Constant; -import com.iformall.utils.DateUtils; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - */ -@Service -public class WxBillOtherServiceImpl extends WxBillBaseService implements WxBillOtherService { - private Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - WxBillOtherMapper wxBillOtherMapper; - - @Autowired - WxShopMapper wxShopMapper; - - @Autowired - WxMerchantMapper wxMerchantMapper; - - @Autowired - WxBillActionService wxBillActionService; - - @Autowired - ExcelService excelService; - - @Autowired - WxPayAccountBillService wxPayAccountBillService; - - @Lazy - @Autowired - WxMerchantService wxMerchantService; - - @Lazy - @Autowired - WxBillAllHelper wxBillAllHelper; - - @Lazy - @Autowired - WxFinanceService wxFinanceService; - - @Override - public PageInfo listAsPage(WxBillOther record, Integer pageIndex, Integer pageSize) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - return getBillOtherPropertyList(pageIndex, pageSize, record, wxPayAccountBill); - } - - @Override - public List list(WxBillOther record) { - updateQueryParam(record); - return wxBillOtherMapper.queryBillList(record); - } - - @Override - public List notifyList(WxBillOther record) { - updateQueryParam(record); - return wxBillOtherMapper.getBillNotifyList(record); - } - - private void updateQueryParam(WxBillOther record) { - if (null != record.getFloorForRule() || null != record.getFloor() || null != record.getBuilding()) { - List merchantIds = wxMerchantService.getFloorBuildMerchantIds(record, record.getFloorForRule(), record.getBuilding(), record.getFloor(), 0, 0); - if (null != merchantIds) { - record.setMerchantIds(merchantIds); - }else { - record.setId(-1L); - } - } - - if (StringUtils.isNotBlank(record.getMerchantName())) { - WxMerchant mq = new WxMerchant(); - mq.updateTenantInfo(record); - mq.setName(StringUtils.trimToNull(record.getMerchantName())); - List mids = wxMerchantService.findIdList(mq); - if (null != mids && mids.size() > 0 ) { - if (null != record.getMerchantIds()) { - List _mids = (List) CollectionUtils.intersection(mids, record.getMerchantIds()); - if (null == _mids || _mids.size() <= 0) { - record.setId(-1L); - }else { - record.setMerchantIds(_mids); - } - }else { - record.setMerchantIds(mids); - } - }else { - record.setId(-1L); - } - } - } - - private PageInfo getBillOtherPropertyList(Integer pageIndex, Integer pageSize,WxBillOther record,WxPayAccountBill wxPayAccountBill) { - updateQueryParam(record); - PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillOtherMapper.queryBillList(record)); - if (null == page) { - return null; - } - - WxMerchant wq = new WxMerchant(); - wq.updateTenantInfo(record); - Map merchantMap = wxMerchantService.findMerchantMap(wq); - - if (null != page.getList()) { - for (int i = 0 ; i < page.getList().size() ; i ++) { - WxBillOther e = page.getList().get(i); - //手续费 = 合同应收+手续费+滞纳金 - computeTotalMoney(wxPayAccountBill, e); - - if (null != e.getMerchantId()) { - WxMerchant m = merchantMap.get(e.getMerchantId()); - if (null != m ) { - e.setMerchantName(m.getName()); - } - } - } - } - - return page; - } - - public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillOther e) { - if (e.getReceivePay() != null) { - BigDecimal servicePay; - if (e.getServiceChargePay() != null) { - servicePay = new BigDecimal(e.getServiceChargePay()); - } else { - servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); - } - e.setRealReceivePay(servicePay.add(new BigDecimal(e.getReceivePay())).toPlainString()); - e.setServiceChargePay(servicePay.toPlainString()); -// if (!e.getStatus().equals(EnumBillStatus.NOT_PAID.getCode())) { -// //e.setOwe("0"); -// } else { -// //e.setOwe(servicePay.add(new BigDecimal(e.getReceivePay())).subtract(new BigDecimal(e.getPay())).toPlainString()); -// //e.setOwe(new BigDecimal(e.getReceivePay()).subtract(new BigDecimal(e.getPay())).toPlainString()); -// } - } - } - - @Override - public void updateBillStatus(WxBillOther record) { -// logger.info("更新其他账单状态开始..."); -// //更新逾期天数及状态 -// updateNotPaidStatus(record); -// //更新待缴的状态 -// updateWaidPayStatus(record); -// logger.info("更新其他账单状态结束..."); - } - -// @Transactional(rollbackFor = {Exception.class}) -// public void updateWaidPayStatus(WxBillOther record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// params.put("waitPay", EnumBillStatus.WAIT_PAY.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// try { -// wxBillOtherMapper.updateWaitPayStatus(params); -// } catch (Exception e) { -// logger.error("更新其他待缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// } -// -// -// @Transactional(rollbackFor = {Exception.class}) -// public void updateNotPaidStatus(WxBillOther record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// params.put("notPaid", EnumBillStatus.NOT_PAID.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// try { -// wxBillOtherMapper.updateNotPaidStatus(params); -// } catch (Exception e) { -// logger.error("更新其他欠缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// } - - @Override - public WxBillOther getById(TenantEntity tenantEntity,Long id) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(tenantEntity); - WxBillOther record = new WxBillOther(); - record.setId(id); - record.updateTenantInfo(tenantEntity); - WxBillOther wxBillOther = getBillOtherPropertyList(1, 1, record, wxPayAccountBill).getList().get(0); - //wxBillOther.setOwe(new BigDecimal(wxBillOther.getRealReceivePay()).subtract(new BigDecimal(wxBillOther.getPay())).toPlainString()); - //wxBillOther.setOwe(new BigDecimal(wxBillOther.getReceivePay()).subtract(new BigDecimal(wxBillOther.getPay())).toPlainString()); - wxBillOther.setMerchant(wxMerchantMapper.selectById(wxBillOther.getMerchantId())); -// if (wxBillOther.getShopId() != null) { -// WxShop shop = new WxShop(); -// shop.setId(wxBillOther.getShopId()); -// List> shoplist = wxShopMapper.findListMap(shop); -// wxBillOther.setShops(shoplist); -// }else{ -// wxBillOther.setShops(Collections.EMPTY_LIST); -// } - - return wxBillOther; - } - - @Override - public ResultData saveOrUpdate(WxBillOther record, MallUserInfo user) { - String receivepay = "0"; - if (StringUtils.isNotBlank(record.getRealReceivePay())) { - receivepay = record.getRealReceivePay(); - } - String pay = "0"; - if (StringUtils.isNotBlank(record.getPay())) { - pay = record.getPay(); - } - if(new BigDecimal(pay).compareTo(new BigDecimal(receivepay)) > 0){ - return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "实收金额不能大于实际应收总金额"); - } - Date date = new Date(); - if (record.getId() == null) { - logger.info("新增其他押金账单"); - WxBillOther otherQuery = new WxBillOther(); - otherQuery.updateTenantInfo(user); - otherQuery.setMerchantId(record.getMerchantId()); - //otherQuery.setReceiveDate(record.getReceiveDate()); - otherQuery.setStarttime(record.getStarttime()); - otherQuery.setEndtime(record.getEndtime()); - otherQuery.setName(record.getName()); - otherQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - List other = wxBillOtherMapper.findList(otherQuery); - if (other != null && other.size() > 0) { - return new ResultData(ErrorCode.BILL_IS_FOUND.getCode(),"商户已存在包含该时间端的费用账单"); - } - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - //record.setStatus(record.getReceiveDate().after(date)?EnumBillStatus.WAIT_PAY.getCode():EnumBillStatus.NOT_PAID.getCode()); - record.setStatus(EnumBillStatus.WAIT_PAY.getCode()); - record.setCreatetime(date); - record.setCreateBy(user.getId()); - record.setCreateByName(user.getName()); - record.setUpdatetime(date); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - record.setExpiredDay(0L); - record.updateTenantInfo(user); - //record.setOwe(new BigDecimal(record.getRealReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); - //record.setOwe(new BigDecimal(record.getReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); - record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - try { - wxBillOtherMapper.insert(record); - } catch (Exception e) { - logger.error("保存其他押金账单失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - return new ResultData(Result.SUCCESS, "保存其他押金账单成功"); - } else { - logger.info("更新其他押金账单"); - WxBillOther wxBillOther = wxBillOtherMapper.selectById(record.getId(),user.getTenantId()); - if(wxBillOther==null){ - return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); - } - WxBillOther otherQuery = new WxBillOther(); - otherQuery.updateTenantInfo(user); - otherQuery.setMerchantId(record.getMerchantId()); - //otherQuery.setReceiveDate(record.getReceiveDate()); - otherQuery.setStarttime(record.getStarttime()); - otherQuery.setEndtime(record.getEndtime()); - otherQuery.setName(record.getName()); - otherQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - List notinidlist = new ArrayList(); - notinidlist.add(record.getId()); - otherQuery.setNotInIds(notinidlist); - List other = wxBillOtherMapper.findList(otherQuery); - if (other != null && other.size() > 0) { - return new ResultData(ErrorCode.BILL_IS_FOUND.getCode(),"商户已存在其他包含该时间端的费用账单"); - } - record.setUpdatetime(date); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - wxBillOtherMapper.updateById(record); - return new ResultData(Result.SUCCESS, "更新其他押金账单成功"); - } - } - - - @Override - public void deleteById(TenantEntity tenantEntity,Long id) { - wxBillOtherMapper.deleteById(id,tenantEntity.getTenantId()); - } - -// @Transactional(rollbackFor = {Exception.class}) -// @Override -// public ResultData updatePaid(Long id) { -// WxBillOther wxBillOther = wxBillOtherMapper.selectById(id); -// if(wxBillOther==null){ -// return new ResultData(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); -// } -// wxBillOther.setStatus(EnumBillStatus.PAID.getCode()); -// Date d =new Date(); -// wxBillOther.setPayDate(d); -// wxBillOther.setUpdatetime(d); -// try { -// wxBillOtherMapper.updateById(wxBillOther); -// } catch (Exception e) { -// logger.error("其他账单结单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(),e.getMessage()); -// } -// return new ResultData(Result.SUCCESS, "其他账单结单成功"); -// } - - @Override - public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillOther wxBillOther) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillOther); - PageInfo datalist = getBillOtherPropertyList(1, 10000, wxBillOther, wxPayAccountBill); - List list = null; - if (null != datalist && null != datalist.getList()) { - list = datalist.getList(); - }else { - list = new ArrayList(); - } - excelService.exportExcel(list, null, "其他费用账单", WxBillOther.class, "其他费用账单.xlsx", response, false); - } - - @Override - public WxBillSum getBillMonthSum(WxBillOther wxBillOther) { - updateQueryParam(wxBillOther); - return wxBillOtherMapper.getBillMonthSum(wxBillOther); - } - - @Override - public List getMerchantIds(WxBillOther wxBillOther) { - updateQueryParam(wxBillOther); - return wxBillOtherMapper.getMerchantIdList(wxBillOther); - } - - @Override - public WxBillHotNotify getBillHotNotify(WxBillOther wxBillOther) { - updateQueryParam(wxBillOther); - return wxBillOtherMapper.getBillHotNotify(wxBillOther); - } - - @Override - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid) { - WxBillOther dbBill = wxBillOtherMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillOther wxBillOther = new WxBillOther(); - wxBillOther.setId(dto.getId()); - wxBillOther.updateTenantInfo(dto); - wxBillOther.setUpdatetime(new Date()); - wxBillOther.setUpdateBy(user.getId()); - wxBillOther.setUpdateByName(user.getName()); - if (forcePaid) { - wxBillOther.setReceivePay(dbBill.getPay()); - wxBillOther.setStatus(EnumBillStatus.PAID.getCode()); - wxBillOtherMapper.updateById(wxBillOther); - String remark = StringUtils.trimToEmpty(dto.getRemark())+ ";【系统】账单被强制为支付完成,自动归结为结清。"; - //账单日志 - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), - dto.getOldPrice(), dto.getNewPrice(),null,null,null, remark,null,null, 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,null,null,dto.getRemark(),null,null, user); - }else { - wxBillOther.setReceivePay(dto.getNewPrice()); - Date payDate = null; - WxBillPayWay payWay = null; - String remark = StringUtils.trimToEmpty(dto.getRemark()); - if (new BigDecimal(dto.getNewPrice()).compareTo(new BigDecimal(dbBill.getPay())) <= 0) { - wxBillOther.setStatus(EnumBillStatus.PAID.getCode()); - payDate = new Date(); - payWay = wxFinanceService.getPayWayById(dto, Constant.bill_pay_way_system); - remark = remark + ";【系统】账单实际应付金额调整至小于等于已付金额,自动归结为结清。"; - } - wxBillOtherMapper.updateById(wxBillOther); - //账单日志 - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), - dto.getOldPrice(), dto.getNewPrice(),null,payDate, payWay,remark,null,null, user); - } - - - } - - @Override - public void notify(WxBillPayDTO dto, MallUserInfo user) { - WxBillOther wxBillRent = new WxBillOther(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setLastOweCallTime(new Date()); - wxBillRent.setLastOweCallUser(user.getName()+"(账号:"+user.getUsername()+")"); - wxBillOtherMapper.updateById(wxBillRent); - this.addBillAction(EnumBillAction.NOTIFY, dto.getBillTypeValue(),dto.getId(), - null, null,null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void backPay(WxBillPayDTO dto, MallUserInfo user) { - WxBillOther dbBill = wxBillOtherMapper.selectById(dto.getId(),dto.getTenantId()); - BigDecimal oldpay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - oldpay = new BigDecimal(dbBill.getPay()); - } - BigDecimal oldsetoff = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getSetOff())) { - oldsetoff = new BigDecimal(dbBill.getSetOff()); - } - WxBillOther wxBillRent = new WxBillOther(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); - wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); - if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { - if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { - wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); - } - } - wxBillOtherMapper.updateById(wxBillRent); - EnumBillAction action = EnumBillAction.RETURN; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void updatePay(WxBillPayDTO dto, MallUserInfo user) { - WxBillOther wxBillRent = updateBillPay(dto); - EnumBillAction action = EnumBillAction.OFFLINE_PAY; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(), dto.getRemark(),null,null, user); - } - - private WxBillOther updateBillPay(WxBillPayDTO dto) { - WxBillOther dbBill = wxBillOtherMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillOther wxBillRent = new WxBillOther(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - BigDecimal opay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - opay = new BigDecimal(dbBill.getPay()); - } - //支付的金额先扣除手续费和滞纳金,多余的再抵扣本金 - String servicePay = dbBill.getServiceChargePay(); - if (StringUtils.isBlank(servicePay)) { - servicePay = "0"; - } - StringBuffer sb = new StringBuffer(StringUtils.trimToEmpty(dto.getRemark())); - BigDecimal serviceLastMoney = new BigDecimal(dto.getAddpay()).add(new BigDecimal(dto.getSetOff())).subtract(new BigDecimal(servicePay)); - if (new BigDecimal(servicePay).compareTo(new BigDecimal(0)) > 0 ) { - if (serviceLastMoney.compareTo(new BigDecimal(0)) >= 0 ) { - wxBillRent.setServiceChargePay("0"); - sb.append(";手续费").append(servicePay).append("已结清"); - }else { - wxBillRent.setServiceChargePay(dto.getAddpay()); - sb.append(";手续费").append(servicePay).append("已支付").append(dto.getAddpay()); - } - } - - if (serviceLastMoney.compareTo(new BigDecimal(0)) > 0 ) { - opay = opay.add(serviceLastMoney); - wxBillRent.setPay(opay.toPlainString()); - //如果付款金额做了扣除手续费/滞纳金,则需要将本金抵扣写到备注 - if (new BigDecimal(dto.getAddpay()).compareTo(serviceLastMoney) > 0 ) { - sb.append(";已付金额增加").append(serviceLastMoney.toPlainString()); - } - if (opay.compareTo(new BigDecimal(dbBill.getOwe())) >= 0 ) { - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - sb.append(";【系统】账单已付金额已大于等于实际应付金额,自动归结为结清。"); - } - } - String oldSetOff = dbBill.getSetOff(); - if (StringUtils.isBlank(oldSetOff)) { - oldSetOff = "0"; - } - wxBillRent.setSetOff(new BigDecimal(oldSetOff).add(new BigDecimal(dto.getSetOff())).toPlainString()); - wxBillRent.setPayDate(new Date()); - wxBillRent.setPayWay(dto.getPayWayObject().getId()); - wxBillOtherMapper.updateById(wxBillRent); - dto.setRemark(sb.toString()); - return wxBillRent; - } - - @Override - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user ,boolean isOnline) { - WxBillOther wxBillRent = updateBillPay(dto); - EnumBillAction action = null; - if (isOnline) { - action = EnumBillAction.SELF_SERVICE_PAY; - }else { - action = EnumBillAction.OFFLINE_PAY; - } - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void bad(WxBillPayDTO dto, MallUserInfo user) { - WxBillOther dbBill = wxBillOtherMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillOther wxBillRent = new WxBillOther(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setStatus(EnumBillStatus.BAD.getCode()); - wxBillOtherMapper.updateById(wxBillRent); - String badMoney = dbBill.getOwe(); - this.addBillAction(EnumBillAction.BAD, dto.getBillTypeValue(),dto.getId(), - badMoney, badMoney,null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void stopMerchantBills(WxMerchant wxMerchant, MallUserInfo userInfo) { - WxBillOther bdel = new WxBillOther(); - bdel.setMerchantId(wxMerchant.getId()); - bdel.updateTenantInfo(wxMerchant); - bdel.setShopEndtime(new Date()); - wxBillOtherMapper.deleteNoNeedPayBill(bdel); - - WxBillOther wxBillRent = new WxBillOther(); - wxBillRent.setMerchantId(wxMerchant.getId()); - wxBillRent.updateTenantInfo(wxMerchant); - List brList = wxBillOtherMapper.findList(wxBillRent); - List realRentList = new ArrayList(); - List actionList = new ArrayList(); - Date current = DateUtils.getDayEnd(new Date()); - if (null != brList && brList.size() > 0 ) { - for (int i = 0 ; i < brList.size() ; i ++ ) { - WxBillOther brent = brList.get(i); - WxBillAction action = new WxBillAction(); - boolean isUpdate = wxBillAllHelper.billEndCalcute(2,current, brent, action, false); - if (isUpdate) { - realRentList.add(brent); - actionList.add(action); - } - } - } - - for (int i = 0 ; i < realRentList.size() ; i ++) { - WxBillOther rbrent = realRentList.get(i); - wxBillOtherMapper.updateById(rbrent); - } - - for (int i = 0 ; i < actionList.size() ; i ++) { - WxBillAction ba = actionList.get(i); - this.addBillAction(ba, userInfo); - } - } - - @Override - public void completeBill(EnumBillStatus status, WxMerchant wxMerchant, MallUserInfo user) { - WxBillOther bill = new WxBillOther(); - bill.updateTenantInfo(wxMerchant); - bill.setFloorForRule(wxMerchant.getFloorForRule()); - bill.setBusinessForRule(wxMerchant.getBusinessForRule()); - bill.setBuilding(wxMerchant.getBuilding()); - bill.setFloor(wxMerchant.getFloor()); - bill.setMerchantId(wxMerchant.getId()); - bill.setStatus(status.getCode()); - updateQueryParam(bill); - PageInfo bpage = this.listAsPage(bill, 1, 100); - if (null != bpage && null != bpage.getList()) { - for (int i = 0 ; i < bpage.getList().size() ; i++ ) { - WxBillOther b = bpage.getList().get(i); - - WxBillOther bu = new WxBillOther(); - bu.setId(b.getId()); - bu.updateTenantInfo(b); - bu.setStatus(EnumBillStatus.INVALID.getCode()); - bu.setUpdatetime(new Date()); - bu.setUpdateBy(user.getId()); - bu.setUpdateByName(user.getName()); - wxBillOtherMapper.updateById(bu); - - WxBillAction wxBillAction = new WxBillAction(); - wxBillAction.setBillId(b.getId()); - wxBillAction.setBillType(b.getBillType()); - wxBillAction.setAction(EnumBillAction.STATUS_CHANGE.getCode()); - wxBillAction.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null,null,null,EnumBillStatus.getEnum(b.getStatus()),EnumBillStatus.INVALID)); - wxBillAction.setRemark(wxMerchant.getBillCompleteRemark()); - this.addBillAction(wxBillAction, user); - } - } - - } -} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java deleted file mode 100644 index c2a307da7..000000000 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java +++ /dev/null @@ -1,686 +0,0 @@ -package com.iformall.service.impl; - -import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillAction; -import com.iformall.domain.po.WxBillDeposit; -import com.iformall.domain.po.WxBillPayWay; -import com.iformall.domain.po.WxBillProperty; -import com.iformall.domain.po.WxBillPropertyDeposit; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -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.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillAction; -import com.iformall.enums.EnumBillStatus; -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; -import com.iformall.service.WxFinanceService; -import com.iformall.service.WxMerchantService; -import com.iformall.service.WxPayAccountBillService; -import com.iformall.service.WxShopService; -import com.iformall.service.helper.WxBillAllHelper; -import com.iformall.utils.Constant; -import com.iformall.utils.DateUtils; - -import org.apache.commons.collections.CollectionUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author gongbiao - */ -@Service -public class WxBillPropertyDepositServiceImpl extends WxBillBaseService implements WxBillPropertyDepositService { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - WxBillPropertyDepositMapper wxBillPropertyDepositMapper; - @Autowired - WxPropertyContractMapper wxPropertyContractMapper; - @Autowired - WxBillActionService wxBillActionService; - @Autowired - WxPayAccountBillService wxPayAccountBillService; - - @Lazy - @Autowired - WxMerchantService wxMerchantService; - - @Lazy - @Autowired - WxShopService wxShopService; - - @Autowired - ExcelService excelService; - - @Lazy - @Autowired - WxBillAllHelper wxBillAllHelper; - - @Lazy - @Autowired - WxFinanceService wxFinanceService; - - @Override - public PageInfo listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - return getBillDepositPropertyList(wxPayAccountBill, record, pageIndex, pageSize); - } - - @Override - public List list(WxBillPropertyDeposit record) { - updateQueryParam(record); - return wxBillPropertyDepositMapper.queryBillDepositList(record); - } - - @Override - public List notifyList(WxBillPropertyDeposit record) { - updateQueryParam(record); - return wxBillPropertyDepositMapper.getBillNotifyList(record); - } - - private void updateQueryParam(WxBillPropertyDeposit record) { - if (null != record.getFloorForRule() || null != record.getFloor() || null != record.getBuilding()) { - List merchantIds = wxMerchantService.getFloorBuildMerchantIds(record, record.getFloorForRule(), record.getBuilding(), record.getFloor(), 0, 0); - if (null != merchantIds) { - record.setMerchantIds(merchantIds); - }else { - record.setId(-1L); - } - } - - if (StringUtils.isNotBlank(record.getMerchantName())) { - WxMerchant mq = new WxMerchant(); - mq.updateTenantInfo(record); - mq.setName(StringUtils.trimToNull(record.getMerchantName())); - List mids = wxMerchantService.findIdList(mq); - if (null != mids && mids.size() > 0 ) { - if (null != record.getMerchantIds()) { - List _mids = (List) CollectionUtils.intersection(mids, record.getMerchantIds()); - if (null == _mids || _mids.size() <= 0) { - record.setId(-1L); - }else { - record.setMerchantIds(_mids); - } - }else { - record.setMerchantIds(mids); - } - }else { - record.setId(-1L); - } - } - } - - private PageInfo getBillDepositPropertyList(WxPayAccountBill wxPayAccountBill,WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize) { - updateQueryParam(record); - PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillPropertyDepositMapper.queryBillDepositList(record)); - if (null == page) { - return null; - } - - WxMerchant wq = new WxMerchant(); - wq.updateTenantInfo(record); - Map merchantMap = wxMerchantService.findMerchantMap(wq); - -// WxShop sq = new WxShop(); -// sq.updateTenantInfo(record); -// Map shopMap = wxShopService.findShopMap(sq); - - if (null != page.getList()) { - for (int i = 0 ; i < page.getList().size() ; i ++) { - WxBillPropertyDeposit e = page.getList().get(i); - //手续费 = 合同应收+手续费+滞纳金 - //computeTotalMoney(Constant.default_long_decimal_size,wxPayAccountBill, e); - - if (null != e.getMerchantId()) { - WxMerchant m = merchantMap.get(e.getMerchantId()); - if (null != m ) { - e.setMerchantName(m.getName()); - } - } - e.setShopNumber(e.getShopNumberByShopInfo()); -// if (null != e.getShopId()) { -// WxShop shop = shopMap.get(e.getShopId()); -// if (null != shop) { -// e.setShopNumber(shop.getShopNumber()); -// } -// } - - } - } - return page; - } - - @Override - public void computeTotalMoney(Integer decimalSize,WxPayAccountBill wxPayAccountBill, WxBillPropertyDeposit deposit) { - if (deposit.getReceivePay() != null) { - BigDecimal servicePay; - if (deposit.getServiceChargePay() != null) { - servicePay = new BigDecimal(deposit.getServiceChargePay()); - } else { - servicePay = new BigDecimal(deposit.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), decimalSize, BigDecimal.ROUND_HALF_UP); - } - BigDecimal realReceivePay = servicePay.add(new BigDecimal(deposit.getReceivePay())); - deposit.setRealReceivePay(realReceivePay.toPlainString()); - deposit.setServiceChargePay(servicePay.toPlainString()); - } - } - - @Override - public void updateBillStatus(WxBillPropertyDeposit record) { -// logger.info("更新物业押金账单状态开始..."); -// //更新逾期天数及状态 -// updateNotPaidStatus(record); -// //更新待缴的状态 -// updateWaidPayStatus(record); -// logger.info("更新物业押金账单状态结束..."); - } - - -// @Transactional(rollbackFor = {Exception.class}) -// public void updateWaidPayStatus(WxBillPropertyDeposit record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// params.put("waitPay", EnumBillStatus.WAIT_PAY.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// -// try { -// wxBillPropertyDepositMapper.updateWaitPayStatus(params); -// } catch (Exception e) { -// logger.error("更新物业押金待缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// } -// -// -// @Transactional(rollbackFor = {Exception.class}) -// public void updateNotPaidStatus(WxBillPropertyDeposit record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// params.put("notPaid", EnumBillStatus.NOT_PAID.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// try { -// wxBillPropertyDepositMapper.updateNotPaidStatus(params); -// } catch (Exception e) { -// logger.error("更新物业押金欠缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// } - - @Override - public WxBillPropertyDeposit getById(TenantEntity tenantEntity ,Long id) { - WxBillPropertyDeposit record = new WxBillPropertyDeposit(); - record.setId(id); - record.updateTenantInfo(tenantEntity); - 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 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 result = new HashMap<>(3); - result.put("deposit", deposit); - result.put("propertyContract", propertyContract); - return result; - } - - @Override - public ResultData saveOrUpdate(WxBillPropertyDeposit record, MallUserInfo user) { - String receivepay = StringUtils.isBlank(record.getReceivePay()) ? "0" : record.getReceivePay(); - String pay = StringUtils.isBlank(record.getPay()) ? "0" : record.getPay(); - if(new BigDecimal(pay).compareTo(new BigDecimal(receivepay)) > 0 ){ - return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "实收金额不能大于实际应收金额"); - } - Date date = new Date(); - if (record.getId() == null) { - logger.info("新增物业押金账单"); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreatetime(date); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - record.setUpdatetime(date); - record.setCreateBy(user.getId()); - record.setCreateByName(user.getName()); - record.updateTenantInfo(user); - //record.setOwe(new BigDecimal(receivepay).subtract(new BigDecimal(pay)).toPlainString()); - record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - try { - wxBillPropertyDepositMapper.insert(record); - } catch (Exception e) { - logger.error("保存物业押金账单失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - return new ResultData(Result.SUCCESS, "保存物业押金账单成功"); - } else { - return new ResultData(); - } - } - - @Override - public void deleteById(TenantEntity tenantEntity ,Long id) { - wxBillPropertyDepositMapper.deleteById(id,tenantEntity.getTenantId()); - } - -// @Transactional(rollbackFor = {Exception.class}) -// @Override -// public ResultData updatePaid(Long id) { -// WxBillPropertyDeposit wxBillDeposit = wxBillPropertyDepositMapper.selectById(id); -// if(wxBillDeposit==null){ -// return new ResultData(ErrorCode.BILL_PROPERTY_DEPOSIT_IS_NOT_FOUND); -// } -// wxBillDeposit.setStatus(EnumBillStatus.PAID.getCode()); -// Date d =new Date(); -// wxBillDeposit.setPayDate(d); -// wxBillDeposit.setUpdatetime(d); -// try { -// wxBillPropertyDepositMapper.updateById(wxBillDeposit); -// } catch (Exception e) { -// logger.error("物业押金结单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// return new ResultData(Result.SUCCESS, "物业押金结单成功"); -// } - -// @Override -// public ResultData returnDeposit(WxBillPropertyDeposit record, MallUserInfo user) { -// logger.info("物业押金退还"); -// WxBillPropertyDeposit wxBillDeposit = wxBillPropertyDepositMapper.selectById(record.getId(),user.getTenantId()); -// if (wxBillDeposit == null) { -// return new ResultData(ErrorCode.BILL_PROPERTY_DEPOSIT_IS_NOT_FOUND); -// } -// wxBillDeposit.setPayWay(record.getPayWay()); -// wxBillDeposit.setReturnPrice(record.getReturnPrice()); -// wxBillDeposit.setStatus(EnumBillStatus.RETURN.getCode()); -// wxBillDeposit.setUpdatetime(new Date()); -// 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.updateTenantInfo(user); -// wxBillAction.setBillId(wxBillDeposit.getId()); -// String message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); -// String price = new BigDecimal(record.getReturnPrice()).divide(new BigDecimal(100)).toPlainString(); -// wxBillAction.setDetails(message + price + "元"); -// wxBillAction.setAction(EnumBillAction.DEPOSIT_RETURN.getCode()); -// wxBillAction.setUserId(user.getId()); -// wxBillAction.setUserName(user.getName()); -// wxBillAction.setPhone(user.getPhone()); -// wxBillAction.updateTenantInfo(user); -// try { -// wxBillActionService.save(wxBillAction); -// } catch (Exception e) { -// logger.error("添加物业押金账单行为日志,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// return new ResultData(Result.SUCCESS, "物业押金退还成功", wxBillDeposit); -// } -// -// -// @Override -// public ResultData adjustDeposit(WxBillPropertyDeposit record) { -// logger.info("物业押金调整"); -// WxBillPropertyDeposit wxBillDeposit = wxBillPropertyDepositMapper.selectById(record.getId(),record.getTenantId()); -// if (wxBillDeposit == null) { -// return new ResultData(ErrorCode.BILL_OTHER_DEPOSIT_IS_NOT_FOUND); -// } -// wxBillDeposit.setReceivePay(record.getReceivePay()); -// //wxBillDeposit.setOwe(new BigDecimal(record.getReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); -// wxBillDeposit.setUpdatetime(new Date()); -// try { -// wxBillPropertyDepositMapper.updateById(wxBillDeposit); -// } catch (Exception e) { -// logger.error("物业押金退还失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// return new ResultData(Result.SUCCESS, "物业押金调整成功", wxBillDeposit); -// } - - @Override - public WxBillSum getBillMonthSum(WxBillPropertyDeposit deposit) { - updateQueryParam(deposit); - return wxBillPropertyDepositMapper.getBillMonthSum(deposit); - } - - @Override - public List getMerchantIds(WxBillPropertyDeposit deposit) { - updateQueryParam(deposit); - return wxBillPropertyDepositMapper.getMerchantIdList(deposit); - } - - @Override - public WxBillHotNotify getBillHotNotify(WxBillPropertyDeposit deposit) { - updateQueryParam(deposit); - return wxBillPropertyDepositMapper.getBillHotNotify(deposit); - } - - @Override - public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillPropertyDeposit deposit) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(deposit); - String billName = deposit.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺物业押金账单" : "多经点位物业押金账单"; - PageInfo billRentList = getBillDepositPropertyList(wxPayAccountBill,deposit,1,10000); - if (null == billRentList || null == billRentList.getList()) { - return ; - } - excelService.exportExcel(billRentList.getList(),null, billName, WxBillPropertyDeposit.class, billName + ".xlsx", response, false); - - } - - @Override - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid) { - WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillPropertyDeposit wxBillPropertyDeposit = new WxBillPropertyDeposit(); - wxBillPropertyDeposit.setId(dto.getId()); - wxBillPropertyDeposit.updateTenantInfo(dto); - wxBillPropertyDeposit.setUpdatetime(new Date()); - wxBillPropertyDeposit.setUpdateBy(user.getId()); - wxBillPropertyDeposit.setUpdateByName(user.getName()); - String billPropertyDepositOldPrce = dto.getOldPrice(); - String billPropertyDepositNewPrce = dto.getNewPrice(); - if (forcePaid) { - wxBillPropertyDeposit.setReceivePay(dbBill.getPay()); - wxBillPropertyDeposit.setStatus(EnumBillStatus.PAID.getCode()); - billPropertyDepositOldPrce = dbBill.getPay(); - billPropertyDepositNewPrce = dbBill.getPay(); - wxBillPropertyDepositMapper.updateById(wxBillPropertyDeposit); - String remark = StringUtils.trimToEmpty(dto.getRemark())+ ";【系统】账单被强制为支付完成,自动归结为结清。"; - //账单日志 - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), - billPropertyDepositOldPrce, billPropertyDepositNewPrce,null,null,null, remark,null,null, 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,null,null,dto.getRemark(),null,null, user); - }else { - wxBillPropertyDeposit.setReceivePay(dto.getNewPrice()); - Date payDate = null; - WxBillPayWay payWay = null; - String remark = StringUtils.trimToEmpty(dto.getRemark()); - if (new BigDecimal(dto.getNewPrice()).compareTo(new BigDecimal(dbBill.getPay())) <= 0) { - wxBillPropertyDeposit.setStatus(EnumBillStatus.PAID.getCode()); - payDate = new Date(); - payWay = wxFinanceService.getPayWayById(dto, Constant.bill_pay_way_system); - remark = remark + ";【系统】账单实际应付金额调整至小于等于已付金额,自动归结为结清。"; - } - wxBillPropertyDepositMapper.updateById(wxBillPropertyDeposit); - //账单日志 - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), - billPropertyDepositOldPrce, billPropertyDepositNewPrce,null,payDate, payWay,remark,null,null, user); - } - - } - - @Override - public void notify(WxBillPayDTO dto, MallUserInfo user) { - WxBillPropertyDeposit wxBillRent = new WxBillPropertyDeposit(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setLastOweCallTime(new Date()); - wxBillRent.setLastOweCallUser(user.getName()+"(账号:"+user.getUsername()+")"); - wxBillPropertyDepositMapper.updateById(wxBillRent); - this.addBillAction(EnumBillAction.NOTIFY, dto.getBillTypeValue(),dto.getId(), - null, null,null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void backPay(WxBillPayDTO dto, MallUserInfo user) { - WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectById(dto.getId(),dto.getTenantId()); - BigDecimal oldpay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - oldpay = new BigDecimal(dbBill.getPay()); - } - BigDecimal oldsetoff = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getSetOff())) { - oldsetoff = new BigDecimal(dbBill.getSetOff()); - } - WxBillPropertyDeposit wxBillRent = new WxBillPropertyDeposit(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); - wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); - if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { - if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { - wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); - } - } - wxBillPropertyDepositMapper.updateById(wxBillRent); - EnumBillAction action = EnumBillAction.RETURN; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void updatePay(WxBillPayDTO dto, MallUserInfo user) { - WxBillPropertyDeposit wxBillRent = updateBillPay(dto); - EnumBillAction action = EnumBillAction.OFFLINE_PAY; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(), dto.getRemark(),null,null, user); - } - - private WxBillPropertyDeposit updateBillPay(WxBillPayDTO dto) { - WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillPropertyDeposit wxBillRent = new WxBillPropertyDeposit(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - BigDecimal opay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - opay = new BigDecimal(dbBill.getPay()); - } - - //支付的金额先扣除手续费和滞纳金,多余的再抵扣本金 - String servicePay = dbBill.getServiceChargePay(); - if (StringUtils.isBlank(servicePay)) { - servicePay = "0"; - } - StringBuffer sb = new StringBuffer(StringUtils.trimToEmpty(dto.getRemark())); - BigDecimal serviceLastMoney = new BigDecimal(dto.getAddpay()).add(new BigDecimal(dto.getSetOff())).subtract(new BigDecimal(servicePay)); - if (new BigDecimal(servicePay).compareTo(new BigDecimal(0)) > 0 ) { - if (serviceLastMoney.compareTo(new BigDecimal(0)) >= 0 ) { - wxBillRent.setServiceChargePay("0"); - sb.append(";手续费").append(servicePay).append("已结清"); - }else { - wxBillRent.setServiceChargePay(dto.getAddpay()); - sb.append(";手续费").append(servicePay).append("已支付").append(dto.getAddpay()); - } - } - - if (serviceLastMoney.compareTo(new BigDecimal(0)) > 0 ) { - opay = opay.add(serviceLastMoney); - wxBillRent.setPay(opay.toPlainString()); - //如果付款金额做了扣除手续费/滞纳金,则需要将本金抵扣写到备注 - if (new BigDecimal(dto.getAddpay()).compareTo(serviceLastMoney) > 0 ) { - sb.append(";已付金额增加").append(serviceLastMoney.toPlainString()); - } - if (opay.compareTo(new BigDecimal(dbBill.getOwe())) >= 0 ) { - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - sb.append(";【系统】账单已付金额已大于等于实际应付金额,自动归结为结清。"); - } - } - String oldSetOff = dbBill.getSetOff(); - if (StringUtils.isBlank(oldSetOff)) { - oldSetOff = "0"; - } - wxBillRent.setSetOff(new BigDecimal(oldSetOff).add(new BigDecimal(dto.getSetOff())).toPlainString()); - wxBillRent.setPayDate(new Date()); - wxBillRent.setPayWay(dto.getPayWayObject().getId()); - wxBillPropertyDepositMapper.updateById(wxBillRent); - dto.setRemark(sb.toString()); - return wxBillRent; - } - - @Override - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline) { - WxBillPropertyDeposit wxBillRent = updateBillPay(dto); - EnumBillAction action = null; - if (isOnline) { - action = EnumBillAction.SELF_SERVICE_PAY; - }else { - action = EnumBillAction.OFFLINE_PAY; - } - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void returnDeposit(WxBillPayDTO dto, MallUserInfo user) { - WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectById(dto.getId(),dto.getTenantId()); - BigDecimal oldpay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getReturnPrice())) { - oldpay = new BigDecimal(dbBill.getReturnPrice()); - } - WxBillPropertyDeposit wxBillRent = new WxBillPropertyDeposit(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setReturnPrice(oldpay.add(new BigDecimal(dto.getAddpay())).toPlainString()); - wxBillPropertyDepositMapper.updateById(wxBillRent); - this.addBillAction(EnumBillAction.RETURN, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void bad(WxBillPayDTO dto, MallUserInfo user) { - WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillPropertyDeposit wxBillRent = new WxBillPropertyDeposit(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setStatus(EnumBillStatus.BAD.getCode()); - wxBillPropertyDepositMapper.updateById(wxBillRent); - String badMoney = dbBill.getOwe(); - this.addBillAction(EnumBillAction.BAD, dto.getBillTypeValue(),dto.getId(), - badMoney, badMoney,null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void propertyContractStop(WxPropertyContract propertyContract, MallUserInfo user) { - WxBillPropertyDeposit brDel = new WxBillPropertyDeposit(); - brDel.setPropertyContractId(propertyContract.getId()); - brDel.updateTenantInfo(propertyContract); - brDel.setShopEndtime(propertyContract.getEndContractTime()); - wxBillPropertyDepositMapper.deleteNoNeedPayBill(brDel); - - - WxBillPropertyDeposit br = new WxBillPropertyDeposit(); - br.setPropertyContractId(propertyContract.getId()); - br.updateTenantInfo(propertyContract); - List brList = wxBillPropertyDepositMapper.findList(br); - List realRentList = new ArrayList(); - List actionList = new ArrayList(); - if (null != brList && brList.size() > 0 ) { - for (int i = 0 ; i < brList.size() ; i ++ ) { - WxBillPropertyDeposit brent = brList.get(i); - WxBillAction action = new WxBillAction(); - boolean isUpdate = wxBillAllHelper.billEndCalcute(propertyContract.getDecimalSize(),propertyContract.getEndContractTime(), brent, action, true); - if (isUpdate) { - realRentList.add(brent); - actionList.add(action); - } - } - } - - for (int i = 0 ; i < realRentList.size() ; i ++) { - WxBillPropertyDeposit rbrent = realRentList.get(i); - wxBillPropertyDepositMapper.updateById(rbrent); - } - - for (int i = 0 ; i < actionList.size() ; i ++) { - WxBillAction ba = actionList.get(i); - this.addBillAction(ba, user); - } - } - - @Override - public void completeBill(EnumBillStatus status, WxMerchant wxMerchant, MallUserInfo user) { - WxBillPropertyDeposit bill = new WxBillPropertyDeposit(); - bill.updateTenantInfo(wxMerchant); - bill.setFloorForRule(wxMerchant.getFloorForRule()); - bill.setBusinessForRule(wxMerchant.getBusinessForRule()); - bill.setBuilding(wxMerchant.getBuilding()); - bill.setFloor(wxMerchant.getFloor()); - bill.setMerchantId(wxMerchant.getId()); - bill.setStatus(status.getCode()); - updateQueryParam(bill); - PageInfo bpage = this.listAsPage(bill, 1, 100); - if (null != bpage && null != bpage.getList()) { - for (int i = 0 ; i < bpage.getList().size() ; i++ ) { - WxBillPropertyDeposit b = bpage.getList().get(i); - - WxBillPropertyDeposit bu = new WxBillPropertyDeposit(); - bu.setId(b.getId()); - bu.updateTenantInfo(b); - bu.setStatus(EnumBillStatus.INVALID.getCode()); - bu.setUpdatetime(new Date()); - bu.setUpdateBy(user.getId()); - bu.setUpdateByName(user.getName()); - wxBillPropertyDepositMapper.updateById(bu); - - WxBillAction wxBillAction = new WxBillAction(); - wxBillAction.setBillId(b.getId()); - wxBillAction.setBillType(b.getBillType()); - wxBillAction.setAction(EnumBillAction.STATUS_CHANGE.getCode()); - wxBillAction.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null,null,null,EnumBillStatus.getEnum(b.getStatus()),EnumBillStatus.INVALID)); - wxBillAction.setRemark(wxMerchant.getBillCompleteRemark()); - this.addBillAction(wxBillAction, user); - } - } - - } -} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java deleted file mode 100644 index c342970f3..000000000 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java +++ /dev/null @@ -1,802 +0,0 @@ -package com.iformall.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillAction; -import com.iformall.domain.po.WxBillPayWay; -import com.iformall.domain.po.WxBillProperty; -import com.iformall.domain.po.WxBillPropertyDeposit; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.domain.po.WxPropertyContract; -import com.iformall.domain.po.WxShop; -import com.iformall.domain.po.base.BaseEntity; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillAction; -import com.iformall.enums.EnumBillStatus; -import com.iformall.enums.EnumDelStatus; -import com.iformall.enums.EnumRentShopType; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.WxBillActionMapper; -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; -import com.iformall.service.WxBillPropertyService; -import com.iformall.service.WxFinanceService; -import com.iformall.service.WxMerchantService; -import com.iformall.service.WxPayAccountBillService; -import com.iformall.service.WxShopService; -import com.iformall.service.helper.WxBillAllHelper; -import com.iformall.utils.Constant; -import com.iformall.utils.DateUtils; - -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * @author gongbiao - */ -@Service -public class WxBillPropertyServiceImpl extends WxBillBaseService implements WxBillPropertyService { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - WxBillPropertyMapper wxBillPropertyMapper; - - @Autowired - WxBillPropertyDepositMapper wxBillPropertyDepositMapper; - - @Autowired - WxPropertyContractMapper wxPropertyContractMapper; - - @Autowired - WxBillActionService wxBillActionService; - - @Autowired - ExcelService excelService; - - @Autowired - WxBillActionMapper wxBillActionMapper; - @Autowired - WxPayAccountBillService wxPayAccountBillService; - @Autowired - WxBillPropertyDepositService wxBillPropertyDepositService; - - - @Lazy - @Autowired - WxMerchantService wxMerchantService; - - @Lazy - @Autowired - WxShopService wxShopService; - - @Lazy - @Autowired - WxBillAllHelper wxBillAllHelper; - - @Lazy - @Autowired - WxFinanceService wxFinanceService; - - @Override - public PageInfo listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - return getBillPropertyList(pageIndex, pageSize, wxPayAccountBill, record); - } - - @Override - public List list(WxBillProperty record) { - updateQueryParam(record); - return wxBillPropertyMapper.queryBillPropertyList(record); - } - - @Override - public List notifyList(WxBillProperty record) { - updateQueryParam(record); - return wxBillPropertyMapper.getBillNotifyList(record); - } - - private void updateQueryParam(WxBillProperty record) { - if(null != record.getDepositStatus()) { - WxBillPropertyDeposit bdq1 = new WxBillPropertyDeposit(); - bdq1.updateTenantInfo(record); - bdq1.setStatus(record.getDepositStatus()); - List rentids = wxBillPropertyDepositMapper.findPropertyContractIds(bdq1); - if (null != rentids && rentids.size() > 0 ) { - record.setPropertyContractIds(rentids); - }else { - record.setId(-1L); - } - } - if (null != record.getFloorForRule() || null != record.getFloor() || null != record.getBuilding()) { - List merchantIds = wxMerchantService.getFloorBuildMerchantIds(record, record.getFloorForRule(), record.getBuilding(), record.getFloor(), 0, 0); - if (null != merchantIds) { - record.setMerchantIds(merchantIds); - }else { - record.setId(-1L); - } - } - - if (StringUtils.isNotBlank(record.getMerchantName())) { - WxMerchant mq = new WxMerchant(); - mq.updateTenantInfo(record); - mq.setName(StringUtils.trimToNull(record.getMerchantName())); - List mids = wxMerchantService.findIdList(mq); - if (null != mids && mids.size() > 0 ) { - if (null != record.getMerchantIds()) { - List _mids = (List) CollectionUtils.intersection(mids, record.getMerchantIds()); - if (null == _mids || _mids.size() <= 0) { - record.setId(-1L); - }else { - record.setMerchantIds(_mids); - } - }else { - record.setMerchantIds(mids); - } - }else { - record.setId(-1L); - } - } - } - - private PageInfo getBillPropertyList(Integer pageIndex, Integer pageSize,WxPayAccountBill wxPayAccountBill,WxBillProperty record) { - updateQueryParam(record); - PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillPropertyMapper.queryBillPropertyList(record)); - if (null == page) { - return null; - } - - List propertyContractIdList = wxBillPropertyMapper.queryPropertyContractIdList(record); - Map propertyContractMap = new HashMap(); -// Map billDepositMap = new HashMap(); - if ( null != propertyContractIdList && propertyContractIdList.size() > 0 ) { - WxPropertyContract rcq = new WxPropertyContract(); - rcq.updateTenantInfo(record); - rcq.setIds(propertyContractIdList); - List rlist = wxPropertyContractMapper.findList(rcq); - if (null != rlist && rlist.size() > 0 ) { - for (int i = 0 ; i < rlist.size(); i++) { - WxPropertyContract rc = rlist.get(i); - propertyContractMap.put(rc.getId(), rc); - } - } - -// WxBillPropertyDeposit bdq = new WxBillPropertyDeposit(); -// bdq.updateTenantInfo(record); -// bdq.setPropertyContractIdList(propertyContractIdList); -// List 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); - Map merchantMap = wxMerchantService.findMerchantMap(wq); - - WxShop sq = new WxShop(); - sq.updateTenantInfo(record); - Map shopMap = wxShopService.findShopMap(sq); - - if (null != page.getList()) { - for (int i = 0 ; i < page.getList().size() ; i ++) { - WxBillProperty e = page.getList().get(i); - //手续费 = 合同应收+手续费+滞纳金 - computeTotalMoney(wxPayAccountBill, e); - - if (null != e.getMerchantId()) { - WxMerchant m = merchantMap.get(e.getMerchantId()); - if (null != m ) { - e.setMerchantName(m.getName()); - } - } - - if (null != e.getShopId()) { - WxShop shop = shopMap.get(e.getShopId()); - if (null != shop) { - e.setShopNumber(shop.getShopNumber()); - } - } - - WxPropertyContract rent = propertyContractMap.get(e.getPropertyContractId()); - if (null != rent) { -// if (StringUtils.isNoneBlank(rent.getLatePayRatio())) { -// e.setLatePayRatio(Integer.parseInt(rent.getLatePayRatio())); -// } - e.setLatePayDay(rent.getLatePayDay()); - e.setShopNumber(rent.getBillShopNumber()); - } - -// WxBillPropertyDeposit bd = billDepositMap.get(e.getPropertyContractId()); -// if (null != bd) { -// e.setDeposit(bd.getReceivePay()); -// e.setDepositStatus(bd.getStatus()); -// } - - } - } - - return page; - - } - - public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillProperty e) { - //手续费 = 合同应收+手续费+滞纳金 - if (e.getReceivePay() != null) { - if (e.getLatePayPrice() == null) { - String latePayPrice = "0"; - e.setLatePayPrice(latePayPrice); - } - BigDecimal servicePay; - if (e.getServiceChargePay() != null) { - servicePay = new BigDecimal(e.getServiceChargePay()); - } else { - servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); - } - BigDecimal realReceivePay = servicePay.add(new BigDecimal(e.getLatePayPrice())).add(new BigDecimal(e.getReceivePay())); - e.setRealReceivePay(realReceivePay.toPlainString()); - e.setServiceChargePay(servicePay.toPlainString()); -// if (!e.getStatus().equals(EnumBillStatus.NOT_PAID.getCode())) { -// //e.setOwe("0"); -// } else { -// //e.setOwe(realReceivePay.subtract(new BigDecimal(e.getPay())).toPlainString()); -// //e.setOwe(new BigDecimal(e.getReceivePay()).subtract(new BigDecimal(e.getPay())).toPlainString()); -// } - } - } - - @Override - public void updateBillStatus(WxBillProperty record) { - logger.info("更新物业账单状态开始..."); -// //更新逾期天数及状态 -// updateNotPaidStatus(record); -// //更新待缴的状态 -// updateWaidPayStatus(record); - logger.info("更新物业账单状态结束..."); - } - -// @Transactional(rollbackFor = {Exception.class}) -// public void updateWaidPayStatus(WxBillProperty record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// params.put("waitPay", EnumBillStatus.WAIT_PAY.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// -// try { -// wxBillPropertyMapper.updateWaitPayStatus(params); -// } catch (Exception e) { -// logger.error("更新物业待缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// } -// -// -// @Transactional(rollbackFor = {Exception.class}) -// public void updateNotPaidStatus(WxBillProperty record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// params.put("notPaid", EnumBillStatus.NOT_PAID.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// try { -// wxBillPropertyMapper.updateNotPaidStatus(params); -// } catch (Exception e) { -// logger.error("更新物业欠缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// } - - @Override - public WxBillProperty getById(TenantEntity tenantEntity,Long id) { - //手续费 = 合同应收+手续费+滞纳金 - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(tenantEntity); - WxBillProperty record = new WxBillProperty(); - record.setId(id); - record.updateTenantInfo(tenantEntity); - PageInfo page = getBillPropertyList(1, 10000, wxPayAccountBill, record); - WxBillProperty property = page.getList().get(0); - //property.setOwe(new BigDecimal(property.getRealReceivePay()).subtract(new BigDecimal(property.getPay())).toPlainString()); - //property.setOwe(new BigDecimal(property.getReceivePay()).subtract(new BigDecimal(property.getPay())).toPlainString()); - return property; - } - - @Override - public ResultData saveOrUpdate(WxBillProperty record, MallUserInfo user) { - //String receivepay = StringUtils.isBlank(record.getRealReceivePay()) ? "0" : record.getRealReceivePay(); - String receivepay = StringUtils.isBlank(record.getReceivePay()) ? "0" : record.getReceivePay(); - String pay = StringUtils.isBlank(record.getPay()) ? "0" : record.getPay(); - if (new BigDecimal(pay).compareTo(new BigDecimal(receivepay)) > 0 ) { - return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "实收金额不能大于实际应收总金额"); - } - Date date = new Date(); - if (record.getId() == null) { - logger.info("新增物业账单"); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreatetime(date); - record.setUpdatetime(date); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - record.setCreateBy(user.getId()); - record.setCreateByName(user.getName()); - record.updateTenantInfo(user); - //record.setOwe(new BigDecimal(record.getRealReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); - //record.setOwe(new BigDecimal(record.getReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); - record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - try { - wxBillPropertyMapper.insert(record); - } catch (Exception e) { - logger.error("保存物业账单失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - return new ResultData(Result.SUCCESS, "保存物业账单成功"); - } else { - return new ResultData(); - } - } - - @Override - public void deleteById(TenantEntity tenantEntity,Long id) { - wxBillPropertyMapper.deleteById(id,tenantEntity.getTenantId()); - } - - @Override - public PageInfo findByPropertyContractId(Long id, TenantEntity tenantEntity, Integer pageIndex, Integer pageSize) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(tenantEntity); - WxBillProperty record = new WxBillProperty(); - record.setPropertyContractId(id); - record.updateTenantInfo(tenantEntity); - record.setSortColumns(BaseEntity.SortField.Id_ASC); - updateBillStatus(record); - PageHelper.startPage(pageIndex, pageSize); - PageInfo billRentList = getBillPropertyList(1, 10000, wxPayAccountBill, record); - return billRentList; - } - - -// @Transactional(rollbackFor = {Exception.class}) -// @Override -// public ResultData updatePaid(Long id) { -// WxBillProperty record = wxBillPropertyMapper.selectById(id); -// if (record == null) { -// return new ResultData(ErrorCode.BILL_PROPERTY_IS_NOT_FOUND); -// } -// record.setStatus(EnumBillStatus.PAID.getCode()); -// Date d = new Date(); -// record.setPayDate(d); -// record.setUpdatetime(d); -// try { -// wxBillPropertyMapper.updateById(record); -// } catch (Exception e) { -// logger.error("结单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// return new ResultData(Result.SUCCESS, "结单成功"); -// } - - @Override - public Object detail(TenantEntity tenantEntity,Long id) { - //物业 - WxBillProperty property = getById(tenantEntity,id); - WxPropertyContract propertyContract = wxPropertyContractMapper.selectById(property.getPropertyContractId()); -// //押金 -// WxBillPropertyDeposit depositParam = new WxBillPropertyDeposit(); -// depositParam.setPropertyContractId(property.getPropertyContractId()); -// WxBillPropertyDeposit deposit = null; -// List 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 result = new HashMap<>(2); - result.put("property", property); - result.put("propertyContract", propertyContract); -// result.put("deposit", deposit); - return result; - } - - @Override - public ResultData updateLatePayStatus(WxBillProperty record) { - record.setLatePayStatus(EnumBillStatus.PAID.getCode()); - record.setUpdatetime(new Date()); - try { - wxBillPropertyMapper.updateById(record); - } catch (Exception e) { - logger.error("修改营业额失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "滞纳金结单失败"); - } - return new ResultData(Result.SUCCESS, "滞纳金结单成功", record); - } - - @Override - public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillProperty wxBillProperty) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillProperty); - String billName = wxBillProperty.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺物业账单" : "多经点位物业账单"; - - PageInfo billPropertyList = getBillPropertyList(1, 10000, wxPayAccountBill, wxBillProperty); - List datalist = new ArrayList<>(); - if (null != billPropertyList && null != billPropertyList.getList()) { - Map> collect = billPropertyList.getList().parallelStream() - .collect(Collectors.groupingBy(WxBillProperty::getMerchantId)); - Set>> entries = collect.entrySet(); - for (Map.Entry> entry : entries) { - List list = entry.getValue(); - for (WxBillProperty property : list) { - if (property.getDepositStatus() == null) { - property.setDepositStatus(0); - } - String shopNumber = property.getShopNumber(); - if (StringUtils.isEmpty(shopNumber)) { - String shopInfo = property.getShopInfo(); - if (StringUtils.isNotEmpty(shopInfo) && !shopInfo.equals("[]")) { - JSONObject jsonObject = JSONObject.parseObject(shopInfo); - StringBuffer sb = new StringBuffer(); - Set> sets = jsonObject.entrySet(); - sets.forEach(x -> sb.append(x.getKey()).append(",")); - if(StringUtils.isNotBlank(sb)){ - property.setShopNumber(sb.deleteCharAt(sb.length() - 1).toString()); - } - } - } - datalist.add(property); - } - } - } - excelService.exportExcel(datalist, null, billName, WxBillProperty.class, billName + ".xlsx", response, false); - } - - @Override - public ResultData updateLatePayMoney(WxBillProperty record, MallUserInfo user) { - - WxBillProperty property = wxBillPropertyMapper.selectById(record.getId(),user.getTenantId()); - if (record.getLatePayMoneyUpdate() != null) { - property.setLatePayPrice(record.getLatePayMoneyUpdate()); - //property.setOwe(new BigDecimal(property.getReceivePay()).add(new BigDecimal(property.getLatePayPrice())) - // .add(new BigDecimal(property.getServiceChargePay())).subtract(new BigDecimal(property.getPay())).toPlainString()); - //property.setOwe(new BigDecimal(property.getReceivePay()).subtract(new BigDecimal(property.getPay())).toPlainString()); - final IdWorker idWorker = IdWorker.get(); - WxBillAction billAction = new WxBillAction(); - billAction.updateTenantInfo(user); - billAction.setId(idWorker.nextId()); - billAction.setCreatetime(new Date()); - billAction.setUserName("系统端"); - billAction.setAction(EnumBillAction.UPDATE_LATE_PAY_MONEY.getCode()); - billAction.setBillId(record.getId()); - billAction.setDetails(record.getLatePayMoneyBefore() + "元变更为" + record.getLatePayMoneyUpdate() + "元"); - billAction.setUpdatetime(new Date()); - wxBillActionMapper.insert(billAction); - } - wxBillPropertyMapper.updateById(property); - return new ResultData(); - } - - @Override - public WxBillSum getBillMonthSum(WxBillProperty wxBillProperty) { - updateQueryParam(wxBillProperty); - return wxBillPropertyMapper.getBillMonthSum(wxBillProperty); - } - - @Override - public List getMerchantIds(WxBillProperty wxBillProperty) { - updateQueryParam(wxBillProperty); - return wxBillPropertyMapper.getMerchantIdList(wxBillProperty); - } - - @Override - public WxBillHotNotify getBillHotNotify(WxBillProperty wxBillProperty) { - updateQueryParam(wxBillProperty); - return wxBillPropertyMapper.getBillHotNotify(wxBillProperty); - } - - @Override - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid) { - WxBillProperty dbBill = wxBillPropertyMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillProperty wxBillProperty = new WxBillProperty(); - wxBillProperty.setId(dto.getId()); - wxBillProperty.updateTenantInfo(dto); - wxBillProperty.setUpdatetime(new Date()); - wxBillProperty.setUpdateBy(user.getId()); - wxBillProperty.setUpdateByName(user.getName()); - if (forcePaid) { - wxBillProperty.setReceivePay(dbBill.getPay()); - wxBillProperty.setStatus(EnumBillStatus.PAID.getCode()); - wxBillPropertyMapper.updateById(wxBillProperty); - String remark = StringUtils.trimToEmpty(dto.getRemark())+ ";【系统】账单被强制为支付完成,自动归结为结清。"; - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), - dbBill.getPay(), dbBill.getPay(),null,null,null,remark,null,null, user); - }else { - if (StringUtils.isNotBlank(dto.getOldLatePrice()) && StringUtils.isNotBlank(dto.getNewLatePrice())) { - wxBillProperty.setLatePayPrice(dto.getNewLatePrice()); - wxBillPropertyMapper.updateById(wxBillProperty); - this.addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, dto.getBillTypeValue(), dto.getId(), - dto.getOldLatePrice(), dto.getNewLatePrice(),null,null,null,dto.getRemark(),null,null, 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,null,null,dto.getRemark(),null,null, user); - } else { - Date payDate = null; - WxBillPayWay payWay = null; - String remark = StringUtils.trimToEmpty(dto.getRemark()); - wxBillProperty.setReceivePay(dto.getNewPrice()); - if (new BigDecimal(dto.getNewPrice()).compareTo(new BigDecimal(dbBill.getPay())) <= 0) { - wxBillProperty.setStatus(EnumBillStatus.PAID.getCode()); - payDate = new Date(); - payWay = wxFinanceService.getPayWayById(dto, Constant.bill_pay_way_system); - remark = remark + ";【系统】账单实际应付金额调整至小于等于已付金额,自动归结为结清。"; - } - wxBillPropertyMapper.updateById(wxBillProperty); - //账单日志 - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), - dto.getOldPrice(), dto.getNewPrice(),null,payDate,payWay,remark,null,null, user); - } - } - } - - @Override - public void notify(WxBillPayDTO dto, MallUserInfo user) { - WxBillProperty wxBillRent = new WxBillProperty(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setLastOweCallTime(new Date()); - wxBillRent.setLastOweCallUser(user.getName()+"(账号:"+user.getUsername()+")"); - wxBillPropertyMapper.updateById(wxBillRent); - this.addBillAction(EnumBillAction.NOTIFY, dto.getBillTypeValue(),dto.getId(), - null,null, null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void backPay(WxBillPayDTO dto, MallUserInfo user) { - WxBillProperty dbBill = wxBillPropertyMapper.selectById(dto.getId(),dto.getTenantId()); - BigDecimal oldpay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - oldpay = new BigDecimal(dbBill.getPay()); - } - BigDecimal oldsetoff = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getSetOff())) { - oldsetoff = new BigDecimal(dbBill.getSetOff()); - } - WxBillProperty wxBillRent = new WxBillProperty(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); - wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); - if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { - if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { - wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); - } - } - wxBillPropertyMapper.updateById(wxBillRent); - EnumBillAction action = EnumBillAction.RETURN; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void updatePay(WxBillPayDTO dto, MallUserInfo user) { - WxBillProperty wxBillRent = updateBillPay(dto); - EnumBillAction action = EnumBillAction.OFFLINE_PAY; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - private WxBillProperty updateBillPay(WxBillPayDTO dto) { - WxBillProperty dbBill = wxBillPropertyMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillProperty wxBillRent = new WxBillProperty(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - BigDecimal opay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - opay = new BigDecimal(dbBill.getPay()); - } - - //支付的金额先扣除手续费和滞纳金,多余的再抵扣本金 - String servicePay = dbBill.getServiceChargePay(); - if (StringUtils.isBlank(servicePay)) { - servicePay = "0"; - } - StringBuffer sb = new StringBuffer(StringUtils.trimToEmpty(dto.getRemark())); - BigDecimal serviceLastMoney = new BigDecimal(dto.getAddpay()).add(new BigDecimal(dto.getSetOff())).subtract(new BigDecimal(servicePay)); - if (new BigDecimal(servicePay).compareTo(new BigDecimal(0)) > 0 ) { - if (serviceLastMoney.compareTo(new BigDecimal(0)) >= 0 ) { - wxBillRent.setServiceChargePay("0"); - sb.append(";手续费").append(servicePay).append("已结清"); - }else { - wxBillRent.setServiceChargePay(dto.getAddpay()); - sb.append(";手续费").append(servicePay).append("已支付").append(dto.getAddpay()); - } - } - - BigDecimal latePayLastMoney = new BigDecimal(0); - if (serviceLastMoney.compareTo(new BigDecimal(0)) > 0 ) { - String latePay = dbBill.getLatePayPrice(); - if (StringUtils.isBlank(latePay)) { - latePay = "0"; - } - latePayLastMoney = serviceLastMoney.subtract(new BigDecimal(latePay)); - if (new BigDecimal(latePay).compareTo(new BigDecimal(0)) > 0 ) { - if (latePayLastMoney.compareTo(new BigDecimal(0)) >= 0 ) { - wxBillRent.setLatePayPrice("0"); - sb.append(";滞纳金").append(latePay).append("已结清"); - }else { - String lp = new BigDecimal(latePay).subtract(serviceLastMoney).toPlainString(); - wxBillRent.setLatePayPrice(lp); - sb.append(";滞纳金").append(latePay).append("已支付").append(lp); - } - } - } - - if (latePayLastMoney.compareTo(new BigDecimal(0)) > 0 ) { - opay = opay.add(latePayLastMoney); - wxBillRent.setPay(opay.toPlainString()); - //如果付款金额做了扣除手续费/滞纳金,则需要将本金抵扣写到备注 - if (new BigDecimal(dto.getAddpay()).compareTo(latePayLastMoney) > 0 ) { - sb.append(";已付金额增加").append(latePayLastMoney.toPlainString()); - } - if (opay.compareTo(new BigDecimal(dbBill.getOwe())) >= 0 ) { - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - sb.append(";【系统】账单已付金额已大于等于实际应付金额,自动归结为结清。"); - } - } - String oldSetOff = dbBill.getSetOff(); - if (StringUtils.isBlank(oldSetOff)) { - oldSetOff = "0"; - } - wxBillRent.setSetOff(new BigDecimal(oldSetOff).add(new BigDecimal(dto.getSetOff())).toPlainString()); - wxBillRent.setPayDate(new Date()); - wxBillRent.setPayWay(dto.getPayWayObject().getId()); - wxBillPropertyMapper.updateById(wxBillRent); - dto.setRemark(sb.toString()); - return wxBillRent; - } - - @Override - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline) { - WxBillProperty wxBillRent = updateBillPay(dto); - EnumBillAction action = null; - if (isOnline) { - action = EnumBillAction.SELF_SERVICE_PAY; - }else { - action = EnumBillAction.OFFLINE_PAY; - } - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void bad(WxBillPayDTO dto, MallUserInfo user) { - WxBillProperty dbBill = wxBillPropertyMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillProperty wxBillRent = new WxBillProperty(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setStatus(EnumBillStatus.BAD.getCode()); - wxBillPropertyMapper.updateById(wxBillRent); - String badMoney = dbBill.getOwe(); - this.addBillAction(EnumBillAction.BAD, dto.getBillTypeValue(),dto.getId(), - badMoney, badMoney,null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void propertyContractStop(WxPropertyContract propertyContract, MallUserInfo user) { - WxBillProperty brDel = new WxBillProperty(); - brDel.setPropertyContractId(propertyContract.getId()); - brDel.setIsPreview(EnumYesOrNo.YES.getCode()); - brDel.updateTenantInfo(propertyContract); - wxBillPropertyMapper.deletePreviewBill(brDel); - - brDel.setShopEndtime(propertyContract.getEndContractTime()); - wxBillPropertyMapper.deleteNoNeedPayBill(brDel); - - WxBillProperty br = new WxBillProperty(); - br.setPropertyContractId(propertyContract.getId()); - br.setIsPreview(EnumYesOrNo.NO.getCode()); - br.updateTenantInfo(propertyContract); - List brList = wxBillPropertyMapper.findList(br); - List realRentList = new ArrayList(); - List actionList = new ArrayList(); - if (null != brList && brList.size() > 0 ) { - for (int i = 0 ; i < brList.size() ; i ++ ) { - WxBillProperty brent = brList.get(i); - WxBillAction action = new WxBillAction(); - boolean isUpdate = wxBillAllHelper.billEndCalcute(propertyContract.getDecimalSize() ,propertyContract.getEndContractTime(), brent, action, false); - if (isUpdate) { - realRentList.add(brent); - actionList.add(action); - } - } - } - - for (int i = 0 ; i < realRentList.size() ; i ++) { - WxBillProperty rbrent = realRentList.get(i); - wxBillPropertyMapper.updateById(rbrent); - } - - for (int i = 0 ; i < actionList.size() ; i ++) { - WxBillAction ba = actionList.get(i); - this.addBillAction(ba, user); - } - } - - @Override - public void completeBill(EnumBillStatus status, WxMerchant wxMerchant, MallUserInfo user) { - WxBillProperty bill = new WxBillProperty(); - bill.updateTenantInfo(wxMerchant); - bill.setFloorForRule(wxMerchant.getFloorForRule()); - bill.setBusinessForRule(wxMerchant.getBusinessForRule()); - bill.setBuilding(wxMerchant.getBuilding()); - bill.setFloor(wxMerchant.getFloor()); - bill.setMerchantId(wxMerchant.getId()); - bill.setStatus(status.getCode()); - updateQueryParam(bill); - PageInfo bpage = this.listAsPage(bill, 1, 100); - if (null != bpage && null != bpage.getList()) { - for (int i = 0 ; i < bpage.getList().size() ; i++ ) { - WxBillProperty b = bpage.getList().get(i); - - WxBillProperty bu = new WxBillProperty(); - bu.setId(b.getId()); - bu.updateTenantInfo(b); - bu.setStatus(EnumBillStatus.INVALID.getCode()); - bu.setUpdatetime(new Date()); - bu.setUpdateBy(user.getId()); - bu.setUpdateByName(user.getName()); - wxBillPropertyMapper.updateById(bu); - - WxBillAction wxBillAction = new WxBillAction(); - wxBillAction.setBillId(b.getId()); - wxBillAction.setBillType(b.getBillType()); - wxBillAction.setAction(EnumBillAction.STATUS_CHANGE.getCode()); - wxBillAction.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null,null,null,EnumBillStatus.getEnum(b.getStatus()),EnumBillStatus.INVALID)); - wxBillAction.setRemark(wxMerchant.getBillCompleteRemark()); - this.addBillAction(wxBillAction, user); - } - } - } -} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentManageServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentManageServiceImpl.java deleted file mode 100644 index a265fc8c3..000000000 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentManageServiceImpl.java +++ /dev/null @@ -1,718 +0,0 @@ -package com.iformall.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillAction; -import com.iformall.domain.po.WxBillPayWay; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxBillRentManage; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.domain.po.WxRentContract; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillAction; -import com.iformall.enums.EnumBillStatus; -import com.iformall.enums.EnumDelStatus; -import com.iformall.enums.EnumIsPreview; -import com.iformall.enums.EnumRentShopType; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.WxBillActionMapper; -import com.iformall.mapper.WxBillRentManageMapper; -import com.iformall.mapper.WxRentContractMapper; -import com.iformall.service.ExcelService; -import com.iformall.service.WxBillActionService; -import com.iformall.service.WxBillRentManageService; -import com.iformall.service.WxFinanceService; -import com.iformall.service.WxMerchantService; -import com.iformall.service.WxPayAccountBillService; -import com.iformall.service.helper.WxBillAllHelper; -import com.iformall.utils.Constant; - -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * @author gongbiao - */ -@Service -public class WxBillRentManageServiceImpl extends WxBillBaseService implements WxBillRentManageService { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - WxBillRentManageMapper wxBillRentManageMapper; - - @Autowired - WxPayAccountBillService wxPayAccountBillService; - - @Autowired - WxBillActionService wxBillActionService; - - @Autowired - WxBillActionMapper wxBillActionMapper; - - @Autowired - ExcelService excelService; - - @Lazy - @Autowired - WxMerchantService wxMerchantService; - - @Autowired - WxRentContractMapper wxRentContractMapper; - - @Lazy - @Autowired - WxBillAllHelper wxBillAllHelper; - - - @Lazy - @Autowired - WxFinanceService wxFinanceService; - - @Override - public PageInfo listAsPage(WxBillRentManage wxBillRentManage, Integer pageIndex, Integer pageSize) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillRentManage); - return getBillRentManageList(pageIndex, pageSize, wxBillRentManage, wxPayAccountBill); - } - - @Override - public List list(WxBillRentManage wxBillRentManage) { - updateQueryParam(wxBillRentManage); - return wxBillRentManageMapper.queryBillManageList(wxBillRentManage); - } - - @Override - public List notifyList(WxBillRentManage record) { - updateQueryParam(record); - return wxBillRentManageMapper.getBillNotifyList(record); - } - - private void updateQueryParam(WxBillRentManage wxBillRentManage) { - if (null != wxBillRentManage.getFloorForRule() || null != wxBillRentManage.getFloor() || null != wxBillRentManage.getBuilding()) { - List merchantIds = wxMerchantService.getFloorBuildMerchantIds(wxBillRentManage, wxBillRentManage.getFloorForRule(), wxBillRentManage.getBuilding(), wxBillRentManage.getFloor(), 0, 0); - if (null != merchantIds) { - wxBillRentManage.setMerchantIds(merchantIds); - }else { - wxBillRentManage.setId(-1L); - } - } - if (StringUtils.isNotBlank(wxBillRentManage.getMerchantName())) { - WxMerchant mq = new WxMerchant(); - mq.updateTenantInfo(wxBillRentManage); - mq.setName(StringUtils.trimToNull(wxBillRentManage.getMerchantName())); - List mids = wxMerchantService.findIdList(mq); - if (null != mids && mids.size() > 0 ) { - if (null != wxBillRentManage.getMerchantIds()) { - List _mids = (List) CollectionUtils.intersection(mids, wxBillRentManage.getMerchantIds()); - if (null == _mids || _mids.size() <= 0) { - wxBillRentManage.setId(-1L); - }else { - wxBillRentManage.setMerchantIds(_mids); - } - }else { - wxBillRentManage.setMerchantIds(mids); - } - }else { - wxBillRentManage.setId(-1L); - } - } - } - - private PageInfo getBillRentManageList(Integer pageIndex, Integer pageSize,WxBillRentManage wxBillRentManage,WxPayAccountBill wxPayAccountBill) { - updateQueryParam(wxBillRentManage); - PageInfo billRentList = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillRentManageMapper.queryBillManageList(wxBillRentManage)); - if (null == billRentList) { - return null; - } - - List rentContractIdList = wxBillRentManageMapper.queryRentContractIds(wxBillRentManage); - Map rentContractMap = new HashMap(); - if ( null != rentContractIdList && rentContractIdList.size() > 0 ) { - WxRentContract rcq = new WxRentContract(); - rcq.updateTenantInfo(wxBillRentManage); - rcq.setIds(rentContractIdList); - List rlist = wxRentContractMapper.findList(rcq); - if (null != rlist && rlist.size() > 0 ) { - for (int i = 0 ; i < rlist.size(); i++) { - WxRentContract rc = rlist.get(i); - rentContractMap.put(rc.getId(), rc); - } - } - } - - if (null != billRentList.getList()) { - for (int i = 0 ; i < billRentList.getList().size() ; i ++) { - WxBillRentManage e = billRentList.getList().get(i); - Integer decimalSize = Constant.default_long_decimal_size; - WxRentContract rent = rentContractMap.get(e.getRentContractId()); - if (null != rent) { - decimalSize = rent.getDecimalSize(); - e.setMerchantName(rent.getMerchantName()); - //e.setRentType(rent.getType()); - //if (null != rent.getPayRatio()) { - // e.setPayRatio(rent.getPayRatio().longValue()); - //}else { - // e.setPayRatio(0l); - //} -// if (StringUtils.isNoneBlank(rent.getLatePayRatio())) { -// e.setLatePayRatio(Integer.parseInt(rent.getLatePayRatio())); -// } - //e.setLatePayDay(rent.getLatePayDay()); - e.setShopNumber(rent.getRentInfoShopNumber()); - } - - //手续费 = 合同应收+手续费+滞纳金 - computeTotalMoney(decimalSize,wxPayAccountBill, e); - } - } - return billRentList; - } - - @Override - public ResultData saveOrUpdate(WxBillRentManage record, MallUserInfo user) { - //String receivepay = StringUtils.isBlank(record.getRealReceivePay()) ? "0" : record.getRealReceivePay(); - String receivepay = StringUtils.isBlank(record.getReceivePay()) ? "0" : record.getReceivePay(); - String pay = StringUtils.isBlank(record.getPay()) ? "0" : record.getPay(); - if(new BigDecimal(pay).compareTo(new BigDecimal(receivepay)) > 0 ){ - return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "实收金额不能大于实际应收总金额"); - } - Date date = new Date(); - if (record.getId() == null) { - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreatetime(date); - record.setUpdatetime(date); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - record.setCreateBy(user.getId()); - record.setCreateByName(user.getName()); - record.updateTenantInfo(user); - //record.setOwe(new BigDecimal(receivepay).subtract(new BigDecimal(pay)).toPlainString()); - record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - try { - wxBillRentManageMapper.insert(record); - } catch (Exception e) { - logger.error("保存租赁账单失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - return new ResultData(Result.SUCCESS, "保存租赁账单成功"); - } else { - return new ResultData(); - } - } - - @Override - public WxBillRentManage getById(TenantEntity tenantEntity,Long id) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(tenantEntity); - WxBillRentManage record = new WxBillRentManage(); - record.setId(id); - record.updateTenantInfo(tenantEntity); - PageInfo page = getBillRentManageList(1, 1, record, wxPayAccountBill); - WxBillRentManage rentManage = page.getList().get(0); - //rentManage.setOwe(new BigDecimal(rentManage.getRealReceivePay()).subtract(new BigDecimal(rentManage.getPay())).toPlainString()); - //rentManage.setOwe(new BigDecimal(rentManage.getReceivePay()).subtract(new BigDecimal(rentManage.getPay())).toPlainString()); - return rentManage; - } - - @Override - public Map detail(TenantEntity tenantEntity, Long id) { - WxBillRentManage manage = getById(tenantEntity, id); - //合同 - WxRentContract wxRentContract = wxRentContractMapper.selectById(manage.getRentContractId()); - Map result = new HashMap<>(3); - result.put("manage", manage); - result.put("wxRentContract", wxRentContract); - return result; - } - - @Override - public PageInfo findByRentContractId(WxBillRentManage record, Integer pageIndex, Integer pageSize) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - return getBillRentManageList(pageIndex, pageSize, record, wxPayAccountBill); - } - - @Override - public void computeTotalMoney(Integer decimalSize, WxPayAccountBill wxPayAccountBill, WxBillRentManage rent) { - if (rent.getReceivePay() != null) { - if (rent.getLatePayPrice() == null) { - rent.setLatePayPrice("0"); - } - BigDecimal servicePay; - if (rent.getServiceChargePay() != null) { - servicePay = new BigDecimal(rent.getServiceChargePay()); - } else { - servicePay = new BigDecimal(rent.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), decimalSize, BigDecimal.ROUND_HALF_UP); - } - BigDecimal realReceivePay = servicePay.add(new BigDecimal(rent.getLatePayPrice()).add(new BigDecimal(rent.getReceivePay()))); - rent.setRealReceivePay(realReceivePay.toPlainString()); - rent.setServiceChargePay(servicePay.toPlainString()); -// if (!rent.getStatus().equals(EnumBillStatus.NOT_PAID.getCode())) { -// //rent.setOwe("0"); -// } else { -// //rent.setOwe(realReceivePay.subtract(new BigDecimal(rent.getPay())).toPlainString()); -// //rent.setOwe(new BigDecimal(rent.getReceivePay()).subtract(new BigDecimal(rent.getPay())).toPlainString()); -// } - } - } - - @Override - public ResultData updateLatePayMoney(WxBillRentManage record, MallUserInfo user) { - WxBillRentManage rent = wxBillRentManageMapper.selectById(record.getId(),user.getTenantId()); - if(record.getLatePayMoneyUpdate() != null) { - rent.setLatePayPrice(record.getLatePayMoneyUpdate()); - //rent.setOwe(new BigDecimal(rent.getReceivePay()).add(new BigDecimal(rent.getLatePayPrice())).add(new BigDecimal(rent.getServiceChargePay())).subtract(new BigDecimal(rent.getPay())).toPlainString()); - //rent.setOwe(new BigDecimal(rent.getReceivePay()).subtract(new BigDecimal(rent.getPay())).toPlainString()); - final IdWorker idWorker = IdWorker.get(); - WxBillAction billAction = new WxBillAction(); - billAction.updateTenantInfo(user); - billAction.setId(idWorker.nextId()); - billAction.setCreatetime(new Date()); - billAction.setUserName("系统端"); - billAction.setAction(EnumBillAction.UPDATE_LATE_PAY_MONEY.getCode()); - billAction.setBillId(record.getId()); - billAction.setDetails(record.getLatePayMoneyBefore()+"元变更为" +record.getLatePayMoneyUpdate()+"元"); - billAction.setUpdatetime(new Date()); - wxBillActionMapper.insert(billAction); - } - wxBillRentManageMapper.updateById(rent); - return new ResultData(); - } - - @Override - public void updateBillStatus(WxBillRentManage record) { - logger.info("更新租赁押金账单状态开始..."); - //更新逾期天数及状态 - //updateNotPaidStatus(record); - //更新待缴的状态 - //updateWaidPayStatus(record); - logger.info("更新租赁押金账单状态结束..."); - } - -// @Transactional(rollbackFor = {Exception.class}) -// public void updateWaidPayStatus(WxBillRentManage record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// params.put("waitPay", EnumBillStatus.WAIT_PAY.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// -// try { -// wxBillRentManageMapper.updateWaitPayStatus(params); -// } catch (Exception e) { -// logger.error("更新物业待缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// } - - -// @Transactional(rollbackFor = {Exception.class}) -// public void updateNotPaidStatus(WxBillRentManage record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// params.put("notPaid", EnumBillStatus.NOT_PAID.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// try { -// wxBillRentManageMapper.updateNotPaidStatus(params); -// } catch (Exception e) { -// logger.error("更新物业欠缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// } - - @Override - public void deleteById(TenantEntity tenantEntity,Long id) { - wxBillRentManageMapper.deleteById(id,tenantEntity.getTenantId()); - } - -// @Transactional(rollbackFor = {Exception.class}) -// @Override -// public ResultData updatePaid(Long id) { -// WxBillRentManage wxBillDeposit = wxBillRentManageMapper.selectById(id); -// if(wxBillDeposit==null){ -// return new ResultData(ErrorCode.BILL_RENT_DEPOSIT_IS_NOT_FOUND); -// } -// wxBillDeposit.setStatus(EnumBillStatus.PAID.getCode()); -// Date d =new Date(); -// wxBillDeposit.setPayDate(d); -// wxBillDeposit.setUpdatetime(d); -// try { -// wxBillRentManageMapper.updateById(wxBillDeposit); -// } catch (Exception e) { -// logger.error("租赁押金结单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// return new ResultData(Result.SUCCESS, "租赁押金结单成功"); -// } - - @Override - public ResultData updateLatePayStatus(WxBillRentManage record) { - record.setLatePayStatus(EnumBillStatus.PAID.getCode()); - record.setUpdatetime(new Date()); - try { - wxBillRentManageMapper.updateById(record); - } catch (Exception e) { - logger.error("修改营业额失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "滞纳金结单失败"); - } - return new ResultData(Result.SUCCESS, "滞纳金结单成功", record); - } - - @Override - public void exportBill(HttpServletRequest request, HttpServletResponse response,WxBillRentManage wxBillRentManage) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillRentManage); - - String billName = wxBillRentManage.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺租金账单" : "多经点位租金账单"; - wxBillRentManage.setHasMerchant(EnumYesOrNo.YES.getCode()); - PageInfo billRentList = getBillRentManageList(1, 10000, wxBillRentManage, wxPayAccountBill); - List datalist = new ArrayList<>(); - if (null != billRentList && null != billRentList.getList()) { - Map> collect = billRentList.getList().parallelStream() - .collect(Collectors.groupingBy(WxBillRentManage::getMerchantId)); - Set>> entries = collect.entrySet(); - for (Map.Entry> entry : entries) { - List list = entry.getValue(); - for (WxBillRentManage rent : list) { - String shopNumber = rent.getShopNumber(); - if (StringUtils.isEmpty(shopNumber)) { - String shopInfo = rent.getShopInfo(); - if (StringUtils.isNotEmpty(shopInfo) && !shopInfo.equals("[]")) { - JSONObject jsonObject = JSONObject.parseObject(shopInfo); - StringBuffer sb = new StringBuffer(); - Set> sets = jsonObject.entrySet(); - sets.forEach(x -> sb.append(x.getKey()).append(",")); - if(StringUtils.isNotBlank(sb)){ - rent.setShopNumber(sb.deleteCharAt(sb.length() - 1).toString()); - } - } - } - datalist.add(rent); - } - } - } - excelService.exportExcel(datalist, null, billName, WxBillRentManage.class, billName + ".xlsx", response, false); - - } - - @Override - public WxBillSum getBillMonthSum(WxBillRentManage wxBillRentManage) { - updateQueryParam(wxBillRentManage); - return wxBillRentManageMapper.getBillMonthSum(wxBillRentManage); - } - - @Override - public List getMerchantIds(WxBillRentManage wxBillRentManage) { - updateQueryParam(wxBillRentManage); - return wxBillRentManageMapper.getMerchantIdList(wxBillRentManage); - } - - @Override - public WxBillHotNotify getBillHotNotify(WxBillRentManage wxBillRentManage) { - updateQueryParam(wxBillRentManage); - return wxBillRentManageMapper.getBillHotNotify(wxBillRentManage); - } - - @Override - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid) { - WxBillRentManage dbBill = wxBillRentManageMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillRentManage wxBillRent = new WxBillRentManage(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - if (forcePaid) { - wxBillRent.setReceivePay(dbBill.getPay()); - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - wxBillRentManageMapper.updateById(wxBillRent); - String remark = StringUtils.trimToEmpty(dto.getRemark())+ ";【系统】账单被强制为支付完成,自动归结为结清。"; - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), dbBill.getPay(), dbBill.getPay(),null,null,null,remark,null,null, user); - }else { - if (StringUtils.isNotBlank(dto.getOldLatePrice()) && StringUtils.isNotBlank(dto.getNewLatePrice())) { - wxBillRent.setLatePayPrice(dto.getNewLatePrice()); - wxBillRentManageMapper.updateById(wxBillRent); - this.addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, dto.getBillTypeValue(),dto.getId(), - dto.getOldLatePrice(), dto.getNewLatePrice(),null,null,null,dto.getRemark(),null,null, 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,null,null,dto.getRemark(),null,null, user); - } else { - //租赁账单更新 - wxBillRent.setReceivePay(dto.getNewPrice()); - Date payDate = null; - WxBillPayWay payWay = null; - String remark = StringUtils.trimToEmpty(dto.getRemark()); - if (new BigDecimal(dto.getNewPrice()).compareTo(new BigDecimal(dbBill.getPay())) <= 0) { - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - payDate = new Date(); - payWay = wxFinanceService.getPayWayById(dto, Constant.bill_pay_way_system); - remark = remark + ";【系统】账单实际应付金额调整至小于等于已付金额,自动归结为结清。"; - } - wxBillRentManageMapper.updateById(wxBillRent); - //账单日志 - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), - dto.getOldPrice(), dto.getNewPrice(),null,payDate,payWay,remark,null,null, user); - } - } - } - - @Override - public void notify(WxBillPayDTO dto, MallUserInfo user) { - WxBillRentManage wxBillRent = new WxBillRentManage(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setLastOweCallTime(new Date()); - wxBillRent.setLastOweCallUser(user.getName()+"(账号:"+user.getUsername()+")"); - wxBillRentManageMapper.updateById(wxBillRent); - this.addBillAction(EnumBillAction.NOTIFY, dto.getBillTypeValue(),dto.getId(), - null, null,null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void backPay(WxBillPayDTO dto, MallUserInfo user) { - WxBillRentManage dbBill = wxBillRentManageMapper.selectById(dto.getId(),dto.getTenantId()); - BigDecimal oldpay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - oldpay = new BigDecimal(dbBill.getPay()); - } - BigDecimal oldsetoff = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getSetOff())) { - oldsetoff = new BigDecimal(dbBill.getSetOff()); - } - WxBillRentManage wxBillRent = new WxBillRentManage(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); - wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); - if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { - if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { - wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); - } - } - wxBillRentManageMapper.updateById(wxBillRent); - EnumBillAction action = EnumBillAction.RETURN; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void updatePay(WxBillPayDTO dto, MallUserInfo user) { - WxBillRentManage wxBillRent = updateBillPay(dto); - EnumBillAction action = EnumBillAction.OFFLINE_PAY; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - private WxBillRentManage updateBillPay(WxBillPayDTO dto) { - WxBillRentManage dbBill = wxBillRentManageMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillRentManage wxBillRent = new WxBillRentManage(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - BigDecimal opay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - opay = new BigDecimal(dbBill.getPay()); - } - - //支付的金额先扣除手续费和滞纳金,多余的再抵扣本金 - String servicePay = dbBill.getServiceChargePay(); - if (StringUtils.isBlank(servicePay)) { - servicePay = "0"; - } - StringBuffer sb = new StringBuffer(StringUtils.trimToEmpty(dto.getRemark())); - BigDecimal serviceLastMoney = new BigDecimal(dto.getAddpay()).add(new BigDecimal(dto.getSetOff())).subtract(new BigDecimal(servicePay)); - if (new BigDecimal(servicePay).compareTo(new BigDecimal(0)) > 0 ) { - if (serviceLastMoney.compareTo(new BigDecimal(0)) >= 0 ) { - wxBillRent.setServiceChargePay("0"); - sb.append(";手续费").append(servicePay).append("已结清"); - }else { - wxBillRent.setServiceChargePay(dto.getAddpay()); - sb.append(";手续费").append(servicePay).append("已支付").append(dto.getAddpay()); - } - } - - BigDecimal latePayLastMoney = new BigDecimal(0); - if (serviceLastMoney.compareTo(new BigDecimal(0)) > 0 ) { - String latePay = dbBill.getLatePayPrice(); - if (StringUtils.isBlank(latePay)) { - latePay = "0"; - } - latePayLastMoney = serviceLastMoney.subtract(new BigDecimal(latePay)); - if (new BigDecimal(latePay).compareTo(new BigDecimal(0)) > 0 ) { - if (latePayLastMoney.compareTo(new BigDecimal(0)) >= 0 ) { - wxBillRent.setLatePayPrice("0"); - sb.append(";滞纳金").append(latePay).append("已结清"); - }else { - String lp = new BigDecimal(latePay).subtract(serviceLastMoney).toPlainString(); - wxBillRent.setLatePayPrice(lp); - sb.append(";滞纳金").append(latePay).append("已支付").append(lp); - } - } - } - - if (latePayLastMoney.compareTo(new BigDecimal(0)) > 0 ) { - opay = opay.add(latePayLastMoney); - wxBillRent.setPay(opay.toPlainString()); - //如果付款金额做了扣除手续费/滞纳金,则需要将本金抵扣写到备注 - if (new BigDecimal(dto.getAddpay()).compareTo(latePayLastMoney) > 0 ) { - sb.append(";已付金额增加").append(latePayLastMoney.toPlainString()); - } - if (opay.compareTo(new BigDecimal(dbBill.getOwe())) >= 0 ) { - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - sb.append(";【系统】账单已付金额已大于等于实际应付金额,自动归结为结清。"); - } - } - String oldSetOff = dbBill.getSetOff(); - if (StringUtils.isBlank(oldSetOff)) { - oldSetOff = "0"; - } - wxBillRent.setSetOff(new BigDecimal(oldSetOff).add(new BigDecimal(dto.getSetOff())).toPlainString()); - wxBillRent.setPayDate(new Date()); - wxBillRent.setPayWay(dto.getPayWayObject().getId()); - wxBillRentManageMapper.updateById(wxBillRent); - dto.setRemark(sb.toString()); - return wxBillRent; - } - - @Override - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline) { - WxBillRentManage wxBillRent = updateBillPay(dto); - EnumBillAction action = null; - if (isOnline) { - action = EnumBillAction.SELF_SERVICE_PAY; - }else { - action = EnumBillAction.OFFLINE_PAY; - } - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void bad(WxBillPayDTO dto, MallUserInfo user) { - WxBillRentManage dbBill = wxBillRentManageMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillRentManage wxBillRent = new WxBillRentManage(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setStatus(EnumBillStatus.BAD.getCode()); - wxBillRentManageMapper.updateById(wxBillRent); - String badMoney = dbBill.getOwe(); - this.addBillAction(EnumBillAction.BAD, dto.getBillTypeValue(),dto.getId(), - badMoney, badMoney,null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void rentContractStop(WxRentContract rentContract,MallUserInfo user) { - //删掉草稿状态的账单 - WxBillRentManage brDel = new WxBillRentManage(); - brDel.setRentContractId(rentContract.getId()); - brDel.updateTenantInfo(rentContract); - brDel.setIsPreview(EnumIsPreview.YES.getCode()); - wxBillRentManageMapper.deletePreviewBill(brDel); - - brDel.setShopEndtime(rentContract.getEndContractTime()); - wxBillRentManageMapper.deleteNoNeedPayBill(brDel); - - - WxBillRentManage br = new WxBillRentManage(); - br.setRentContractId(rentContract.getId()); - br.updateTenantInfo(rentContract); - br.setIsPreview(EnumIsPreview.NO.getCode()); - List brList = wxBillRentManageMapper.findList(br); - List realRentList = new ArrayList(); - List actionList = new ArrayList(); - if (null != brList && brList.size() > 0 ) { - for (int i = 0 ; i < brList.size() ; i ++ ) { - WxBillRentManage brent = brList.get(i); - WxBillAction action = new WxBillAction(); - boolean isUpdate = wxBillAllHelper.billEndCalcute(rentContract.getDecimalSize(),rentContract.getEndContractTime(), brent, action, false); - if (isUpdate) { - realRentList.add(brent); - actionList.add(action); - } - } - } - - for (int i = 0 ; i < realRentList.size() ; i ++) { - WxBillRentManage rbrent = realRentList.get(i); - wxBillRentManageMapper.updateById(rbrent); - } - - for (int i = 0 ; i < actionList.size() ; i ++) { - WxBillAction ba = actionList.get(i); - this.addBillAction(ba, user); - } - } - - @Override - public void completeBill(EnumBillStatus status, WxMerchant wxMerchant, MallUserInfo user) { - WxBillRentManage bill = new WxBillRentManage(); - bill.updateTenantInfo(wxMerchant); - bill.setFloorForRule(wxMerchant.getFloorForRule()); - bill.setBusinessForRule(wxMerchant.getBusinessForRule()); - bill.setBuilding(wxMerchant.getBuilding()); - bill.setFloor(wxMerchant.getFloor()); - bill.setMerchantId(wxMerchant.getId()); - bill.setStatus(status.getCode()); - updateQueryParam(bill); - PageInfo bpage = this.listAsPage(bill, 1, 100); - if (null != bpage && null != bpage.getList()) { - for (int i = 0 ; i < bpage.getList().size() ; i++ ) { - WxBillRentManage b = bpage.getList().get(i); - - WxBillRentManage bu = new WxBillRentManage(); - bu.setId(b.getId()); - bu.updateTenantInfo(b); - bu.setStatus(EnumBillStatus.INVALID.getCode()); - bu.setUpdatetime(new Date()); - bu.setUpdateBy(user.getId()); - bu.setUpdateByName(user.getName()); - wxBillRentManageMapper.updateById(bu); - - WxBillAction wxBillAction = new WxBillAction(); - wxBillAction.setBillId(b.getId()); - wxBillAction.setBillType(b.getBillType()); - wxBillAction.setAction(EnumBillAction.STATUS_CHANGE.getCode()); - wxBillAction.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null,null,null,EnumBillStatus.getEnum(b.getStatus()),EnumBillStatus.INVALID)); - wxBillAction.setRemark(wxMerchant.getBillCompleteRemark()); - this.addBillAction(wxBillAction, user); - } - } - } - -} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java deleted file mode 100644 index 841f5269a..000000000 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java +++ /dev/null @@ -1,910 +0,0 @@ -package com.iformall.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.Result; -import com.iformall.common.ResultData; -import com.iformall.domain.dto.WxBillPayDTO; -import com.iformall.domain.dto.WxBillReceiveUpdateDTO; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillAction; -import com.iformall.domain.po.WxBillDeposit; -import com.iformall.domain.po.WxBillPayWay; -import com.iformall.domain.po.WxBillRent; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.WxMerchantBUser; -import com.iformall.domain.po.WxPayAccountBill; -import com.iformall.domain.po.WxRentContract; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.RatioVo; -import com.iformall.domain.vo.WxBillHotNotify; -import com.iformall.domain.vo.WxBillNotify; -import com.iformall.domain.vo.WxBillSum; -import com.iformall.enums.EnumBillAction; -import com.iformall.enums.EnumBillStatus; -import com.iformall.enums.EnumBusRatioTime; -import com.iformall.enums.EnumDelStatus; -import com.iformall.enums.EnumGetRatioFrom; -import com.iformall.enums.EnumMissTimeType; -import com.iformall.enums.EnumRentContractType; -import com.iformall.enums.EnumRentShopType; -import com.iformall.enums.EnumYesOrNo; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.WxBillActionMapper; -import com.iformall.mapper.WxBillDepositMapper; -import com.iformall.mapper.WxBillRentManageMapper; -import com.iformall.mapper.WxBillRentMapper; -import com.iformall.mapper.WxRentContractMapper; -import com.iformall.service.ExcelService; -import com.iformall.service.WxBillActionService; -import com.iformall.service.WxBillDepositService; -import com.iformall.service.WxBillRentService; -import com.iformall.service.WxFinanceService; -import com.iformall.service.WxMerchantService; -import com.iformall.service.WxMerchantTradeDailyService; -import com.iformall.service.WxPayAccountBillService; -import com.iformall.service.helper.WxBillAllHelper; -import com.iformall.utils.Constant; -import com.iformall.utils.DateUtils; - -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.joda.time.DateTime; -import org.joda.time.Months; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * @author gongbiao - */ -@Service -public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRentService { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - WxBillRentMapper wxBillRentMapper; - @Autowired - WxBillDepositMapper wxBillDepositMapper; - @Autowired - WxBillActionService wxBillActionService; - @Autowired - ExcelService excelService; - @Autowired - WxBillActionMapper wxBillActionMapper; - @Autowired - WxRentContractMapper wxRentContractMapper; - @Autowired - WxMerchantTradeDailyService wxMerchantTradeDailyService; - @Autowired - WxPayAccountBillService wxPayAccountBillService; - @Autowired - WxBillDepositService wxBillDepositService; - @Autowired - WxBillRentManageMapper wxBillRentManageMapper; - - @Lazy - @Autowired - WxMerchantService wxMerchantService; - - @Lazy - @Autowired - WxBillAllHelper wxBillAllHelper; - - @Lazy - @Autowired - WxFinanceService wxFinanceService; - - @Override - public PageInfo listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - return getBillRentPropertyList(pageIndex,pageSize,record,wxPayAccountBill); - } - - @Override - public List list(WxBillRent record) { - updateQueryParam(record); - return wxBillRentMapper.queryBillRentList(record); - } - - @Override - public List notifyList(WxBillRent record) { - updateQueryParam(record); - return wxBillRentMapper.getBillNotifyList(record); - } - - public void computeTotalMoney(Integer decimalSize,WxPayAccountBill wxPayAccountBill, WxBillRent rent) { - if (rent.getReceivePay() != null) { - BigDecimal servicePay; - if (rent.getServiceChargePay() != null) { - servicePay = new BigDecimal(rent.getServiceChargePay()); - } else { - servicePay = new BigDecimal(rent.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), decimalSize, BigDecimal.ROUND_HALF_UP); - } - BigDecimal realReceivePay = servicePay.add(new BigDecimal(rent.getBillLatePay())).add(new BigDecimal(rent.getReceivePay())); - rent.setRealReceivePay(realReceivePay.toPlainString()); - rent.setServiceChargePay(servicePay.toPlainString()); -// if (!rent.getStatus().equals(EnumBillStatus.NOT_PAID.getCode())) { -// //rent.setOwe("0"); -// } else { -// //rent.setOwe(realReceivePay.subtract(new BigDecimal(rent.getPay())).toPlainString()); -// //rent.setOwe(new BigDecimal(rent.getReceivePay()).subtract(new BigDecimal(rent.getPay())).toPlainString()); -// } - } - } - - @Override - public void updateBillStatus(WxBillRent record) { -// logger.info("更新租赁账单状态开始..."); -// //更新逾期天数及状态 -// updateNotPaidStatus(record); -// //更新待缴的状态 -// updateWaidPayStatus(record); -// logger.info("更新租赁账单状态结束..."); - } - -// @Transactional(rollbackFor = {Exception.class}) -// public void updateWaidPayStatus(WxBillRent record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// params.put("waitPay", EnumBillStatus.WAIT_PAY.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// -// try { -// wxBillRentMapper.updateWaitPayStatus(params); -// } catch (Exception e) { -// logger.error("更新物业待缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// } -// -// -// @Transactional(rollbackFor = {Exception.class}) -// public void updateNotPaidStatus(WxBillRent record) { -// Map params = new HashMap<>(); -// params.put("tenantId", record.getTenantId()); -// params.put("notPaid", EnumBillStatus.NOT_PAID.getCode()); -// params.put("paid", EnumBillStatus.PAID.getCode()); -// try { -// wxBillRentMapper.updateNotPaidStatus(params); -// } catch (Exception e) { -// logger.error("更新物业欠缴账单状态失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// } - - @Override - public WxBillRent getById(TenantEntity tenantEntity,Long id) { - WxBillRent record = new WxBillRent(); - record.setId(id); - record.updateTenantInfo(tenantEntity); - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(tenantEntity); - PageInfo rp = getBillRentPropertyList(1,1,record,wxPayAccountBill); - WxBillRent rent = rp.getList().get(0); - //手续费 = 合同应收+手续费+滞纳金 - //computeTotalMoney(wxPayAccountBill, rent); - //rent.setOwe(new BigDecimal(rent.getRealReceivePay()).subtract(new BigDecimal(rent.getPay())).toPlainString()); - //rent.setOwe(new BigDecimal(rent.getReceivePay()).subtract(new BigDecimal(rent.getPay())).toPlainString()); - return rent; - } - - @Override - public ResultData saveOrUpdate(WxBillRent record, MallUserInfo user) { - //String receivepay = StringUtils.isBlank(record.getRealReceivePay()) ? "0" : record.getRealReceivePay(); - String receivepay = StringUtils.isBlank(record.getReceivePay()) ? "0" : record.getReceivePay(); - String pay = StringUtils.isBlank(record.getPay()) ? "0" : record.getPay(); - if(new BigDecimal(pay).compareTo(new BigDecimal(receivepay)) > 0 ){ - return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "实收金额不能大于实际应收总金额"); - } - Date date = new Date(); - if (record.getId() == null) { - logger.info("新增租赁账单"); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreatetime(date); - record.setUpdatetime(date); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); - record.setCreateBy(user.getId()); - record.setCreateByName(user.getName()); - record.updateTenantInfo(user); - //record.setOwe(new BigDecimal(receivepay).subtract(new BigDecimal(pay)).toPlainString()); - //record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - try { - wxBillRentMapper.insert(record); - } catch (Exception e) { - logger.error("保存租赁账单失败,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - return new ResultData(Result.SUCCESS, "保存租赁账单成功"); - } else { - return new ResultData(); - } - } - - @Override - public void deleteById(TenantEntity tenantEntity,Long id) { - wxBillRentMapper.deleteById(id); - } - - @Override - public PageInfo findByRentContractId(WxBillRent record, Integer pageIndex, Integer pageSize) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - return getBillRentPropertyList(pageIndex,pageSize,record,wxPayAccountBill); - } - -// @Transactional(rollbackFor = {Exception.class}) -// @Override -// public ResultData updatePaid(Long id) { -// WxBillRent wxBillRent = wxBillRentMapper.selectById(id); -// if(wxBillRent==null){ -// return new ResultData(ErrorCode.BILL_RENT_IS_NOT_FOUND); -// } -// wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); -// Date d =new Date(); -// wxBillRent.setPayDate(d); -// wxBillRent.setUpdatetime(d); -// try { -// wxBillRentMapper.updateById(wxBillRent); -// } catch (Exception e) { -// logger.error("租赁账单结单失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); -// } -// return new ResultData(Result.SUCCESS, "租赁账单结单成功"); -// } - - @Override - public Object detail(TenantEntity tenantEntity,Long id) { - //租赁 - WxBillRent rent = getById(tenantEntity,id); - //合同 - WxRentContract wxRentContract = wxRentContractMapper.selectById(rent.getRentContractId()); -// //押金 -// WxBillDeposit depositParam = new WxBillDeposit(); -// depositParam.setRentContractId(rent.getRentContractId()); -// WxBillDeposit deposit = null; -// List 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 result = new HashMap<>(3); - result.put("rent", rent); - if (null != wxRentContract) { - wxRentContract.setTypeName(EnumRentContractType.getEnum(wxRentContract.getType()).getMessage()); - } - result.put("wxRentContract", wxRentContract); -// 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); - - return result; - } - - - public static int getMonths(String startStr,String endStr){ - DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); - DateTime start = formatter.parseDateTime(startStr); - DateTime end = formatter.parseDateTime(endStr); - int months = Months.monthsBetween(start, end).getMonths(); - return months; - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public ResultData updateRevenue(WxBillRent record, MallUserInfo user) { - WxBillRent wxBillRent = wxBillRentMapper.selectById(record.getId(),user.getTenantId()); - WxRentContract wxRentContract = wxRentContractMapper.selectById(wxBillRent.getRentContractId()); - SimpleDateFormat sdD = new SimpleDateFormat("d"); - SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); - - int startInt = Integer.parseInt(sdD.format(wxBillRent.getStarttime())); - int endInt = Integer.parseInt(sdD.format(DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1))); - int months = getMonths(sdM.format(wxBillRent.getStarttime())+"-01",sdM.format(DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1))+"-01"); - - //wxBillRent.setRevenue(record.getRevenue()); - - String ratio = "0"; - RatioVo ratioVo = null; - if(StringUtils.isNotBlank(wxRentContract.getPayRatio())){ - ratio = wxRentContract.getPayRatio(); - }else{ - if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){ -// long dayCount = DateUtils.startToEnd(wxBillRent.getStarttime(),wxBillRent.getEndtime()) + 1; -// if(EnumBusRatioTime.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())){ -// if(startInt == endInt && months == 12){ -// //刚好1年 -// ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(), -// wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.OTHER.getCode(),dayCount,0,null); -// }else{ -// ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(), -// wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.YEAR.getCode(),dayCount,0,null); -// } -// }else if(EnumBusRatioTime.MONTH.getCode().equals(wxRentContract.getBusDiscountTime())){ -// if(startInt == endInt && months == 1){ -// //刚好1个月 -// ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(), -// wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.OTHER.getCode(),dayCount,0,null); -// }else{ -// ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(), -// wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.MONTH.getCode(),dayCount,0,null); -// } -// }else if(EnumBusRatioTime.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())){ -// ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(), -// EnumMissTimeType.PERIOD.getCode(),dayCount,wxRentContract.getReceivePeriod(),wxRentContract.getReceivePeriodUnit()); -// } - } - } - - String newReceivePay; - if(ratioVo != null){ - newReceivePay = ratioVo.getPrice(); - //wxBillRent.setPayRatio(ratioVo.getRatio().longValue()); - //如果在跳点区间中,修改扣点率 - if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){ - //wxBillRent.setBusDiscountRatio(ratioVo.getUseRatio()); - } - }else{ - //BigDecimal revenue = new BigDecimal(StringUtils.isBlank(record.getRevenue()) ? "0" : record.getRevenue()); - BigDecimal revenue = new BigDecimal(0); - BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000)); - BigDecimal price = revenue.multiply(payRatio).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN); - newReceivePay = price.toPlainString(); - } - //wxBillRent.setJoinRentPrice(newReceivePay); - if(new BigDecimal(newReceivePay).compareTo(new BigDecimal(wxBillRent.getReceivePay())) > 0){ - wxBillRent.setReceivePay(newReceivePay); - } - - String oldPrice = wxBillRent.getReceivePay(); - String newPrice = newReceivePay; - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - String latePayPrice = StringUtils.isBlank(wxBillRent.getBillLatePay()) ? "0" : wxBillRent.getBillLatePay(); - //wxBillRent.setOwe(new BigDecimal(newPrice).add(new BigDecimal(wxBillRent.getServiceChargePay())).add(new BigDecimal(latePayPrice)).subtract(new BigDecimal(wxBillRent.getPay())).toPlainString()); - //wxBillRent.setOwe(new BigDecimal(newPrice).subtract(new BigDecimal(wxBillRent.getPay())).toPlainString()); - wxBillRentMapper.updateById(wxBillRent); - - if (!oldPrice.equals(newPrice)) { - //日志 - WxBillAction wxBillAction = new WxBillAction(); - wxBillAction.updateTenantInfo(user); - wxBillAction.setBillId(wxBillRent.getId()); - String oldPriceStr = new BigDecimal(oldPrice).divide(new BigDecimal(100)).toPlainString(); - String newPriceStr = new BigDecimal(newPrice).divide(new BigDecimal(100)).toPlainString(); - wxBillAction.setDetails("录入营业额时应收金额" + oldPriceStr + "元变更成" + newPriceStr + "元"); - wxBillAction.setAction(EnumBillAction.UPDATE_BILL.getCode()); - wxBillAction.setUserId(user.getId()); - wxBillAction.setUserName(user.getName()); - wxBillAction.setPhone(user.getPhone()); - wxBillAction.updateTenantInfo(wxBillRent); - try { - wxBillActionService.save(wxBillAction); - } catch (Exception e) { - logger.error("添加租赁账单行为日志,e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "修改营业额失败"); - } - } - return new ResultData(Result.SUCCESS, "修改营业额成功", wxBillRent); - } - - @Override - public ResultData updateLatePayStatus(WxBillRent record) { -// record.setLatePayStatus(EnumBillStatus.PAID.getCode()); -// record.setUpdatetime(new Date()); -// try { -// wxBillRentMapper.updateById(record); -// } catch (Exception e) { -// logger.error("修改营业额失败,e:" + e.getMessage()); -// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "滞纳金结单失败"); -// } - return new ResultData(Result.SUCCESS, "滞纳金结单成功", record); - } - - @Override - public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillRent wxBillRent) { - WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillRent); - - String billName = wxBillRent.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺租金账单" : "多经点位租金账单"; - PageInfo billRentList = getBillRentPropertyList(1,10000,wxBillRent,wxPayAccountBill); - List datalist = new ArrayList<>(); - if (null != billRentList && null != billRentList.getList()) { - Map> collect = billRentList.getList().parallelStream() - .collect(Collectors.groupingBy(WxBillRent::getMerchantId)); - Set>> entries = collect.entrySet(); - for (Map.Entry> entry : entries) { - List list = entry.getValue(); - for (WxBillRent rent : list) { - //if (rent.getDepositStatus() == null) { - // rent.setDepositStatus(0); - //} - String shopNumber = rent.getShopNumber(); - if (StringUtils.isEmpty(shopNumber)) { - String shopInfo = rent.getShopInfo(); - if (StringUtils.isNotEmpty(shopInfo) && !shopInfo.equals("[]")) { - JSONObject jsonObject = JSONObject.parseObject(shopInfo); - StringBuffer sb = new StringBuffer(); - Set> sets = jsonObject.entrySet(); - sets.forEach(x -> sb.append(x.getKey()).append(",")); - if(StringUtils.isNotBlank(sb)){ - rent.setShopNumber(sb.deleteCharAt(sb.length() - 1).toString()); - } - } - } - datalist.add(rent); - } - } - } - excelService.exportExcel(datalist, null, billName, WxBillRent.class, billName + ".xlsx", response, false); - } - - private void updateQueryParam(WxBillRent wxBillRent) { -// if(null != wxBillRent.getDepositStatus()) { -// WxBillDeposit bdq1 = new WxBillDeposit(); -// bdq1.updateTenantInfo(wxBillRent); -// bdq1.setStatus(wxBillRent.getDepositStatus()); -// List rentids = wxBillDepositMapper.findRentContractIds(bdq1); -// if (null != rentids && rentids.size() > 0 ) { -// wxBillRent.setRentContractIdList(rentids); -// }else { -// wxBillRent.setId(-1L); -// } -// } - if (null != wxBillRent.getFloorForRule() || null != wxBillRent.getFloor() || null != wxBillRent.getBuilding()) { - List merchantIds = wxMerchantService.getFloorBuildMerchantIds(wxBillRent, wxBillRent.getFloorForRule(), wxBillRent.getBuilding(), wxBillRent.getFloor(), 0, 0); - if (null != merchantIds) { - wxBillRent.setMerchantIdList(merchantIds); - }else { - wxBillRent.setId(-1L); - } - } - - if (StringUtils.isNotBlank(wxBillRent.getMerchantName())) { - WxMerchant mq = new WxMerchant(); - mq.updateTenantInfo(wxBillRent); - mq.setName(StringUtils.trimToNull(wxBillRent.getMerchantName())); - List mids = wxMerchantService.findIdList(mq); - if (null != mids && mids.size() > 0 ) { - if (null != wxBillRent.getMerchantIdList()) { - List _mids = (List) CollectionUtils.intersection(mids, wxBillRent.getMerchantIdList()); - if (null == _mids || _mids.size() <= 0) { - wxBillRent.setId(-1L); - }else { - wxBillRent.setMerchantIdList(_mids); - } - }else { - wxBillRent.setMerchantIdList(mids); - } - }else { - wxBillRent.setId(-1L); - } - } - } - - private PageInfo getBillRentPropertyList(Integer pageIndex, Integer pageSize,WxBillRent wxBillRent,WxPayAccountBill wxPayAccountBill) { - updateQueryParam(wxBillRent); - PageInfo billRentList = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillRentMapper.queryBillRentList(wxBillRent)); - if (null == billRentList) { - return null; - } - - List rentContractIdList = wxBillRentMapper.queryBillRentContractIdList(wxBillRent); - Map rentContractMap = new HashMap(); -// Map billDepositMap = new HashMap(); - if ( null != rentContractIdList && rentContractIdList.size() > 0 ) { - WxRentContract rcq = new WxRentContract(); - rcq.updateTenantInfo(wxBillRent); - rcq.setIds(rentContractIdList); - List rlist = wxRentContractMapper.findList(rcq); - if (null != rlist && rlist.size() > 0 ) { - for (int i = 0 ; i < rlist.size(); i++) { - WxRentContract rc = rlist.get(i); - rentContractMap.put(rc.getId(), rc); - } - } - -// WxBillDeposit bdq = new WxBillDeposit(); -// bdq.updateTenantInfo(wxBillRent); -// bdq.setRentContractIdList(rentContractIdList); -// List 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()) { - for (int i = 0 ; i < billRentList.getList().size() ; i ++) { - WxBillRent e = billRentList.getList().get(i); - Integer decimalSize = Constant.default_long_decimal_size; - WxRentContract rent = rentContractMap.get(e.getRentContractId()); - if (null != rent) { - decimalSize = rent.getDecimalSize(); - e.setMerchantName(rent.getMerchantName()); - //e.setRentType(rent.getType()); -// if (StringUtils.isNotBlank(rent.getPayRatio())) { -// e.setPayRatio(rent.getPayRatio()); -// }else { -// e.setPayRatio("0"); -// } -// if (StringUtils.isNoneBlank(rent.getLatePayRatio())) { -// e.setLatePayRatio(Integer.parseInt(rent.getLatePayRatio())); -// } - //e.setLatePayDay(rent.getLatePayDay()); - e.setShopNumber(rent.getRentInfoShopNumber()); - e.setRentShopType(rent.getRentShopType()); - } - - //手续费 = 合同应收+手续费+滞纳金 - computeTotalMoney(decimalSize,wxPayAccountBill, e); - -// WxBillDeposit bd = billDepositMap.get(e.getRentContractId()); -// if (null != bd) { -// e.setDeposit(bd.getReceivePay()); -// e.setDepositStatus(bd.getStatus()); -// } - - - - } - } - - return billRentList; - } - - @Override - public ResultData updateLatePayMoney(WxBillRent record, MallUserInfo user) { -// WxBillRent rent = wxBillRentMapper.selectById(record.getId(),user.getTenantId()); -// if(record.getLatePayMoneyUpdate() != null) { -// rent.setBillLatePay(record.getLatePayMoneyUpdate()); -// //rent.setOwe(new BigDecimal(rent.getReceivePay()).add(new BigDecimal(rent.getLatePayPrice())).add(new BigDecimal(rent.getServiceChargePay())).subtract(new BigDecimal(rent.getPay())).toPlainString()); -// //rent.setOwe(new BigDecimal(rent.getReceivePay()).subtract(new BigDecimal(rent.getPay())).toPlainString()); -// final IdWorker idWorker = IdWorker.get(); -// WxBillAction billAction = new WxBillAction(); -// billAction.updateTenantInfo(user); -// billAction.setId(idWorker.nextId()); -// billAction.setCreatetime(new Date()); -// billAction.setUserName("系统端"); -// billAction.setAction(EnumBillAction.UPDATE_LATE_PAY_MONEY.getCode()); -// billAction.setBillId(record.getId()); -// billAction.setDetails(record.getLatePayMoneyBefore()+"元变更为" +record.getLatePayMoneyUpdate()+"元"); -// billAction.setUpdatetime(new Date()); -// wxBillActionMapper.insert(billAction); -// } -// wxBillRentMapper.updateById(rent); - return new ResultData(); - } - - @Override - public WxBillSum getBillMonthSum(WxBillRent wxBillRent) { - updateQueryParam(wxBillRent); - return wxBillRentMapper.getBillMonthSum(wxBillRent); - } - - @Override - public List getMerchantIds(WxBillRent wxBillRent) { - updateQueryParam(wxBillRent); - return wxBillRentMapper.getMerchantIdList(wxBillRent); - } - - @Override - public WxBillHotNotify getBillHotNotify(WxBillRent wxBillRent) { - updateQueryParam(wxBillRent); - return wxBillRentMapper.getBillHotNotify(wxBillRent); - } - - @Override - public void updateReceivePay(WxBillReceiveUpdateDTO dto, MallUserInfo user, boolean forcePaid) { - WxBillRent dbBill = wxBillRentMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillRent wxBillRent = new WxBillRent(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - if (forcePaid) { - wxBillRent.setReceivePay(dbBill.getPay()); - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - wxBillRentMapper.updateById(wxBillRent); - String remark = StringUtils.trimToEmpty(dto.getRemark())+ ";【系统】账单被强制为支付完成,自动归结为结清。"; - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), dbBill.getPay(), dbBill.getPay(),null,null,null,remark,null,null, user); - }else { - if (StringUtils.isNotBlank(dto.getOldLatePrice()) && StringUtils.isNotBlank(dto.getNewLatePrice())) { - wxBillRent.setBillLatePay(dto.getNewLatePrice()); - wxBillRentMapper.updateById(wxBillRent); - this.addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, dto.getBillTypeValue(), dto.getId(), - dto.getOldLatePrice(), dto.getNewLatePrice(),null,null,null,dto.getRemark(),null,null, user); - }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,null,null,dto.getRemark(),null,null, user); - }else { - //租赁账单更新 - wxBillRent.setReceivePay(dto.getNewPrice()); - Date payDate = null; - WxBillPayWay payWay = null; - String remark = StringUtils.trimToEmpty(dto.getRemark()); - if (new BigDecimal(dto.getNewPrice()).compareTo(new BigDecimal(dbBill.getPay())) <= 0) { - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - payDate = new Date(); - payWay = wxFinanceService.getPayWayById(dto, Constant.bill_pay_way_system); - remark = remark + ";【系统】账单实际应付金额调整至小于等于已付金额,自动归结为结清。"; - } - wxBillRentMapper.updateById(wxBillRent); - //账单日志 - this.addBillAction(EnumBillAction.UPDATE_BILL, dto.getBillTypeValue(),dto.getId(), - dto.getOldPrice(), dto.getNewPrice(),null,payDate,payWay,remark,null,null, user); - } - } - } - - @Override - public void notify(WxBillPayDTO dto, MallUserInfo user) { - WxBillRent wxBillRent = new WxBillRent(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setLastOweCallTime(new Date()); - wxBillRent.setLastOweCallUser(user.getName()+"(账号:"+user.getUsername()+")"); - wxBillRentMapper.updateById(wxBillRent); - this.addBillAction(EnumBillAction.NOTIFY, dto.getBillTypeValue(),dto.getId(), - null, null,null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void backPay(WxBillPayDTO dto, MallUserInfo user) { - WxBillRent dbBill = wxBillRentMapper.selectById(dto.getId(),dto.getTenantId()); - BigDecimal oldpay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - oldpay = new BigDecimal(dbBill.getPay()); - } - BigDecimal oldsetoff = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getSetOff())) { - oldsetoff = new BigDecimal(dbBill.getSetOff()); - } - WxBillRent wxBillRent = new WxBillRent(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setPay(oldpay.subtract(new BigDecimal(dto.getAddpay())).toPlainString()); - wxBillRent.setSetOff(oldsetoff.subtract(new BigDecimal(dto.getSetOff())).toPlainString()); - if (dbBill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { - if (new BigDecimal(dbBill.getOwe()).compareTo(new BigDecimal(0)) > 0 ) { - wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); - } - } - wxBillRentMapper.updateById(wxBillRent); - EnumBillAction action = EnumBillAction.RETURN; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void updatePay(WxBillPayDTO dto, MallUserInfo user) { - WxBillRent wxBillRent = updateBillPay(dto); - EnumBillAction action = EnumBillAction.OFFLINE_PAY; - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),dto.getSetOff(),wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - private WxBillRent updateBillPay(WxBillPayDTO dto) { - WxBillRent dbBill = wxBillRentMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillRent wxBillRent = new WxBillRent(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - BigDecimal opay = new BigDecimal(0); - if (StringUtils.isNotBlank(dbBill.getPay())) { - opay = new BigDecimal(dbBill.getPay()); - } - //支付的金额先扣除手续费和滞纳金,多余的再抵扣本金 - String servicePay = dbBill.getServiceChargePay(); - if (StringUtils.isBlank(servicePay)) { - servicePay = "0"; - } - StringBuffer sb = new StringBuffer(StringUtils.trimToEmpty(dto.getRemark())); - BigDecimal serviceLastMoney = new BigDecimal(dto.getAddpay()).add(new BigDecimal(dto.getSetOff())).subtract(new BigDecimal(servicePay)); - if (new BigDecimal(servicePay).compareTo(new BigDecimal(0)) > 0 ) { - if (serviceLastMoney.compareTo(new BigDecimal(0)) >= 0 ) { - wxBillRent.setServiceChargePay("0"); - sb.append(";手续费").append(servicePay).append("已结清"); - }else { - wxBillRent.setServiceChargePay(dto.getAddpay()); - sb.append(";手续费").append(servicePay).append("已支付").append(dto.getAddpay()); - } - } - - BigDecimal latePayLastMoney = new BigDecimal(0); - if (serviceLastMoney.compareTo(new BigDecimal(0)) > 0 ) { - String latePay = dbBill.getBillLatePay(); - if (StringUtils.isBlank(latePay)) { - latePay = "0"; - } - latePayLastMoney = serviceLastMoney.subtract(new BigDecimal(latePay)); - if (new BigDecimal(latePay).compareTo(new BigDecimal(0)) > 0 ) { - if (latePayLastMoney.compareTo(new BigDecimal(0)) >= 0 ) { - wxBillRent.setBillLatePay("0"); - sb.append(";滞纳金").append(latePay).append("已结清"); - }else { - String lp = new BigDecimal(latePay).subtract(serviceLastMoney).toPlainString(); - wxBillRent.setBillLatePay(lp); - sb.append(";滞纳金").append(latePay).append("已支付").append(lp); - } - } - } - - if (latePayLastMoney.compareTo(new BigDecimal(0)) > 0 ) { - opay = opay.add(latePayLastMoney); - wxBillRent.setPay(opay.toPlainString()); - //如果付款金额做了扣除手续费/滞纳金,则需要将本金抵扣写到备注 - if (new BigDecimal(dto.getAddpay()).compareTo(latePayLastMoney) > 0 ) { - sb.append(";已付金额增加").append(latePayLastMoney.toPlainString()); - } - if (opay.compareTo(new BigDecimal(dbBill.getOwe())) >= 0 ) { - wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); - sb.append(";【系统】账单已付金额已大于等于实际应付金额,自动归结为结清。"); - } - } - String oldSetOff = dbBill.getSetOff(); - if (StringUtils.isBlank(oldSetOff)) { - oldSetOff = "0"; - } - wxBillRent.setSetOff(new BigDecimal(oldSetOff).add(new BigDecimal(dto.getSetOff())).toPlainString()); - wxBillRent.setPayDate(new Date()); - wxBillRent.setPayWay(dto.getPayWayObject().getId()); - wxBillRentMapper.updateById(wxBillRent); - dto.setRemark(sb.toString()); - return wxBillRent; - } - - @Override - public void updatePayByMerchant(WxBillPayDTO dto, WxMerchantBUser user,boolean isOnline) { - WxBillRent wxBillRent = updateBillPay(dto); - EnumBillAction action = null; - if (isOnline) { - action = EnumBillAction.SELF_SERVICE_PAY; - }else { - action = EnumBillAction.OFFLINE_PAY; - } - this.addBillAction(action, dto.getBillTypeValue(),dto.getId(), - dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWayObject(),dto.getRemark(),null,null, user); - } - - @Override - public void bad(WxBillPayDTO dto, MallUserInfo user) { - WxBillRent dbBill = wxBillRentMapper.selectById(dto.getId(),dto.getTenantId()); - WxBillRent wxBillRent = new WxBillRent(); - wxBillRent.setId(dto.getId()); - wxBillRent.updateTenantInfo(dto); - wxBillRent.setUpdatetime(new Date()); - wxBillRent.setUpdateBy(user.getId()); - wxBillRent.setUpdateByName(user.getName()); - wxBillRent.setStatus(EnumBillStatus.BAD.getCode()); - wxBillRentMapper.updateById(wxBillRent); - String badMoney = dbBill.getOwe(); - this.addBillAction(EnumBillAction.BAD, dto.getBillTypeValue(),dto.getId(), - badMoney, badMoney,null,null,null,dto.getRemark(),null,null, user); - } - - @Override - public void rentContractStop(WxRentContract rentContract,MallUserInfo user) { - //删除草稿状态的账单 - WxBillRent brDel = new WxBillRent(); - brDel.setRentContractId(rentContract.getId()); - brDel.updateTenantInfo(rentContract); - brDel.setIsPreview(EnumYesOrNo.YES.getCode()); - wxBillRentMapper.deletePreviewBill(brDel); - //删除还未到期的账单 - brDel.setShopEndtime(rentContract.getEndContractTime()); - wxBillRentMapper.deleteNoNeedPayBill(brDel); - - WxBillRent br = new WxBillRent(); - br.setRentContractId(rentContract.getId()); - br.updateTenantInfo(rentContract); - br.setIsPreview(EnumYesOrNo.NO.getCode()); - List brList = wxBillRentMapper.findList(br); - List realRentList = new ArrayList(); - List actionList = new ArrayList(); - if (null != brList && brList.size() > 0 ) { - for (int i = 0 ; i < brList.size() ; i ++ ) { - WxBillRent brent = brList.get(i); - WxBillAction action = new WxBillAction(); - boolean isUpdate = wxBillAllHelper.billEndCalcute(rentContract.getDecimalSize(),rentContract.getEndContractTime(), brent, action, false); - if (isUpdate) { - realRentList.add(brent); - actionList.add(action); - } - } - } - - for (int i = 0 ; i < realRentList.size() ; i ++) { - WxBillRent rbrent = realRentList.get(i); - wxBillRentMapper.updateById(rbrent); - } - - for (int i = 0 ; i < actionList.size() ; i ++) { - WxBillAction ba = actionList.get(i); - this.addBillAction(ba, user); - } - } - - @Override - public void completeBill(EnumBillStatus status, WxMerchant wxMerchant, MallUserInfo user) { - WxBillRent bill = new WxBillRent(); - bill.updateTenantInfo(wxMerchant); - bill.setFloorForRule(wxMerchant.getFloorForRule()); - bill.setBusinessForRule(wxMerchant.getBusinessForRule()); - bill.setBuilding(wxMerchant.getBuilding()); - bill.setFloor(wxMerchant.getFloor()); - bill.setMerchantId(wxMerchant.getId()); - bill.setStatus(status.getCode()); - updateQueryParam(bill); - PageInfo bpage = this.listAsPage(bill, 1, 100); - if (null != bpage && null != bpage.getList()) { - for (int i = 0 ; i < bpage.getList().size() ; i++ ) { - WxBillRent b = bpage.getList().get(i); - - WxBillRent bu = new WxBillRent(); - bu.setId(b.getId()); - bu.updateTenantInfo(b); - bu.setStatus(EnumBillStatus.INVALID.getCode()); - bu.setUpdatetime(new Date()); - bu.setUpdateBy(user.getId()); - bu.setUpdateByName(user.getName()); - wxBillRentMapper.updateById(bu); - - WxBillAction wxBillAction = new WxBillAction(); - wxBillAction.setBillId(b.getId()); - wxBillAction.setBillType(b.getBillType()); - wxBillAction.setAction(EnumBillAction.STATUS_CHANGE.getCode()); - wxBillAction.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null,null,null,EnumBillStatus.getEnum(b.getStatus()),EnumBillStatus.INVALID)); - wxBillAction.setRemark(wxMerchant.getBillCompleteRemark()); - this.addBillAction(wxBillAction, user); - } - } - - } - -} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java deleted file mode 100644 index b933616da..000000000 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java +++ /dev/null @@ -1,647 +0,0 @@ -package com.iformall.service.impl; - -import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.ResultData; -import com.iformall.domain.po.*; -import com.iformall.domain.vo.WxBillSettleVo; -import com.iformall.enums.*; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.*; -import com.iformall.service.ExcelService; -import com.iformall.service.WxBillSettleService; -import com.iformall.service.WxFlowService; -import com.iformall.utils.DateUtils; -import org.apache.commons.collections.CollectionUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * @author luozukai - * @date 2019/8/26 17:37 - */ -@Service -public class WxBillSettleServiceImpl implements WxBillSettleService { - @Autowired - private WxBillSettleMapper wxBillSettleMapper; - @Autowired - private WxMerchantMapper wxMerchantMapper; - @Autowired - private WxFlowService wxFlowService; - @Autowired - private WxBillSettleBillMapper wxBillSettleBillMapper; - @Autowired - private WxBillRentMapper wxBillRentMapper; - @Autowired - private WxBillDepositMapper wxBillDepositMapper; - @Autowired - private WxBillPropertyMapper wxBillPropertyMapper; - @Autowired - private WxBillDailyMapper wxBillDailyMapper; - @Autowired - private WxBillOtherMapper wxBillOtherMapper; - @Autowired - private WxBillPropertyDepositMapper wxBillPropertyDepositMapper; - @Autowired - private WxBillOtherDepositMapper wxBillOtherDepositMapper; - @Autowired - private WxBillSettleRecordMapper wxBillSettleRecordMapper; - @Autowired - private WxMerchantSubsidyMapper wxMerchantSubsidyMapper; - @Autowired - private ExcelService excelService; - @Autowired - private WxBillActionMapper wxBillActionMapper; - @Autowired - private WxBillAllMapper wxBillAllMapper; - - @Override - public PageInfo listAsPage(WxBillSettle record, Integer pageIndex, Integer pageSize) { - record.setLimitStart(0); - record.setLimitEnd(Integer.MAX_VALUE); - List totalList = wxBillSettleMapper.findList(record); - if(CollectionUtils.isEmpty(totalList)){ - PageHelper.startPage(pageIndex, pageSize); - PageInfo pageInfo = new PageInfo(new ArrayList()); - pageInfo.setPages(0); - pageInfo.setTotal(0); - PageHelper.clearPage(); - return pageInfo; - } - - int total = totalList.size(); - int pages; - if(total % pageSize == 0){ - pages = total / pageSize; - }else{ - pages = total / pageSize +1; - } - record.setLimitStart((pageIndex -1) * pageSize); - record.setLimitEnd(pageSize); - List list = wxBillSettleMapper.findList(record); - - PageHelper.startPage(pageIndex, pageSize); - PageInfo pageInfo = new PageInfo(list); - pageInfo.setPages(pages); - pageInfo.setTotal(total); - PageHelper.clearPage(); - return pageInfo; - - } - - @Override - public WxBillSettle getById(Long id,Integer filterSettleRecord){ - WxBillSettle billSettle = wxBillSettleMapper.selectById(id); - - if(billSettle != null) { - WxMerchant merchant = wxMerchantMapper.selectById(billSettle.getMerchantId()); - if (null == merchant) { - throw new MallinkException(ErrorCode.MALL_INFO_NOT_FOUND); - } - if(merchant != null){ - billSettle.setMerchantName(merchant.getName()); - } - - //加载账单列表 - WxBillSettleBill wxBillSettleBill = new WxBillSettleBill(); - wxBillSettleBill.updateTenantInfo(merchant); - wxBillSettleBill.setSettleId(billSettle.getId()); - wxBillSettleBill.setType(EnumSettleBillType.R.getCode()); - billSettle.setReceiveBillIds(wxBillSettleBillMapper.findBySettleId(wxBillSettleBill)); - wxBillSettleBill.setType(EnumSettleBillType.P.getCode()); - billSettle.setPayBillIds(wxBillSettleBillMapper.findBySettleId(wxBillSettleBill)); - - //加载清算历史 - WxBillSettleRecord wxBillSettleRecord = new WxBillSettleRecord(); - wxBillSettleRecord.updateTenantInfo(merchant); - wxBillSettleRecord.setSettleId(billSettle.getId()); - billSettle.setSettleRecordList(wxBillSettleRecordMapper.findList(wxBillSettleRecord)); - - //加载应收、承付、结余 - WxBillSettle query = new WxBillSettle(); - query.updateTenantInfo(merchant); - query.setId(id); - query.setFilterSettleRecord(filterSettleRecord); - query = wxBillSettleMapper.findList(query).get(0); - billSettle.setReceiveMoney(query.getReceiveMoney()); - billSettle.setPayMoney(query.getPayMoney()); - billSettle.setBalance(query.getBalance()); - - //清算方向 - if(billSettle.getReceiveMoney() > billSettle.getPayMoney()){ - billSettle.setSettleWay(EnumSettleWay.B.getCode()); - }else{ - billSettle.setSettleWay(EnumSettleWay.M.getCode()); - } - } - return billSettle; - } - - public void addBillAction(Long billId,String money){ -// final IdWorker idWorker = IdWorker.get(); -// WxBillAction billAction = new WxBillAction(); -// billAction.setId(idWorker.nextId()); -// billAction.setCreatetime(new Date()); -// billAction.setUserName("系统端"); -// billAction.setAction(EnumBillAction.UPDATE_SETTLE_MONEY.getCode()); -// billAction.setBillId(billId); -// BigDecimal newmoney = new BigDecimal(money).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP); -// billAction.setDetails("通过结算单清算"+newmoney.toString()+"元"); -// billAction.setUpdatetime(new Date()); -// billAction.setPayDate(new Date()); -// wxBillActionMapper.insert(billAction); - } - - @Override - public void updateFreezeOrStatus(List billList,Integer freezeStatus,Integer status,Integer applyStatus){ -// //1租金2押金3物业4日常费用6其他8补贴 -// for (WxBillSettleBill bill:billList) { -// if(EnumBillQueryType.RENT.getCode().equals(bill.getBillType())) { -// WxBillRent wxBillRent = new WxBillRent(); -// wxBillRent.setId(bill.getBillId()); -// if ( null != applyStatus) { -// wxBillRent.setApplyStatus(applyStatus); -// wxBillRent.setApplyUpdateTime(bill.getApplyUpdateTime()); -// } -// if (!StringUtils.isBlank(bill.getApplyPayImg())) { -// wxBillRent.setApplyPayImg(bill.getApplyPayImg()); -// } -// if(freezeStatus != null) wxBillRent.setFreeze(freezeStatus); -// if(status != null){ -// wxBillRent.setStatus(status); -// } -// if(EnumBillStatus.PAID.getCode().equals(status)){ -// wxBillRent.setPayDate(new Date()); -// WxBillRent dbBill = wxBillRentMapper.selectById(wxBillRent.getId()); -// if(dbBill!=null) { -// if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); -// //if(StringUtils.isBlank(dbBill.getOwe())) dbBill.setOwe("0"); -// //wxBillRent.setPay(new BigDecimal(dbBill.getPay()).add(new BigDecimal(dbBill.getOwe())).toPlainString()); -// wxBillRent.setPay(new BigDecimal(dbBill.getPay()).toPlainString()); -// wxBillRent.setPayDate(new Date()); -// //addBillAction(bill.getBillId(), dbBill.getOwe()); -// } -// } -// wxBillRentMapper.updateById(wxBillRent); -// }else if(EnumBillType.DEPOSIT.getCode().equals(bill.getBillType())) { -// WxBillDeposit wxBillRent = new WxBillDeposit(); -// wxBillRent.setId(bill.getBillId()); -// if ( null != applyStatus) { -// wxBillRent.setApplyStatus(applyStatus); -// wxBillRent.setApplyUpdateTime(bill.getApplyUpdateTime()); -// } -// if (!StringUtils.isBlank(bill.getApplyPayImg())) { -// wxBillRent.setApplyPayImg(bill.getApplyPayImg()); -// } -// if(freezeStatus != null) wxBillRent.setFreeze(freezeStatus); -// if(status != null){ -// wxBillRent.setStatus(status); -// } -// if(EnumBillStatus.PAID.getCode().equals(status)){ -// wxBillRent.setPayDate(new Date()); -// WxBillDeposit dbBill = wxBillDepositMapper.selectById(wxBillRent.getId()); -// if(dbBill!=null) { -// if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); -// if(StringUtils.isBlank(dbBill.getReceivePay())) dbBill.setReceivePay("0"); -// wxBillRent.setPay(new BigDecimal(dbBill.getPay()).add(new BigDecimal(dbBill.getReceivePay())).toPlainString()); //押金是ReceivePay -// wxBillRent.setPayDate(new Date()); -// if(EnumSettleBillType.R.getCode().equals(bill.getType())){ -// wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); -// }else{ -// wxBillRent.setStatus(EnumBillStatus.RETURN.getCode()); -// } -// //addBillAction(bill.getBillId(), dbBill.getOwe()); -// } -// } -// wxBillDepositMapper.updateById(wxBillRent); -// -// WxBillOtherDeposit wxBillOtherDeposit = new WxBillOtherDeposit(); -// wxBillOtherDeposit.setId(bill.getBillId()); -// if ( null != applyStatus) { -// wxBillOtherDeposit.setApplyStatus(applyStatus); -// wxBillOtherDeposit.setApplyUpdateTime(bill.getApplyUpdateTime()); -// } -// if (!StringUtils.isBlank(bill.getApplyPayImg())) { -// wxBillOtherDeposit.setApplyPayImg(bill.getApplyPayImg()); -// } -// if(freezeStatus != null) wxBillOtherDeposit.setFreeze(freezeStatus); -// if(status != null){ -// wxBillOtherDeposit.setStatus(status); -// } -// if(EnumBillStatus.PAID.getCode().equals(status)){ -// wxBillOtherDeposit.setPayDate(new Date()); -// WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectById(wxBillRent.getId()); -// if(dbBill!=null) { -// if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); -// if(StringUtils.isBlank(dbBill.getReceivePay())) dbBill.setReceivePay("0"); -// wxBillOtherDeposit.setPay(dbBill.getPay()+ dbBill.getReceivePay()); -// wxBillOtherDeposit.setPayDate(new Date()); -// if(EnumSettleBillType.R.getCode().equals(bill.getType())){ -// wxBillOtherDeposit.setStatus(EnumBillStatus.PAID.getCode()); -// }else{ -// wxBillOtherDeposit.setStatus(EnumBillStatus.RETURN.getCode()); -// } -// //addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); -// } -// } -// wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); -// -// WxBillPropertyDeposit propertyDeposit = new WxBillPropertyDeposit(); -// propertyDeposit.setId(bill.getBillId()); -// if ( null != applyStatus) { -// propertyDeposit.setApplyStatus(applyStatus); -// propertyDeposit.setApplyUpdateTime(bill.getApplyUpdateTime()); -// } -// if (!StringUtils.isBlank(bill.getApplyPayImg())) { -// propertyDeposit.setApplyPayImg(bill.getApplyPayImg()); -// } -// if(freezeStatus != null) propertyDeposit.setFreeze(freezeStatus); -// if(status != null){ -// propertyDeposit.setStatus(status); -// } -// if(EnumBillStatus.PAID.getCode().equals(status)){ -// propertyDeposit.setPayDate(new Date()); -// WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectById(wxBillRent.getId()); -// if(dbBill!=null) { -// if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); -// if(StringUtils.isBlank(dbBill.getReceivePay())) dbBill.setReceivePay("0"); -// propertyDeposit.setPay(new BigDecimal(dbBill.getPay()).add(new BigDecimal(dbBill.getReceivePay())).toPlainString()); -// propertyDeposit.setPayDate(new Date()); -// if(EnumSettleBillType.R.getCode().equals(bill.getType())){ -// propertyDeposit.setStatus(EnumBillStatus.PAID.getCode()); -// }else{ -// propertyDeposit.setStatus(EnumBillStatus.RETURN.getCode()); -// } -// //addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); -// } -// } -// wxBillPropertyDepositMapper.updateById(propertyDeposit); -// -// }else if(EnumBillType.PROPERTY.getCode().equals(bill.getBillType())) { -// WxBillProperty wxBillRent = new WxBillProperty(); -// wxBillRent.setId(bill.getBillId()); -// if ( null != applyStatus) { -// wxBillRent.setApplyStatus(applyStatus); -// wxBillRent.setApplyUpdateTime(bill.getApplyUpdateTime()); -// } -// if (!StringUtils.isBlank(bill.getApplyPayImg())) { -// wxBillRent.setApplyPayImg(bill.getApplyPayImg()); -// } -// if(freezeStatus != null) wxBillRent.setFreeze(freezeStatus); -// if(status != null){ -// wxBillRent.setStatus(status); -// } -// if(EnumBillStatus.PAID.getCode().equals(status)){ -// wxBillRent.setPayDate(new Date()); -// WxBillProperty dbBill = wxBillPropertyMapper.selectById(wxBillRent.getId()); -// if(dbBill!=null) { -// if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); -// //if(StringUtils.isBlank(dbBill.getOwe())) dbBill.setOwe("0"); -// //wxBillRent.setPay(new BigDecimal(dbBill.getPay()).add(new BigDecimal(dbBill.getOwe())).toPlainString()); -// wxBillRent.setPay(new BigDecimal(dbBill.getPay()).toPlainString()); -// wxBillRent.setPayDate(new Date()); -// //addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); -// } -// } -// wxBillPropertyMapper.updateById(wxBillRent); -// -// WxBillPropertyDeposit propertyDeposit = new WxBillPropertyDeposit(); -// propertyDeposit.setId(bill.getBillId()); -// if ( null != applyStatus) { -// propertyDeposit.setApplyStatus(applyStatus); -// propertyDeposit.setApplyUpdateTime(bill.getApplyUpdateTime()); -// } -// if (!StringUtils.isBlank(bill.getApplyPayImg())) { -// propertyDeposit.setApplyPayImg(bill.getApplyPayImg()); -// } -// if(freezeStatus != null) propertyDeposit.setFreeze(freezeStatus); -// if(status != null){ -// propertyDeposit.setStatus(status); -// } -// if(EnumBillStatus.PAID.getCode().equals(status)){ -// propertyDeposit.setPayDate(new Date()); -// WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectById(wxBillRent.getId()); -// if(dbBill!=null) { -// if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); -// if(StringUtils.isBlank(dbBill.getReceivePay())) dbBill.setReceivePay("0"); -// propertyDeposit.setPay(new BigDecimal(dbBill.getPay()).add(new BigDecimal(dbBill.getReceivePay())).toPlainString()); -// propertyDeposit.setPayDate(new Date()); -// if(EnumSettleBillType.R.getCode().equals(bill.getType())){ -// propertyDeposit.setStatus(EnumBillStatus.PAID.getCode()); -// }else{ -// propertyDeposit.setStatus(EnumBillStatus.RETURN.getCode()); -// } -// //addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); -// } -// } -// wxBillPropertyDepositMapper.updateById(propertyDeposit); -// }else if(EnumBillType.ROUTINE.getCode().equals(bill.getBillType())) { -// WxBillOther wxBillRent = new WxBillOther(); -// wxBillRent.setId(bill.getBillId()); -// if ( null != applyStatus) { -// wxBillRent.setApplyStatus(applyStatus); -// wxBillRent.setApplyUpdateTime(bill.getApplyUpdateTime()); -// } -// if (!StringUtils.isBlank(bill.getApplyPayImg())) { -// wxBillRent.setApplyPayImg(bill.getApplyPayImg()); -// } -// if(freezeStatus != null) wxBillRent.setFreeze(freezeStatus); -// if(status != null){ -// wxBillRent.setStatus(status); -// } -// if(EnumBillStatus.PAID.getCode().equals(status)){ -// wxBillRent.setPayDate(new Date()); -// WxBillOther dbBill = wxBillOtherMapper.selectById(wxBillRent.getId()); -// if(dbBill!=null) { -// if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); -// //if(StringUtils.isBlank(dbBill.getOwe())) dbBill.setOwe("0"); -// //wxBillRent.setPay(new BigDecimal(dbBill.getPay()).add(new BigDecimal(dbBill.getOwe())).toPlainString()); -// wxBillRent.setPay(new BigDecimal(dbBill.getPay()).toPlainString()); -// wxBillRent.setPayDate(new Date()); -// //addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); -// } -// } -// wxBillOtherMapper.updateById(wxBillRent); -// }else if(EnumBillType.OTHER_DEPOSIT.getCode().equals(bill.getBillType())) { -// WxBillOtherDeposit wxBillRent = new WxBillOtherDeposit(); -// wxBillRent.setId(bill.getBillId()); -// if ( null != applyStatus) { -// wxBillRent.setApplyStatus(applyStatus); -// wxBillRent.setApplyUpdateTime(bill.getApplyUpdateTime()); -// } -// if (!StringUtils.isBlank(bill.getApplyPayImg())) { -// wxBillRent.setApplyPayImg(bill.getApplyPayImg()); -// } -// if(freezeStatus != null) wxBillRent.setFreeze(freezeStatus); -// if(status != null){ -// wxBillRent.setStatus(status); -// } -// if(EnumBillStatus.PAID.getCode().equals(status)){ -// wxBillRent.setPayDate(new Date()); -// WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectById(wxBillRent.getId()); -// if(dbBill!=null) { -// if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); -// if(StringUtils.isBlank(dbBill.getReceivePay())) dbBill.setReceivePay("0"); -// wxBillRent.setPay(new BigDecimal(dbBill.getPay()).add(new BigDecimal(dbBill.getReceivePay())).toPlainString()); -// wxBillRent.setPayDate(new Date()); -// if(EnumSettleBillType.R.getCode().equals(bill.getType())){ -// wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); -// }else{ -// wxBillRent.setStatus(EnumBillStatus.RETURN.getCode()); -// } -// //addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); -// } -// } -// wxBillOtherDepositMapper.updateById(wxBillRent); -// -// WxMerchantSubsidy wxMerchantSubsidy = new WxMerchantSubsidy(); -// wxMerchantSubsidy.setId(bill.getBillId()); -// if(freezeStatus != null) wxMerchantSubsidy.setFreeze(freezeStatus); -// if(status != null){ -// wxMerchantSubsidy.setStatus(EnumMerchantSubsidyStatus.MANUAL_SUBSIDIED.getCode()); -// } -// wxMerchantSubsidyMapper.updateById(wxMerchantSubsidy); -// }else if(EnumBillType.OTHER_DEPOSIT.getCode().equals(bill.getBillType())) { -// WxBillOtherDeposit wxBillRent = new WxBillOtherDeposit(); -// wxBillRent.setId(bill.getBillId()); -// if ( null != applyStatus) { -// wxBillRent.setApplyStatus(applyStatus); -// wxBillRent.setApplyUpdateTime(bill.getApplyUpdateTime()); -// } -// if (!StringUtils.isBlank(bill.getApplyPayImg())) { -// wxBillRent.setApplyPayImg(bill.getApplyPayImg()); -// } -// if(freezeStatus != null) wxBillRent.setFreeze(freezeStatus); -// if(status != null){ -// wxBillRent.setStatus(status); -// } -// if(EnumBillStatus.PAID.getCode().equals(status)){ -// wxBillRent.setPayDate(new Date()); -// WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectById(wxBillRent.getId()); -// if(dbBill!=null) { -// if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); -// if(StringUtils.isBlank(dbBill.getReceivePay())) dbBill.setReceivePay("0"); -// wxBillRent.setPay(new BigDecimal(dbBill.getPay()).add(new BigDecimal(dbBill.getReceivePay())).toPlainString()); -// wxBillRent.setPayDate(new Date()); -// if(EnumSettleBillType.R.getCode().equals(bill.getType())){ -// wxBillRent.setStatus(EnumBillStatus.PAID.getCode()); -// }else{ -// wxBillRent.setStatus(EnumBillStatus.RETURN.getCode()); -// } -// //addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); -// } -// } -// wxBillOtherDepositMapper.updateById(wxBillRent); -// }else{ -// WxBillDaily wxBillDaily = new WxBillDaily(); -// wxBillDaily.setId(bill.getBillId()); -// if ( null != applyStatus) { -// wxBillDaily.setApplyStatus(applyStatus); -// wxBillDaily.setApplyUpdateTime(bill.getApplyUpdateTime()); -// } -// if (!StringUtils.isBlank(bill.getApplyPayImg())) { -// wxBillDaily.setApplyPayImg(bill.getApplyPayImg()); -// } -// if(freezeStatus != null) wxBillDaily.setFreeze(freezeStatus); -// if(status != null){ -// wxBillDaily.setStatus(status); -// } -// if(EnumBillStatus.PAID.getCode().equals(status)){ -// wxBillDaily.setPayDate(new Date()); -// WxBillDaily dbBill = wxBillDailyMapper.selectById(wxBillDaily.getId()); -// if(dbBill!=null) { -// if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); -// //if(StringUtils.isBlank(dbBill.getOwe())) dbBill.setOwe("0"); -// //wxBillDaily.setPay(new BigDecimal(dbBill.getPay()).add(new BigDecimal(dbBill.getOwe())).toPlainString()); -// wxBillDaily.setPay(new BigDecimal(dbBill.getPay()).toPlainString()); -// wxBillDaily.setPayDate(new Date()); -// //addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); -// } -// } -// wxBillDailyMapper.updateById(wxBillDaily); -// -// WxBillOther wxBillRent = new WxBillOther(); -// wxBillRent.setId(bill.getBillId()); -// if ( null != applyStatus) { -// wxBillRent.setApplyStatus(applyStatus); -// wxBillRent.setApplyUpdateTime(bill.getApplyUpdateTime()); -// } -// if (!StringUtils.isBlank(bill.getApplyPayImg())) { -// wxBillRent.setApplyPayImg(bill.getApplyPayImg()); -// } -// if(freezeStatus != null) wxBillRent.setFreeze(freezeStatus); -// if(status != null){ -// wxBillRent.setStatus(status); -// } -// if(EnumBillStatus.PAID.getCode().equals(status)){ -// wxBillRent.setPayDate(new Date()); -// WxBillOther dbBill = wxBillOtherMapper.selectById(wxBillRent.getId()); -// if(dbBill!=null) { -// if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); -// //if(StringUtils.isBlank(dbBill.getOwe())) dbBill.setOwe("0"); -// //wxBillRent.setPay(new BigDecimal(dbBill.getPay()).add(new BigDecimal(dbBill.getOwe())).toPlainString()); -// wxBillRent.setPay(new BigDecimal(dbBill.getPay()).toPlainString()); -// wxBillRent.setPayDate(new Date()); -// //addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); -// } -// } -// wxBillOtherMapper.updateById(wxBillRent); -// -// WxBillPropertyDeposit propertyDeposit = new WxBillPropertyDeposit(); -// propertyDeposit.setId(bill.getBillId()); -// if ( null != applyStatus) { -// propertyDeposit.setApplyStatus(applyStatus); -// propertyDeposit.setApplyUpdateTime(bill.getApplyUpdateTime()); -// } -// if (!StringUtils.isBlank(bill.getApplyPayImg())) { -// propertyDeposit.setApplyPayImg(bill.getApplyPayImg()); -// } -// if(freezeStatus != null) propertyDeposit.setFreeze(freezeStatus); -// if(status != null){ -// propertyDeposit.setStatus(status); -// } -// if(EnumBillStatus.PAID.getCode().equals(status)){ -// propertyDeposit.setPayDate(new Date()); -// WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectById(wxBillRent.getId()); -// if(dbBill!=null) { -// propertyDeposit.setPay(dbBill.getPay()+dbBill.getReceivePay()); -// propertyDeposit.setPayDate(new Date()); -// if(EnumSettleBillType.R.getCode().equals(bill.getType())){ -// propertyDeposit.setStatus(EnumBillStatus.PAID.getCode()); -// }else{ -// propertyDeposit.setStatus(EnumBillStatus.RETURN.getCode()); -// } -// //addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); -// } -// } -// wxBillPropertyDepositMapper.updateById(propertyDeposit); -// } -// } - } - - public Integer getType(Long billId, WxBillSettle record){ - for (WxBillSettleBill bill:record.getReceiveBillIds()) { - if(bill.getBillId().equals(billId)){ - return 0; - } - } - return 1; - } - - @Override - @Transactional - public ResultData saveOrUpdate(WxBillSettle record, MallUserInfo userInfo) { - final IdWorker idWorker = IdWorker.get(); - - //检查账单是否存在其他结算单中 -// WxBillSettle query = new WxBillSettle(); -// query.setId(record.getId()); -// List list = new ArrayList<>(); -// list.addAll(record.getReceiveBillIds()); -// list.addAll(record.getPayBillIds()); -// query.setReceiveBillIds(list); -// List existList = wxBillSettleBillMapper.findExist(query); -// Set idSet = new HashSet(); -// if(CollectionUtils.isNotEmpty(existList)){ -// for (WxBillSettleBill b:existList) { -// idSet.add(b.getBillId()); -// } -// String ids = ""; -// for (Long id:idSet) { -// WxBillSettleBill queryBill = new WxBillSettleBill(); -// queryBill.setBillId(id); -// queryBill.setType(getType(id,record)); -// WxBillSettleBill db = wxBillSettleBillMapper.findByBillId(queryBill).get(0); -// BigDecimal r = new BigDecimal(db.getReceivePay()).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP); -// ids += db.getBillName()+r.toString()+"元,"; -// } -// -// return new ResultData(ErrorCode.DB_FAIL.getCode(), ids.substring(0,ids.length()-1)+"已经在其他结算单中,请移除!"); -// } - - if (record.getFlowParams() == null || record.getFlowParams().size() == 0) { - record.setStatus(EnumSettleStatus.NOT_FINISH.getCode()); - //选择的账单改为已结清 - updateFreezeOrStatus(record.getReceiveBillIds(), null,EnumBillStatus.PAID.getCode(),null); - updateFreezeOrStatus(record.getPayBillIds(), null,EnumBillStatus.PAID.getCode(),null); - - //刚好结清 - if(record.getReceiveMoney().equals(record.getPayMoney())){ - record.setStatus(EnumSettleStatus.FINISH.getCode()); - } - } - if (record.getId() == null) { - record.setId(idWorker.nextId()); - wxBillSettleMapper.insert(record); - }else{ - wxBillSettleMapper.updateById(record); - } - - wxBillSettleBillMapper.delBySettleId(record); - //保存中间表 - for (WxBillSettleBill bill:record.getReceiveBillIds()) { - bill.setId(idWorker.nextId()); - bill.setSettleId(record.getId()); - bill.updateTenantInfo(userInfo); - bill.setType(EnumSettleBillType.R.getCode()); - wxBillSettleBillMapper.insert(bill); - } - for (WxBillSettleBill bill:record.getPayBillIds()) { - bill.setId(idWorker.nextId()); - bill.setSettleId(record.getId()); - bill.updateTenantInfo(userInfo); - bill.setType(EnumSettleBillType.P.getCode()); - wxBillSettleBillMapper.insert(bill); - } - - //改为冻结状态 - if (record.getFlowParams() != null && record.getFlowParams().size() > 0) { - updateFreezeOrStatus(record.getReceiveBillIds(), EnumFreezeType.YES.getCode(),null,null); - updateFreezeOrStatus(record.getPayBillIds(),EnumFreezeType.YES.getCode(),null,null); - - //启动审批流 - record.getFlowParams().put("businessId",record.getId()); - if (record.getFlowParams() != null && record.getFlowParams().size() > 0) { - wxFlowService.start(record.getFlowParams(), userInfo.getId(), userInfo.getName(), record); - } - } - return new ResultData(); - } - - @Override - public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillSettle wxBillSettle) { - List list = wxBillSettleMapper.findList(wxBillSettle); - List voList = new ArrayList<>(); - - for (WxBillSettle s:list) { - WxBillSettleVo vo = new WxBillSettleVo(); - vo.setSettleNumber(s.getSettleNumber()); - vo.setMerchantName(s.getMerchantName()); - vo.setCreatetime(DateUtils.formatDateTime(s.getCreatetime())); - vo.setReceiveMoney(new BigDecimal(s.getReceiveMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toString()); - vo.setPayMoney(new BigDecimal(s.getPayMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toString()); - vo.setBalance(new BigDecimal(s.getReceiveMoney()).subtract(new BigDecimal(s.getPayMoney())).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toString()); - vo.setSettletime(DateUtils.formatDateTime(s.getCreatetime())); - vo.setStatus(EnumSettleStatus.getEnum(s.getStatus()).getMessage()); - vo.setApplyStatus(EnumRentContractAppStatus.getEnum(s.getApplyStatus()).getMessage()); - voList.add(vo); - } - excelService.exportExcel(voList, null, "结算单", WxBillSettleVo.class, "结算单.xlsx", response, false); - } - - @Override - public void downloadBill(HttpServletRequest request, HttpServletResponse response, WxBillSettle wxBillSettle) { - - } -} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java index 54fdc8239..7ddfa37e2 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java @@ -138,9 +138,6 @@ public class WxChartServiceImpl implements WxChartDataService { private WxMallService wxMallService; @Autowired WxShopMapper wxShopMapper; - @Autowired - WxBillRentMapper wxBillRentMapper; - @Lazy @Autowired WxMerchantService wxMerchantService; @@ -180,12 +177,6 @@ public class WxChartServiceImpl implements WxChartDataService { @Autowired WxOrderGroupMapper wxOrderGroupMapper; @Autowired - WxBillPropertyMapper wxBillPropertyMapper; - @Autowired - WxBillDepositMapper wxBillDepositMapper; - @Autowired - WxBillOtherMapper wxBillOtherMapper; - @Autowired WxBillAllMapper wxBillAllMapper; @Autowired WxCUserCarMapper wxCUserCarMapper; @@ -2804,7 +2795,8 @@ public class WxChartServiceImpl implements WxChartDataService { params.put("parentTenantId", tenantEntity.getParentTenantId()); params.put("startdate", startdate + " 00:00:00"); params.put("enddate", enddate + " 23:59:59"); - Map payinfo = wxBillRentMapper.queryPayInfo(params); + //Map payinfo = wxBillRentMapper.queryPayInfo(params); + Map payinfo = null; if (payinfo != null) { BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); BigDecimal pay = (BigDecimal) payinfo.get("pay"); @@ -2962,7 +2954,8 @@ public class WxChartServiceImpl implements WxChartDataService { } params.put("startdate", DateUtils.date2String(startDate,"yyyy-MM-dd") + " 00:00:00"); params.put("enddate", DateUtils.date2String(endDate,"yyyy-MM-dd") + " 23:59:59"); - Map payinfo = wxBillRentMapper.queryPayInfoTotal(params); + //Map payinfo = wxBillRentMapper.queryPayInfoTotal(params); + Map payinfo = null; if (payinfo != null) { Double receivepay = ((BigDecimal) payinfo.get("receivepay")).doubleValue(); Double pay = ((BigDecimal) payinfo.get("pay")).doubleValue(); @@ -2983,7 +2976,7 @@ public class WxChartServiceImpl implements WxChartDataService { } //物业费收缴率 - payinfo = wxBillPropertyMapper.queryPayInfoTotal(params); + //payinfo = wxBillPropertyMapper.queryPayInfoTotal(params); if (payinfo != null) { Double receivepay = ((BigDecimal) payinfo.get("receivepay")).doubleValue(); Double pay = ((BigDecimal) payinfo.get("pay")).doubleValue(); @@ -3004,7 +2997,7 @@ public class WxChartServiceImpl implements WxChartDataService { } //押金收缴率 - payinfo = wxBillDepositMapper.queryPayInfoAllTotal(params); + //payinfo = wxBillDepositMapper.queryPayInfoAllTotal(params); if (payinfo != null) { Double receivepay = ((BigDecimal) payinfo.get("receivepay")).doubleValue(); Double pay = ((BigDecimal) payinfo.get("pay")).doubleValue(); @@ -3025,7 +3018,7 @@ public class WxChartServiceImpl implements WxChartDataService { } //其他费用收缴率 - payinfo = wxBillOtherMapper.queryPayInfoTotal(params); + //payinfo = wxBillOtherMapper.queryPayInfoTotal(params); if (payinfo != null) { Double receivepay = ((BigDecimal) payinfo.get("receivepay")).doubleValue(); Double pay = ((BigDecimal) payinfo.get("pay")).doubleValue(); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java index 2a487cf10..341e4a042 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java @@ -77,7 +77,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { @Lazy @Autowired - WxBillDailyService wxBillDailyService; + WxAllBillService wxAllBillService; @Override public PageInfo meterListAsPage(WxEnergyMeter record, Integer pageIndex, Integer pageSize) { @@ -915,7 +915,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { } } - List billList = new ArrayList(); + List billList = new ArrayList(); for (int i = 0 ; i< readingList.size() ; i ++) { WxEnergyMeterReading mr = readingList.get(i); //用户表账单 @@ -928,7 +928,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"表["+mr.getMeterName()+"]不存在"); } WxShop shop = shopMap.get(mr.getShopId()); - WxBillDaily userBill = mr.generateUserBill(record, merchant, user, meter); + WxAllBill userBill = mr.generateUserBill(record, merchant, user, meter); userBill.setEnergyFeesId(fees.getId()); if (null != userBill) { billList.add(userBill); @@ -939,7 +939,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { * 如果科目是根据楼栋公摊,则根据当前记录的楼栋面积计算 * 如果科目是根据楼层公摊,则根据当前记录的楼层面积计算 */ - WxBillDaily publicBill = null; + WxAllBill publicBill = null; if (fees.getPublicCalcute().intValue() == EnumEnergyPublicCalcuteRule.ALL.getCode().intValue()) { if (publicTotalMoney.compareTo(b0) > 0 ) { String needPay = publicTotalMoney.multiply(new BigDecimal(shop.getRentArea())).divide(new BigDecimal(publicTotalArea)).setScale(2,RoundingMode.HALF_UP).toPlainString(); @@ -989,11 +989,11 @@ public class WxEnergyServiceImpl implements WxEnergyService { if (billList.size() > 0 ) { try { //先把之前的未付的账单全部删除掉,已支付的账单先不处理 - WxBillDaily delDaily = new WxBillDaily(); + WxAllBill delDaily = new WxAllBill(); delDaily.updateTenantInfo(record); delDaily.setEnergyReadingCalcuteId(record.getId()); - wxBillDailyService.deleteEnergyReadingBills(delDaily); - wxBillDailyService.insertBills(record, billList); + wxAllBillService.deleteEnergyReadingBills(delDaily); + wxAllBillService.insertBills(record.getTenantId(), billList); }catch(Exception e) { logger.error("insert bills error.",e); allSuccess = false; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java index 172e90a83..7dbd4b2ea 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java @@ -13,7 +13,6 @@ import com.iformall.domain.dto.FinanceSetOffCalcuteDTO; import com.iformall.domain.dto.FinanceSetOffDTO; import com.iformall.domain.dto.WxBillPayDTO; import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxBillAdvance; import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxBillPayWay; import com.iformall.domain.po.WxEnergyFees; @@ -41,7 +40,6 @@ import com.iformall.mapper.WxFinanceReceiveBillMapper; import com.iformall.mapper.WxFinanceReceiveMapper; import com.iformall.mapper.WxFinanceReceivePaywayMapper; import com.iformall.mapper.WxFinanceReceiveSetoffMapper; -import com.iformall.service.WxBillAdvanceService; import com.iformall.service.WxEnergyService; import com.iformall.service.WxFinanceService; import com.iformall.service.WxMerchantService; @@ -97,9 +95,6 @@ public class WxFinanceServiceImpl implements WxFinanceService { @Lazy @Autowired WxBillAllHelper wxBillAllHelper; - @Lazy - @Autowired - WxBillAdvanceService wxBillAdvanceService; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java index a7da9b8d8..38cefc174 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -349,7 +349,7 @@ public class WxFlowServiceImpl implements WxFlowService { forcePaid = true; } - wxBillAllService.updateReceivePay(wxBillAll, user,forcePaid); + //wxBillAllService.updateReceivePay(wxBillAll, user,forcePaid); //账单修改金额,解冻 List billList = new ArrayList<>(); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index 8dce01969..322d88853 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -72,9 +72,6 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Autowired WxRentContractMapper wxRentContractMapper; - @Autowired - WxBillRentMapper wxBillRentMapper; - @Autowired WxCouponMapper wxCouponMapper; @@ -90,9 +87,6 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Autowired WxProfitPaymentReceiverService wxProfitPaymentReceiverService; - @Autowired - WxBillDepositMapper wxBillDepositMapper; - @Autowired WxMerchantCorpMapper wxMerchantCorpMapper; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPayAccountBillServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPayAccountBillServiceImpl.java index efe955ab2..cd555606a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPayAccountBillServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPayAccountBillServiceImpl.java @@ -6,8 +6,6 @@ import com.github.pagehelper.PageInfo; import com.iformall.common.IdWorker; import com.iformall.domain.po.WxPayAccountBill; import com.iformall.domain.po.base.TenantEntity; -import com.iformall.mapper.WxBillPropertyMapper; -import com.iformall.mapper.WxBillRentMapper; import com.iformall.mapper.WxPayAccountBillMapper; import com.iformall.service.WxPayAccountBillService; import org.slf4j.Logger; @@ -22,11 +20,6 @@ public class WxPayAccountBillServiceImpl implements WxPayAccountBillService { @Autowired WxPayAccountBillMapper wxPayAccountBillMapper; - @Autowired - WxBillRentMapper wxBillRentMapper; - - @Autowired - WxBillPropertyMapper wxBillPropertyMapper; @Override public void payAccountBillInit(TenantEntity tenantInfo) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPayBillServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPayBillServiceImpl.java index b1f118523..91e3aec67 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPayBillServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPayBillServiceImpl.java @@ -102,234 +102,235 @@ public class WxPayBillServiceImpl implements WxPayBillService { @Override public ResultData createPayBill(WxMerchant merchant,Integer billTypeValue,WxAppinfo appInfo, WxPayBill record, EnumPayWay payWay) { - final IdWorker idworker = IdWorker.get(); - - EnumPayShare isShare = EnumPayShare.NO; - try { - //查询账单是否存在 - WxBillAll wxBillAll = new WxBillAll(); - wxBillAll.updateTenantInfo(record); - wxBillAll.setId(record.getBillId()); - wxBillAll.setBillTypeValue(billTypeValue); - List> bills = wxBillAllService.listBill(wxBillAll,merchant,true,false,false,false); - if (bills.size()==0) { - logger.error("pay bill, bill not allow, repaymentReq: " + JSONObject.toJSONString(record) + ", payWay: " + payWay.toString()); - throw new MallinkException(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); - } - //获取账单数据 - Map bill = bills.get(0); - Long owe = (Long) bill.get("owe"); - - if (owe.longValue() <= 0) { - logger.info("账单欠缴为0"); - return new ResultData(ErrorCode.BILL_OWE_ZERO); - } - //获取支付账户信息 - WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); - Date currentDate = new Date(); - String payBillNo; - WxPayBill billParam= new WxPayBill(); - billParam.setBillId(record.getBillId()); - List list = wxPayBillMapper.findList(billParam); - //数据库不存在已有订单,新建订单 - if (list.size() <= 0) { - // 创建支付订单 - Long id = idworker.nextId(); - payBillNo = id+DateUtils.getSystemTime("yyMMddHHmmss"); - record.setId(id); - record.updateTenantInfo(record); - record.setbUserId(record.getbUserId()); - record.setCreateTime(currentDate); - record.setUpdateTime(currentDate); - record.setPayTimeStart(currentDate); - long endtime = currentDate.getTime() + 120 * 60 * 1000; - record.setPayTimeEnd(new Date(endtime)); - // 支付单号 - record.setPayBillNo(payBillNo); - record.setPayAmount((Long) bill.get("owe")); - record.setPayVendor(payWay.getCode()); - record.setPayBillStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); - record.setShare(isShare.getCode()); - record.setBillTypeValue(billTypeValue); - int sqlRow = wxPayBillMapper.insert(record); - if (sqlRow != 1) { - logger.error("pay bill insert error: " + JSONObject.toJSONString(record)); - throw new MallinkException(ErrorCode.DB_FAIL); - } - logger.info("创建支付订单:"+record.toString()); - } else { - //数据库存在订单信息,更新支付中状态,返回之前的预支付信息 - WxPayBill wxPayBill = list.get(0); - wxPayBill.setShare(isShare.getCode()); - //更新订单状态为支付中 - wxPayBill.setPayBillStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); - wxPayBill.setUpdateTime(currentDate); - int sqlRow = wxPayBillMapper.updateById(wxPayBill); - if (sqlRow != 1) { - logger.error("pay bill update error: " + wxPayBill.toString()); - throw new MallinkException(ErrorCode.DB_FAIL); - } - //数据库中openId与再次传来的openId不相同那么关闭此订单再次生成新的订单 - if(!wxPayBill.getOpenId().equals(record.getOpenId())){ - String openId = record.getOpenId(); - //关闭订单 - logger.info("openId不同时关闭之前的订单:"+record.toString()); - ResultData resultData = payBillClose(appInfo, wxPayBill); - if(resultData.code!=Result.SUCCESS){ - return new ResultData(ErrorCode.ORDER_IS_FAIL); - } - record = wxPayBillMapper.selectById(wxPayBill.getId()); - record.setOpenId(openId); - //创建新的订单号 - payBillNo = record.getId()+DateUtils.getSystemTime("yyMMddHHmmss"); - record.setPayTimeStart(currentDate); - long endtime = currentDate.getTime() + 120 * 60 * 1000; - record.setPayTimeEnd(new Date(endtime)); - record.setPayBillNo(payBillNo); - record.setPayAmount((Long) bill.get("owe")); - record.setUpdateTime(currentDate); - sqlRow = wxPayBillMapper.updateById(record); - if (sqlRow != 1) { - logger.error("pay bill update error: " + JSONObject.toJSONString(record)); - throw new MallinkException(ErrorCode.DB_FAIL); - } - logger.info("新的订单数据:"+JSONObject.toJSONString(record)); - }else{ - logger.info("数据库存在订单信息,更新支付中状态,返回之前的预支付信息:"+JSONObject.toJSONString(wxPayBill)); - if (!owe.equals(wxPayBill.getPayAmount())) { - logger.info("欠缴费用与之前不同发起新的订单:" + wxPayBill.toString()); - ResultData resultData = payBillClose(appInfo, wxPayBill); - if (resultData.code != Result.SUCCESS) { - return new ResultData(ErrorCode.ORDER_IS_FAIL); - } - record = wxPayBillMapper.selectById(wxPayBill.getId()); - //创建新的订单号 - payBillNo = record.getId() + DateUtils.getSystemTime("yyMMddHHmmss"); - record.setPayTimeStart(currentDate); - long endtime = currentDate.getTime() + 120 * 60 * 1000; - record.setPayTimeEnd(new Date(endtime)); - record.setPayBillNo(payBillNo); - record.setPayAmount((Long) bill.get("owe")); - record.setUpdateTime(currentDate); - sqlRow = wxPayBillMapper.updateById(record); - if (sqlRow != 1) { - logger.error("pay bill update error: " + JSONObject.toJSONString(record)); - throw new MallinkException(ErrorCode.DB_FAIL); - } - logger.info("新的订单数据:" + JSONObject.toJSONString(record)); - } else if (wxPayBill.getPayTimeEnd().after(new Date())) { - //订单在120分钟之内没有失效,延用之前预支付订单号 - String noncestr = Utility.generate32UUID(); - String timestamp = String.valueOf(Utility.getCurrentTimeStamp()); - Map sighMap = MapUtil.getOrderMap(); - sighMap.put("appId", appInfo.getAppId()); - sighMap.put("timeStamp", timestamp); - sighMap.put("nonceStr", noncestr); - sighMap.put("package", "prepay_id=" + wxPayBill.getPrepayId()); - sighMap.put("signType", "HMAC-SHA256"); - String signAgent = WxPayment.createSignHMAC(sighMap, payAccount.getApiKey()); - Map returnMap=new HashMap<>(); - returnMap.put("timeStamp", timestamp); - returnMap.put("nonceStr", noncestr); - returnMap.put("package", "prepay_id=" + wxPayBill.getPrepayId()); - returnMap.put("paySign", signAgent); - returnMap.put("signType", "HMAC-SHA256"); - logger.info("订单在120分钟之内没有失效,延用之前预支付订单号:"+JSONObject.toJSONString(wxPayBill)); - return new ResultData(Result.SUCCESS, "创建支付订单成功", returnMap); - } else { - //超过时间关闭订单 - logger.info("超过时间关闭订单:" + wxPayBill.toString()); - ResultData resultData = payBillClose(appInfo, wxPayBill); - if(resultData.code!=Result.SUCCESS){ - return new ResultData(ErrorCode.ORDER_IS_FAIL); - } - record = wxPayBillMapper.selectById(wxPayBill.getId()); - //创建新的订单号 - payBillNo = record.getId()+DateUtils.getSystemTime("yyMMddHHmmss"); - record.setPayTimeStart(currentDate); - long endtime = currentDate.getTime() + 120 * 60 * 1000; - record.setPayTimeEnd(new Date(endtime)); - record.setPayBillNo(payBillNo); - record.setPayAmount((Long) bill.get("owe")); - record.setUpdateTime(currentDate); - sqlRow = wxPayBillMapper.updateById(record); - if (sqlRow != 1) { - logger.error("pay bill update error: " + JSONObject.toJSONString(record)); - throw new MallinkException(ErrorCode.DB_FAIL); - } - logger.info("新的订单数据:"+JSONObject.toJSONString(record)); - } - - } - - } - - // 统一下单 // 服务商模式 - String noncestr = Utility.generate32UUID(); - WxPayOrderSP wxPayBillSP = new WxPayOrderSP(); - wxPayBillSP.setSub_openid(record.getOpenId()); - wxPayBillSP.setAppid(appInfo.getParentAppId()); - wxPayBillSP.setMch_id(payAccount.getMchId()); - wxPayBillSP.setSub_appid(appInfo.getAppId()); - wxPayBillSP.setSub_mch_id(payAccount.getSubMchId()); - wxPayBillSP.setNonce_str(noncestr); - wxPayBillSP.setBody(bill.get("billType").toString()); - wxPayBillSP.setOut_trade_no(record.getPayBillNo()); - wxPayBillSP.setTotal_fee(bill.get("owe").toString()); - // 终端IP - wxPayBillSP.setSpbill_create_ip(record.getIp()); - wxPayBillSP.setNotify_url(payAccount.getPayNotifyUrl()); - // 终端类型 - wxPayBillSP.setTrade_type(WxPay.TradeType.JSAPI.name()); - // 订单ID - wxPayBillSP.setProduct_id(String.valueOf(bill.get("id").toString())); - wxPayBillSP.setTime_start(Utility.getDataFormatStringYYYYMMDDHHmmss(currentDate)); - wxPayBillSP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(record.getPayTimeEnd())); - wxPayBillSP.setSign_type("HMAC-SHA256"); - wxPayBillSP.setProfit_sharing(null); - if (isShare == EnumPayShare.YES) { - wxPayBillSP.setProfit_sharing("Y"); - } - Map payBillMap = BeanUtils.toStringMap(wxPayBillSP); - wxPayBillSP.setSign(WxPayment.createSignHMAC(payBillMap, payAccount.getApiKey())); - String response = WxPay.pushOrder(BeanUtils.toStringMap(wxPayBillSP)); - logger.info("pay bill, wechat pushBill, " + wxPayBillSP.toString() + ", response: " + response); - Map returnMap = WxPayment.xmlToMap(response); - returnMap.put("payBillId", record.getId().toString()); - String result_code = returnMap.get("result_code"); - if ("SUCCESS".equals(result_code)) { - String prepay_id = returnMap.get("prepay_id"); - // update payBill with prepay_id - record.setPrepayId(prepay_id); - record.setUpdateTime(new Date()); - try { - wxPayBillMapper.updateById(record); - } catch (Exception e) { - logger.error("pay bill update error: " + record.toString()); - throw new MallinkException(ErrorCode.DB_FAIL); - } - String timestamp = String.valueOf(Utility.getCurrentTimeStamp()); - Map sighMap = MapUtil.getOrderMap(); - sighMap.put("appId", appInfo.getAppId()); - sighMap.put("timeStamp", timestamp); - sighMap.put("nonceStr", noncestr); - sighMap.put("package", "prepay_id=" + prepay_id); - sighMap.put("signType", "HMAC-SHA256"); - String signAgent = WxPayment.createSignHMAC(sighMap, payAccount.getApiKey()); - returnMap.put("timeStamp", timestamp); - returnMap.put("nonceStr", noncestr); - returnMap.put("package", "prepay_id=" + prepay_id); - returnMap.put("paySign", signAgent); - returnMap.put("signType", "HMAC-SHA256"); - logger.info("back to UI: " + returnMap.toString()); - return new ResultData(Result.SUCCESS, "创建支付订单成功", returnMap); - } - return updatePayBill(record, returnMap, result_code); - } catch (RuntimeException e) { - throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); - } catch (Exception e) { - throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); - } +// final IdWorker idworker = IdWorker.get(); +// +// EnumPayShare isShare = EnumPayShare.NO; +// try { +// //查询账单是否存在 +// WxBillAll wxBillAll = new WxBillAll(); +// wxBillAll.updateTenantInfo(record); +// wxBillAll.setId(record.getBillId()); +// wxBillAll.setBillTypeValue(billTypeValue); +// List> bills = wxBillAllService.listBill(wxBillAll,merchant,true,false,false,false); +// if (bills.size()==0) { +// logger.error("pay bill, bill not allow, repaymentReq: " + JSONObject.toJSONString(record) + ", payWay: " + payWay.toString()); +// throw new MallinkException(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); +// } +// //获取账单数据 +// Map bill = bills.get(0); +// Long owe = (Long) bill.get("owe"); +// +// if (owe.longValue() <= 0) { +// logger.info("账单欠缴为0"); +// return new ResultData(ErrorCode.BILL_OWE_ZERO); +// } +// //获取支付账户信息 +// WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); +// Date currentDate = new Date(); +// String payBillNo; +// WxPayBill billParam= new WxPayBill(); +// billParam.setBillId(record.getBillId()); +// List list = wxPayBillMapper.findList(billParam); +// //数据库不存在已有订单,新建订单 +// if (list.size() <= 0) { +// // 创建支付订单 +// Long id = idworker.nextId(); +// payBillNo = id+DateUtils.getSystemTime("yyMMddHHmmss"); +// record.setId(id); +// record.updateTenantInfo(record); +// record.setbUserId(record.getbUserId()); +// record.setCreateTime(currentDate); +// record.setUpdateTime(currentDate); +// record.setPayTimeStart(currentDate); +// long endtime = currentDate.getTime() + 120 * 60 * 1000; +// record.setPayTimeEnd(new Date(endtime)); +// // 支付单号 +// record.setPayBillNo(payBillNo); +// record.setPayAmount((Long) bill.get("owe")); +// record.setPayVendor(payWay.getCode()); +// record.setPayBillStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); +// record.setShare(isShare.getCode()); +// record.setBillTypeValue(billTypeValue); +// int sqlRow = wxPayBillMapper.insert(record); +// if (sqlRow != 1) { +// logger.error("pay bill insert error: " + JSONObject.toJSONString(record)); +// throw new MallinkException(ErrorCode.DB_FAIL); +// } +// logger.info("创建支付订单:"+record.toString()); +// } else { +// //数据库存在订单信息,更新支付中状态,返回之前的预支付信息 +// WxPayBill wxPayBill = list.get(0); +// wxPayBill.setShare(isShare.getCode()); +// //更新订单状态为支付中 +// wxPayBill.setPayBillStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); +// wxPayBill.setUpdateTime(currentDate); +// int sqlRow = wxPayBillMapper.updateById(wxPayBill); +// if (sqlRow != 1) { +// logger.error("pay bill update error: " + wxPayBill.toString()); +// throw new MallinkException(ErrorCode.DB_FAIL); +// } +// //数据库中openId与再次传来的openId不相同那么关闭此订单再次生成新的订单 +// if(!wxPayBill.getOpenId().equals(record.getOpenId())){ +// String openId = record.getOpenId(); +// //关闭订单 +// logger.info("openId不同时关闭之前的订单:"+record.toString()); +// ResultData resultData = payBillClose(appInfo, wxPayBill); +// if(resultData.code!=Result.SUCCESS){ +// return new ResultData(ErrorCode.ORDER_IS_FAIL); +// } +// record = wxPayBillMapper.selectById(wxPayBill.getId()); +// record.setOpenId(openId); +// //创建新的订单号 +// payBillNo = record.getId()+DateUtils.getSystemTime("yyMMddHHmmss"); +// record.setPayTimeStart(currentDate); +// long endtime = currentDate.getTime() + 120 * 60 * 1000; +// record.setPayTimeEnd(new Date(endtime)); +// record.setPayBillNo(payBillNo); +// record.setPayAmount((Long) bill.get("owe")); +// record.setUpdateTime(currentDate); +// sqlRow = wxPayBillMapper.updateById(record); +// if (sqlRow != 1) { +// logger.error("pay bill update error: " + JSONObject.toJSONString(record)); +// throw new MallinkException(ErrorCode.DB_FAIL); +// } +// logger.info("新的订单数据:"+JSONObject.toJSONString(record)); +// }else{ +// logger.info("数据库存在订单信息,更新支付中状态,返回之前的预支付信息:"+JSONObject.toJSONString(wxPayBill)); +// if (!owe.equals(wxPayBill.getPayAmount())) { +// logger.info("欠缴费用与之前不同发起新的订单:" + wxPayBill.toString()); +// ResultData resultData = payBillClose(appInfo, wxPayBill); +// if (resultData.code != Result.SUCCESS) { +// return new ResultData(ErrorCode.ORDER_IS_FAIL); +// } +// record = wxPayBillMapper.selectById(wxPayBill.getId()); +// //创建新的订单号 +// payBillNo = record.getId() + DateUtils.getSystemTime("yyMMddHHmmss"); +// record.setPayTimeStart(currentDate); +// long endtime = currentDate.getTime() + 120 * 60 * 1000; +// record.setPayTimeEnd(new Date(endtime)); +// record.setPayBillNo(payBillNo); +// record.setPayAmount((Long) bill.get("owe")); +// record.setUpdateTime(currentDate); +// sqlRow = wxPayBillMapper.updateById(record); +// if (sqlRow != 1) { +// logger.error("pay bill update error: " + JSONObject.toJSONString(record)); +// throw new MallinkException(ErrorCode.DB_FAIL); +// } +// logger.info("新的订单数据:" + JSONObject.toJSONString(record)); +// } else if (wxPayBill.getPayTimeEnd().after(new Date())) { +// //订单在120分钟之内没有失效,延用之前预支付订单号 +// String noncestr = Utility.generate32UUID(); +// String timestamp = String.valueOf(Utility.getCurrentTimeStamp()); +// Map sighMap = MapUtil.getOrderMap(); +// sighMap.put("appId", appInfo.getAppId()); +// sighMap.put("timeStamp", timestamp); +// sighMap.put("nonceStr", noncestr); +// sighMap.put("package", "prepay_id=" + wxPayBill.getPrepayId()); +// sighMap.put("signType", "HMAC-SHA256"); +// String signAgent = WxPayment.createSignHMAC(sighMap, payAccount.getApiKey()); +// Map returnMap=new HashMap<>(); +// returnMap.put("timeStamp", timestamp); +// returnMap.put("nonceStr", noncestr); +// returnMap.put("package", "prepay_id=" + wxPayBill.getPrepayId()); +// returnMap.put("paySign", signAgent); +// returnMap.put("signType", "HMAC-SHA256"); +// logger.info("订单在120分钟之内没有失效,延用之前预支付订单号:"+JSONObject.toJSONString(wxPayBill)); +// return new ResultData(Result.SUCCESS, "创建支付订单成功", returnMap); +// } else { +// //超过时间关闭订单 +// logger.info("超过时间关闭订单:" + wxPayBill.toString()); +// ResultData resultData = payBillClose(appInfo, wxPayBill); +// if(resultData.code!=Result.SUCCESS){ +// return new ResultData(ErrorCode.ORDER_IS_FAIL); +// } +// record = wxPayBillMapper.selectById(wxPayBill.getId()); +// //创建新的订单号 +// payBillNo = record.getId()+DateUtils.getSystemTime("yyMMddHHmmss"); +// record.setPayTimeStart(currentDate); +// long endtime = currentDate.getTime() + 120 * 60 * 1000; +// record.setPayTimeEnd(new Date(endtime)); +// record.setPayBillNo(payBillNo); +// record.setPayAmount((Long) bill.get("owe")); +// record.setUpdateTime(currentDate); +// sqlRow = wxPayBillMapper.updateById(record); +// if (sqlRow != 1) { +// logger.error("pay bill update error: " + JSONObject.toJSONString(record)); +// throw new MallinkException(ErrorCode.DB_FAIL); +// } +// logger.info("新的订单数据:"+JSONObject.toJSONString(record)); +// } +// +// } +// +// } +// +// // 统一下单 // 服务商模式 +// String noncestr = Utility.generate32UUID(); +// WxPayOrderSP wxPayBillSP = new WxPayOrderSP(); +// wxPayBillSP.setSub_openid(record.getOpenId()); +// wxPayBillSP.setAppid(appInfo.getParentAppId()); +// wxPayBillSP.setMch_id(payAccount.getMchId()); +// wxPayBillSP.setSub_appid(appInfo.getAppId()); +// wxPayBillSP.setSub_mch_id(payAccount.getSubMchId()); +// wxPayBillSP.setNonce_str(noncestr); +// wxPayBillSP.setBody(bill.get("billType").toString()); +// wxPayBillSP.setOut_trade_no(record.getPayBillNo()); +// wxPayBillSP.setTotal_fee(bill.get("owe").toString()); +// // 终端IP +// wxPayBillSP.setSpbill_create_ip(record.getIp()); +// wxPayBillSP.setNotify_url(payAccount.getPayNotifyUrl()); +// // 终端类型 +// wxPayBillSP.setTrade_type(WxPay.TradeType.JSAPI.name()); +// // 订单ID +// wxPayBillSP.setProduct_id(String.valueOf(bill.get("id").toString())); +// wxPayBillSP.setTime_start(Utility.getDataFormatStringYYYYMMDDHHmmss(currentDate)); +// wxPayBillSP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(record.getPayTimeEnd())); +// wxPayBillSP.setSign_type("HMAC-SHA256"); +// wxPayBillSP.setProfit_sharing(null); +// if (isShare == EnumPayShare.YES) { +// wxPayBillSP.setProfit_sharing("Y"); +// } +// Map payBillMap = BeanUtils.toStringMap(wxPayBillSP); +// wxPayBillSP.setSign(WxPayment.createSignHMAC(payBillMap, payAccount.getApiKey())); +// String response = WxPay.pushOrder(BeanUtils.toStringMap(wxPayBillSP)); +// logger.info("pay bill, wechat pushBill, " + wxPayBillSP.toString() + ", response: " + response); +// Map returnMap = WxPayment.xmlToMap(response); +// returnMap.put("payBillId", record.getId().toString()); +// String result_code = returnMap.get("result_code"); +// if ("SUCCESS".equals(result_code)) { +// String prepay_id = returnMap.get("prepay_id"); +// // update payBill with prepay_id +// record.setPrepayId(prepay_id); +// record.setUpdateTime(new Date()); +// try { +// wxPayBillMapper.updateById(record); +// } catch (Exception e) { +// logger.error("pay bill update error: " + record.toString()); +// throw new MallinkException(ErrorCode.DB_FAIL); +// } +// String timestamp = String.valueOf(Utility.getCurrentTimeStamp()); +// Map sighMap = MapUtil.getOrderMap(); +// sighMap.put("appId", appInfo.getAppId()); +// sighMap.put("timeStamp", timestamp); +// sighMap.put("nonceStr", noncestr); +// sighMap.put("package", "prepay_id=" + prepay_id); +// sighMap.put("signType", "HMAC-SHA256"); +// String signAgent = WxPayment.createSignHMAC(sighMap, payAccount.getApiKey()); +// returnMap.put("timeStamp", timestamp); +// returnMap.put("nonceStr", noncestr); +// returnMap.put("package", "prepay_id=" + prepay_id); +// returnMap.put("paySign", signAgent); +// returnMap.put("signType", "HMAC-SHA256"); +// logger.info("back to UI: " + returnMap.toString()); +// return new ResultData(Result.SUCCESS, "创建支付订单成功", returnMap); +// } +// return updatePayBill(record, returnMap, result_code); +// } catch (RuntimeException e) { +// throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); +// } catch (Exception e) { +// throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); +// } + return null; } private ResultData updatePayBill(WxPayBill record, Map returnMap, String result_code) { @@ -408,46 +409,47 @@ public class WxPayBillServiceImpl implements WxPayBillService { */ @Override public ResultData payBillQuery(WxAppinfo appInfo, WxPayBill record) { - try { - if (StringUtils.isBlank(record.getPayBillNo())) { - record.setPayBillNo(record.getPayBillNo()); - } - - String response = wechatPayBillQuery(appInfo, record); - - logger.info("pay bill query, " + record.toString() + ", response: " + response); - Map returnMap = WxPayment.xmlToMap(response); - String result_code = returnMap.get("result_code"); - if ("SUCCESS".equals(result_code)) { - String trade_state = returnMap.get("trade_state"); - //SUCCESS—支付成功 - //REFUND—转入退款 - //NOTPAY—未支付 - //CLOSED—已关闭 - //REVOKED—已撤销(刷卡支付) - //USERPAYING--用户支付中 - //PAYERROR--支付失败(其他原因,如银行返回失败) - if ("SUCCESS".equals(trade_state)) { - record.setPayBillStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); - handlePayBillStatusUpdate(record); - } else if ("USERPAYING".equals(trade_state)) { - record.setPayBillStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); - handlePayBillStatusUpdate(record); - } else { - record.setPayBillStatus(EnumPayStatus.PAY_STATUS_FAIL.getCode()); - handlePayBillStatusUpdate(record); - } - return new ResultData(Result.SUCCESS, "订单查询成功", returnMap); - } else { - return updatePayBill(record, returnMap, result_code); - } - } catch (MallinkException e) { - throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); - } catch (RuntimeException e) { - throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); - } catch (Exception e) { - throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); - } +// try { +// if (StringUtils.isBlank(record.getPayBillNo())) { +// record.setPayBillNo(record.getPayBillNo()); +// } +// +// String response = wechatPayBillQuery(appInfo, record); +// +// logger.info("pay bill query, " + record.toString() + ", response: " + response); +// Map returnMap = WxPayment.xmlToMap(response); +// String result_code = returnMap.get("result_code"); +// if ("SUCCESS".equals(result_code)) { +// String trade_state = returnMap.get("trade_state"); +// //SUCCESS—支付成功 +// //REFUND—转入退款 +// //NOTPAY—未支付 +// //CLOSED—已关闭 +// //REVOKED—已撤销(刷卡支付) +// //USERPAYING--用户支付中 +// //PAYERROR--支付失败(其他原因,如银行返回失败) +// if ("SUCCESS".equals(trade_state)) { +// record.setPayBillStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); +// handlePayBillStatusUpdate(record); +// } else if ("USERPAYING".equals(trade_state)) { +// record.setPayBillStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); +// handlePayBillStatusUpdate(record); +// } else { +// record.setPayBillStatus(EnumPayStatus.PAY_STATUS_FAIL.getCode()); +// handlePayBillStatusUpdate(record); +// } +// return new ResultData(Result.SUCCESS, "订单查询成功", returnMap); +// } else { +// return updatePayBill(record, returnMap, result_code); +// } +// } catch (MallinkException e) { +// throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); +// } catch (RuntimeException e) { +// throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); +// } catch (Exception e) { +// throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); +// } + return null; } private String wechatPayBillClose(WxAppinfo appInfo, WxPayBill record) { @@ -570,112 +572,113 @@ public class WxPayBillServiceImpl implements WxPayBillService { */ @Override public String notify(String tenantId,Map paramMap, EnumPayWay payWay) { - // how to get wechatAppId, wechatMchId, partnerKey - logger.info("-------------"); - logger.info("微信回调返回值:" + JSONObject.toJSONString(paramMap)); - logger.info("-------------"); - String appId = paramMap.get("appid"); - String subAppId = paramMap.get("sub_appid"); - String mchId = paramMap.get("mch_id"); - String subMchId = paramMap.get("sub_mch_id"); - String attach = paramMap.get("attach"); - WxAppinfo appinfo; - boolean isNormal = true; - if (StringUtils.isBlank(subAppId) && StringUtils.isBlank(subMchId)) { - // 普通商户号 - appinfo = wxAppinfoService.getByAppIdFromRedis(appId,tenantId); - if (appinfo == null) { - throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); - } - isNormal = true; - } else { - // 服务号 现在用hmac-sha256 - appinfo = wxAppinfoService.getByAppIdFromRedis(subAppId,tenantId); - if (appinfo == null) { - throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); - } - isNormal = false; - } - - WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appinfo.getPayId()); - if (payAccount == null) { - throw new MallinkException(ErrorCode.MCH_INFO_NOT_FOUND); - } - String partnerKey = payAccount.getApiKey(); - try { - if (payWay.getType() == EnumPayWay.EnumPayWayType.WX_MINIPAY) { - boolean signVerified = false; - if (isNormal) { - // 普通商户号支付 - signVerified = WxPayment.verifyNotify(paramMap, partnerKey); - if (!signVerified) { - logger.warn("notify bill, wxpay checksign error, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); - throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); - } - } else { - // 服务号 现在用hmac-sha256 - signVerified = WxPayment.verifyNotifyHMAC(paramMap, partnerKey); - if (!signVerified) { - logger.warn("notify bill, wxpay checksign error, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); - throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); - } - } - - if (!"SUCCESS".equals(paramMap.get("return_code"))) { - logger.warn("notify bill, wxpay status not success, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); - SortedMap resultMap = new TreeMap(); - resultMap.put("return_code", "FAIL"); - resultMap.put("return_msg", "订单状态码非SUCCESS"); - return XmlUtil.getRequestXml(resultMap); - } - - String payBillNo = paramMap.get("out_trade_no"); - String timEndStr = paramMap.get("time_end"); - Long payBillId = Long.valueOf(payBillNo.substring(0,payBillNo.length()-12)); - WxPayBill payBill = wxPayBillMapper.selectById(payBillId); - if (payBill == null) { - logger.warn("notify bill, wxpay check pay bill not exists, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); - SortedMap resultMap = new TreeMap(); - resultMap.put("return_code", "FAIL"); - resultMap.put("return_msg", "订单不存在"); - return XmlUtil.getRequestXml(resultMap); - } - // 验证支付金额 - if (!paramMap.get("total_fee").equals(payBill.getPayAmount().toString())) { - logger.warn("notify bill, wxpay check total_fee is invalid, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); - SortedMap resultMap = new TreeMap(); - resultMap.put("return_code", "FAIL"); - resultMap.put("return_msg", "订单总金额不一致"); - return XmlUtil.getRequestXml(resultMap); - } - - Date timeEnd = null; - - try { - timeEnd = Utility.getDateFromString(timEndStr); - } catch (ParseException e) { - logger.error("解析timeEnd失败"); - timeEnd = new Date(); - } - payBill.setPayTimeEnd(timeEnd); - - // 处理支付成功 - handleBillPaySuccess(payBill, paramMap.get("transaction_id")); - logger.info("notify bill, wxpay checksign success, paramMap:{}, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); - SortedMap resultMap = new TreeMap(); - resultMap.put("return_code", "SUCCESS"); - resultMap.put("return_msg", "OK"); - return XmlUtil.getRequestXml(resultMap); - } - } catch (RuntimeException e) { - logger.warn("notify bill, checksign error, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString() + ", e:" + e.getMessage()); - throw new MallinkException(ErrorCode.PAY_ORDER_ERROR); - } - - SortedMap resultMap = new TreeMap(); - resultMap.put("return_code", "FAIL"); - resultMap.put("return_msg", "FAILED"); - return XmlUtil.getRequestXml(resultMap); +// // how to get wechatAppId, wechatMchId, partnerKey +// logger.info("-------------"); +// logger.info("微信回调返回值:" + JSONObject.toJSONString(paramMap)); +// logger.info("-------------"); +// String appId = paramMap.get("appid"); +// String subAppId = paramMap.get("sub_appid"); +// String mchId = paramMap.get("mch_id"); +// String subMchId = paramMap.get("sub_mch_id"); +// String attach = paramMap.get("attach"); +// WxAppinfo appinfo; +// boolean isNormal = true; +// if (StringUtils.isBlank(subAppId) && StringUtils.isBlank(subMchId)) { +// // 普通商户号 +// appinfo = wxAppinfoService.getByAppIdFromRedis(appId,tenantId); +// if (appinfo == null) { +// throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); +// } +// isNormal = true; +// } else { +// // 服务号 现在用hmac-sha256 +// appinfo = wxAppinfoService.getByAppIdFromRedis(subAppId,tenantId); +// if (appinfo == null) { +// throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); +// } +// isNormal = false; +// } +// +// WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appinfo.getPayId()); +// if (payAccount == null) { +// throw new MallinkException(ErrorCode.MCH_INFO_NOT_FOUND); +// } +// String partnerKey = payAccount.getApiKey(); +// try { +// if (payWay.getType() == EnumPayWay.EnumPayWayType.WX_MINIPAY) { +// boolean signVerified = false; +// if (isNormal) { +// // 普通商户号支付 +// signVerified = WxPayment.verifyNotify(paramMap, partnerKey); +// if (!signVerified) { +// logger.warn("notify bill, wxpay checksign error, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); +// throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); +// } +// } else { +// // 服务号 现在用hmac-sha256 +// signVerified = WxPayment.verifyNotifyHMAC(paramMap, partnerKey); +// if (!signVerified) { +// logger.warn("notify bill, wxpay checksign error, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); +// throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); +// } +// } +// +// if (!"SUCCESS".equals(paramMap.get("return_code"))) { +// logger.warn("notify bill, wxpay status not success, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); +// SortedMap resultMap = new TreeMap(); +// resultMap.put("return_code", "FAIL"); +// resultMap.put("return_msg", "订单状态码非SUCCESS"); +// return XmlUtil.getRequestXml(resultMap); +// } +// +// String payBillNo = paramMap.get("out_trade_no"); +// String timEndStr = paramMap.get("time_end"); +// Long payBillId = Long.valueOf(payBillNo.substring(0,payBillNo.length()-12)); +// WxPayBill payBill = wxPayBillMapper.selectById(payBillId); +// if (payBill == null) { +// logger.warn("notify bill, wxpay check pay bill not exists, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); +// SortedMap resultMap = new TreeMap(); +// resultMap.put("return_code", "FAIL"); +// resultMap.put("return_msg", "订单不存在"); +// return XmlUtil.getRequestXml(resultMap); +// } +// // 验证支付金额 +// if (!paramMap.get("total_fee").equals(payBill.getPayAmount().toString())) { +// logger.warn("notify bill, wxpay check total_fee is invalid, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); +// SortedMap resultMap = new TreeMap(); +// resultMap.put("return_code", "FAIL"); +// resultMap.put("return_msg", "订单总金额不一致"); +// return XmlUtil.getRequestXml(resultMap); +// } +// +// Date timeEnd = null; +// +// try { +// timeEnd = Utility.getDateFromString(timEndStr); +// } catch (ParseException e) { +// logger.error("解析timeEnd失败"); +// timeEnd = new Date(); +// } +// payBill.setPayTimeEnd(timeEnd); +// +// // 处理支付成功 +// handleBillPaySuccess(payBill, paramMap.get("transaction_id")); +// logger.info("notify bill, wxpay checksign success, paramMap:{}, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); +// SortedMap resultMap = new TreeMap(); +// resultMap.put("return_code", "SUCCESS"); +// resultMap.put("return_msg", "OK"); +// return XmlUtil.getRequestXml(resultMap); +// } +// } catch (RuntimeException e) { +// logger.warn("notify bill, checksign error, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString() + ", e:" + e.getMessage()); +// throw new MallinkException(ErrorCode.PAY_ORDER_ERROR); +// } +// +// SortedMap resultMap = new TreeMap(); +// resultMap.put("return_code", "FAIL"); +// resultMap.put("return_msg", "FAILED"); +// return XmlUtil.getRequestXml(resultMap); + return null; } @@ -707,171 +710,171 @@ public class WxPayBillServiceImpl implements WxPayBillService { @Override @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) public void handleBillPaySuccess(WxPayBill record, String transactionId) { - Date currentDate = new Date(); - EnumPayStatus payStatus = EnumPayStatus.getEnum(record.getPayBillStatus()); - // 判断支付状态 - if (payStatus == EnumPayStatus.PAY_STATUS_SUCCESS) { - // 已经是成功状态,只更新transactionId - try { - record.setUpdateTime(currentDate); - record.setTransactionId(transactionId); - wxPayBillMapper.updateById(record); - WxBillAll wxBillAll = new WxBillAll(); - wxBillAll.setId(record.getBillId()); - wxBillAll.setBillTypeValue(record.getBillTypeValue()); - WxMerchantBUser buser = wxMerchantBUserService.getById(record.getbUserId()); - WxMerchant wxMerchant = wxMerchantService.getById(buser.getMerchantId()); - List> bills = wxBillAllService.listBill(wxBillAll, wxMerchant,false, false, false, false); - if (bills.size() > 0) { - Map bill = bills.get(0); - bill.put("userId", record.getbUserId()); - wxBillAllService.updateBill(bill); - } - } catch (Exception e) { - logger.error(e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL); - } - return; - } - WxBillAll wxBillAll = new WxBillAll(); - wxBillAll.setId(record.getBillId()); - wxBillAll.updateTenantInfo(record); - List> bills = wxBillAllService.listBill(wxBillAll, null,false, false, false, false); - if (bills.size()==0) { - logger.error("pay success handle, bill " + record.getBillId() + " not found , payBillNo : " + record.getPayBillNo()); - throw new MallinkException(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); - } - Map bill; - bill = bills.get(0); - bill.put("userId", record.getbUserId()); - // 修改支付订单状态 - WxPayBill updateBill = new WxPayBill(); - updateBill.setId(record.getId()); - updateBill.setBillId(record.getBillId()); - updateBill.setUpdateTime(currentDate); - updateBill.setPayBillStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); - updateBill.setTransactionId(transactionId); - try { - wxPayBillMapper.updateById(updateBill); - } catch (Exception e) { - logger.error("支付订单数据库更新失败: " + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "支付订单数据库更新失败: " + e.getMessage()); - } - - //修改账单状态 - try { - wxBillAllService.updateBill(bill); - } catch (Exception e) { - logger.error(e.getMessage()); - throw new MallinkException(ErrorCode.BILL_UPDATE_FAILED); - } +// Date currentDate = new Date(); +// EnumPayStatus payStatus = EnumPayStatus.getEnum(record.getPayBillStatus()); +// // 判断支付状态 +// if (payStatus == EnumPayStatus.PAY_STATUS_SUCCESS) { +// // 已经是成功状态,只更新transactionId +// try { +// record.setUpdateTime(currentDate); +// record.setTransactionId(transactionId); +// wxPayBillMapper.updateById(record); +// WxBillAll wxBillAll = new WxBillAll(); +// wxBillAll.setId(record.getBillId()); +// wxBillAll.setBillTypeValue(record.getBillTypeValue()); +// WxMerchantBUser buser = wxMerchantBUserService.getById(record.getbUserId()); +// WxMerchant wxMerchant = wxMerchantService.getById(buser.getMerchantId()); +// List> bills = wxBillAllService.listBill(wxBillAll, wxMerchant,false, false, false, false); +// if (bills.size() > 0) { +// Map bill = bills.get(0); +// bill.put("userId", record.getbUserId()); +// wxBillAllService.updateBill(bill); +// } +// } catch (Exception e) { +// logger.error(e.getMessage()); +// throw new MallinkException(ErrorCode.DB_FAIL); +// } +// return; +// } +// WxBillAll wxBillAll = new WxBillAll(); +// wxBillAll.setId(record.getBillId()); +// wxBillAll.updateTenantInfo(record); +// List> bills = wxBillAllService.listBill(wxBillAll, null,false, false, false, false); +// if (bills.size()==0) { +// logger.error("pay success handle, bill " + record.getBillId() + " not found , payBillNo : " + record.getPayBillNo()); +// throw new MallinkException(ErrorCode.BILL_ROUTINE_IS_NOT_FOUND); +// } +// Map bill; +// bill = bills.get(0); +// bill.put("userId", record.getbUserId()); +// // 修改支付订单状态 +// WxPayBill updateBill = new WxPayBill(); +// updateBill.setId(record.getId()); +// updateBill.setBillId(record.getBillId()); +// updateBill.setUpdateTime(currentDate); +// updateBill.setPayBillStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); +// updateBill.setTransactionId(transactionId); +// try { +// wxPayBillMapper.updateById(updateBill); +// } catch (Exception e) { +// logger.error("支付订单数据库更新失败: " + e.getMessage()); +// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "支付订单数据库更新失败: " + e.getMessage()); +// } +// +// //修改账单状态 +// try { +// wxBillAllService.updateBill(bill); +// } catch (Exception e) { +// logger.error(e.getMessage()); +// throw new MallinkException(ErrorCode.BILL_UPDATE_FAILED); +// } } @Override @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) public void handlePayBillStatusUpdate(WxPayBill record) { - // 判断支付状态 - if (record.getPayBillStatus().equals(EnumPayStatus.PAY_STATUS_WAIT.getCode())) { - logger.error("pay handle, payBill " + record.getPayBillNo() + - "is complete, billId : " + record.getBillId()); - return; - } - WxBillAll wxBillAll = new WxBillAll(); - wxBillAll.setId(record.getBillId()); - wxBillAll.setBillTypeValue(record.getBillTypeValue()); - WxMerchantBUser buser = wxMerchantBUserService.getById(record.getbUserId()); - WxMerchant wxMerchant = wxMerchantService.getById(buser.getMerchantId()); - List> bills = wxBillAllService.listBill(wxBillAll, wxMerchant,false, false, false, false); - if (bills.size()==0) { - logger.error("pay handle, bill " + record.getBillId() + " not found , payBillNo : " + record.getPayBillNo()); - throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); - } - Map bill = bills.get(0); - if (record.getId() > 0) { - // 1. get appinfo - WxAppinfo appInfo = null; - WxAppinfo appinfoQ = new WxAppinfo(); - appinfoQ.setTenantId(bill.get("tenantId").toString()); - appinfoQ.setType(EnumAppType.B.getCode()); - List appList = wxAppinfoService.getList(appinfoQ); - if (appList.size() > 0) { - appInfo = appList.get(0); - } - - // 检查支付订单状态 - WxPayBill payBillQ = new WxPayBill(); - payBillQ.setId(record.getId()); - payBillQ.setTenantId(bill.get("tenantId").toString()); - payBillQ.setBillId(record.getBillId()); - WxPayBill updateBill; - try { - updateBill = wxPayBillMapper.selectOne(new QueryWrapper(payBillQ)); - } catch (Exception e) { - logger.error(e.getMessage()); - throw new MallinkException(ErrorCode.PAY_ORDER_NOT_FOUND); - } - - if (record.getPayBillStatus().equals(EnumPayStatus.PAY_STATUS_FAIL.getCode())) { - // 支付订单取消 - if (updateBill.getPayAmount() > 0) { - payBillQ = new WxPayBill(); - payBillQ.setTenantId(bill.get("tenantId").toString()); - payBillQ.setBillId(record.getBillId()); - List payBills = wxPayBillMapper.selectList(new QueryWrapper(payBillQ)); - for (WxPayBill payBill : payBills) { - if(payBill.getPayTimeEnd().before(new Date())){ - payBillClose(appInfo, payBill); - } - } - } - } else { - // 支付订单成功? - if (updateBill.getPayBillStatus().equals(EnumPayStatus.PAY_STATUS_SUCCESS.getCode())) { - if (!StringUtils.isBlank(updateBill.getTransactionId())) { - // 回调已设置成功 - wxBillAllService.updateBill(bill); - // 继续修改订单状态 - } else { - // 回调异常 - throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), "transactionId未获取"); - } - } else if (updateBill.getPayBillStatus().equals(EnumPayStatus.PAY_STATUS_WAIT.getCode())) { - // 回调未返回,主动检查支付订单状态 - try { - record.setPayBillNo(String.valueOf(record.getId())); - String response = wechatPayBillQuery(appInfo, record); - logger.info("pay bill query, " + record.toString() + ", response: " + response); - Map returnMap = WxPayment.xmlToMap(response); - String result_code = returnMap.get("result_code"); - if ("SUCCESS".equals(result_code)) { - String trade_state = returnMap.get("trade_state"); - //SUCCESS—支付成功 - //REFUND—转入退款 - //NOTPAY—未支付 - //CLOSED—已关闭 - //REVOKED—已撤销(刷卡支付) - //USERPAYING--用户支付中 - //PAYERROR--支付失败(其他原因,如银行返回失败) - if ("SUCCESS".equals(trade_state)) { - // 查询支付订单 -- 已支付 - // 继续更改状态 - wxBillAllService.updateBill(bill); - } else { - // 支付订单未成功,返回异常 - throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), "支付订单未成功"); - } - } - } catch (MallinkException e) { - throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); - } catch (RuntimeException e) { - throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); - } catch (Exception e) { - throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); - } - } - } - } +// // 判断支付状态 +// if (record.getPayBillStatus().equals(EnumPayStatus.PAY_STATUS_WAIT.getCode())) { +// logger.error("pay handle, payBill " + record.getPayBillNo() + +// "is complete, billId : " + record.getBillId()); +// return; +// } +// WxBillAll wxBillAll = new WxBillAll(); +// wxBillAll.setId(record.getBillId()); +// wxBillAll.setBillTypeValue(record.getBillTypeValue()); +// WxMerchantBUser buser = wxMerchantBUserService.getById(record.getbUserId()); +// WxMerchant wxMerchant = wxMerchantService.getById(buser.getMerchantId()); +// List> bills = wxBillAllService.listBill(wxBillAll, wxMerchant,false, false, false, false); +// if (bills.size()==0) { +// logger.error("pay handle, bill " + record.getBillId() + " not found , payBillNo : " + record.getPayBillNo()); +// throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); +// } +// Map bill = bills.get(0); +// if (record.getId() > 0) { +// // 1. get appinfo +// WxAppinfo appInfo = null; +// WxAppinfo appinfoQ = new WxAppinfo(); +// appinfoQ.setTenantId(bill.get("tenantId").toString()); +// appinfoQ.setType(EnumAppType.B.getCode()); +// List appList = wxAppinfoService.getList(appinfoQ); +// if (appList.size() > 0) { +// appInfo = appList.get(0); +// } +// +// // 检查支付订单状态 +// WxPayBill payBillQ = new WxPayBill(); +// payBillQ.setId(record.getId()); +// payBillQ.setTenantId(bill.get("tenantId").toString()); +// payBillQ.setBillId(record.getBillId()); +// WxPayBill updateBill; +// try { +// updateBill = wxPayBillMapper.selectOne(new QueryWrapper(payBillQ)); +// } catch (Exception e) { +// logger.error(e.getMessage()); +// throw new MallinkException(ErrorCode.PAY_ORDER_NOT_FOUND); +// } +// +// if (record.getPayBillStatus().equals(EnumPayStatus.PAY_STATUS_FAIL.getCode())) { +// // 支付订单取消 +// if (updateBill.getPayAmount() > 0) { +// payBillQ = new WxPayBill(); +// payBillQ.setTenantId(bill.get("tenantId").toString()); +// payBillQ.setBillId(record.getBillId()); +// List payBills = wxPayBillMapper.selectList(new QueryWrapper(payBillQ)); +// for (WxPayBill payBill : payBills) { +// if(payBill.getPayTimeEnd().before(new Date())){ +// payBillClose(appInfo, payBill); +// } +// } +// } +// } else { +// // 支付订单成功? +// if (updateBill.getPayBillStatus().equals(EnumPayStatus.PAY_STATUS_SUCCESS.getCode())) { +// if (!StringUtils.isBlank(updateBill.getTransactionId())) { +// // 回调已设置成功 +// wxBillAllService.updateBill(bill); +// // 继续修改订单状态 +// } else { +// // 回调异常 +// throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), "transactionId未获取"); +// } +// } else if (updateBill.getPayBillStatus().equals(EnumPayStatus.PAY_STATUS_WAIT.getCode())) { +// // 回调未返回,主动检查支付订单状态 +// try { +// record.setPayBillNo(String.valueOf(record.getId())); +// String response = wechatPayBillQuery(appInfo, record); +// logger.info("pay bill query, " + record.toString() + ", response: " + response); +// Map returnMap = WxPayment.xmlToMap(response); +// String result_code = returnMap.get("result_code"); +// if ("SUCCESS".equals(result_code)) { +// String trade_state = returnMap.get("trade_state"); +// //SUCCESS—支付成功 +// //REFUND—转入退款 +// //NOTPAY—未支付 +// //CLOSED—已关闭 +// //REVOKED—已撤销(刷卡支付) +// //USERPAYING--用户支付中 +// //PAYERROR--支付失败(其他原因,如银行返回失败) +// if ("SUCCESS".equals(trade_state)) { +// // 查询支付订单 -- 已支付 +// // 继续更改状态 +// wxBillAllService.updateBill(bill); +// } else { +// // 支付订单未成功,返回异常 +// throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), "支付订单未成功"); +// } +// } +// } catch (MallinkException e) { +// throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); +// } catch (RuntimeException e) { +// throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); +// } catch (Exception e) { +// throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); +// } +// } +// } +// } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index c07b4bad3..55d8d8836 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -59,12 +59,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService @Autowired WxShopMapper wxShopMapper; - @Autowired - WxBillPropertyMapper wxBillPropertyMapper; - - @Autowired - WxBillPropertyDepositMapper wxBillPropertyDepositMapper; - @Autowired WxMerchantMapper wxMerchantMapper; diff --git a/mallinkService/src/main/resources/mapper/WxAllBillMapper.xml b/mallinkService/src/main/resources/mapper/WxAllBillMapper.xml index 53a9080fa..689f93ea9 100644 --- a/mallinkService/src/main/resources/mapper/WxAllBillMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxAllBillMapper.xml @@ -13,6 +13,7 @@ + @@ -45,9 +46,9 @@ `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`rent_shop_type`,`createtime`,`create_by`,`create_by_name`,`updatetime`,`update_by`,`update_by_name`, - `need_pay`,`receive_pay`,`pay`,`bill_type`,`pay_way`,`pay_date`,`set_off`,`starttime`,`endtime`,`status`,`energy_fees_id`,`return_pay`,`bill_remark`, - `last_owe_call_time`,`last_owe_call_user`,`bussiness_manage_fee_need_pay`,`operating_manage_fee_need_pay`,`shop_id`,`shop_number`,`is_preview`, - `shop_info`,`rent_contract_id`,`property_contract_id`,`parent_bill_id`,`energy_reading_calcuteId`,`energy_reading_id` + `price_detail`,`need_pay`,`receive_pay`,`pay`,`bill_type`,`pay_way`,`pay_date`,`set_off`,`starttime`,`endtime`,`status`,`energy_fees_id`,`return_pay`, + `bill_remark`,`last_owe_call_time`,`last_owe_call_user`,`bussiness_manage_fee_need_pay`,`operating_manage_fee_need_pay`,`shop_id`,`shop_number`, + `is_preview`,`shop_info`,`rent_contract_id`,`property_contract_id`,`parent_bill_id`,`energy_reading_calcuteId`,`energy_reading_id` @@ -224,8 +225,8 @@ ( #{item.id},#{item.tenantId},#{item.parentTenantId},#{item.merchantId},#{item.rentShopType},#{item.createtime}, - #{item.createBy},#{item.createByName},#{item.updatetime},#{item.updateBy},#{item.updateByName},#{item.needPay}, - #{item.receivePay},#{item.pay},#{item.billType},#{item.payWay},#{item.payDate},#{item.setOff}, + #{item.createBy},#{item.createByName},#{item.updatetime},#{item.updateBy},#{item.updateByName},#{item.priceDetail}, + #{item.needPay},#{item.receivePay},#{item.pay},#{item.billType},#{item.payWay},#{item.payDate},#{item.setOff}, #{item.starttime},#{item.endtime},#{item.status},#{item.energyFeesId},#{item.returnPay},#{item.billRemark}, #{item.lastOweCallTime},#{item.lastOweCallUser},#{item.bussinessManageFeeNeedPay},#{item.operatingManageFeeNeedPay}, #{item.shopId},#{item.shopNumber},#{item.isPreview},#{item.shopInfo},#{item.rentContractId},#{item.propertyContractId}, @@ -237,6 +238,10 @@ delete from wx_all_bill where id = #{id} and tenant_id = #{tenantId} + + + delete from wx_all_bill where energy_reading_calcuteId = #{energyReadingCalcuteId} and tenant_id = #{tenantId} and status = 2 and pay <= 0 and IFNULL(`set_off`,'0') <= 0 and IFNULL(`return_pay`,'0') <= 0 + diff --git a/mallinkService/src/main/resources/mapper/WxBillAdvanceMapper.xml b/mallinkService/src/main/resources/mapper/WxBillAdvanceMapper.xml deleted file mode 100644 index caf01c10f..000000000 --- a/mallinkService/src/main/resources/mapper/WxBillAdvanceMapper.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`rent_shop_type`,`createtime`,`create_by`,`create_by_name`,`updatetime`, - `update_by`,`update_by_name`,`pay_way`,`pay`,`receive_pay`,`pay_date`,`set_off`,`starttime`,`endtime`,`energy_fees_id`,`remark`,`advance_id` - - - - where 1=1 - and `id` = #{id} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and `energy_fees_id` = #{energyFeesId} - and `advance_id` = #{advanceId} - and `receive_pay` = #{receivePay} - and `pay` = #{pay} - and `pay_date` = #{payDate} - and `createtime` = #{createtime} - and `status` = #{status} - and `merchant_id` = #{merchantId} - and `updatetime` = #{updatetime} - and `rent_shop_type` = #{rentShopType} - and `pay_way` = #{payWay} - and `starttime` = #{starttime} - and `endtime` = #{endtime} - - and endtime >= #{endtimeBegin} - - - and endtime < #{endtimeEnd} - - - and status in - - #{stItem} - - - - and id in - - #{idItem} - - - order by ${sortColumns} - - - - - - - - - 1 = 1 - and br.`id` = #{id} - and br.`tenant_id` = #{tenantId} - and br.`parent_tenant_id` = #{parentTenantId} - and br.`rent_shop_type` = #{rentShopType} - and br.`status` = #{status} - and br.`merchant_id` = #{merchantId} - and br.`energy_fees_id` = #{energyFeesId} - and br.`advance_id` = #{advanceId} - and br.`pay_way` = #{payWay} - and br.`starttime` <= #{starttime} - and br.`endtime` >= #{endtime} - - and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} - - - and br.`merchant_id` in - - #{midItem} - - - - and br.`status` in - - #{stItem} - - - - - - - - - - - delete from wx_bill_advance where id = #{id} and tenant_id = #{tenantId} - - - - diff --git a/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml deleted file mode 100644 index 2dece8cf0..000000000 --- a/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml +++ /dev/null @@ -1,291 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`apply_status`,`apply_pay_img`,`apply_update_time`, - `tenant_id`,`parent_tenant_id`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`shop_name`,`updatetime`,`type`,`last_owe_call_time`, - `rent_shop_type`,`pay_way`,`price_detail`,`starttime`,`endtime`,freeze,build_way,service_charge_pay,`remark`,`last_owe_call_user`, - `create_by`,`create_by_name`,`update_by`,`update_by_name`,`energy_reading_calcuteId`,`energy_reading_id`,`energy_fees_id`,`set_off` - - - - where 1 = 1 - and `id` = #{id} - and `receive_pay` = #{receivePay} - and `pay` = #{pay} - and `receive_date` = #{receiveDate} - and `pay_date` = #{payDate} - and `createtime` = #{createtime} - and `expired_day` = #{expiredDay} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and `status` = #{status} - and `apply_status` = #{applyStatus} - and `is_del` = #{isDel} - and `merchant_id` = #{merchantId} - and `energy_fees_id` = #{energyFeesId} - and `user_id` = #{userId} - and `updatetime` = #{updatetime} - and `type` = #{type} - and `rent_shop_type` = #{rentShopType} - and `pay_way` = #{payWay} - and `build_way` = #{buildWay} - and `energy_reading_calcuteId` = #{energyReadingCalcuteId} - and `energy_reading_id` = #{energyReadingId} - and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) ) - - - and status in - - #{stItem} - - - - - and id in - - #{idItem} - - - - - and id not in - - #{nidItem} - - - - order by ${sortColumns} - - - - - - - - - 1 = 1 - and br.`id` = #{id} - and br.`tenant_id` = #{tenantId} - and br.`parent_tenant_id` = #{parentTenantId} - and br.`freeze` = #{freeze} - and br.`id` = #{id} - and br.`merchant_id` = #{merchantId} - and br.`energy_fees_id` = #{energyFeesId} - and br.`status` = #{status} - and br.`apply_status` = #{applyStatus} - and br.`is_del` = #{isDel} - and br.`type` = #{type} - and br.`rent_shop_type` = #{rentShopType} - and br.`pay_way` = #{payWay} - and br.`starttime` <= #{starttime} - and br.`endtime` >= #{endtime} - - and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} - - - and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - and br.`build_way` = #{buildWay} - and br.`energy_reading_calcuteId` = #{energyReadingCalcuteId} - and br.`energy_reading_id` = #{energyReadingId} - and (br.`last_owe_call_time` is not null and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7) ) - - and br.`merchant_id` in - - #{midItem} - - - - and br.`id` not in - - #{nidItem} - - - - and br.status in - - #{stItem} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - update wx_bill_daily set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) - where status!=#{paid} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and DATEDIFF(now(),receive_date)>0 - - - - update wx_bill_daily set status=#{waitPay} where status!=#{paid} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and DATEDIFF(now(),receive_date) <=0 - - - - delete from wx_bill_daily where id = #{id} and tenant_id = #{tenantId} - - - - INSERT INTO wx_bill_daily (`id`,`tenant_id`,`parent_tenant_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`status`,`is_del`, - `merchant_id`,`user_id`,`shop_id`,`shop_name`,`updatetime`,`type`,`rent_shop_type`,`apply_status`,`pay_way`,`price_detail`, - `starttime`,`endtime`,`freeze`,`build_way`,`service_charge_pay`,`apply_pay_img`,`apply_update_time`,`remark`,`create_by`,`update_by`, - `create_by_name`,`update_by_name`,`energy_reading_calcuteId`,`energy_reading_id`,`energy_fees_id`) - VALUES - - ( - #{item.id},#{item.tenantId},#{item.parentTenantId},#{item.receivePay},#{item.pay},#{item.receiveDate},#{item.payDate},#{item.createtime},#{item.expiredDay},#{item.status},#{item.isDel}, - #{item.merchantId},#{item.userId},#{item.shopId},#{item.shopName},#{item.updatetime},#{item.type},#{item.rentShopType},#{item.applyStatus},#{item.payWay},#{item.priceDetail}, - #{item.starttime},#{item.endtime},#{item.freeze},#{item.buildWay},#{item.serviceChargePay},#{item.applyPayImg},#{item.applyUpdateTime},#{item.remark},#{item.createBy},#{item.updateBy}, - #{item.createByName},#{item.updateByName},#{item.energyReadingCalcuteId},#{item.energyReadingId},#{item.energyFeesId} - ) - - - - - delete from wx_bill_daily where energy_reading_calcuteId = #{energyReadingCalcuteId} and tenant_id = #{tenantId} and status = 2 and pay <= 0 and IFNULL(`set_off`,'0') <= 0 - - - - delete from wx_bill_daily where merchant_id = #{merchantId} and status = 2 - and starttime > #{shopEndtime} and IFNULL(`pay`,'0') <= 0 AND IFNULL(`set_off`,'0') <= 0 - - - diff --git a/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml deleted file mode 100644 index 29e2b93a6..000000000 --- a/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml +++ /dev/null @@ -1,394 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `id`,`tenant_id`,`parent_tenant_id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`last_owe_call_time`,`set_off`,`starttime`,`endtime`, - `expired_day`,`status`,`is_del`,`need_pay`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`apply_status`,`apply_pay_img`,`apply_update_time`,`energy_fees_id`, - `last_owe_call_user`,`rent_shop_type`,`return_price`,`pay_way`,service_charge_pay,contract_depoist_detail,`create_by`,`create_by_name`,`update_by`,`update_by_name` - - - - where 1 = 1 - and `id` = #{id} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and `rent_contract_id` = #{rentContractId} - and `energy_fees_id` = #{energyFeesId} - and `receive_pay` = #{receivePay} - and `pay` = #{pay} - and `receive_date` = #{receiveDate} - and `pay_date` = #{payDate} - and `createtime` = #{createtime} - and `expired_day` = #{expiredDay} - and `status` = #{status} - and `apply_status` = #{applyStatus} - and `is_del` = #{isDel} - and `need_pay` = #{needPay} - and `merchant_id` = #{merchantId} - and `user_id` = #{userId} - and `shop_id` = #{shopId} - and `updatetime` = #{updatetime} - and `rent_shop_type` = #{rentShopType} - and `pay_way` = #{payWay} - - and `contract_depoist_detail` like concat('%', #{contractDepoistDetail},'%') - - - and `starttime` <= #{starttime} - and `endtime` >= #{endtime} - - and date_format(starttime,'%Y-%m') <= #{month} and date_format(endtime,'%Y-%m') >= #{month} - - - and (`starttime` <= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7)) - - - and (`starttime` > #{oweBillLastTime} and `starttime` <= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7)) - - and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) ) - - and `merchant_id` in - - #{midItem} - - - - and rent_contract_id in - - #{rdItem} - - - - and status in - - #{stItem} - - - - and id in - - #{idItem} - - - order by ${sortColumns} - - - - - - - - - - - - - 1 = 1 - and br.`id` = #{id} - and br.`merchant_id` = #{merchantId} - - and br.`tenant_id` = #{tenantId} - - - and br.`parent_tenant_id` = #{parentTenantId} - - and br.`status` = #{status} - and br.`apply_status` = #{applyStatus} - and br.`is_del` = #{isDel} - and br.`rent_shop_type` = #{rentShopType} - and br.`rent_contract_id` = #{rentContractId} - and br.`energy_fees_id` = #{energyFeesId} - and br.`pay_way` = #{payWay} - - and br.`contract_depoist_detail` like concat('%', #{contractDepoistDetail},'%') - - and br.`starttime` <= #{starttime} - and br.`endtime` >= #{endtime} - - and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} - - - and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - and (br.`last_owe_call_time` is not null and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7) ) - - and br.`merchant_id` in - - #{midItem} - - - - and br.status in - - #{stItem} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - update wx_bill_rent_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) - where status!=#{paid} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and status!=5 and DATEDIFF(now(),receive_date)>0 - - - - update wx_bill_rent_deposit set status=#{waitPay} where id in( - select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_rent_deposit br - left join wx_rent_contract rc on br.rent_contract_id=rc.id - where br.status!=#{paid} - - and br.`tenant_id` = #{tenantId} - - - and br.`parent_tenant_id` = #{parentTenantId} - - and br.status!=5 and now() < br.receive_date - and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) - - - - - - delete from wx_bill_rent_deposit where id = #{id} and tenant_id = #{tenantId} - - - - INSERT INTO wx_bill_rent_deposit (id,rent_contract_id, receive_pay, pay, receive_date, pay_date, createtime, - expired_day,tenant_id, parent_tenant_id,status,is_del,need_pay, merchant_id, user_id, shop_id, updatetime, starttime, - endtime,rent_shop_type,return_price,shop_info,pay_way,freeze,service_charge_pay, - contract_depoist_detail,create_by,create_by_name,update_by,update_by_name,energy_fees_id - ) - VALUES - - ( - #{item.id},#{item.rentContractId},#{item.receivePay},#{item.pay},#{item.receiveDate},#{item.payDate},#{item.createtime}, - #{item.expiredDay},#{item.tenantId},#{item.parentTenantId},#{item.status},#{item.isDel},#{item.needPay}, - #{item.merchantId},#{item.userId},#{item.shopId},#{item.updatetime},#{item.starttime}, - #{item.endtime},#{item.rentShopType},#{item.returnPrice},#{item.shopInfo},#{item.payWay},#{item.freeze},#{item.serviceChargePay}, - #{item.contractDepoistDetail},#{item.createBy},#{item.createByName},#{item.updateBy},#{item.updateByName},#{item.energyFeesId} - ) - - - - - delete from wx_bill_rent_deposit where rent_contract_id = #{rentContractId} and status = 2 - and starttime > #{shopEndtime} and IFNULL(`pay`,'0') <= 0 AND IFNULL(`set_off`,'0') <= 0 AND IFNULL(`return_price`,'0') <= 0 - - - - diff --git a/mallinkService/src/main/resources/mapper/WxBillOtherDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxBillOtherDepositMapper.xml deleted file mode 100644 index 9413857ea..000000000 --- a/mallinkService/src/main/resources/mapper/WxBillOtherDepositMapper.xml +++ /dev/null @@ -1,271 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `id`,`tenant_id`,`parent_tenant_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`last_owe_call_time`,`last_owe_call_user`, - `status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`shop_name`,`updatetime`,`name`,`comments`,`apply_status`,`apply_pay_img`,`apply_update_time`, - `rent_shop_type`,`return_price`,`pay_way`,`starttime`,`endtime`,freeze,service_charge_pay,`create_by`,`create_by_name`,`update_by`,`update_by_name`, - `energy_fees_id`,`set_off` - - - - where 1 = 1 - and `id` = #{id} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and `receive_pay` = #{receivePay} - and `pay` = #{pay} - and `receive_date` = #{receiveDate} - and `pay_date` = #{payDate} - and `createtime` = #{createtime} - and `expired_day` = #{expiredDay} - and `status` = #{status} - and `energy_fees_id` = #{energyFeesId} - and `apply_status` = #{applyStatus} - and `is_del` = #{isDel} - and `merchant_id` = #{merchantId} - and `user_id` = #{userId} - and `starttime` <= #{starttime} - and `endtime` >= #{endtime} - and `shop_id` = #{shopId} - and `updatetime` = #{updatetime} - and `name` = #{name} - and `rent_shop_type` = #{rentShopType} - and `pay_way` = #{payWay} - and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) ) - - and id in - - #{idItem} - - - - - and id not in - - #{nidItem} - - - - - and status in - - #{stItem} - - - order by ${sortColumns} - - - - - - - - - 1 = 1 - and br.`id` = #{id} - and br.`tenant_id` = #{tenantId} - and br.`parent_tenant_id` = #{parentTenantId} - and br.`freeze` = #{freeze} - and br.`merchant_id` = #{merchantId} - and br.`status` = #{status} - and br.`apply_status` = #{applyStatus} - and br.`is_del` = #{isDel} - and br.`energy_fees_id` = #{energyFeesId} - and br.`name` = #{name} - and br.`rent_shop_type` = #{rentShopType} - and br.`pay_way` = #{payWay} - and br.`comments` like concat('%',#{comments},'%') - and br.`starttime` <= #{starttime} - and br.`endtime` >= #{endtime} - - and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} - - - and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - and (br.`last_owe_call_time` is not null and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7) ) - - and br.`merchant_id` in - - #{midItem} - - - - and br.id not in - - #{nidItem} - - - - - and br.status in - - #{stItem} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - update wx_bill_other_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) - where status!=#{paid} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and status!=5 and DATEDIFF(now(),receive_date)>0 - - - - update wx_bill_other_deposit set status=#{waitPay} - where 1=1 - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and status!=5 - and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 - - - - delete from wx_bill_other_deposit where id = #{id} and tenant_id = #{tenantId} - - - - delete from wx_bill_other_deposit where merchant_id = #{merchantId} and status = 2 - and starttime > #{shopEndtime} and IFNULL(`pay`,'0') <= 0 AND IFNULL(`set_off`,'0') <= 0 AND IFNULL(`return_price`,'0') <= 0 - - - - diff --git a/mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml b/mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml deleted file mode 100644 index e6bb93079..000000000 --- a/mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml +++ /dev/null @@ -1,313 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `id`,`tenant_id`,`parent_tenant_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`last_owe_call_user`, - `status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`shop_name`,`updatetime`,`name`,`comments`,`last_owe_call_time`, - `rent_shop_type`,`pay_way`,`starttime`,`endtime`,endtime,service_charge_pay,`apply_status`,`apply_pay_img`,`apply_update_time`, - `create_by`,`create_by_name`,`update_by`,`update_by_name`,`energy_fees_id`,`set_off` - - - - where 1 = 1 - and `id` = #{id} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and `receive_pay` = #{receivePay} - and `pay` = #{pay} - and `receive_date` = #{receiveDate} - and `pay_date` = #{payDate} - and `createtime` = #{createtime} - and `expired_day` = #{expiredDay} - and `status` = #{status} - and `apply_status` = #{applyStatus} - and `is_del` = #{isDel} - and `merchant_id` = #{merchantId} - and `energy_fees_id` = #{energyFeesId} - and `user_id` = #{userId} - and `shop_id` = #{shopId} - and `updatetime` = #{updatetime} - and `name` = #{name} - and `rent_shop_type` = #{rentShopType} - and `pay_way` = #{payWay} - and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) ) - - and id in - - #{idItem} - - - - - and id not in - - #{nidItem} - - - - - and status in - - #{stItem} - - - order by ${sortColumns} - - - - - - - - - 1 = 1 - and br.`id` = #{id} - and br.`tenant_id` = #{tenantId} - and br.`parent_tenant_id` = #{parentTenantId} - and br.`freeze` = #{freeze} - and br.`merchant_id` = #{merchantId} - and br.`status` = #{status} - and br.`apply_status` = #{applyStatus} - and br.`is_del` = #{isDel} - and br.`energy_fees_id` = #{energyFeesId} - and br.`name` like concat('%',#{name},'%') - and br.`rent_shop_type` = #{rentShopType} - and br.`pay_way` = #{payWay} - and br.`starttime` <= #{starttime} - and br.`endtime` >= #{endtime} - - and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} - - - and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - and (br.`last_owe_call_time` is not null and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7) ) - - and br.`merchant_id` in - - #{midItem} - - - - - and br.id not in - - #{nidItem} - - - - - and br.status in - - #{stItem} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - update wx_bill_other set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) - where 1=1 - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and status!=#{paid} and DATEDIFF(now(),receive_date)>0 - - - - update wx_bill_other set status=#{waitPay} where 1=1 - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 - - - - - - - - - - delete from wx_bill_other where id = #{id} and tenant_id = #{tenantId} - - - - delete from wx_bill_other where merchant_id = #{merchantId} and status = 2 - and starttime > #{shopEndtime} and IFNULL(`pay`,'0') <= 0 AND IFNULL(`set_off`,'0') <= 0 - - - diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml deleted file mode 100644 index 7a5fef33c..000000000 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml +++ /dev/null @@ -1,280 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `id`,`tenant_id`,`parent_tenant_id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`,`starttime`,`endtime`, - `pay_date`,`createtime`,`expired_day`,`status`,`is_del`,`need_pay`,`apply_status`,`apply_pay_img`,`apply_update_time`,`last_owe_call_user`, - `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`,`return_price`,`shop_info`,`pay_way`,freeze,service_charge_pay, - `create_by`,`create_by_name`,`update_by`,`update_by_name`,`energy_fees_id`,`set_off` - - - - where 1 = 1 - and `id` = #{id} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and `property_contract_id` = #{propertyContractId} - and `energy_fees_id` = #{energyFeesId} - and `receive_pay` = #{receivePay} - and `pay` = #{pay} - and `receive_date` = #{receiveDate} - and `pay_date` = #{payDate} - and `createtime` = #{createtime} - and `expired_day` = #{expiredDay} - and `status` = #{status} - and `apply_status` = #{applyStatus} - and `is_del` = #{isDel} - and `need_pay` = #{needPay} - and `merchant_id` = #{merchantId} - and `user_id` = #{userId} - and `shop_id` = #{shopId} - and `updatetime` = #{updatetime} - and `rent_shop_type` = #{rentShopType} - and `pay_way` = #{payWay} - and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) ) - - and property_contract_id in - - #{pidItem} - - - - and status in - - #{stItem} - - - - and id in - - #{idItem} - - - order by ${sortColumns} - - - - - - - - - - - and br.`id` = #{id} - - and br.`tenant_id` = #{tenantId} - - - and br.`parent_tenant_id` = #{parentTenantId} - - and br.`merchant_id` = #{merchantId} - and br.`status` = #{status} - and br.`apply_status` = #{applyStatus} - and br.`is_del` = #{isDel} - and br.`rent_shop_type` = #{rentShopType} - and br.`property_contract_id` = #{propertyContractId} - and br.`energy_fees_id` = #{energyFeesId} - and br.`pay_way` = #{payWay} - and br.`starttime` <= #{starttime} - and br.`endtime` >= #{endtime} - - and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} - - - and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - and (br.`last_owe_call_time` is not null and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7) ) - - and br.`merchant_id` in - - #{midItem} - - - - and br.status in - - #{stItem} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - update wx_bill_property_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) - where status!=#{paid} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and status!=5 and DATEDIFF(now(),receive_date)>0 - - - - update wx_bill_property_deposit set status=#{waitPay} where id in( - select a.id from (select br.id,rc.receive_period,br.property_contract_id,br.receive_date from wx_bill_property_deposit br - left join wx_property_contract rc on br.property_contract_id=rc.id - where br.status!=#{paid} - - and br.`tenant_id` = #{tenantId} - - - and br.`parent_tenant_id` = #{parentTenantId} - - and br.status!=5 and now() < br.receive_date - and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) - - - - - - - delete from wx_bill_property_deposit where id = #{id} and tenant_id = #{tenantId} - - - - delete from wx_bill_property_deposit where property_contract_id = #{propertyContractId} and status = 2 - and starttime > #{shopEndtime} and IFNULL(`pay`,'0') <= 0 AND IFNULL(`set_off`,'0') <= 0 AND IFNULL(`return_price`,'0') <= 0 - - - diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml deleted file mode 100644 index e0af46074..000000000 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml +++ /dev/null @@ -1,496 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `id`,`tenant_id`,`parent_tenant_id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`, - `createtime`,`expired_day`,`tenant_id`,`status`,`is_del`,`need_pay`,`last_owe_call_time`,`last_owe_call_user`, - `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`,`apply_status`,`apply_pay_img`,`apply_update_time`, - `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`,`create_by`,`create_by_name`,`update_by`,`update_by_name`, - `pay_way`,`late_pay_status`,`comments`,starttime,endtime,freeze,service_charge_pay,`parent_bill_id`,`energy_fees_id`,`set_off` - - - - where 1=1 - and `id` = #{id} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and `property_contract_id` = #{propertyContractId} - and `energy_fees_id` = #{energyFeesId} - and `receive_pay` = #{receivePay} - and `pay` = #{pay} - and `receive_date` = #{receiveDate} - and `pay_date` = #{payDate} - and `createtime` = #{createtime} - and `expired_day` = #{expiredDay} - and `status` = #{status} - and `apply_status` = #{applyStatus} - and `is_del` = #{isDel} - and `need_pay` = #{needPay} - and `merchant_id` = #{merchantId} - and `user_id` = #{userId} - and `shop_id` = #{shopId} - and `updatetime` = #{updatetime} - and `rent_shop_type` = #{rentShopType} - and is_preview = #{isPreview} - and `pay_way` = #{payWay} - and `late_pay_status` = #{latePayStatus} - and `parent_bill_id` = #{parentBillId} - and `parent_bill_id` is not null - and `parent_bill_id` is null - and `energy_fees_id` is not null - and `energy_fees_id` is null - - and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) ) - - and property_contract_id in - - #{pidItem} - - - - - and merchant_id in - - #{midItem} - - - - - and status in - - #{stItem} - - - - - and id in - - #{idItem} - - - order by ${sortColumns} - - - - - - - - - br.is_preview = 0 - and br.`id` = #{id} - and br.`tenant_id` = #{tenantId} - and br.`parent_tenant_id` = #{parentTenantId} - and br.`freeze` = #{freeze} - and br.`id` = #{id} - and br.`merchant_id` = #{merchantId} - and br.`energy_fees_id` = #{energyFeesId} - and br.`status` = #{status} - and br.`apply_status` = #{applyStatus} - and br.`is_del` = #{isDel} - and br.`starttime` <= #{starttime} - and br.`endtime` >= #{endtime} - - and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} - - - and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - and br.`rent_shop_type` = #{rentShopType} - and br.`property_contract_id` = #{propertyContractId} - and br.`pay_way` = #{payWay} - and br.`late_pay_status` = #{latePayStatus} - and br.`parent_bill_id` = #{parentBillId} - and br.`parent_bill_id` is not null - and br.`parent_bill_id` is null - and br.`energy_fees_id` is not null - and br.`energy_fees_id` is null - - and (br.`last_owe_call_time` is not null and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7) ) - - and br.property_contract_id in - - #{pidItem} - - - - - and br.merchant_id in - - #{midItem} - - - - - and br.status in - - #{stItem} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - update wx_bill_property b set b.status=#{notPaid},b.expired_day= - DATEDIFF(now(), b.receive_date) - where b.status!=#{paid} and b.status!=6 - and DATEDIFF(now(), b.receive_date) >0 - - and b.`tenant_id` = #{tenantId} - - - and b.`parent_tenant_id` = #{parentTenantId} - - - - - update wx_bill_property set status=#{waitPay} where id in( - select a.id from ( - select br.id,rc.receive_period,br.property_contract_id,br.receive_date - from wx_bill_property br - left join wx_property_contract rc on br.property_contract_id=rc.id - where 1=1 - - and br.`tenant_id` = #{tenantId} - - - and br.`parent_tenant_id` = #{parentTenantId} - - and br.status!=#{paid} and br.status != 6 and now() < br.receive_date - and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) - - - - - update wx_bill_property set status = 6 where property_contract_id = #{propertyContractId} - and status in(4,2) - - - - update wx_bill_property set status = 6 where property_contract_id in - (select id from wx_property_contract where rent_contract_id = #{id}) - and status != 3 - - - - delete from wx_bill_property where property_contract_id = #{id} - - - - delete from wx_bill_property where property_contract_id = #{propertyContractId} - and is_preview = #{isPreview} - - - - delete from wx_bill_property where property_contract_id = #{propertyContractId} and is_preview = 0 and status = 2 - and starttime > #{shopEndtime} and IFNULL(`pay`,'0') <= 0 AND IFNULL(`set_off`,'0') <= 0 - - - - update wx_bill_property set updatetime = now() - ,receive_pay = #{receivePay} - ,comments = #{comments} - ,receive_date = #{receiveDate} - ,status = 3,pay_date=now() - where id = #{id} - - - - update wx_bill_property set is_preview = #{isPreview},merchant_id = #{merchantId},need_pay = receive_pay - where property_contract_id = #{propertyContractId} - - - - - - - INSERT INTO wx_bill_property (id,property_contract_id, receive_pay, pay, receive_date, pay_date, createtime, - expired_day,create_by,create_by_name,update_by,update_by_name, - tenant_id, parent_tenant_id, status, is_del, need_pay, merchant_id, user_id, shop_id, updatetime, starttime, - endtime, - rent_shop_type, revenue, late_pay_ratio, late_pay_time, late_pay_price, period, is_preview, shop_info, - pay_way, late_pay_status, comments,service_charge_pay,parent_bill_id,energy_fees_id) - VALUES - - ( - #{item.id},#{item.propertyContractId},#{item.receivePay},#{item.pay},#{item.receiveDate},#{item.payDate},#{item.createtime}, - #{item.expiredDay},#{item.createBy},#{item.createByName},#{item.updateBy},#{item.updateByName}, - #{item.tenantId},#{item.parentTenantId},#{item.status},#{item.isDel},#{item.needPay},#{item.merchantId}, - #{item.userId},#{item.shopId},#{item.updatetime},#{item.starttime},#{item.endtime},#{item.rentShopType},#{item.revenue}, - #{item.latePayRatio},#{item.latePayTime},#{item.latePayPrice},#{item.period},#{item.isPreview},#{item.shopInfo}, - #{item.payWay},#{item.latePayStatus},#{item.comments},#{item.serviceChargePay},#{item.parentBillId},#{item.energyFeesId} - ) - - - - - - update wx_bill_property - - updatetime = now(),receive_pay = #{item.receivePay}, - comments = #{item.comments}, - receive_date = #{item.receiveDate}, - status = 3,pay_date=now() - - where id = #{item.id} - - - - - - - delete from wx_bill_property where id = #{id} and tenant_id = #{tenantId} - - - - - - - diff --git a/mallinkService/src/main/resources/mapper/WxBillRentManageMapper.xml b/mallinkService/src/main/resources/mapper/WxBillRentManageMapper.xml deleted file mode 100644 index bafd2815c..000000000 --- a/mallinkService/src/main/resources/mapper/WxBillRentManageMapper.xml +++ /dev/null @@ -1,333 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `id`,`tenant_id`,`parent_tenant_id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`last_owe_call_user`, - `createtime`,`expired_day`,`status`,`apply_status`,`apply_pay_img`,`apply_update_time`,`is_del`,`is_preview`,`need_pay`, - `last_owe_call_time`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`,`late_pay_ratio`,`late_pay_time`, - `late_pay_price`,`period`,`shop_info`,`pay_way`,`late_pay_status`,starttime,endtime,freeze,service_charge_pay,manage_fee_type, - `create_by`,`create_by_name`,`update_by`,`update_by_name`,`energy_fees_id`,`set_off` - - - - where 1=1 - and `id` = #{id} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and `rent_contract_id` = #{rentContractId} - and `energy_fees_id` = #{energyFeesId} - and `receive_pay` = #{receivePay} - and `pay` = #{pay} - and `receive_date` = #{receiveDate} - and `pay_date` = #{payDate} - and `createtime` = #{createtime} - and `expired_day` = #{expiredDay} - and `status` = #{status} - and `apply_status` = #{applyStatus} - and `is_preview` = #{isPreview} - and `is_del` = #{isDel} - and `need_pay` = #{needPay} - and `merchant_id` = #{merchantId} - and `user_id` = #{userId} - and `shop_id` = #{shopId} - and `updatetime` = #{updatetime} - and `rent_shop_type` = #{rentShopType} - and `pay_way` = #{payWay} - and `late_pay_status` = #{latePayStatus} - and `manage_fee_type` = #{manageFeeType} - and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) ) - - and merchant_id in - - #{midItem} - - - - and status in - - #{stItem} - - - - and id in - - #{idItem} - - - order by ${sortColumns} - - - - - - - - - - br.`is_preview` = 0 - and br.`id` = #{id} - and br.`tenant_id` = #{tenantId} - and br.`parent_tenant_id` = #{parentTenantId} - and br.`freeze` = #{freeze} - and br.`rent_shop_type` = #{rentShopType} - and br.`status` = #{status} - and br.`apply_status` = #{applyStatus} - and br.`id` = #{id} - and br.`merchant_id` = #{merchantId} - and br.`is_del` = #{isDel} - and br.`rent_contract_id` = #{rentContractId} - and br.`energy_fees_id` = #{energyFeesId} - and br.`pay_way` = #{payWay} - and br.`late_pay_status` = #{latePayStatus} - and br.`starttime` <= #{starttime} - and br.`endtime` >= #{endtime} - - and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} - - - and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - and br.`manage_fee_type` = #{manageFeeType} - and br.`merchant_id` is not null - and (br.`last_owe_call_time` is not null and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7) ) - - and br.merchant_id in - - #{midItem} - - - - and br.status in - - #{stItem} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - update wx_bill_rent_manage set is_preview = #{isPreview} where rent_contract_id = #{rentContractId} - - - - - - update wx_bill_rent_manage b set b.status=#{notPaid},b.expired_day= - DATEDIFF(now(), b.receive_date) - where b.status!=#{paid} and b.status!=6 and - DATEDIFF(now(), b.receive_date) >0 - - and b.`tenant_id` = #{tenantId} - - - and b.`parent_tenant_id` = #{parentTenantId} - - - - - update wx_bill_rent_manage set status=#{waitPay} where id in( - select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_rent_manage br - left join wx_rent_contract rc on br.rent_contract_id=rc.id - where br.status!=#{paid} - - and br.`tenant_id` = #{tenantId} - - - and br.`parent_tenant_id` = #{parentTenantId} - - and br.status!=6 and now() < br.receive_date - and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) - - - - delete from wx_bill_rent_manage where rent_contract_id = #{rentContractId} and manage_fee_type = #{manageFeeType} - and `is_preview` = #{isPreview} - - - - delete from wx_bill_rent_manage where rent_contract_id = #{rentContractId} and is_preview = 0 and status = 2 - and starttime > #{shopEndtime} and IFNULL(`pay`,'0') <= 0 AND IFNULL(`set_off`,'0') <= 0 - - - - - - INSERT INTO wx_bill_rent_manage (id,tenant_id,parent_tenant_id, - rent_contract_id, receive_pay, pay, receive_date, pay_date, createtime, expired_day, - status, is_del, need_pay, merchant_id, user_id, shop_id, updatetime, starttime, endtime, - rent_shop_type, late_pay_ratio, late_pay_time, late_pay_price, period, shop_info, - pay_way, late_pay_status, service_charge_pay,manage_fee_type,create_by,create_by_name,update_by,update_by_name,energy_fees_id) - VALUES - - ( - #{item.id},#{item.tenantId},#{item.parentTenantId}, - #{item.rentContractId},#{item.receivePay},#{item.pay},#{item.receiveDate},#{item.payDate},#{item.createtime},#{item.expiredDay}, - #{item.status},#{item.isDel},#{item.needPay},#{item.merchantId},#{item.userId},#{item.shopId},#{item.updatetime},#{item.starttime},#{item.endtime}, - #{item.rentShopType},#{item.latePayRatio},#{item.latePayTime},#{item.latePayPrice},#{item.period},#{item.shopInfo}, - #{item.payWay},#{item.latePayStatus},#{item.serviceChargePay},#{item.manageFeeType}, - #{item.createBy},#{item.createByName},#{item.updateBy},#{item.updateByName},#{item.energyFeesId} - ) - - - - - delete from wx_bill_rent_manage where id = #{id} and tenant_id = #{tenantId} - - - - diff --git a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml deleted file mode 100644 index b1d5af351..000000000 --- a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml +++ /dev/null @@ -1,486 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `id`,`tenant_id`,`parent_tenant_id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`create_by`,`create_by_name`,`update_by`,`update_by_name`, - `createtime`,`expired_day`,`status`,`is_del`,`contract_need_pay`,`rent_price_info`,`need_pay`,`bussiness_manage_fee_need_pay`,`operating_manage_fee_need_pay`, - `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`,`apply_status`,`apply_pay_img`,`apply_update_time`,`last_owe_call_time`, - `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`,`last_owe_call_user`,`set_off`, - `pay_way`,`late_pay_status`,`comments`,starttime,endtime,bus_discount_ratio,freeze,join_rent_price,service_charge_pay,`energy_fees_id` - - - - where 1=1 - and `id` = #{id} - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - and `rent_contract_id` = #{rentContractId} - and `energy_fees_id` = #{energyFeesId} - and `receive_pay` = #{receivePay} - and `pay` = #{pay} - and `receive_date` = #{receiveDate} - and `pay_date` = #{payDate} - and `createtime` = #{createtime} - and `expired_day` = #{expiredDay} - and `status` = #{status} - and `apply_status` = #{applyStatus} - and `is_del` = #{isDel} - and `need_pay` = #{needPay} - and `merchant_id` = #{merchantId} - and `user_id` = #{userId} - and `shop_id` = #{shopId} - and `updatetime` = #{updatetime} - and `rent_shop_type` = #{rentShopType} - and is_preview = #{isPreview} - and `pay_way` = #{payWay} - and `late_pay_status` = #{latePayStatus} - and `starttime` = #{starttime} - and `endtime` = #{endtime} - - and endtime >= #{endtimeBegin} - - - and endtime < #{endtimeEnd} - - and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) ) - - and status in - - #{stItem} - - - - and id in - - #{idItem} - - - order by ${sortColumns} - - - - - - - - - br.is_preview = 0 - and br.`id` = #{id} - and br.`tenant_id` = #{tenantId} - and br.`parent_tenant_id` = #{parentTenantId} - and br.`freeze` = #{freeze} - and br.`rent_shop_type` = #{rentShopType} - and br.`status` = #{status} - and br.`apply_status` = #{applyStatus} - and br.`id` = #{id} - and br.`merchant_id` = #{merchantId} - and br.`is_del` = #{isDel} - and br.`rent_contract_id` = #{rentContractId} - and br.`energy_fees_id` = #{energyFeesId} - and br.`pay_way` = #{payWay} - and br.`late_pay_status` = #{latePayStatus} - and br.`starttime` <= #{starttime} - and br.`endtime` >= #{endtime} - - and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} - - - and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - - and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) - - and (br.`last_owe_call_time` is not null and br.`receive_pay` - br.`pay`- IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7) ) - - and br.`rent_contract_id` in - - #{ridItem} - - - - and br.`merchant_id` in - - #{midItem} - - - - and br.`status` in - - #{stItem} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - update wx_bill_rent b set b.status=#{notPaid},b.expired_day= - DATEDIFF(now(), b.receive_date) - where b.status!=#{paid} and b.status!=6 and - DATEDIFF(now(), b.receive_date) >0 - - and b.`tenant_id` = #{tenantId} - - - and b.`parent_tenant_id` = #{parentTenantId} - - - - - update wx_bill_rent set status=#{waitPay} where id in( - select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_rent br - left join wx_rent_contract rc on br.rent_contract_id=rc.id - where br.status!=#{paid} - - and br.`tenant_id` = #{tenantId} - - - and br.`parent_tenant_id` = #{parentTenantId} - - and br.status!=6 and now() < br.receive_date - and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) - - - - - update wx_bill_rent set status = 6 where rent_contract_id = #{rentContractId} - and status != 3 - - - - delete from wx_bill_rent where rent_contract_id = #{id} - - - - delete from wx_bill_rent where rent_contract_id = #{rentContractId} - and is_preview = #{isPreview} - - - - delete from wx_bill_rent where rent_contract_id = #{rentContractId} and is_preview = 0 and status = 2 - and starttime > #{shopEndtime} and IFNULL(`pay`,'0') <= 0 AND IFNULL(`set_off`,'0') <= 0 - - - - update wx_bill_rent set updatetime = now() - ,receive_pay = #{receivePay} - ,comments = #{comments} - ,receive_date = #{receiveDate} - ,status = 3,pay_date=now() - - where id = #{id} - - - - update wx_bill_rent set is_preview = #{isPreview},merchant_id = #{merchantId},need_pay = receive_pay - where rent_contract_id = #{rentContractId} - - - - - - INSERT INTO wx_bill_rent (id,tenant_id,parent_tenant_id, - rent_contract_id, receive_pay, pay, receive_date, pay_date, createtime, expired_day,create_by,create_by_name,update_by,update_by_name, - status, is_del, contract_need_pay,rent_price_info,need_pay,bussiness_manage_fee_need_pay,operating_manage_fee_need_pay, merchant_id, - user_id, shop_id, updatetime, starttime, endtime,rent_shop_type, revenue, - late_pay_ratio, late_pay_time, late_pay_price, period, is_preview, shop_info, - pay_way, late_pay_status, comments,service_charge_pay,energy_fees_id) - VALUES - - ( - #{item.id},#{item.tenantId},#{item.parentTenantId}, - #{item.rentContractId},#{item.receivePay},#{item.pay},#{item.receiveDate},#{item.payDate},#{item.createtime},#{item.expiredDay},#{item.createBy},#{item.createByName},#{item.updateBy},#{item.updateByName}, - #{item.status},#{item.isDel},#{item.contractNeedPay},#{item.rentPriceInfo},#{item.needPay},#{item.bussinessManageFeeNeedPay},#{item.operatingManageFeeNeedPay},#{item.merchantId}, - #{item.userId},#{item.shopId},#{item.updatetime},#{item.starttime},#{item.endtime},#{item.rentShopType},#{item.revenue}, - #{item.latePayRatio},#{item.latePayTime},#{item.latePayPrice},#{item.period},#{item.isPreview},#{item.shopInfo}, - #{item.payWay},#{item.latePayStatus},#{item.comments},#{item.serviceChargePay},#{item.energyFeesId} - ) - - - - - - update wx_bill_rent - - updatetime = now(),receive_pay = #{item.receivePay}, - comments = #{item.comments}, - receive_date = #{item.receiveDate}, - status = 3,pay_date=now() - - where id = #{item.id} - - - - - - - delete from wx_bill_rent where id = #{id} and tenant_id = #{tenantId} - - - - - - - - - - diff --git a/mallinkService/src/main/resources/mapper/WxBillSettleScheduleMapper.xml b/mallinkService/src/main/resources/mapper/WxBillSettleScheduleMapper.xml deleted file mode 100644 index aee7748ca..000000000 --- a/mallinkService/src/main/resources/mapper/WxBillSettleScheduleMapper.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - `id`,`tenant_id`,`parent_tenant_id`,`settle_number`,`merchant_id`,`status`,`apply_status`, - `receive_money`,`pay_money`,`settletime`,`createtime`,`updatetime`,`settle_receive_pay` - - - - insert into wx_bill_settle_schedule(`id`,`tenant_id`,`parent_tenant_id`,`settle_number`,`merchant_id`,`status`,`apply_status`,`receive_money`,`pay_money`,`settletime`,`createtime`, - `updatetime`,`settle_receive_pay`) - select `id`,`tenant_id`,`parent_tenant_id`,`settle_number`,`merchant_id`,`status`,`apply_status`,`receive_money`,`pay_money`,`settletime`,`createtime`,`updatetime`,#{settleReceivePay} - from wx_bill_settle where id = #{id} - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml index 71fce6487..f77dc3917 100644 --- a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml @@ -430,9 +430,9 @@ select * from wx_property_contract where rent_contract_id =#{id} order by createtime desc limit 1 - select * from wx_property_contract where id in( - select property_contract_id from wx_bill_property id = #{id} + select property_contract_id from wx_all_bill id = #{id} ) diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index e76a2fb90..6f79e43f1 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -444,10 +444,10 @@ order by rc.createtime desc,rc.id desc - select from wx_rent_contract where id in( - select rent_contract_id from wx_bill_rent id = #{id} + select rent_contract_id from wx_all_bill id = #{id} )