| @@ -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()); | |||
| @@ -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<Integer,String> tmap = new HashMap<Integer,String>(); | |||
| 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<WxBillDaily> 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); | |||
| } | |||
| } | |||
| @@ -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<WxBillDeposit> 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); | |||
| // | |||
| // } | |||
| } | |||
| @@ -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<WxBillOther> 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); | |||
| // } | |||
| } | |||
| @@ -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<WxBillOtherDeposit> 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); | |||
| // } | |||
| } | |||
| @@ -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<WxBillProperty> 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<WxBillProperty> 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); | |||
| } | |||
| } | |||
| @@ -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<WxBillPropertyDeposit> 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); | |||
| // | |||
| // } | |||
| } | |||
| @@ -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<WxBillRent> 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<WxBillRent> 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); | |||
| } | |||
| } | |||
| @@ -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<WxBillRentManage> 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<WxBillRentManage> 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); | |||
| } | |||
| } | |||
| @@ -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()); | |||
| } | |||
| } | |||
| @@ -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<WxActivity> 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<WxActivityJoin> 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<String, String> 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<WxActivity> 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<WxActivityJoin> 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<String, String> 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分钟一次 | |||
| @@ -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("查询欠缴账单数据"); | |||
| @@ -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<Long> 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); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -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<WxMall> wxMalls = wxMallMapper.findList(null); | |||
| // for (WxMall wxMall : wxMalls) { | |||
| // TenantEntity tenantEntity = wxMall.getTenantInfo(); | |||
| // WxBillAll wxBillAll = new WxBillAll(); | |||
| // wxBillAll.updateTenantInfo(tenantEntity); | |||
| // wxBillAllService.updateBillStatus(wxBillAll); | |||
| // } | |||
| // | |||
| // logger.info("账单状态更新结束"); | |||
| // } | |||
| } | |||
| @@ -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); | |||
| // } | |||
| // } | |||
| } | |||
| @@ -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; | |||
| @@ -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; | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -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<Long> merchantIds; | |||
| @TableField(exist = false) | |||
| private List<Long> 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; | |||
| // } | |||
| } | |||
| @@ -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<Long> rentContractIdList; | |||
| @TableField(exist = false) | |||
| private List<Long> 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; | |||
| // } | |||
| } | |||
| @@ -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<Long> merchantIds; | |||
| @TableField(exist = false) | |||
| private List<Long> 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; | |||
| // } | |||
| } | |||
| @@ -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<Map<String, Object>> 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<Long> merchantIds; | |||
| @TableField(exist = false) | |||
| private List<Long> 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; | |||
| // } | |||
| } | |||
| @@ -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<Long> propertyContractIds; | |||
| @TableField(exist = false) | |||
| private List<Long> 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<WxBillFeesStandardsListVo> unFixedbillFeesStandardsList; | |||
| @TableField(exist = false) | |||
| private Integer hasParentBillId; | |||
| @TableField(exist = false) | |||
| private Integer hasFeesStardarsId; | |||
| } | |||
| @@ -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<Long> propertyContractIdList; | |||
| @TableField(exist = false) | |||
| private List<Long> merchantIds; | |||
| public String getShopNumberByShopInfo() { | |||
| StringBuffer sb = new StringBuffer(""); | |||
| String rentInfo = this.getShopInfo(); | |||
| if (!StringUtils.isBlank(rentInfo)) { | |||
| JSONObject rentInfoObject = JSONArray.parseObject(rentInfo); | |||
| for (Iterator<String> it = rentInfoObject.keySet().iterator();it.hasNext();) { | |||
| sb.append(it.next()).append(","); | |||
| } | |||
| } | |||
| return sb.toString(); | |||
| } | |||
| // @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; | |||
| // } | |||
| } | |||
| @@ -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<Long> rentContractIdList; | |||
| // | |||
| } | |||
| @@ -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<Long> merchantIds; | |||
| @TableField(exist = false) | |||
| private Integer hasMerchant; | |||
| } | |||
| @@ -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; | |||
| } | |||
| @@ -169,7 +169,7 @@ public class WxPropertyContract extends TenantEntity { | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value = "物业预账单列表", name = "previewBillRentList") | |||
| private List<WxBillProperty> previewBillRentList; | |||
| private List<WxAllBill> previewBillRentList; | |||
| @io.swagger.annotations.ApiModelProperty(value = "租金信息", name = "rentInfo") | |||
| private String rentInfo; | |||
| @@ -355,11 +355,11 @@ public class WxRentContract extends TenantEntity { | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value = "租赁合同预账单列表", name = "previewBillRentList") | |||
| private List<WxBillRent> previewBillRentList; | |||
| private List<WxAllBill> previewBillRentList; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value = "物业合同预账单列表", name = "reviewBillPropertyPList") | |||
| private List<WxBillProperty> reviewBillPropertyPList; | |||
| private List<WxAllBill> reviewBillPropertyPList; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value = "审批说明", name = "remark") | |||
| @@ -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; | |||
| } | |||
| @@ -35,5 +35,7 @@ public interface WxAllBillMapper extends CommonMapper<WxAllBill, Long> { | |||
| 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); | |||
| } | |||
| @@ -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<WxBillAdvance, Long> { | |||
| List<WxBillAdvance> queryBillList(WxBillAdvance record); | |||
| List<WxBillAdvance> findList(WxBillAdvance wxBillRent); | |||
| List<Long> getMerchantIdList(WxBillAdvance wxBillRent); | |||
| WxBillAdvance selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| } | |||
| @@ -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<WxBillDaily, Long> { | |||
| List<WxBillDaily> findList(WxBillDaily wxBillDaily); | |||
| void updateNotPaidStatus(Map<String,Object> params); | |||
| void updateWaitPayStatus(Map<String,Object> params); | |||
| List<WxBillDaily> queryBillDailyList(WxBillDaily record); | |||
| List<WxBillNotify> getBillNotifyList(WxBillDaily record); | |||
| WxBillSum getBillMonthSum(WxBillDaily record); | |||
| List<Long> 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<WxBillDaily> resultList); | |||
| void deleteEnergyReadingBills(@Param("energyReadingCalcuteId")Long energyReadingCalcuteId,@Param("tenantId")String tenantId); | |||
| void deleteNoNeedPayBill(WxBillDaily wxBillRent); | |||
| } | |||
| @@ -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<WxBillDeposit, Long> { | |||
| List<WxBillDeposit> findList(WxBillDeposit wxBillDeposit); | |||
| List<Long> findRentContractIds(WxBillDeposit wxBillDeposit); | |||
| List<WxBillDeposit> queryBillDepositList(WxBillDeposit record); | |||
| List<WxBillNotify> getBillNotifyList(WxBillDeposit record); | |||
| Map<String,Object> queryPayInfo(Map<String,Object> params); | |||
| Map<String,Object> queryOweInfoAll(Map<String,Object> params); | |||
| Map<String,Object> queryPayInfoAllTotal(Map<String,Object> params); | |||
| void updateNotPaidStatus(Map<String,Object> params); | |||
| void updateWaitPayStatus(Map<String,Object> params); | |||
| long queryOweCount(WxRentContract wxRentContract); | |||
| WxBillSum getBillMonthSum(WxBillDeposit wxBillDeposit); | |||
| List<Long> 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<WxBillDeposit> resultList); | |||
| void deleteNoNeedPayBill(WxBillDeposit wxBillRent); | |||
| } | |||
| @@ -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<WxBillOtherDeposit, Long> { | |||
| List<WxBillOtherDeposit> findList(WxBillOtherDeposit record); | |||
| void updateNotPaidStatus(Map<String, Object> params); | |||
| void updateWaitPayStatus(Map<String, Object> params); | |||
| List<WxBillOtherDeposit> queryBillList(WxBillOtherDeposit record); | |||
| List<WxBillNotify> getBillNotifyList(WxBillOtherDeposit record); | |||
| WxBillSum getBillMonthSum(WxBillOtherDeposit record); | |||
| List<Long> 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); | |||
| } | |||
| @@ -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<WxBillOther, Long> { | |||
| List<WxBillOther> findList(WxBillOther wxBillDaily); | |||
| void updateNotPaidStatus(Map<String, Object> params); | |||
| void updateWaitPayStatus(Map<String, Object> params); | |||
| List<WxBillOther> queryBillList(WxBillOther record); | |||
| List<WxBillNotify> getBillNotifyList(WxBillOther record); | |||
| Map<String,Object> queryPayInfoTotal(Map<String,Object> params); | |||
| Map<String,Object> queryOweInfo(Map<String,Object> params); | |||
| WxBillSum getBillMonthSum(WxBillOther record); | |||
| List<Long> 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); | |||
| } | |||
| @@ -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<WxBillPropertyDeposit, Long> { | |||
| List<WxBillPropertyDeposit> findList(WxBillPropertyDeposit wxBillPropertyDeposit); | |||
| List<Long> findPropertyContractIds(WxBillPropertyDeposit wxBillPropertyDeposit); | |||
| List<WxBillPropertyDeposit> queryBillDepositList(WxBillPropertyDeposit record); | |||
| List<WxBillNotify> getBillNotifyList(WxBillPropertyDeposit record); | |||
| Map<String,Object> queryPayInfo(Map<String,Object> params); | |||
| void updateNotPaidStatus(Map<String,Object> params); | |||
| void updateWaitPayStatus(Map<String,Object> params); | |||
| long queryOweCount(WxPropertyContract wxPropertyContract); | |||
| WxBillSum getBillMonthSum(WxBillPropertyDeposit wxBillPropertyDeposit); | |||
| List<Long> 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); | |||
| } | |||
| @@ -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<WxBillProperty, Long> { | |||
| List<WxBillProperty> findList(WxBillProperty wxBillProperty); | |||
| List<WxBillProperty> queryBillPropertyList(WxBillProperty record); | |||
| List<WxBillNotify> getBillNotifyList(WxBillProperty record); | |||
| List<Long> queryPropertyContractIdList(WxBillProperty record); | |||
| Map<String,Object> queryPayInfo(Map<String,Object> params); | |||
| Map<String,Object> queryPayInfoTotal(Map<String,Object> params); | |||
| Map<String,Object> queryOweInfo(Map<String,Object> params); | |||
| void updateNotPaidStatus(Map<String,Object> params); | |||
| void updateWaitPayStatus(Map<String,Object> 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<WxBillProperty> resultList); | |||
| void insertBills(@Param("tenantId")String tenantId, @Param("list") List<WxBillProperty> resultList); | |||
| WxBillProperty selectBillOne(WxBillProperty propertyQuery); | |||
| /** | |||
| * 累加每一天的滞纳金 | |||
| */ | |||
| //void autoAddLatePayPrice(); | |||
| /** | |||
| * 保存billAction | |||
| */ | |||
| //void insertBillAction(); | |||
| //void updateServiceCharge(WxPayAccountBill tenantId); | |||
| //void updateOwe(); | |||
| WxBillSum getBillMonthSum(WxBillProperty propertyQuery); | |||
| List<Long> 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); | |||
| } | |||
| @@ -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<WxBillRentManage, Long> { | |||
| List<WxBillRentManage> findList(WxBillRentManage wxBillRentManage); | |||
| List<WxBillRentManage> queryBillManageList(WxBillRentManage wxBillRentManage); | |||
| List<Long> queryRentContractIds(WxBillRentManage wxBillRentManage); | |||
| List<WxBillNotify> getBillNotifyList(WxBillRentManage record); | |||
| Map<String,Object> queryPayInfoTotal(Map<String,Object> params); | |||
| void updateNotPaidStatus(Map<String,Object> params); | |||
| void updateWaitPayStatus(Map<String,Object> params); | |||
| void deletePreviewBill(WxBillRentManage wxBillRentManage); | |||
| void deleteNoNeedPayBill(WxBillRentManage wxBillRentManage); | |||
| long oweBillCount(@Param("contractId") Long contractId); | |||
| void insertBills(@Param("tenantId")String tenantId, @Param("list")List<WxBillRentManage> resultList); | |||
| WxBillSum getBillMonthSum(WxBillRentManage wxBillRentManage); | |||
| List<Long> 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); | |||
| } | |||
| @@ -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<WxBillRent, Long> { | |||
| List<WxBillRent> findList(WxBillRent wxBillRent); | |||
| List<WxBillRent> queryBillRentList(WxBillRent record); | |||
| List<Long> queryBillRentContractIdList(WxBillRent record); | |||
| List<WxBillNotify> getBillNotifyList(WxBillRent record); | |||
| Map<String,Object> queryPayInfo(Map<String,Object> params); | |||
| Map<String,Object> queryPayInfoTotal(Map<String,Object> params); | |||
| Map<String,Object> queryOweInfo(Map<String,Object> params); | |||
| void updateNotPaidStatus(Map<String,Object> params); | |||
| void updateWaitPayStatus(Map<String,Object> 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<WxBillRent> resultList); | |||
| void updateBills(@Param("bills") List<WxBillRent> resultList); | |||
| WxBillRent selectBillOne(WxBillRent rentQuery); | |||
| /** | |||
| * 累加每一天的滞纳金 | |||
| */ | |||
| //void autoAddLatePayPrice(); | |||
| /** | |||
| * 保存billAction | |||
| */ | |||
| //void insertBillAction(); | |||
| //void updateServiceCharge(WxPayAccountBill record); | |||
| //void updateOwe(); | |||
| WxBillSum getBillMonthSum(WxBillRent wxBillRent); | |||
| List<Long> 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); | |||
| } | |||
| @@ -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<WxBillSettleSchedule, Long> { | |||
| void createScheduleFromBillSettle(@Param("id") Long id,@Param("settleReceivePay") Double settleReceivePay); | |||
| List<Long> listToSettleBillIdList(WxBillAll wxBillAll); | |||
| List<Long> 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); | |||
| } | |||
| @@ -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<WxPropertyContrac | |||
| WxPropertyContract findOneByRentId(WxRentContract wxRentContract); | |||
| WxPropertyContract getByBill(WxBillProperty billRent); | |||
| WxPropertyContract getByBill(WxAllBill billRent); | |||
| void endContract(WxPropertyContract wxPropertyContract); | |||
| @@ -1,7 +1,7 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxAllBill; | |||
| import com.iformall.domain.po.WxBusiness; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import com.iformall.domain.vo.WxRentPropertyContractVo; | |||
| @@ -37,7 +37,7 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long> | |||
| List<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo record); | |||
| WxRentContract getByBill(WxBillRent billRent); | |||
| WxRentContract getByBill(WxAllBill billRent); | |||
| int getShopCountMax(); | |||
| @@ -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<WxAllBill> listAsPage(WxAllBill record, Integer pageIndex, Integer pageSize); | |||
| List<Long> getMerchantIds(WxAllBill wxBillRent); | |||
| List<WxBillHotNotify> 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<WxAllBill> list(WxAllBill record); | |||
| List<WxBillNotify> 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<WxAllBill> 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); | |||
| @@ -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<WxBillAdvance> 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<Long> 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); | |||
| } | |||
| @@ -22,74 +22,74 @@ import java.util.Map; | |||
| @Deprecated | |||
| public interface WxBillAllService { | |||
| List<WxBillAllVo> allDepositList(WxBillAll wxBillAll); | |||
| Map<String, Object> listAsPage(WxBillAll wxBillAll, Integer pageNum, Integer pageSize); | |||
| //List<Map<String, Object>> listBillOweAndWaitPay(WxBillAll wxBillAll); | |||
| ResultData pageListBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasShop,boolean hasPayBill,boolean hasReceivePay); | |||
| List<Map<String, Object>> listBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasSet,boolean hasShop,boolean hasPayBill,boolean hasReceivePay); | |||
| Map<String,Object> detail(Long id,Integer type); | |||
| void updateBill(Map<String, Object> 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<String, Object> getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize); | |||
| /** | |||
| * 应收和承付商户分页列表 | |||
| * | |||
| * @return | |||
| */ | |||
| PageInfo<Map> 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<WxBillAllVo> allDepositList(WxBillAll wxBillAll); | |||
| // | |||
| // Map<String, Object> listAsPage(WxBillAll wxBillAll, Integer pageNum, Integer pageSize); | |||
| // | |||
| // //List<Map<String, Object>> listBillOweAndWaitPay(WxBillAll wxBillAll); | |||
| // | |||
| // ResultData pageListBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasShop,boolean hasPayBill,boolean hasReceivePay); | |||
| // List<Map<String, Object>> listBill(WxBillAll wxBillAll,WxMerchant wxMerchant,boolean hasSet,boolean hasShop,boolean hasPayBill,boolean hasReceivePay); | |||
| // | |||
| // Map<String,Object> detail(Long id,Integer type); | |||
| // | |||
| // void updateBill(Map<String, Object> 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<String, Object> getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize); | |||
| // | |||
| // | |||
| // /** | |||
| // * 应收和承付商户分页列表 | |||
| // * | |||
| // * @return | |||
| // */ | |||
| // PageInfo<Map> 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); | |||
| } | |||
| @@ -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<WxBillDaily> listAsPage(WxBillDaily record, Integer pageIndex, Integer pageSize); | |||
| List<WxBillDaily> list(WxBillDaily record); | |||
| List<WxBillNotify> 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<Long> 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<WxBillDaily> list); | |||
| public void deleteEnergyReadingBills(WxBillDaily wxBillDaily); | |||
| } | |||
| @@ -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<WxBillDeposit> listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize); | |||
| List<WxBillDeposit> list(WxBillDeposit record); | |||
| List<WxBillNotify> 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<Long> 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); | |||
| } | |||
| @@ -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<WxBillOtherDeposit> listAsPage(WxBillOtherDeposit record, Integer pageIndex, Integer pageSize); | |||
| List<WxBillOtherDeposit> list(WxBillOtherDeposit record); | |||
| List<WxBillNotify> 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<Long> 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); | |||
| } | |||
| @@ -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<WxBillOther> listAsPage(WxBillOther record, Integer pageIndex, Integer pageSize); | |||
| List<WxBillOther> list(WxBillOther record); | |||
| List<WxBillNotify> 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<Long> 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); | |||
| } | |||
| @@ -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<WxBillPropertyDeposit> listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize); | |||
| List<WxBillPropertyDeposit> list(WxBillPropertyDeposit record); | |||
| List<WxBillNotify> 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<Long> 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); | |||
| } | |||
| @@ -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<WxBillProperty> listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize); | |||
| List<WxBillProperty> list(WxBillProperty record); | |||
| List<WxBillNotify> 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<WxBillProperty> 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<Long> 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); | |||
| } | |||
| @@ -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<WxBillRentManage> listAsPage(WxBillRentManage wxBillRentManage, Integer pageIndex, Integer pageSize); | |||
| List<WxBillRentManage> list(WxBillRentManage wxBillRentManage); | |||
| List<WxBillNotify> notifyList(WxBillRentManage wxBillRentManage); | |||
| void updateBillStatus(WxBillRentManage record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxBillRentManage getById(TenantEntity tenantEntity,Long id); | |||
| Map detail(TenantEntity tenantEntity,Long id); | |||
| PageInfo<WxBillRentManage> 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<Long> 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); | |||
| } | |||
| @@ -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<WxBillRent> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize); | |||
| List<WxBillRent> list(WxBillRent record); | |||
| List<WxBillNotify> 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<WxBillRent> 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<Long> 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); | |||
| } | |||
| @@ -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<String, Object> payinfo = wxBillRentMapper.queryPayInfo(params); | |||
| //Map<String, Object> payinfo = wxBillRentMapper.queryPayInfo(params); | |||
| Map<String, Object> 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<String, Object> payinfo = wxBillRentMapper.queryPayInfo(params); | |||
| //Map<String, Object> payinfo = wxBillRentMapper.queryPayInfo(params); | |||
| Map<String, Object> payinfo = null; | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| if (payinfo != null) { | |||
| BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); | |||
| @@ -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<WxAllBill> bills) { | |||
| wxAllBillMapper.insertBills(tenantId, bills); | |||
| } | |||
| @Override | |||
| public void deleteEnergyReadingBills(WxAllBill wxBillDaily) { | |||
| wxAllBillMapper.deleteEnergyReadingBills(wxBillDaily.getEnergyReadingCalcuteId(), wxBillDaily.getTenantId()); | |||
| } | |||
| } | |||
| @@ -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<WxBillAdvance> listAsPage(WxBillAdvance record, Integer pageIndex, Integer pageSize) { | |||
| return getBillRentPropertyList(pageIndex,pageSize,record); | |||
| } | |||
| private PageInfo<WxBillAdvance> getBillRentPropertyList(Integer pageIndex, Integer pageSize,WxBillAdvance wxBillRent) { | |||
| updateQueryParam(wxBillRent); | |||
| PageInfo<WxBillAdvance> 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<Long,WxMerchant> merchantMap = wxMerchantService.findMerchantMap(wq); | |||
| Map<Long, String> 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<Long> 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<Long> mids = wxMerchantService.findIdList(mq); | |||
| if (null != mids && mids.size() > 0 ) { | |||
| if (null != wxBillRent.getMerchantIdList()) { | |||
| List<Long> _mids = (List<Long>) 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<WxBillAdvance> 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<Long> 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<WxBillRent> brList = wxBillRentMapper.findList(br); | |||
| // List<WxBillRent> realRentList = new ArrayList<WxBillRent>(); | |||
| // List<WxBillAction> actionList = new ArrayList<WxBillAction>(); | |||
| // 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<WxBillRent> 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); | |||
| // } | |||
| // } | |||
| // | |||
| // } | |||
| } | |||
| @@ -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<WxBillDaily> listAsPage(WxBillDaily record, Integer pageIndex, Integer pageSize) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | |||
| return getBillRentPropertyList(pageIndex, pageSize, record, wxPayAccountBill); | |||
| } | |||
| @Override | |||
| public List<WxBillDaily> list(WxBillDaily record) { | |||
| updateQueryParam(record); | |||
| return wxBillDailyMapper.queryBillDailyList(record); | |||
| } | |||
| @Override | |||
| public List<WxBillNotify> 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<Long> 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<Long> mids = wxMerchantService.findIdList(mq); | |||
| if (null != mids && mids.size() > 0 ) { | |||
| if (null != record.getMerchantIds()) { | |||
| List<Long> _mids = (List<Long>) 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<WxBillDaily> getBillRentPropertyList(Integer pageIndex, Integer pageSize,WxBillDaily record,WxPayAccountBill wxPayAccountBill) { | |||
| updateQueryParam(record); | |||
| PageInfo<WxBillDaily> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillDailyMapper.queryBillDailyList(record)); | |||
| if (null == page) { | |||
| return null; | |||
| } | |||
| WxMerchant wq = new WxMerchant(); | |||
| wq.updateTenantInfo(record); | |||
| Map<Long,WxMerchant> 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<String, Object> 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<String, Object> 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<Map<String, Object>> 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<WxBillDaily> 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<Long> notinidlist = new ArrayList<Long>(); | |||
| notinidlist.add(record.getId()); | |||
| dailyQuery.setNotInIds(notinidlist); | |||
| List<WxBillDaily> 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<WxBillDailyVo> 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<WxBillDaily> billDailyList = getBillRentPropertyList(1, 10000, record, wxPayAccountBill); | |||
| List<WxBillDailyExportVo> 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<Long> 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<WxBillDaily> brList = wxBillDailyMapper.findList(wxBillRent); | |||
| List<WxBillDaily> realRentList = new ArrayList<WxBillDaily>(); | |||
| List<WxBillAction> actionList = new ArrayList<WxBillAction>(); | |||
| 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<WxBillDaily> 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<WxBillDaily> list) { | |||
| wxBillDailyMapper.insertBills(tenantEntity.getTenantId(), list); | |||
| } | |||
| @Override | |||
| public void deleteEnergyReadingBills(WxBillDaily wxBillDaily) { | |||
| wxBillDailyMapper.deleteEnergyReadingBills(wxBillDaily.getEnergyReadingCalcuteId(), wxBillDaily.getTenantId()); | |||
| } | |||
| } | |||
| @@ -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<WxBillDeposit> listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | |||
| return getBillDepositPropertyList(wxPayAccountBill, record, pageIndex, pageSize); | |||
| } | |||
| @Override | |||
| public List<WxBillDeposit> list(WxBillDeposit record) { | |||
| setQueryParam(record); | |||
| return wxBillDepositMapper.queryBillDepositList(record); | |||
| } | |||
| @Override | |||
| public List<WxBillNotify> 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<Long> 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<Long> mids = wxMerchantService.findIdList(mq); | |||
| if (null != mids && mids.size() > 0 ) { | |||
| if (null != record.getMerchantIds()) { | |||
| List<Long> _mids = (List<Long>) 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<WxBillDeposit> getBillDepositPropertyList(WxPayAccountBill wxPayAccountBill,WxBillDeposit record, Integer pageIndex, Integer pageSize) { | |||
| setQueryParam(record); | |||
| PageInfo<WxBillDeposit> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillDepositMapper.queryBillDepositList(record)); | |||
| if (null == page) { | |||
| return null; | |||
| } | |||
| WxMerchant wq = new WxMerchant(); | |||
| wq.updateTenantInfo(record); | |||
| Map<Long,WxMerchant> merchantMap = wxMerchantService.findMerchantMap(wq); | |||
| List<Long> rentContractIdList = wxBillDepositMapper.findRentContractIds(record); | |||
| Map<Long,WxRentContract> rentContractMap = new HashMap<Long,WxRentContract>(); | |||
| if ( null != rentContractIdList && rentContractIdList.size() > 0 ) { | |||
| WxRentContract rcq = new WxRentContract(); | |||
| rcq.updateTenantInfo(record); | |||
| rcq.setIds(rentContractIdList); | |||
| List<WxRentContract> 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<String, Object> 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<String, Object> 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<WxBillDeposit> page = this.listAsPage(record, 1, 1); | |||
| WxBillDeposit deposit = null; | |||
| WxRentContract wxRentContract = null; | |||
| if (null != page && null != page.getList()) { | |||
| deposit = page.getList().get(0); | |||
| //合同 | |||
| wxRentContract = wxRentContractMapper.selectById(deposit.getRentContractId()); | |||
| if (null != wxRentContract) { | |||
| wxRentContract.setTypeName(EnumRentContractType.getEnum(wxRentContract.getType()).getMessage()); | |||
| } | |||
| } | |||
| Map<String, Object> result = new HashMap<>(3); | |||
| result.put("despoit", deposit); | |||
| result.put("wxRentContract", wxRentContract); | |||
| return result; | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillDeposit record, MallUserInfo user) { | |||
| 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<Long> 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<WxBillDeposit> 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<WxBillDeposit> brList = wxBillDepositMapper.findList(br); | |||
| List<WxBillDeposit> realRentList = new ArrayList<WxBillDeposit>(); | |||
| List<WxBillAction> actionList = new ArrayList<WxBillAction>(); | |||
| 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<WxBillDeposit> 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) { | |||
| } | |||
| } | |||
| @@ -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<WxBillOtherDeposit> listAsPage(WxBillOtherDeposit record, Integer pageIndex, Integer pageSize) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | |||
| return getBillRentPropertyList(pageIndex, pageSize, record, wxPayAccountBill); | |||
| } | |||
| @Override | |||
| public List<WxBillOtherDeposit> list(WxBillOtherDeposit record) { | |||
| updateQueryParam(record); | |||
| return wxBillOtherDepositMapper.queryBillList(record); | |||
| } | |||
| @Override | |||
| public List<WxBillNotify> 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<Long> 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<Long> mids = wxMerchantService.findIdList(mq); | |||
| if (null != mids && mids.size() > 0 ) { | |||
| if (null != record.getMerchantIds()) { | |||
| List<Long> _mids = (List<Long>) 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<WxBillOtherDeposit> getBillRentPropertyList(Integer pageIndex, Integer pageSize,WxBillOtherDeposit record,WxPayAccountBill wxPayAccountBill) { | |||
| updateQueryParam(record); | |||
| PageInfo<WxBillOtherDeposit> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillOtherDepositMapper.queryBillList(record)); | |||
| if (null == page) { | |||
| return null; | |||
| } | |||
| WxMerchant wq = new WxMerchant(); | |||
| wq.updateTenantInfo(record); | |||
| Map<Long,WxMerchant> 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<String, Object> 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<String, Object> 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<Map<String, Object>> 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<WxBillOtherDeposit> 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<Long> notinidlist = new ArrayList<Long>(); | |||
| notinidlist.add(record.getId()); | |||
| otherDepositQuery.setNotInIds(notinidlist); | |||
| List<WxBillOtherDeposit> 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<WxBillOtherDeposit> datalist = getBillRentPropertyList(1, 10000, wxBillDeposit, wxPayAccountBill); | |||
| List<WxBillOtherDeposit> list = null; | |||
| if (null != datalist && null != datalist.getList()) { | |||
| list = datalist.getList(); | |||
| }else { | |||
| list = new ArrayList<WxBillOtherDeposit>(); | |||
| } | |||
| excelService.exportExcel(list, null, "其他押金账单", WxBillOtherDeposit.class, "其他押金账单.xlsx", response, false); | |||
| } | |||
| @Override | |||
| public WxBillSum getBillMonthSum(WxBillOtherDeposit wxBillDeposit) { | |||
| updateQueryParam(wxBillDeposit); | |||
| return wxBillOtherDepositMapper.getBillMonthSum(wxBillDeposit); | |||
| } | |||
| @Override | |||
| public List<Long> 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<WxBillOtherDeposit> brList = wxBillOtherDepositMapper.findList(wxBillRent); | |||
| List<WxBillOtherDeposit> realRentList = new ArrayList<WxBillOtherDeposit>(); | |||
| List<WxBillAction> actionList = new ArrayList<WxBillAction>(); | |||
| 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<WxBillOtherDeposit> 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); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -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<WxBillOther> listAsPage(WxBillOther record, Integer pageIndex, Integer pageSize) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | |||
| return getBillOtherPropertyList(pageIndex, pageSize, record, wxPayAccountBill); | |||
| } | |||
| @Override | |||
| public List<WxBillOther> list(WxBillOther record) { | |||
| updateQueryParam(record); | |||
| return wxBillOtherMapper.queryBillList(record); | |||
| } | |||
| @Override | |||
| public List<WxBillNotify> 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<Long> 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<Long> mids = wxMerchantService.findIdList(mq); | |||
| if (null != mids && mids.size() > 0 ) { | |||
| if (null != record.getMerchantIds()) { | |||
| List<Long> _mids = (List<Long>) 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<WxBillOther> getBillOtherPropertyList(Integer pageIndex, Integer pageSize,WxBillOther record,WxPayAccountBill wxPayAccountBill) { | |||
| updateQueryParam(record); | |||
| PageInfo<WxBillOther> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillOtherMapper.queryBillList(record)); | |||
| if (null == page) { | |||
| return null; | |||
| } | |||
| WxMerchant wq = new WxMerchant(); | |||
| wq.updateTenantInfo(record); | |||
| Map<Long,WxMerchant> 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<String, Object> 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<String, Object> 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<Map<String, Object>> 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<WxBillOther> 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<Long> notinidlist = new ArrayList<Long>(); | |||
| notinidlist.add(record.getId()); | |||
| otherQuery.setNotInIds(notinidlist); | |||
| List<WxBillOther> 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<WxBillOther> datalist = getBillOtherPropertyList(1, 10000, wxBillOther, wxPayAccountBill); | |||
| List<WxBillOther> list = null; | |||
| if (null != datalist && null != datalist.getList()) { | |||
| list = datalist.getList(); | |||
| }else { | |||
| list = new ArrayList<WxBillOther>(); | |||
| } | |||
| excelService.exportExcel(list, null, "其他费用账单", WxBillOther.class, "其他费用账单.xlsx", response, false); | |||
| } | |||
| @Override | |||
| public WxBillSum getBillMonthSum(WxBillOther wxBillOther) { | |||
| updateQueryParam(wxBillOther); | |||
| return wxBillOtherMapper.getBillMonthSum(wxBillOther); | |||
| } | |||
| @Override | |||
| public List<Long> 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<WxBillOther> brList = wxBillOtherMapper.findList(wxBillRent); | |||
| List<WxBillOther> realRentList = new ArrayList<WxBillOther>(); | |||
| List<WxBillAction> actionList = new ArrayList<WxBillAction>(); | |||
| 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<WxBillOther> 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); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -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<WxBillPropertyDeposit> listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | |||
| return getBillDepositPropertyList(wxPayAccountBill, record, pageIndex, pageSize); | |||
| } | |||
| @Override | |||
| public List<WxBillPropertyDeposit> list(WxBillPropertyDeposit record) { | |||
| updateQueryParam(record); | |||
| return wxBillPropertyDepositMapper.queryBillDepositList(record); | |||
| } | |||
| @Override | |||
| public List<WxBillNotify> 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<Long> 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<Long> mids = wxMerchantService.findIdList(mq); | |||
| if (null != mids && mids.size() > 0 ) { | |||
| if (null != record.getMerchantIds()) { | |||
| List<Long> _mids = (List<Long>) 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<WxBillPropertyDeposit> getBillDepositPropertyList(WxPayAccountBill wxPayAccountBill,WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize) { | |||
| updateQueryParam(record); | |||
| PageInfo<WxBillPropertyDeposit> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillPropertyDepositMapper.queryBillDepositList(record)); | |||
| if (null == page) { | |||
| return null; | |||
| } | |||
| WxMerchant wq = new WxMerchant(); | |||
| wq.updateTenantInfo(record); | |||
| Map<Long,WxMerchant> merchantMap = wxMerchantService.findMerchantMap(wq); | |||
| // WxShop sq = new WxShop(); | |||
| // sq.updateTenantInfo(record); | |||
| // Map<Long,WxShop> shopMap = wxShopService.findShopMap(sq); | |||
| if (null != page.getList()) { | |||
| for (int i = 0 ; i < page.getList().size() ; i ++) { | |||
| 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<String, Object> 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<String, Object> 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<WxBillPropertyDeposit> page = this.listAsPage(record, 1, 1); | |||
| WxBillPropertyDeposit deposit = null; | |||
| WxPropertyContract propertyContract = null; | |||
| if (null != page && null != page.getList()) { | |||
| deposit = page.getList().get(0); | |||
| propertyContract = wxPropertyContractMapper.selectById(deposit.getPropertyContractId()); | |||
| } | |||
| Map<String, Object> result = new HashMap<>(3); | |||
| result.put("deposit", deposit); | |||
| result.put("propertyContract", propertyContract); | |||
| return result; | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillPropertyDeposit record, MallUserInfo user) { | |||
| 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<Long> 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<WxBillPropertyDeposit> 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<WxBillPropertyDeposit> brList = wxBillPropertyDepositMapper.findList(br); | |||
| List<WxBillPropertyDeposit> realRentList = new ArrayList<WxBillPropertyDeposit>(); | |||
| List<WxBillAction> actionList = new ArrayList<WxBillAction>(); | |||
| 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<WxBillPropertyDeposit> 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); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -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<WxBillProperty> listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | |||
| return getBillPropertyList(pageIndex, pageSize, wxPayAccountBill, record); | |||
| } | |||
| @Override | |||
| public List<WxBillProperty> list(WxBillProperty record) { | |||
| updateQueryParam(record); | |||
| return wxBillPropertyMapper.queryBillPropertyList(record); | |||
| } | |||
| @Override | |||
| public List<WxBillNotify> 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<Long> 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<Long> 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<Long> mids = wxMerchantService.findIdList(mq); | |||
| if (null != mids && mids.size() > 0 ) { | |||
| if (null != record.getMerchantIds()) { | |||
| List<Long> _mids = (List<Long>) 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<WxBillProperty> getBillPropertyList(Integer pageIndex, Integer pageSize,WxPayAccountBill wxPayAccountBill,WxBillProperty record) { | |||
| updateQueryParam(record); | |||
| PageInfo<WxBillProperty> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillPropertyMapper.queryBillPropertyList(record)); | |||
| if (null == page) { | |||
| return null; | |||
| } | |||
| List<Long> propertyContractIdList = wxBillPropertyMapper.queryPropertyContractIdList(record); | |||
| Map<Long,WxPropertyContract> propertyContractMap = new HashMap<Long,WxPropertyContract>(); | |||
| // Map<Long,WxBillPropertyDeposit> billDepositMap = new HashMap<Long,WxBillPropertyDeposit>(); | |||
| if ( null != propertyContractIdList && propertyContractIdList.size() > 0 ) { | |||
| WxPropertyContract rcq = new WxPropertyContract(); | |||
| rcq.updateTenantInfo(record); | |||
| rcq.setIds(propertyContractIdList); | |||
| List<WxPropertyContract> 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<WxBillPropertyDeposit> bdlist = wxBillPropertyDepositMapper.findList(bdq); | |||
| // if (null != bdlist && bdlist.size() > 0 ) { | |||
| // for (int i = 0 ; i < bdlist.size(); i++) { | |||
| // WxBillPropertyDeposit rc = bdlist.get(i); | |||
| // billDepositMap.put(rc.getId(), rc); | |||
| // } | |||
| // } | |||
| } | |||
| WxMerchant wq = new WxMerchant(); | |||
| wq.updateTenantInfo(record); | |||
| Map<Long,WxMerchant> merchantMap = wxMerchantService.findMerchantMap(wq); | |||
| WxShop sq = new WxShop(); | |||
| sq.updateTenantInfo(record); | |||
| Map<Long,WxShop> shopMap = wxShopService.findShopMap(sq); | |||
| if (null != page.getList()) { | |||
| for (int i = 0 ; i < page.getList().size() ; i ++) { | |||
| 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<String, Object> 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<String, Object> 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<WxBillProperty> 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<WxBillProperty> 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<WxBillProperty> 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<WxBillPropertyDeposit> billDepositList = wxBillPropertyDepositMapper.queryBillDepositList(depositParam); | |||
| // if (!billDepositList.isEmpty()) { | |||
| // deposit = billDepositList.get(0); | |||
| // //WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(property.getTenantId()); | |||
| // //wxBillPropertyDepositService.computeTotalMoney(wxPayAccountBill, deposit); | |||
| // //deposit.setOwe(deposit.getRealReceivePay() - deposit.getPay()); | |||
| // } | |||
| Map<String, Object> result = new HashMap<>(2); | |||
| result.put("property", property); | |||
| result.put("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<WxBillProperty> billPropertyList = getBillPropertyList(1, 10000, wxPayAccountBill, wxBillProperty); | |||
| List<WxBillProperty> datalist = new ArrayList<>(); | |||
| if (null != billPropertyList && null != billPropertyList.getList()) { | |||
| Map<Long, List<WxBillProperty>> collect = billPropertyList.getList().parallelStream() | |||
| .collect(Collectors.groupingBy(WxBillProperty::getMerchantId)); | |||
| Set<Map.Entry<Long, List<WxBillProperty>>> entries = collect.entrySet(); | |||
| for (Map.Entry<Long, List<WxBillProperty>> entry : entries) { | |||
| List<WxBillProperty> 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<Map.Entry<String, Object>> 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<Long> 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<WxBillProperty> brList = wxBillPropertyMapper.findList(br); | |||
| List<WxBillProperty> realRentList = new ArrayList<WxBillProperty>(); | |||
| List<WxBillAction> actionList = new ArrayList<WxBillAction>(); | |||
| 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<WxBillProperty> 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); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -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<WxBillRentManage> listAsPage(WxBillRentManage wxBillRentManage, Integer pageIndex, Integer pageSize) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillRentManage); | |||
| return getBillRentManageList(pageIndex, pageSize, wxBillRentManage, wxPayAccountBill); | |||
| } | |||
| @Override | |||
| public List<WxBillRentManage> list(WxBillRentManage wxBillRentManage) { | |||
| updateQueryParam(wxBillRentManage); | |||
| return wxBillRentManageMapper.queryBillManageList(wxBillRentManage); | |||
| } | |||
| @Override | |||
| public List<WxBillNotify> 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<Long> 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<Long> mids = wxMerchantService.findIdList(mq); | |||
| if (null != mids && mids.size() > 0 ) { | |||
| if (null != wxBillRentManage.getMerchantIds()) { | |||
| List<Long> _mids = (List<Long>) 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<WxBillRentManage> getBillRentManageList(Integer pageIndex, Integer pageSize,WxBillRentManage wxBillRentManage,WxPayAccountBill wxPayAccountBill) { | |||
| updateQueryParam(wxBillRentManage); | |||
| PageInfo<WxBillRentManage> billRentList = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillRentManageMapper.queryBillManageList(wxBillRentManage)); | |||
| if (null == billRentList) { | |||
| return null; | |||
| } | |||
| List<Long> rentContractIdList = wxBillRentManageMapper.queryRentContractIds(wxBillRentManage); | |||
| Map<Long,WxRentContract> rentContractMap = new HashMap<Long,WxRentContract>(); | |||
| if ( null != rentContractIdList && rentContractIdList.size() > 0 ) { | |||
| WxRentContract rcq = new WxRentContract(); | |||
| rcq.updateTenantInfo(wxBillRentManage); | |||
| rcq.setIds(rentContractIdList); | |||
| List<WxRentContract> 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<WxBillRentManage> 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<String, Object> result = new HashMap<>(3); | |||
| result.put("manage", manage); | |||
| result.put("wxRentContract", wxRentContract); | |||
| return result; | |||
| } | |||
| @Override | |||
| public PageInfo<WxBillRentManage> findByRentContractId(WxBillRentManage record, Integer pageIndex, Integer pageSize) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | |||
| 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<String, Object> 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<String, Object> 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<WxBillRentManage> billRentList = getBillRentManageList(1, 10000, wxBillRentManage, wxPayAccountBill); | |||
| List<WxBillRentManage> datalist = new ArrayList<>(); | |||
| if (null != billRentList && null != billRentList.getList()) { | |||
| Map<Long, List<WxBillRentManage>> collect = billRentList.getList().parallelStream() | |||
| .collect(Collectors.groupingBy(WxBillRentManage::getMerchantId)); | |||
| Set<Map.Entry<Long, List<WxBillRentManage>>> entries = collect.entrySet(); | |||
| for (Map.Entry<Long, List<WxBillRentManage>> entry : entries) { | |||
| List<WxBillRentManage> 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<Map.Entry<String, Object>> 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<Long> 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<WxBillRentManage> brList = wxBillRentManageMapper.findList(br); | |||
| List<WxBillRentManage> realRentList = new ArrayList<WxBillRentManage>(); | |||
| List<WxBillAction> actionList = new ArrayList<WxBillAction>(); | |||
| 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<WxBillRentManage> 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); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -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<WxBillRent> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); | |||
| return getBillRentPropertyList(pageIndex,pageSize,record,wxPayAccountBill); | |||
| } | |||
| @Override | |||
| public List<WxBillRent> list(WxBillRent record) { | |||
| updateQueryParam(record); | |||
| return wxBillRentMapper.queryBillRentList(record); | |||
| } | |||
| @Override | |||
| public List<WxBillNotify> 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<String, Object> 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<String, Object> 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<WxBillRent> 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<WxBillRent> 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<WxBillDeposit> billDepositList = wxBillDepositMapper.queryBillDepositList(depositParam); | |||
| // if (!billDepositList.isEmpty()) { | |||
| // deposit = billDepositList.get(0); | |||
| // //WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(rent.getTenantId()); | |||
| // //wxBillDepositService.computeTotalMoney(wxPayAccountBill, deposit); | |||
| // //deposit.setOwe(deposit.getRealReceivePay() - deposit.getPay()); | |||
| // } | |||
| //周期 | |||
| Map<String, Object> result = new HashMap<>(3); | |||
| result.put("rent", rent); | |||
| 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<WxBillRent> billRentList = getBillRentPropertyList(1,10000,wxBillRent,wxPayAccountBill); | |||
| List<WxBillRent> datalist = new ArrayList<>(); | |||
| if (null != billRentList && null != billRentList.getList()) { | |||
| Map<Long, List<WxBillRent>> collect = billRentList.getList().parallelStream() | |||
| .collect(Collectors.groupingBy(WxBillRent::getMerchantId)); | |||
| Set<Map.Entry<Long, List<WxBillRent>>> entries = collect.entrySet(); | |||
| for (Map.Entry<Long, List<WxBillRent>> entry : entries) { | |||
| List<WxBillRent> 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<Map.Entry<String, Object>> 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<Long> 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<Long> 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<Long> mids = wxMerchantService.findIdList(mq); | |||
| if (null != mids && mids.size() > 0 ) { | |||
| if (null != wxBillRent.getMerchantIdList()) { | |||
| List<Long> _mids = (List<Long>) 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<WxBillRent> getBillRentPropertyList(Integer pageIndex, Integer pageSize,WxBillRent wxBillRent,WxPayAccountBill wxPayAccountBill) { | |||
| updateQueryParam(wxBillRent); | |||
| PageInfo<WxBillRent> billRentList = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillRentMapper.queryBillRentList(wxBillRent)); | |||
| if (null == billRentList) { | |||
| return null; | |||
| } | |||
| List<Long> rentContractIdList = wxBillRentMapper.queryBillRentContractIdList(wxBillRent); | |||
| Map<Long,WxRentContract> rentContractMap = new HashMap<Long,WxRentContract>(); | |||
| // Map<Long,WxBillDeposit> billDepositMap = new HashMap<Long,WxBillDeposit>(); | |||
| if ( null != rentContractIdList && rentContractIdList.size() > 0 ) { | |||
| WxRentContract rcq = new WxRentContract(); | |||
| rcq.updateTenantInfo(wxBillRent); | |||
| rcq.setIds(rentContractIdList); | |||
| List<WxRentContract> 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<WxBillDeposit> bdlist = wxBillDepositMapper.findList(bdq); | |||
| // if (null != bdlist && bdlist.size() > 0 ) { | |||
| // for (int i = 0 ; i < bdlist.size(); i++) { | |||
| // WxBillDeposit rc = bdlist.get(i); | |||
| // billDepositMap.put(rc.getId(), rc); | |||
| // } | |||
| // } | |||
| } | |||
| if (null != billRentList.getList()) { | |||
| 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<Long> 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<WxBillRent> brList = wxBillRentMapper.findList(br); | |||
| List<WxBillRent> realRentList = new ArrayList<WxBillRent>(); | |||
| List<WxBillAction> actionList = new ArrayList<WxBillAction>(); | |||
| 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<WxBillRent> 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); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -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<WxBillSettle> 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<WxBillSettle> 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<WxBillSettle> list = wxBillSettleMapper.findList(record); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| PageInfo<WxBillSettle> 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<WxBillSettleBill> 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<WxBillSettleBill> list = new ArrayList<>(); | |||
| // list.addAll(record.getReceiveBillIds()); | |||
| // list.addAll(record.getPayBillIds()); | |||
| // query.setReceiveBillIds(list); | |||
| // List<WxBillSettleBill> existList = wxBillSettleBillMapper.findExist(query); | |||
| // Set<Long> 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<WxBillSettle> list = wxBillSettleMapper.findList(wxBillSettle); | |||
| List<WxBillSettleVo> 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) { | |||
| } | |||
| } | |||
| @@ -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<String, Object> payinfo = wxBillRentMapper.queryPayInfo(params); | |||
| //Map<String, Object> payinfo = wxBillRentMapper.queryPayInfo(params); | |||
| Map<String, Object> 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<String, Object> payinfo = wxBillRentMapper.queryPayInfoTotal(params); | |||
| //Map<String, Object> payinfo = wxBillRentMapper.queryPayInfoTotal(params); | |||
| Map<String, Object> 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(); | |||
| @@ -77,7 +77,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| @Lazy | |||
| @Autowired | |||
| WxBillDailyService wxBillDailyService; | |||
| WxAllBillService wxAllBillService; | |||
| @Override | |||
| public PageInfo<WxEnergyMeter> meterListAsPage(WxEnergyMeter record, Integer pageIndex, Integer pageSize) { | |||
| @@ -915,7 +915,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| } | |||
| } | |||
| List<WxBillDaily> billList = new ArrayList<WxBillDaily>(); | |||
| List<WxAllBill> billList = new ArrayList<WxAllBill>(); | |||
| 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; | |||
| @@ -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; | |||
| @@ -349,7 +349,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| forcePaid = true; | |||
| } | |||
| wxBillAllService.updateReceivePay(wxBillAll, user,forcePaid); | |||
| //wxBillAllService.updateReceivePay(wxBillAll, user,forcePaid); | |||
| //账单修改金额,解冻 | |||
| List<WxBillSettleBill> billList = new ArrayList<>(); | |||
| @@ -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; | |||
| @@ -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) { | |||
| @@ -59,12 +59,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| @Autowired | |||
| WxShopMapper wxShopMapper; | |||
| @Autowired | |||
| WxBillPropertyMapper wxBillPropertyMapper; | |||
| @Autowired | |||
| WxBillPropertyDepositMapper wxBillPropertyDepositMapper; | |||
| @Autowired | |||
| WxMerchantMapper wxMerchantMapper; | |||
| @@ -13,6 +13,7 @@ | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | |||
| <result column="update_by" jdbcType="BIGINT" property="updateBy"/> | |||
| <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/> | |||
| <result column="price_detail" jdbcType="VARCHAR" property="priceDetail"/> | |||
| <result column="need_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| @@ -45,9 +46,9 @@ | |||
| <sql id="allColumns"> | |||
| `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` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -224,8 +225,8 @@ | |||
| <foreach collection="list" item="item" index="index" separator=","> | |||
| ( | |||
| #{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 id = "deleteById" parameterType="HashMap"> | |||
| delete from wx_all_bill where id = #{id} and tenant_id = #{tenantId} | |||
| </delete> | |||
| <delete id = "deleteEnergyReadingBills" parameterType="HashMap"> | |||
| 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 | |||
| </delete> | |||
| </mapper> | |||
| @@ -1,142 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxBillAdvanceMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillAdvance"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/> | |||
| <result column="create_by" jdbcType="BIGINT" property="createBy"/> | |||
| <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | |||
| <result column="update_by" jdbcType="BIGINT" property="updateBy"/> | |||
| <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/> | |||
| <result column="pay_way" jdbcType="BIGINT" property="payWay"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate"/> | |||
| <result column="set_off" jdbcType="VARCHAR" property="setOff"/> | |||
| <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/> | |||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | |||
| <result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="advance_id" jdbcType="BIGINT" property="advanceId"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `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` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != energyFeesId ">and `energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != advanceId ">and `advance_id` = #{advanceId}</if> | |||
| <if test=" null != receivePay ">and `receive_pay` = #{receivePay}</if> | |||
| <if test=" null != pay ">and `pay` = #{pay}</if> | |||
| <if test=" null != payDate ">and `pay_date` = #{payDate}</if> | |||
| <if test=" null != createtime ">and `createtime` = #{createtime}</if> | |||
| <if test=" null != status ">and `status` = #{status}</if> | |||
| <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if> | |||
| <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if> | |||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | |||
| <if test=" null != starttime ">and `starttime` = #{starttime}</if> | |||
| <if test=" null != endtime ">and `endtime` = #{endtime}</if> | |||
| <if test=" null != endtimeBegin "> | |||
| and endtime >= #{endtimeBegin} | |||
| </if> | |||
| <if test=" null != endtimeEnd"> | |||
| and endtime < #{endtimeEnd} | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillAdvance" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_bill_advance | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_bill_advance where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <sql id="queryBillListCondition"> | |||
| <where> | |||
| 1 = 1 | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> and br.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId">and br.`parent_tenant_id` = #{parentTenantId}</if> | |||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != status ">and br.`status` = #{status}</if> | |||
| <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | |||
| <if test=" null != energyFeesId ">and br.`energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != advanceId ">and br.`advance_id` = #{advanceId}</if> | |||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | |||
| <if test=" null != starttime">and br.`starttime` <= #{starttime}</if> | |||
| <if test=" null != endtime">and br.`endtime` >= #{endtime}</if> | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null != merchantIdList "> | |||
| and br.`merchant_id` in | |||
| <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")"> | |||
| #{midItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and br.`status` in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| </where> | |||
| </sql> | |||
| <select id="queryBillRentList" parameterType="com.iformall.domain.po.WxBillAdvance" resultMap="BaseResultMap"> | |||
| br.`id`,br.`tenant_id`,br.`parent_tenant_id`,br.`merchant_id`,br.`rent_shop_type`,br.`createtime`,br.`create_by`,br.`create_by_name`,br.`updatetime`,br.`advance_id`, | |||
| br.`update_by`,br.`update_by_name`,br.`pay_way`,br.`pay`,br.`receive_pay`,br.`pay_date`,br.`set_off`,br.`starttime`,br.`endtime`,br.`energy_fees_id`,br.`remark` | |||
| from wx_bill_advance br | |||
| <include refid="queryBillListCondition"/> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| <if test="null != limitStart and null != limitEnd"> | |||
| limit #{limitStart},#{limitEnd} | |||
| </if> | |||
| </select> | |||
| <select id="getMerchantIdList" parameterType="com.iformall.domain.po.WxBillAdvance" resultType="Long"> | |||
| select distinct merchant_id from wx_bill_advance br | |||
| <include refid="queryBillListCondition"/> | |||
| </select> | |||
| <delete id = "deleteById" parameterType="HashMap"> | |||
| delete from wx_bill_advance where id = #{id} and tenant_id = #{tenantId} | |||
| </delete> | |||
| </mapper> | |||
| @@ -1,291 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxBillDailyMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillDaily"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate" /> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate" /> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime" /> | |||
| <result column="create_by" jdbcType="BIGINT" property="createBy"/> | |||
| <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/> | |||
| <result column="update_by" jdbcType="BIGINT" property="updateBy"/> | |||
| <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/> | |||
| <result column="expired_day" jdbcType="INTEGER" property="expiredDay" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/> | |||
| <result column="apply_pay_img" jdbcType="INTEGER" property="applyPayImg"/> | |||
| <result column="apply_update_time" jdbcType="INTEGER" property="applyUpdateTime"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel" /> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| <result column="user_id" jdbcType="BIGINT" property="userId" /> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId" /> | |||
| <result column="shop_name" jdbcType="VARCHAR" property="shopName" /> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" /> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | |||
| <result column="pay_way" jdbcType="BIGINT" property="payWay"/> | |||
| <result column="price_detail" jdbcType="VARCHAR" property="priceDetail"/> | |||
| <result column="starttime" property="starttime"/> | |||
| <result column="endtime" property="endtime"/> | |||
| <result column="last_owe_call_time" jdbcType="TIMESTAMP" property="lastOweCallTime"/> | |||
| <result column="last_owe_call_user" jdbcType="VARCHAR" property="lastOweCallUser"/> | |||
| <result column="freeze" property="freeze"/> | |||
| <result column="build_way" property="buildWay"/> | |||
| <result column="service_charge_pay" property="serviceChargePay"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="energy_reading_calcuteId" jdbcType="BIGINT" property="energyReadingCalcuteId" /> | |||
| <result column="energy_reading_id" jdbcType="BIGINT" property="energyReadingId" /> | |||
| <result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/> | |||
| <result column="set_off" jdbcType="VARCHAR" property="setOff"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `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` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if> | |||
| <if test=" null != pay "> and `pay` = #{pay} </if> | |||
| <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if> | |||
| <if test=" null != payDate "> and `pay_date` = #{payDate} </if> | |||
| <if test=" null != createtime "> and `createtime` = #{createtime} </if> | |||
| <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != status "> and `status` = #{status} </if> | |||
| <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isDel "> and `is_del` = #{isDel} </if> | |||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||
| <if test=" null != energyFeesId ">and `energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != userId "> and `user_id` = #{userId} </if> | |||
| <if test=" null != updatetime "> and `updatetime` = #{updatetime} </if> | |||
| <if test=" null != type "> and `type` = #{type} </if> | |||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | |||
| <if test=" null != buildWay ">and `build_way` = #{buildWay}</if> | |||
| <if test=" null != energyReadingCalcuteId ">and `energy_reading_calcuteId` = #{energyReadingCalcuteId}</if> | |||
| <if test=" null != energyReadingId ">and `energy_reading_id` = #{energyReadingId}</if> | |||
| <if test=" 1 == notifyed ">and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) )</if> | |||
| <if test=" null != statusList "> | |||
| and status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != notInIds "> | |||
| and id not in | |||
| <foreach collection="notInIds" index="index" item="nidItem" open="(" separator="," close=")"> | |||
| #{nidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillDaily" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_bill_daily | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_bill_daily | |||
| where id = #{id} and tenant_id = #{tenantId} | |||
| </select> | |||
| <sql id = "queryBillDailyListConditions" > | |||
| <where> | |||
| 1 = 1 | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> and br.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId">and br.`parent_tenant_id` = #{parentTenantId}</if> | |||
| <if test=" null != freeze ">and br.`freeze` = #{freeze}</if> | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | |||
| <if test=" null != energyFeesId ">and br.`energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != status ">and br.`status` = #{status}</if> | |||
| <if test=" null != applyStatus ">and br.`apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isDel ">and br.`is_del` = #{isDel}</if> | |||
| <if test=" null != type ">and br.`type` = #{type}</if> | |||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | |||
| <if test=" null != starttime">and br.`starttime` <= #{starttime}</if> | |||
| <if test=" null != endtime">and br.`endtime` >= #{endtime}</if> | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| 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)) | |||
| </if> | |||
| <if test=" null != needPayStartDay"> | |||
| and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" null != buildWay ">and br.`build_way` = #{buildWay}</if> | |||
| <if test=" null != energyReadingCalcuteId ">and br.`energy_reading_calcuteId` = #{energyReadingCalcuteId}</if> | |||
| <if test=" null != energyReadingId ">and br.`energy_reading_id` = #{energyReadingId}</if> | |||
| <if test=" 1 == notifyed ">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) )</if> | |||
| <if test=" null != merchantIds "> | |||
| and br.`merchant_id` in | |||
| <foreach collection="merchantIds" index="index" item="midItem" open="(" separator="," close=")"> | |||
| #{midItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != notInIds "> | |||
| and br.`id` not in | |||
| <foreach collection="notInIds" index="index" item="nidItem" open="(" separator="," close=")"> | |||
| #{nidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and br.status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| </where> | |||
| </sql> | |||
| <select id="queryBillDailyList" parameterType="com.iformall.domain.po.WxBillDaily" resultMap="BaseResultMap"> | |||
| select br.`id`,br.`tenant_id`,br.`parent_tenant_id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day` , | |||
| br.`status`,br.`updatetime`,br.`merchant_id`,br.shop_id,br.`last_owe_call_time`,br.`last_owe_call_user`,br.`set_off`, | |||
| br.shop_name,br.type,br.`rent_shop_type`,br.pay_way,br.price_detail,br.`starttime`,br.`endtime`,br.`build_way`, | |||
| br.freeze,br.service_charge_pay,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,br.`remark`,br.`energy_fees_id`, | |||
| br.`create_by`,br.`create_by_name`,br.`update_by`,br.`update_by_name`,br.`energy_reading_calcuteId`,br.`energy_reading_id` | |||
| from wx_bill_daily br | |||
| <include refid="queryBillDailyListConditions" /> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <if test=" null == sortColumns">order by id desc</if> | |||
| </select> | |||
| <resultMap id="SumBaseResultMap" type="com.iformall.domain.vo.WxBillSum"> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="paid" jdbcType="VARCHAR" property="paid" /> | |||
| <result column="min_date" jdbcType="TIMESTAMP" property="minDate" /> | |||
| <result column="max_date" jdbcType="TIMESTAMP" property="maxDate" /> | |||
| <result column="service_pay" jdbcType="VARCHAR" property="servicePay"/> | |||
| <result column="late_pay" jdbcType="VARCHAR" property="latePay"/> | |||
| <result column="return_pay" jdbcType="VARCHAR" property="returnPay"/> | |||
| </resultMap> | |||
| <select id="getBillMonthSum" parameterType="com.iformall.domain.po.WxBillDaily" resultMap="SumBaseResultMap"> | |||
| select | |||
| sum(CAST(br.receive_pay AS DECIMAL(20,2))) receive_pay , | |||
| sum(CAST(br.pay AS DECIMAL(20,2))) paid, | |||
| min(starttime) min_date, | |||
| max(endtime) max_date, | |||
| sum(CAST(br.service_charge_pay AS DECIMAL(20,2))) service_pay , | |||
| '0' late_pay, | |||
| '0' return_pay | |||
| from wx_bill_daily br | |||
| <include refid="queryBillDailyListConditions"/> | |||
| </select> | |||
| <select id="getMerchantIdList" parameterType="com.iformall.domain.po.WxBillDaily" resultType="Long"> | |||
| select distinct merchant_id from wx_bill_daily br | |||
| <include refid="queryBillDailyListConditions"/> | |||
| </select> | |||
| <resultMap id="HotNotifyBaseResultMap" type="com.iformall.domain.vo.WxBillHotNotify"> | |||
| <result column="total_count" jdbcType="INTEGER" property="totalCount"/> | |||
| <result column="total_money" jdbcType="VARCHAR" property="totalMoney" /> | |||
| <result column="min_begin_time" jdbcType="TIMESTAMP" property="minBeginTime"/> | |||
| </resultMap> | |||
| <select id="getBillHotNotify" parameterType="com.iformall.domain.po.WxBillDaily" resultMap="HotNotifyBaseResultMap"> | |||
| select count(1) total_count , sum(CAST(br.`receive_pay` AS DECIMAL(20,2)) - CAST(br.`pay` AS DECIMAL(20,2)) - CAST(IFNULL(br.`set_off`,'0') AS DECIMAL(20,2))) total_money,MIN(br.starttime) min_begin_time from wx_bill_daily br | |||
| <include refid="queryBillDailyListConditions"/> | |||
| </select> | |||
| <resultMap id="NotifyResultMap" type="com.iformall.domain.vo.WxBillNotify"> | |||
| <result column="bill_type" jdbcType="INTEGER" property="billType"/> | |||
| <result column="bill_type_name" jdbcType="VARCHAR" property="billTypeName" /> | |||
| <result column="bill_id" jdbcType="BIGINT" property="billId" /> | |||
| <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/> | |||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| </resultMap> | |||
| <select id="getBillNotifyList" parameterType="com.iformall.domain.po.WxBillDaily" resultMap="NotifyResultMap"> | |||
| select #{billType} bill_type,#{billTypeName} bill_type_name,br.id as bill_id, br.starttime,br.endtime,br.receive_pay,br.pay,br.merchant_id from wx_bill_daily br | |||
| <include refid="queryBillDailyListConditions"/> | |||
| </select> | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| update wx_bill_daily set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | |||
| where status!=#{paid} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and DATEDIFF(now(),receive_date)>0 | |||
| </update> | |||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||
| update wx_bill_daily set status=#{waitPay} where status!=#{paid} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and DATEDIFF(now(),receive_date) <=0 | |||
| </update> | |||
| <delete id = "deleteById" parameterType="HashMap"> | |||
| delete from wx_bill_daily where id = #{id} and tenant_id = #{tenantId} | |||
| </delete> | |||
| <insert id="insertBills" parameterType="HashMap"> | |||
| 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 | |||
| <foreach collection="list" item="item" index="index" separator=","> | |||
| ( | |||
| #{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} | |||
| ) | |||
| </foreach> | |||
| </insert> | |||
| <delete id = "deleteEnergyReadingBills" parameterType="HashMap"> | |||
| 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> | |||
| <delete id="deleteNoNeedPayBill" parameterType="com.iformall.domain.po.WxBillDaily"> | |||
| 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 | |||
| </delete> | |||
| </mapper> | |||
| @@ -1,394 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxBillDepositMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillDeposit"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="rent_contract_id" jdbcType="BIGINT" property="rentContractId" /> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate" /> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate" /> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime" /> | |||
| <result column="create_by" jdbcType="BIGINT" property="createBy"/> | |||
| <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/> | |||
| <result column="update_by" jdbcType="BIGINT" property="updateBy"/> | |||
| <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/> | |||
| <result column="expired_day" jdbcType="BIGINT" property="expiredDay" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/> | |||
| <result column="apply_pay_img" jdbcType="INTEGER" property="applyPayImg"/> | |||
| <result column="apply_update_time" jdbcType="INTEGER" property="applyUpdateTime"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel" /> | |||
| <result column="need_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| <result column="user_id" jdbcType="BIGINT" property="userId" /> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId" /> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" /> | |||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | |||
| <result column="return_price" jdbcType="VARCHAR" property="returnPrice"/> | |||
| <result column="pay_way" jdbcType="BIGINT" property="payWay"/> | |||
| <result column="service_charge_pay" property="serviceChargePay"/> | |||
| <result column="shop_info" property="shopInfo"/> | |||
| <result column="freeze" property="freeze"/> | |||
| <result column="merchant_name" property="merchantName"/> | |||
| <result column="shop_number" property="shopNumber"/> | |||
| <result column="contract_depoist_detail" property="contractDepoistDetail"/> | |||
| <result column="last_owe_call_time" jdbcType="TIMESTAMP" property="lastOweCallTime"/> | |||
| <result column="last_owe_call_user" jdbcType="VARCHAR" property="lastOweCallUser"/> | |||
| <result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/> | |||
| <result column="set_off" jdbcType="VARCHAR" property="setOff"/> | |||
| <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/> | |||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `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` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != rentContractId "> and `rent_contract_id` = #{rentContractId} </if> | |||
| <if test=" null != energyFeesId ">and `energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if> | |||
| <if test=" null != pay "> and `pay` = #{pay} </if> | |||
| <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if> | |||
| <if test=" null != payDate "> and `pay_date` = #{payDate} </if> | |||
| <if test=" null != createtime "> and `createtime` = #{createtime} </if> | |||
| <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if> | |||
| <if test=" null != status "> and `status` = #{status} </if> | |||
| <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isDel "> and `is_del` = #{isDel} </if> | |||
| <if test=" null != needPay "> and `need_pay` = #{needPay} </if> | |||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||
| <if test=" null != userId "> and `user_id` = #{userId} </if> | |||
| <if test=" null != shopId "> and `shop_id` = #{shopId} </if> | |||
| <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if> | |||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | |||
| <if test=" null != contractDepoistDetail and '' != contractDepoistDetail"> | |||
| and `contract_depoist_detail` like concat('%', #{contractDepoistDetail},'%') | |||
| </if> | |||
| <if test=" null != starttime">and `starttime` <= #{starttime}</if> | |||
| <if test=" null != endtime">and `endtime` >= #{endtime}</if> | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(starttime,'%Y-%m') <= #{month} and date_format(endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (`starttime` <= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7)) | |||
| </if> | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| and (`starttime` > #{oweBillLastTime} and `starttime` <= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7)) | |||
| </if> | |||
| <if test=" 1 == notifyed ">and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) )</if> | |||
| <if test=" null != merchantIds "> | |||
| and `merchant_id` in | |||
| <foreach collection="merchantIds" index="index" item="midItem" open="(" separator="," close=")"> | |||
| #{midItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != rentContractIdList "> | |||
| and rent_contract_id in | |||
| <foreach collection="rentContractIdList" index="index" item="rdItem" open="(" separator="," close=")"> | |||
| #{rdItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillDeposit" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_bill_rent_deposit | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_bill_rent_deposit | |||
| where id = #{id} and tenant_id = #{tenantId} | |||
| </select> | |||
| <select id="findRentContractIds" parameterType="com.iformall.domain.po.WxBillDeposit" resultType="Long"> | |||
| select distinct rent_contract_id from wx_bill_rent_deposit | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="queryBillDepositList" parameterType="com.iformall.domain.po.WxBillDeposit" resultMap="BaseResultMap"> | |||
| select br.`id`,br.`tenant_id`,br.`parent_tenant_id`,br.`rent_contract_id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`,br.`last_owe_call_time`, | |||
| br.`status`,br.`need_pay`,br.`updatetime`,br.`merchant_id`,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,br.`contract_depoist_detail`,br.`last_owe_call_user`,br.`set_off`, | |||
| br.`rent_shop_type`,br.`return_price`, br.pay_way,br.shop_info ,br.freeze,br.service_charge_pay,br.`create_by`,br.`create_by_name`,br.`update_by`,br.`update_by_name`,br.`energy_fees_id`, | |||
| br.`starttime`,br.`endtime` | |||
| from wx_bill_rent_deposit br | |||
| <include refid="queryBillRentListCondition"/> | |||
| order by br.id desc | |||
| </select> | |||
| <sql id="queryBillRentListCondition"> | |||
| <where> | |||
| 1 = 1 | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and br.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and br.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != status ">and br.`status` = #{status}</if> | |||
| <if test=" null != applyStatus ">and br.`apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isDel ">and br.`is_del` = #{isDel}</if> | |||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != rentContractId ">and br.`rent_contract_id` = #{rentContractId}</if> | |||
| <if test=" null != energyFeesId ">and br.`energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | |||
| <if test=" null != contractDepoistDetail and '' != contractDepoistDetail"> | |||
| and br.`contract_depoist_detail` like concat('%', #{contractDepoistDetail},'%') | |||
| </if> | |||
| <if test=" null != starttime">and br.`starttime` <= #{starttime}</if> | |||
| <if test=" null != endtime">and br.`endtime` >= #{endtime}</if> | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| 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)) | |||
| </if> | |||
| <if test=" null != needPayStartDay"> | |||
| and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" 1 == notifyed ">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) )</if> | |||
| <if test=" null != merchantIds "> | |||
| and br.`merchant_id` in | |||
| <foreach collection="merchantIds" index="index" item="midItem" open="(" separator="," close=")"> | |||
| #{midItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and br.status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| </where> | |||
| </sql> | |||
| <resultMap id="SumBaseResultMap" type="com.iformall.domain.vo.WxBillSum"> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="paid" jdbcType="VARCHAR" property="paid" /> | |||
| <result column="min_date" jdbcType="TIMESTAMP" property="minDate" /> | |||
| <result column="max_date" jdbcType="TIMESTAMP" property="maxDate" /> | |||
| <result column="service_pay" jdbcType="VARCHAR" property="servicePay"/> | |||
| <result column="late_pay" jdbcType="VARCHAR" property="latePay"/> | |||
| <result column="return_pay" jdbcType="VARCHAR" property="returnPay"/> | |||
| </resultMap> | |||
| <select id="getBillMonthSum" parameterType="com.iformall.domain.po.WxBillDeposit" resultMap="SumBaseResultMap"> | |||
| select | |||
| sum(CAST(br.receive_pay AS DECIMAL(20,2))) receive_pay , | |||
| sum(CAST(br.pay AS DECIMAL(20,2))) paid, | |||
| min(starttime) min_date, | |||
| max(endtime) max_date, | |||
| sum(CAST(br.service_charge_pay AS DECIMAL(20,2))) service_pay , | |||
| '0' late_pay, | |||
| sum(CAST(br.return_price AS DECIMAL(20,2))) as return_pay | |||
| from wx_bill_rent_deposit br | |||
| <include refid="queryBillRentListCondition"/> | |||
| </select> | |||
| <select id="getMerchantIdList" parameterType="com.iformall.domain.po.WxBillDeposit" resultType="Long"> | |||
| select distinct merchant_id from wx_bill_rent_deposit br | |||
| <include refid="queryBillRentListCondition"/> | |||
| </select> | |||
| <resultMap id="HotNotifyBaseResultMap" type="com.iformall.domain.vo.WxBillHotNotify"> | |||
| <result column="total_count" jdbcType="INTEGER" property="totalCount"/> | |||
| <result column="total_money" jdbcType="VARCHAR" property="totalMoney" /> | |||
| <result column="min_begin_time" jdbcType="TIMESTAMP" property="minBeginTime"/> | |||
| </resultMap> | |||
| <select id="getBillHotNotify" parameterType="com.iformall.domain.po.WxBillDeposit" resultMap="HotNotifyBaseResultMap"> | |||
| select count(1) total_count , sum(CAST(br.`receive_pay` AS DECIMAL(20,2)) - CAST(br.`pay` AS DECIMAL(20,2)) - CAST(IFNULL(br.`set_off`,'0') AS DECIMAL(20,2))) total_money,MIN(br.starttime) min_begin_time from wx_bill_rent_deposit br | |||
| <include refid="queryBillRentListCondition"/> | |||
| </select> | |||
| <resultMap id="NotifyResultMap" type="com.iformall.domain.vo.WxBillNotify"> | |||
| <result column="bill_type" jdbcType="INTEGER" property="billType"/> | |||
| <result column="bill_type_name" jdbcType="VARCHAR" property="billTypeName" /> | |||
| <result column="bill_id" jdbcType="BIGINT" property="billId" /> | |||
| <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/> | |||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| </resultMap> | |||
| <select id="getBillNotifyList" parameterType="com.iformall.domain.po.WxBillDeposit" resultMap="NotifyResultMap"> | |||
| select #{billType} bill_type,#{billTypeName} bill_type_name,br.id as bill_id, br.starttime,br.endtime,br.receive_pay,br.pay,br.merchant_id from wx_bill_rent_deposit br | |||
| <include refid="queryBillRentListCondition"/> | |||
| </select> | |||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id,parent_tenant_id from wx_bill_rent_deposit | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and date_format(receive_date,'%Y-%m')=#{receiveDate} | |||
| group by tenant_id,parent_tenant_id | |||
| </select> | |||
| <select id="queryPayInfoAllTotal" resultType="hashmap" parameterType="hashmap"> | |||
| select round(sum(res.receivepay)/100,2) receivepay,round(sum(res.pay)/100,2) pay,res.tenant_id from | |||
| ( | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent_deposit | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| union all | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property_deposit | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| union all | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_other_deposit | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| ) res | |||
| </select> | |||
| <select id="queryOweInfoAll" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(round(sum(res.owe)/100,2),0) owe,res.tenant_id from | |||
| ( | |||
| select IFNULL(sum(receive_pay - pay),0) owe,tenant_id from wx_bill_rent_deposit | |||
| where status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| union all | |||
| select IFNULL(sum(receive_pay - pay),0) owe,tenant_id from wx_bill_property_deposit | |||
| where status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| union all | |||
| select IFNULL(sum(receive_pay - pay),0) owe,tenant_id from wx_bill_other_deposit | |||
| where status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| ) res | |||
| </select> | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| update wx_bill_rent_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | |||
| where status!=#{paid} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and status!=5 and DATEDIFF(now(),receive_date)>0 | |||
| </update> | |||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||
| 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} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and br.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and br.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and br.status!=5 and now() < br.receive_date | |||
| and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | |||
| </update> | |||
| <select id="queryOweCount" parameterType="com.iformall.domain.po.WxRentContract" resultType="Long"> | |||
| select count(*) c from wx_rent_contract r,wx_bill_rent_deposit b | |||
| where b.rent_contract_id = r.id and b.status = 1 and r.id = #{id} | |||
| </select> | |||
| <delete id = "deleteById" parameterType="HashMap"> | |||
| delete from wx_bill_rent_deposit where id = #{id} and tenant_id = #{tenantId} | |||
| </delete> | |||
| <insert id="insertBills" parameterType="hashmap"> | |||
| 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 | |||
| <foreach collection="list" item="item" index="index" separator=","> | |||
| ( | |||
| #{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} | |||
| ) | |||
| </foreach> | |||
| </insert> | |||
| <delete id="deleteNoNeedPayBill" parameterType="com.iformall.domain.po.WxBillDeposit"> | |||
| 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 | |||
| </delete> | |||
| </mapper> | |||
| @@ -1,271 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxBillOtherDepositMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillOtherDeposit"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate"/> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate"/> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/> | |||
| <result column="create_by" jdbcType="BIGINT" property="createBy"/> | |||
| <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/> | |||
| <result column="update_by" jdbcType="BIGINT" property="updateBy"/> | |||
| <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/> | |||
| <result column="expired_day" jdbcType="INTEGER" property="expiredDay"/> | |||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/> | |||
| <result column="apply_pay_img" jdbcType="INTEGER" property="applyPayImg"/> | |||
| <result column="apply_update_time" jdbcType="INTEGER" property="applyUpdateTime"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="user_id" jdbcType="BIGINT" property="userId"/> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | |||
| <result column="shop_name" jdbcType="VARCHAR" property="shopName" /> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | |||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||
| <result column="comments" jdbcType="VARCHAR" property="comments"/> | |||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | |||
| <result column="return_price" jdbcType="VARCHAR" property="returnPrice"/> | |||
| <result column="pay_way" jdbcType="BIGINT" property="payWay"/> | |||
| <result column="last_owe_call_time" jdbcType="TIMESTAMP" property="lastOweCallTime"/> | |||
| <result column="last_owe_call_user" jdbcType="VARCHAR" property="lastOweCallUser"/> | |||
| <result column="merchant_name" property="merchantName"/> | |||
| <result column="starttime" property="starttime"/> | |||
| <result column="endtime" property="endtime"/> | |||
| <result column="freeze" property="freeze"/> | |||
| <result column="service_charge_pay" property="serviceChargePay"/> | |||
| <result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/> | |||
| <result column="set_off" jdbcType="VARCHAR" property="setOff"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `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` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != receivePay ">and `receive_pay` = #{receivePay}</if> | |||
| <if test=" null != pay ">and `pay` = #{pay}</if> | |||
| <if test=" null != receiveDate ">and `receive_date` = #{receiveDate}</if> | |||
| <if test=" null != payDate ">and `pay_date` = #{payDate}</if> | |||
| <if test=" null != createtime ">and `createtime` = #{createtime}</if> | |||
| <if test=" null != expiredDay ">and `expired_day` = #{expiredDay}</if> | |||
| <if test=" null != status ">and `status` = #{status}</if> | |||
| <if test=" null != energyFeesId ">and `energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||
| <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if> | |||
| <if test=" null != userId ">and `user_id` = #{userId}</if> | |||
| <if test=" null != starttime">and `starttime` <= #{starttime}</if> | |||
| <if test=" null != endtime">and `endtime` >= #{endtime}</if> | |||
| <if test=" null != shopId ">and `shop_id` = #{shopId}</if> | |||
| <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if> | |||
| <if test=" null != name ">and `name` = #{name}</if> | |||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | |||
| <if test=" 1 == notifyed ">and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) )</if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != notInIds "> | |||
| and id not in | |||
| <foreach collection="notInIds" index="index" item="nidItem" open="(" separator="," close=")"> | |||
| #{nidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillOtherDeposit" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_bill_other_deposit | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_bill_other_deposit | |||
| where id = #{id} and tenant_id = #{tenantId} | |||
| </select> | |||
| <sql id ="queryBillListConditions"> | |||
| <where> | |||
| 1 = 1 | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> and br.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId">and br.`parent_tenant_id` = #{parentTenantId}</if> | |||
| <if test=" null != freeze ">and br.`freeze` = #{freeze}</if> | |||
| <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | |||
| <if test=" null != status ">and br.`status` = #{status}</if> | |||
| <if test=" null != applyStatus ">and br.`apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isDel ">and br.`is_del` = #{isDel}</if> | |||
| <if test=" null != energyFeesId ">and br.`energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != name and ''!=name">and br.`name` = #{name}</if> | |||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | |||
| <if test=" null != comments and ''!=comments">and br.`comments` like concat('%',#{comments},'%')</if> | |||
| <if test=" null != starttime">and br.`starttime` <= #{starttime}</if> | |||
| <if test=" null != endtime">and br.`endtime` >= #{endtime}</if> | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| 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)) | |||
| </if> | |||
| <if test=" null != needPayStartDay"> | |||
| and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" 1 == notifyed ">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) )</if> | |||
| <if test=" null != merchantIds "> | |||
| and br.`merchant_id` in | |||
| <foreach collection="merchantIds" index="index" item="midItem" open="(" separator="," close=")"> | |||
| #{midItem} | |||
| </foreach> | |||
| <if test=" null != notInIds "> | |||
| and br.id not in | |||
| <foreach collection="notInIds" index="index" item="nidItem" open="(" separator="," close=")"> | |||
| #{nidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and br.status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| </if> | |||
| </where> | |||
| </sql> | |||
| <select id="queryBillList" parameterType="com.iformall.domain.po.WxBillOtherDeposit" resultMap="BaseResultMap"> | |||
| select br.`id`,br.`tenant_id`,br.`parent_tenant_id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`,br.`last_owe_call_user`,br.`set_off`, | |||
| br.`status`,br.shop_name,br.`updatetime`,br.`return_price`,br.`merchant_id`,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,br.`last_owe_call_time`,br.`energy_fees_id`, | |||
| br.shop_id,br.name,br.comments,br.`rent_shop_type`,br.pay_way,br.`starttime`,br.`endtime`,br.freeze,br.service_charge_pay,br.`create_by`,br.`create_by_name`,br.`update_by`,br.`update_by_name` | |||
| from wx_bill_other_deposit br | |||
| <include refid="queryBillListConditions"/> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <if test=" null == sortColumns"> order by id desc </if> | |||
| </select> | |||
| <resultMap id="SumBaseResultMap" type="com.iformall.domain.vo.WxBillSum"> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="paid" jdbcType="VARCHAR" property="paid" /> | |||
| <result column="min_date" jdbcType="TIMESTAMP" property="minDate" /> | |||
| <result column="max_date" jdbcType="TIMESTAMP" property="maxDate" /> | |||
| <result column="service_pay" jdbcType="VARCHAR" property="servicePay"/> | |||
| <result column="late_pay" jdbcType="VARCHAR" property="latePay"/> | |||
| <result column="return_pay" jdbcType="VARCHAR" property="returnPay"/> | |||
| </resultMap> | |||
| <select id="getBillMonthSum" parameterType="com.iformall.domain.po.WxBillOtherDeposit" resultMap="SumBaseResultMap"> | |||
| select | |||
| sum(CAST(br.receive_pay AS DECIMAL(20,2))) receive_pay , | |||
| sum(CAST(br.pay AS DECIMAL(20,2))) paid, | |||
| min(starttime) min_date, | |||
| max(endtime) max_date, | |||
| sum(CAST(br.service_charge_pay AS DECIMAL(20,2))) service_pay , | |||
| '0' late_pay, | |||
| sum(CAST(br.return_price AS DECIMAL(20,2))) return_pay | |||
| from wx_bill_other_deposit br | |||
| <include refid="queryBillListConditions"/> | |||
| </select> | |||
| <select id="getMerchantIdList" parameterType="com.iformall.domain.po.WxBillOtherDeposit" resultType="Long"> | |||
| select distinct merchant_id from wx_bill_other_deposit br | |||
| <include refid="queryBillListConditions"/> | |||
| </select> | |||
| <resultMap id="HotNotifyBaseResultMap" type="com.iformall.domain.vo.WxBillHotNotify"> | |||
| <result column="total_count" jdbcType="INTEGER" property="totalCount"/> | |||
| <result column="total_money" jdbcType="VARCHAR" property="totalMoney" /> | |||
| <result column="min_begin_time" jdbcType="TIMESTAMP" property="minBeginTime"/> | |||
| </resultMap> | |||
| <select id="getBillHotNotify" parameterType="com.iformall.domain.po.WxBillOtherDeposit" resultMap="HotNotifyBaseResultMap"> | |||
| select count(1) total_count , sum(CAST(br.`receive_pay` AS DECIMAL(20,2)) - CAST(br.`pay` AS DECIMAL(20,2)) - CAST(IFNULL(br.`set_off`,'0') AS DECIMAL(20,2))) total_money,MIN(br.starttime) min_begin_time from wx_bill_other_deposit br | |||
| <include refid="queryBillListConditions"/> | |||
| </select> | |||
| <resultMap id="NotifyResultMap" type="com.iformall.domain.vo.WxBillNotify"> | |||
| <result column="bill_type" jdbcType="INTEGER" property="billType"/> | |||
| <result column="bill_type_name" jdbcType="VARCHAR" property="billTypeName" /> | |||
| <result column="bill_id" jdbcType="BIGINT" property="billId" /> | |||
| <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/> | |||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| </resultMap> | |||
| <select id="getBillNotifyList" parameterType="com.iformall.domain.po.WxBillOtherDeposit" resultMap="NotifyResultMap"> | |||
| select #{billType} bill_type,#{billTypeName} bill_type_name,br.id as bill_id, br.starttime,br.endtime,br.receive_pay,br.pay,br.merchant_id from wx_bill_other_deposit br | |||
| <include refid="queryBillListConditions"/> | |||
| </select> | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| update wx_bill_other_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | |||
| where status!=#{paid} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and status!=5 and DATEDIFF(now(),receive_date)>0 | |||
| </update> | |||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||
| update wx_bill_other_deposit set status=#{waitPay} | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and status!=5 | |||
| and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 | |||
| </update> | |||
| <delete id = "deleteById" parameterType="HashMap"> | |||
| delete from wx_bill_other_deposit where id = #{id} and tenant_id = #{tenantId} | |||
| </delete> | |||
| <delete id="deleteNoNeedPayBill" parameterType="com.iformall.domain.po.WxBillOtherDeposit"> | |||
| 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 | |||
| </delete> | |||
| </mapper> | |||
| @@ -1,313 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxBillOtherMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillOther"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate" /> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate" /> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime" /> | |||
| <result column="create_by" jdbcType="BIGINT" property="createBy"/> | |||
| <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/> | |||
| <result column="update_by" jdbcType="BIGINT" property="updateBy"/> | |||
| <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/> | |||
| <result column="expired_day" jdbcType="INTEGER" property="expiredDay" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/> | |||
| <result column="apply_pay_img" jdbcType="INTEGER" property="applyPayImg"/> | |||
| <result column="apply_update_time" jdbcType="INTEGER" property="applyUpdateTime"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel" /> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| <result column="user_id" jdbcType="BIGINT" property="userId" /> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId" /> | |||
| <result column="shop_name" jdbcType="VARCHAR" property="shopName" /> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" /> | |||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||
| <result column="last_owe_call_time" jdbcType="TIMESTAMP" property="lastOweCallTime"/> | |||
| <result column="last_owe_call_user" jdbcType="VARCHAR" property="lastOweCallUser"/> | |||
| <result column="comments" jdbcType="VARCHAR" property="comments" /> | |||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | |||
| <result column="pay_way" jdbcType="BIGINT" property="payWay"/> | |||
| <result column="merchant_name" property="merchantName"/> | |||
| <result column="starttime" property="starttime"/> | |||
| <result column="endtime" property="endtime"/> | |||
| <result column="freeze" property="freeze"/> | |||
| <result column="service_charge_pay" property="serviceChargePay"/> | |||
| <result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/> | |||
| <result column="set_off" jdbcType="VARCHAR" property="setOff"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `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` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if> | |||
| <if test=" null != pay "> and `pay` = #{pay} </if> | |||
| <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if> | |||
| <if test=" null != payDate "> and `pay_date` = #{payDate} </if> | |||
| <if test=" null != createtime "> and `createtime` = #{createtime} </if> | |||
| <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if> | |||
| <if test=" null != status "> and `status` = #{status} </if> | |||
| <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isDel "> and `is_del` = #{isDel} </if> | |||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||
| <if test=" null != energyFeesId ">and `energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != userId "> and `user_id` = #{userId} </if> | |||
| <if test=" null != shopId "> and `shop_id` = #{shopId} </if> | |||
| <if test=" null != updatetime "> and `updatetime` = #{updatetime} </if> | |||
| <if test=" null != name "> and `name` = #{name} </if> | |||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | |||
| <if test=" 1 == notifyed ">and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) )</if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != notInIds "> | |||
| and id not in | |||
| <foreach collection="notInIds" index="index" item="nidItem" open="(" separator="," close=")"> | |||
| #{nidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillOther" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_bill_other | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_bill_other | |||
| where id = #{id} and tenant_id = #{tenantId} | |||
| </select> | |||
| <sql id = "queryBillListConditions"> | |||
| <where> | |||
| 1 = 1 | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> and br.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId">and br.`parent_tenant_id` = #{parentTenantId}</if> | |||
| <if test=" null != freeze ">and br.`freeze` = #{freeze}</if> | |||
| <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | |||
| <if test=" null != status ">and br.`status` = #{status}</if> | |||
| <if test=" null != applyStatus ">and br.`apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isDel ">and br.`is_del` = #{isDel}</if> | |||
| <if test=" null != energyFeesId ">and br.`energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != name and ''!=name">and br.`name` like concat('%',#{name},'%')</if> | |||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | |||
| <if test=" null != starttime">and br.`starttime` <= #{starttime}</if> | |||
| <if test=" null != endtime">and br.`endtime` >= #{endtime}</if> | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| 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)) | |||
| </if> | |||
| <if test=" null != needPayStartDay"> | |||
| and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" 1 == notifyed ">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) )</if> | |||
| <if test=" null != merchantIds "> | |||
| and br.`merchant_id` in | |||
| <foreach collection="merchantIds" index="index" item="midItem" open="(" separator="," close=")"> | |||
| #{midItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != notInIds "> | |||
| and br.id not in | |||
| <foreach collection="notInIds" index="index" item="nidItem" open="(" separator="," close=")"> | |||
| #{nidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and br.status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| </where> | |||
| </sql> | |||
| <select id="queryBillList" parameterType="com.iformall.domain.po.WxBillOther" resultMap="BaseResultMap"> | |||
| select br.`id`,br.`tenant_id`,br.`parent_tenant_id`,br.`receive_pay`,br.`pay`,br.`receive_date`, br.`pay_date`,br.`createtime`,br.`expired_day`, | |||
| br.`status`,br.shop_name,br.`updatetime`,br.`apply_status`,br.`last_owe_call_time`,br.`last_owe_call_user`,br.`set_off`, | |||
| br.`apply_pay_img`,br.`apply_update_time`,br.`merchant_id`,br.shop_id,br.name,br.comments,br.`rent_shop_type`,br.`energy_fees_id`, | |||
| br.pay_way,br.`starttime`,br.`endtime`,br.freeze,br.service_charge_pay,br.`create_by`,br.`create_by_name`,br.`update_by`,br.`update_by_name` | |||
| from wx_bill_other br | |||
| <include refid="queryBillListConditions" /> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <if test=" null == sortColumns">order by id desc</if> | |||
| </select> | |||
| <resultMap id="SumBaseResultMap" type="com.iformall.domain.vo.WxBillSum"> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="paid" jdbcType="VARCHAR" property="paid" /> | |||
| <result column="min_date" jdbcType="TIMESTAMP" property="minDate" /> | |||
| <result column="max_date" jdbcType="TIMESTAMP" property="maxDate" /> | |||
| <result column="service_pay" jdbcType="VARCHAR" property="servicePay"/> | |||
| <result column="late_pay" jdbcType="VARCHAR" property="latePay"/> | |||
| <result column="return_pay" jdbcType="VARCHAR" property="returnPay"/> | |||
| </resultMap> | |||
| <select id="getBillMonthSum" parameterType="com.iformall.domain.po.WxBillOther" resultMap="SumBaseResultMap"> | |||
| select | |||
| sum(CAST(br.receive_pay AS DECIMAL(20,2))) receive_pay , | |||
| sum(CAST(br.pay AS DECIMAL(20,2))) paid, | |||
| min(starttime) min_date, | |||
| max(endtime) max_date, | |||
| sum(CAST(br.service_charge_pay AS DECIMAL(20,2))) service_pay , | |||
| '0' late_pay, | |||
| '0' return_pay | |||
| from wx_bill_other br | |||
| <include refid="queryBillListConditions"/> | |||
| </select> | |||
| <select id="getMerchantIdList" parameterType="com.iformall.domain.po.WxBillOther" resultType="Long"> | |||
| select distinct merchant_id from wx_bill_other br | |||
| <include refid="queryBillListConditions"/> | |||
| </select> | |||
| <resultMap id="HotNotifyBaseResultMap" type="com.iformall.domain.vo.WxBillHotNotify"> | |||
| <result column="total_count" jdbcType="INTEGER" property="totalCount"/> | |||
| <result column="total_money" jdbcType="VARCHAR" property="totalMoney" /> | |||
| <result column="min_begin_time" jdbcType="TIMESTAMP" property="minBeginTime"/> | |||
| </resultMap> | |||
| <select id="getBillHotNotify" parameterType="com.iformall.domain.po.WxBillOther" resultMap="HotNotifyBaseResultMap"> | |||
| select count(1) total_count , sum(CAST(br.`receive_pay` AS DECIMAL(20,2)) - CAST(br.`pay` AS DECIMAL(20,2)) - CAST(IFNULL(br.`set_off`,'0') AS DECIMAL(20,2))) total_money,MIN(br.starttime) min_begin_time from wx_bill_other br | |||
| <include refid="queryBillListConditions"/> | |||
| </select> | |||
| <resultMap id="NotifyResultMap" type="com.iformall.domain.vo.WxBillNotify"> | |||
| <result column="bill_type" jdbcType="INTEGER" property="billType"/> | |||
| <result column="bill_type_name" jdbcType="VARCHAR" property="billTypeName" /> | |||
| <result column="bill_id" jdbcType="BIGINT" property="billId" /> | |||
| <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/> | |||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| </resultMap> | |||
| <select id="getBillNotifyList" parameterType="com.iformall.domain.po.WxBillOther" resultMap="NotifyResultMap"> | |||
| select #{billType} bill_type,#{billTypeName} bill_type_name,br.id as bill_id, br.starttime,br.endtime,br.receive_pay,br.pay,br.merchant_id from wx_bill_other br | |||
| <include refid="queryBillListConditions"/> | |||
| </select> | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| update wx_bill_other set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and status!=#{paid} and DATEDIFF(now(),receive_date)>0 | |||
| </update> | |||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||
| update wx_bill_other set status=#{waitPay} where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 | |||
| </update> | |||
| <select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap"> | |||
| select round(sum(t.receivepay)/100,2) receivepay,round(sum(t.pay)/100,2) pay from | |||
| ( | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_other | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| union | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_daily | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| ) t | |||
| </select> | |||
| <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(round(sum(res.owe)/100,2),0) owe,res.tenant_id from | |||
| ( | |||
| select IFNULL(sum(receive_pay - pay),0) owe,tenant_id from wx_bill_daily | |||
| where status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| union all | |||
| select IFNULL(sum(receive_pay - pay),0) owe,tenant_id from wx_bill_daily | |||
| where status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| ) res | |||
| </select> | |||
| <delete id = "deleteById" parameterType="HashMap"> | |||
| delete from wx_bill_other where id = #{id} and tenant_id = #{tenantId} | |||
| </delete> | |||
| <delete id="deleteNoNeedPayBill" parameterType="com.iformall.domain.po.WxBillOther"> | |||
| 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 | |||
| </delete> | |||
| </mapper> | |||
| @@ -1,280 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxBillPropertyDepositMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillPropertyDeposit"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="property_contract_id" jdbcType="BIGINT" property="propertyContractId"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate" /> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate" /> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime" /> | |||
| <result column="create_by" jdbcType="BIGINT" property="createBy"/> | |||
| <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/> | |||
| <result column="update_by" jdbcType="BIGINT" property="updateBy"/> | |||
| <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/> | |||
| <result column="expired_day" jdbcType="INTEGER" property="expiredDay" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/> | |||
| <result column="apply_pay_img" jdbcType="INTEGER" property="applyPayImg"/> | |||
| <result column="apply_update_time" jdbcType="INTEGER" property="applyUpdateTime"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel" /> | |||
| <result column="need_pay" jdbcType="VARCHAR" property="needPay" /> | |||
| <result column="merchant_id" jdbcType="INTEGER" property="merchantId" /> | |||
| <result column="user_id" jdbcType="INTEGER" property="userId" /> | |||
| <result column="shop_id" jdbcType="INTEGER" property="shopId" /> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" /> | |||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | |||
| <result column="return_price" jdbcType="VARCHAR" property="returnPrice"/> | |||
| <result column="shop_info" jdbcType="VARCHAR" property="shopInfo"/> | |||
| <result column="pay_way" jdbcType="BIGINT" property="payWay"/> | |||
| <result column="freeze" property="freeze"/> | |||
| <result column="service_charge_pay" property="serviceChargePay"/> | |||
| <result column="starttime" property="starttime"/> | |||
| <result column="endtime" property="endtime"/> | |||
| <result column="last_owe_call_time" jdbcType="TIMESTAMP" property="lastOweCallTime"/> | |||
| <result column="last_owe_call_user" jdbcType="VARCHAR" property="lastOweCallUser"/> | |||
| <result column="merchant_name" property="merchantName"/> | |||
| <result column="shop_number" property="shopNumber"/> | |||
| <result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/> | |||
| <result column="set_off" jdbcType="VARCHAR" property="setOff"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `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` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != propertyContractId "> and `property_contract_id` = #{propertyContractId} </if> | |||
| <if test=" null != energyFeesId ">and `energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if> | |||
| <if test=" null != pay "> and `pay` = #{pay} </if> | |||
| <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if> | |||
| <if test=" null != payDate "> and `pay_date` = #{payDate} </if> | |||
| <if test=" null != createtime "> and `createtime` = #{createtime} </if> | |||
| <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if> | |||
| <if test=" null != status "> and `status` = #{status} </if> | |||
| <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isDel "> and `is_del` = #{isDel} </if> | |||
| <if test=" null != needPay "> and `need_pay` = #{needPay} </if> | |||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||
| <if test=" null != userId "> and `user_id` = #{userId} </if> | |||
| <if test=" null != shopId "> and `shop_id` = #{shopId} </if> | |||
| <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if> | |||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | |||
| <if test=" 1 == notifyed ">and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) )</if> | |||
| <if test=" null != propertyContractIdList "> | |||
| and property_contract_id in | |||
| <foreach collection="propertyContractIdList" index="index" item="pidItem" open="(" separator="," close=")"> | |||
| #{pidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillPropertyDeposit" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_bill_property_deposit | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_bill_property_deposit | |||
| where id = #{id} and tenant_id = #{tenantId} | |||
| </select> | |||
| <select id="findPropertyContractIds" parameterType="com.iformall.domain.po.WxBillPropertyDeposit" resultMap="BaseResultMap"> | |||
| select distinct property_contract_id from wx_bill_property_deposit | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <sql id="queryBillDepositListConditions"> | |||
| <where> | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and br.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and br.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | |||
| <if test=" null != status ">and br.`status` = #{status}</if> | |||
| <if test=" null != applyStatus ">and br.`apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isDel ">and br.`is_del` = #{isDel}</if> | |||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != propertyContractId ">and br.`property_contract_id` = #{propertyContractId}</if> | |||
| <if test=" null != energyFeesId ">and br.`energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | |||
| <if test=" null != starttime">and br.`starttime` <= #{starttime}</if> | |||
| <if test=" null != endtime">and br.`endtime` >= #{endtime}</if> | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| 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)) | |||
| </if> | |||
| <if test=" null != needPayStartDay"> | |||
| and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" 1 == notifyed ">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) )</if> | |||
| <if test=" null != merchantIds "> | |||
| and br.`merchant_id` in | |||
| <foreach collection="merchantIds" index="index" item="midItem" open="(" separator="," close=")"> | |||
| #{midItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and br.status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| </where> | |||
| </sql> | |||
| <select id="queryBillDepositList" parameterType="com.iformall.domain.po.WxBillPropertyDeposit" resultMap="BaseResultMap"> | |||
| select br.`id`,br.`tenant_id`,br.`parent_tenant_id`,br.`property_contract_id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`,br.`status`, | |||
| br.`need_pay`,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,br.`return_price`,br.`shop_info`,br.pay_way,br.`starttime`,br.`endtime`,br.`last_owe_call_user`,br.`set_off`, | |||
| br.freeze,br.service_charge_pay,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,br.`create_by`,br.`create_by_name`,br.`update_by`,br.`update_by_name`,br.`energy_fees_id` | |||
| from wx_bill_property_deposit br | |||
| <include refid="queryBillDepositListConditions"/> | |||
| order by id desc | |||
| </select> | |||
| <resultMap id="SumBaseResultMap" type="com.iformall.domain.vo.WxBillSum"> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="paid" jdbcType="VARCHAR" property="paid" /> | |||
| <result column="min_date" jdbcType="TIMESTAMP" property="minDate" /> | |||
| <result column="max_date" jdbcType="TIMESTAMP" property="maxDate" /> | |||
| <result column="service_pay" jdbcType="VARCHAR" property="servicePay"/> | |||
| <result column="late_pay" jdbcType="VARCHAR" property="latePay"/> | |||
| <result column="return_pay" jdbcType="VARCHAR" property="returnPay"/> | |||
| </resultMap> | |||
| <select id="getBillMonthSum" parameterType="com.iformall.domain.po.WxBillPropertyDeposit" resultMap="SumBaseResultMap"> | |||
| select | |||
| sum(CAST(br.receive_pay AS DECIMAL(20,2))) receive_pay , | |||
| sum(CAST(br.pay AS DECIMAL(20,2))) paid, | |||
| min(starttime) min_date, | |||
| max(endtime) max_date, | |||
| sum(CAST(br.service_charge_pay AS DECIMAL(20,2))) service_pay , | |||
| '0' late_pay, | |||
| sum(CAST(br.return_price AS DECIMAL(20,2))) return_pay | |||
| from wx_bill_property_deposit br | |||
| <include refid="queryBillDepositListConditions"/> | |||
| </select> | |||
| <select id="getMerchantIdList" parameterType="com.iformall.domain.po.WxBillPropertyDeposit" resultType="Long"> | |||
| select distinct merchant_id from wx_bill_property_deposit br | |||
| <include refid="queryBillDepositListConditions"/> | |||
| </select> | |||
| <resultMap id="HotNotifyBaseResultMap" type="com.iformall.domain.vo.WxBillHotNotify"> | |||
| <result column="total_count" jdbcType="INTEGER" property="totalCount"/> | |||
| <result column="total_money" jdbcType="VARCHAR" property="totalMoney" /> | |||
| <result column="min_begin_time" jdbcType="TIMESTAMP" property="minBeginTime"/> | |||
| </resultMap> | |||
| <select id="getBillHotNotify" parameterType="com.iformall.domain.po.WxBillPropertyDeposit" resultMap="HotNotifyBaseResultMap"> | |||
| select count(1) total_count , sum(CAST(br.`receive_pay` AS DECIMAL(20,2)) - CAST(br.`pay` AS DECIMAL(20,2)) - CAST(IFNULL(br.`set_off`,'0') AS DECIMAL(20,2))) total_money,MIN(br.starttime) min_begin_time from wx_bill_property_deposit br | |||
| <include refid="queryBillDepositListConditions"/> | |||
| </select> | |||
| <resultMap id="NotifyResultMap" type="com.iformall.domain.vo.WxBillNotify"> | |||
| <result column="bill_type" jdbcType="INTEGER" property="billType"/> | |||
| <result column="bill_type_name" jdbcType="VARCHAR" property="billTypeName" /> | |||
| <result column="bill_id" jdbcType="BIGINT" property="billId" /> | |||
| <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/> | |||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| </resultMap> | |||
| <select id="getBillNotifyList" parameterType="com.iformall.domain.po.WxBillPropertyDeposit" resultMap="NotifyResultMap"> | |||
| select #{billType} bill_type,#{billTypeName} bill_type_name,br.id as bill_id, br.starttime,br.endtime,br.receive_pay,br.pay,br.merchant_id from wx_bill_property_deposit br | |||
| <include refid="queryBillDepositListConditions"/> | |||
| </select> | |||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL((sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property_deposit | |||
| where date_format(receive_date,'%Y-%m')=#{receiveDate} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| group by tenant_id | |||
| </select> | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| update wx_bill_property_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | |||
| where status!=#{paid} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and status!=5 and DATEDIFF(now(),receive_date)>0 | |||
| </update> | |||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||
| 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} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and br.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and br.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and br.status!=5 and now() < br.receive_date | |||
| and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | |||
| </update> | |||
| <select id="queryOweCount" parameterType="com.iformall.domain.po.WxPropertyContract" resultType="Long"> | |||
| select count(*) from wx_property_contract r,wx_bill_property_deposit b | |||
| where b.property_contract_id = r.id and b.status = 1 | |||
| <if test=" null != id ">and r.id = #{id}</if> | |||
| <if test=" null != rentContractId ">and r.rent_contract_id = #{rentContractId}</if> | |||
| </select> | |||
| <delete id = "deleteById" parameterType="HashMap"> | |||
| delete from wx_bill_property_deposit where id = #{id} and tenant_id = #{tenantId} | |||
| </delete> | |||
| <delete id="deleteNoNeedPayBill" parameterType="com.iformall.domain.po.WxBillPropertyDeposit"> | |||
| 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 | |||
| </delete> | |||
| </mapper> | |||
| @@ -1,496 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxBillPropertyMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillProperty"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | |||
| <result column="property_contract_id" jdbcType="BIGINT" property="propertyContractId"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate"/> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate"/> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/> | |||
| <result column="create_by" jdbcType="BIGINT" property="createBy"/> | |||
| <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/> | |||
| <result column="update_by" jdbcType="BIGINT" property="updateBy"/> | |||
| <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/> | |||
| <result column="expired_day" jdbcType="INTEGER" property="expiredDay"/> | |||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/> | |||
| <result column="apply_pay_img" jdbcType="INTEGER" property="applyPayImg"/> | |||
| <result column="apply_update_time" jdbcType="INTEGER" property="applyUpdateTime"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="need_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="user_id" jdbcType="BIGINT" property="userId"/> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | |||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | |||
| <result column="revenue" jdbcType="BIGINT" property="revenue"/> | |||
| <result column="late_pay_ratio" jdbcType="INTEGER" property="latePayRatio"/> | |||
| <result column="late_pay_time" jdbcType="TIMESTAMP" property="latePayTime"/> | |||
| <result column="late_pay_price" jdbcType="VARCHAR" property="latePayPrice"/> | |||
| <result column="period" jdbcType="INTEGER" property="period"/> | |||
| <result column="is_preview" property="isPreview"/> | |||
| <result column="shop_info" jdbcType="VARCHAR" property="shopInfo"/> | |||
| <result column="pay_way" jdbcType="BIGINT" property="payWay"/> | |||
| <result column="late_pay_status" jdbcType="INTEGER" property="latePayStatus"/> | |||
| <result column="comments" jdbcType="VARCHAR" property="comments"/> | |||
| <result column="parent_bill_id" jdbcType="BIGINT" property="parentBillId"/> | |||
| <result column="starttime" property="starttime"/> | |||
| <result column="endtime" property="endtime"/> | |||
| <result column="last_owe_call_time" jdbcType="TIMESTAMP" property="lastOweCallTime"/> | |||
| <result column="last_owe_call_user" jdbcType="VARCHAR" property="lastOweCallUser"/> | |||
| <result column="merchant_name" property="merchantName"/> | |||
| <result column="deposit" property="deposit"/> | |||
| <result column="deposit_status" property="depositStatus"/> | |||
| <result column="all_period" property="allPeriod"/> | |||
| <result column="late_pay_day" property="latePayDay"/> | |||
| <result column="late_pay_ratio" property="latePayRatio"/> | |||
| <result column="freeze" property="freeze"/> | |||
| <result column="service_charge_pay" property="serviceChargePay"/> | |||
| <result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/> | |||
| <result column="set_off" jdbcType="VARCHAR" property="setOff"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `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` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != propertyContractId ">and `property_contract_id` = #{propertyContractId}</if> | |||
| <if test=" null != energyFeesId ">and `energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != receivePay ">and `receive_pay` = #{receivePay}</if> | |||
| <if test=" null != pay ">and `pay` = #{pay}</if> | |||
| <if test=" null != receiveDate ">and `receive_date` = #{receiveDate}</if> | |||
| <if test=" null != payDate ">and `pay_date` = #{payDate}</if> | |||
| <if test=" null != createtime ">and `createtime` = #{createtime}</if> | |||
| <if test=" null != expiredDay ">and `expired_day` = #{expiredDay}</if> | |||
| <if test=" null != status ">and `status` = #{status}</if> | |||
| <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||
| <if test=" null != needPay ">and `need_pay` = #{needPay}</if> | |||
| <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if> | |||
| <if test=" null != userId ">and `user_id` = #{userId}</if> | |||
| <if test=" null != shopId ">and `shop_id` = #{shopId}</if> | |||
| <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if> | |||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != isPreview ">and is_preview = #{isPreview}</if> | |||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | |||
| <if test=" null != latePayStatus ">and `late_pay_status` = #{latePayStatus}</if> | |||
| <if test=" null != parentBillId ">and `parent_bill_id` = #{parentBillId}</if> | |||
| <if test=" 1 == hasParentBillId ">and `parent_bill_id` is not null</if> | |||
| <if test=" 0 == hasParentBillId ">and `parent_bill_id` is null</if> | |||
| <if test=" 1 == hasFeesStardarsId ">and `energy_fees_id` is not null</if> | |||
| <if test=" 0 == hasFeesStardarsId ">and `energy_fees_id` is null</if> | |||
| <if test=" 1 == notifyed ">and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) )</if> | |||
| <if test=" null != propertyContractIds "> | |||
| and property_contract_id in | |||
| <foreach collection="propertyContractIds" index="index" item="pidItem" open="(" separator="," close=")"> | |||
| #{pidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != merchantIds "> | |||
| and merchant_id in | |||
| <foreach collection="merchantIds" index="index" item="midItem" open="(" separator="," close=")"> | |||
| #{midItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_bill_property | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_bill_property | |||
| where id = #{id} and tenant_id = #{tenantId} | |||
| </select> | |||
| <sql id="queryBillPropertyListConditions"> | |||
| <where> | |||
| br.is_preview = 0 | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> and br.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId">and br.`parent_tenant_id` = #{parentTenantId}</if> | |||
| <if test=" null != freeze ">and br.`freeze` = #{freeze}</if> | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | |||
| <if test=" null != energyFeesId ">and br.`energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != status ">and br.`status` = #{status}</if> | |||
| <if test=" null != applyStatus ">and br.`apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isDel ">and br.`is_del` = #{isDel}</if> | |||
| <if test=" null != starttime">and br.`starttime` <= #{starttime}</if> | |||
| <if test=" null != endtime">and br.`endtime` >= #{endtime}</if> | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| 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)) | |||
| </if> | |||
| <if test=" null != needPayStartDay"> | |||
| and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != propertyContractId ">and br.`property_contract_id` = #{propertyContractId}</if> | |||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | |||
| <if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if> | |||
| <if test=" null != parentBillId ">and br.`parent_bill_id` = #{parentBillId}</if> | |||
| <if test=" 1 == hasParentBillId ">and br.`parent_bill_id` is not null</if> | |||
| <if test=" 0 == hasParentBillId ">and br.`parent_bill_id` is null</if> | |||
| <if test=" 1 == hasFeesStardarsId ">and br.`energy_fees_id` is not null</if> | |||
| <if test=" 0 == hasFeesStardarsId ">and br.`energy_fees_id` is null</if> | |||
| <if test=" 1 == notifyed ">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) )</if> | |||
| <if test=" null != propertyContractIds "> | |||
| and br.property_contract_id in | |||
| <foreach collection="propertyContractIds" index="index" item="pidItem" open="(" separator="," close=")"> | |||
| #{pidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != merchantIds "> | |||
| and br.merchant_id in | |||
| <foreach collection="merchantIds" index="index" item="midItem" open="(" separator="," close=")"> | |||
| #{midItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and br.status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| </where> | |||
| </sql> | |||
| <select id="queryBillPropertyList" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="BaseResultMap"> | |||
| select br.`id`,br.`tenant_id`,br.`parent_tenant_id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`, | |||
| br.`status`,br.`need_pay`,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,br.`period`,br.`last_owe_call_time`,br.`last_owe_call_user`, | |||
| br.`revenue`,br.`late_pay_time`,br.`property_contract_id`,br.late_pay_price,br.`shop_info`,br.pay_way,br.late_pay_status,br.`energy_fees_id`, | |||
| br.`comments`,br.starttime,br.endtime,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,br.freeze,br.service_charge_pay, | |||
| br.`late_pay_ratio`,br.`parent_bill_id`,br.`create_by`,br.`create_by_name`,br.`update_by`,br.`update_by_name`,br.`set_off` | |||
| from wx_bill_property br | |||
| <include refid="queryBillPropertyListConditions"/> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </select> | |||
| <select id="queryPropertyContractIdList" parameterType="com.iformall.domain.po.WxBillProperty" resultType="Long"> | |||
| select distinct br.property_contract_id | |||
| from wx_bill_property br | |||
| <include refid="queryBillPropertyListConditions"/> | |||
| </select> | |||
| <resultMap id="SumBaseResultMap" type="com.iformall.domain.vo.WxBillSum"> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="paid" jdbcType="VARCHAR" property="paid" /> | |||
| <result column="min_date" jdbcType="TIMESTAMP" property="minDate" /> | |||
| <result column="max_date" jdbcType="TIMESTAMP" property="maxDate" /> | |||
| <result column="service_pay" jdbcType="VARCHAR" property="servicePay"/> | |||
| <result column="late_pay" jdbcType="VARCHAR" property="latePay"/> | |||
| <result column="return_pay" jdbcType="VARCHAR" property="returnPay"/> | |||
| </resultMap> | |||
| <select id="getBillMonthSum" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="SumBaseResultMap"> | |||
| select | |||
| sum(CAST(br.receive_pay AS DECIMAL(20,2))) receive_pay , | |||
| sum(CAST(br.pay AS DECIMAL(20,2))) paid, | |||
| min(starttime) min_date, | |||
| max(endtime) max_date, | |||
| sum(CAST(br.service_charge_pay AS DECIMAL(20,2))) service_pay , | |||
| sum(CAST(br.late_pay_price AS DECIMAL(20,2))) late_pay, | |||
| '0' return_pay | |||
| from wx_bill_property br | |||
| <include refid="queryBillPropertyListConditions"/> | |||
| </select> | |||
| <select id="getMerchantIdList" parameterType="com.iformall.domain.po.WxBillProperty" resultType="Long"> | |||
| select distinct merchant_id from wx_bill_property br | |||
| <include refid="queryBillPropertyListConditions"/> | |||
| </select> | |||
| <resultMap id="HotNotifyBaseResultMap" type="com.iformall.domain.vo.WxBillHotNotify"> | |||
| <result column="total_count" jdbcType="INTEGER" property="totalCount"/> | |||
| <result column="total_money" jdbcType="VARCHAR" property="totalMoney" /> | |||
| <result column="min_begin_time" jdbcType="TIMESTAMP" property="minBeginTime"/> | |||
| </resultMap> | |||
| <select id="getBillHotNotify" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="HotNotifyBaseResultMap"> | |||
| select count(1) total_count , sum(CAST(br.`receive_pay` AS DECIMAL(20,2)) - CAST(br.`pay` AS DECIMAL(20,2)) - CAST(IFNULL(br.`set_off`,'0') AS DECIMAL(20,2))) total_money,MIN(br.starttime) min_begin_time from wx_bill_property br | |||
| <include refid="queryBillPropertyListConditions"/> | |||
| </select> | |||
| <resultMap id="NotifyResultMap" type="com.iformall.domain.vo.WxBillNotify"> | |||
| <result column="bill_type" jdbcType="INTEGER" property="billType"/> | |||
| <result column="bill_type_name" jdbcType="VARCHAR" property="billTypeName" /> | |||
| <result column="bill_id" jdbcType="BIGINT" property="billId" /> | |||
| <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/> | |||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| </resultMap> | |||
| <select id="getBillNotifyList" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="NotifyResultMap"> | |||
| select #{billType} bill_type,#{billTypeName} bill_type_name,br.id as bill_id, br.starttime,br.endtime,br.receive_pay,br.pay,br.merchant_id from wx_bill_property br | |||
| <include refid="queryBillPropertyListConditions"/> | |||
| </select> | |||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property | |||
| where is_preview = 0 and status!=6 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| group by tenant_id, parent_tenant_id | |||
| </select> | |||
| <select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property | |||
| where receive_date between #{startdate} and #{enddate} | |||
| and is_preview = 0 and status!=6 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(receive_pay - pay),0) owe,tenant_id from wx_bill_property | |||
| where status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} | |||
| and is_preview = 0 | |||
| </select> | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| 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 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and b.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and b.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||
| 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 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and br.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and br.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| 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> | |||
| <update id="updateInvalidStatus" parameterType="com.iformall.domain.po.WxBillProperty"> | |||
| update wx_bill_property set status = 6 where property_contract_id = #{propertyContractId} | |||
| and status in(4,2) | |||
| </update> | |||
| <update id="updateInvalidStatusByRent" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| 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 | |||
| </update> | |||
| <delete id="deleteBillByContract" parameterType="com.iformall.domain.po.WxPropertyContract"> | |||
| delete from wx_bill_property where property_contract_id = #{id} | |||
| </delete> | |||
| <delete id="deletePreviewBill" parameterType="com.iformall.domain.po.WxBillProperty"> | |||
| delete from wx_bill_property where property_contract_id = #{propertyContractId} | |||
| <if test=" null != isPreview "> and is_preview = #{isPreview}</if> | |||
| </delete> | |||
| <delete id="deleteNoNeedPayBill" parameterType="com.iformall.domain.po.WxBillProperty"> | |||
| 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 | |||
| </delete> | |||
| <update id="updateForReceivePay" parameterType="com.iformall.domain.po.WxBillProperty"> | |||
| update wx_bill_property set updatetime = now() | |||
| <if test=" null != receivePay ">,receive_pay = #{receivePay}</if> | |||
| <if test=" null != comments ">,comments = #{comments}</if> | |||
| <if test=" null != receiveDate ">,receive_date = #{receiveDate}</if> | |||
| <if test="0 == receivePay or 0l == receivePay">,status = 3,pay_date=now()</if> | |||
| where id = #{id} | |||
| </update> | |||
| <update id="updatePreviewStatus" parameterType="com.iformall.domain.po.WxBillProperty"> | |||
| update wx_bill_property set is_preview = #{isPreview},merchant_id = #{merchantId},need_pay = receive_pay | |||
| where property_contract_id = #{propertyContractId} | |||
| </update> | |||
| <select id="oweBillCount" parameterType="java.lang.Long" resultType="java.lang.Long"> | |||
| select count(br.id) from wx_bill_property br,wx_property_contract c | |||
| where c.id = br.property_contract_id and br.status = 1 and c.id = #{contractId} | |||
| </select> | |||
| <insert id="insertBills" parameterType="hashmap"> | |||
| 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 | |||
| <foreach collection="list" item="item" index="index" separator=","> | |||
| ( | |||
| #{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} | |||
| ) | |||
| </foreach> | |||
| </insert> | |||
| <update id="updateBills" parameterType="java.util.List"> | |||
| <foreach collection="list" item="item" index="index" open="" close="" separator=";"> | |||
| update wx_bill_property | |||
| <set> | |||
| <if test=" null != item.receivePay ">updatetime = now(),receive_pay = #{item.receivePay},</if> | |||
| <if test=" null != item.comments ">comments = #{item.comments},</if> | |||
| <if test=" null != item.receiveDate ">receive_date = #{item.receiveDate},</if> | |||
| <if test="0 == item.receivePay or 0l == item.receivePay">status = 3,pay_date=now()</if> | |||
| </set> | |||
| where id = #{item.id} | |||
| </foreach> | |||
| </update> | |||
| <select id="selectBillOne" parameterType="com.iformall.domain.po.WxBillProperty" | |||
| resultType="com.iformall.domain.po.WxBillProperty"> | |||
| select * from wx_bill_property where merchant_id=#{merchantId} | |||
| AND rent_shop_type = #{rentShopType} AND is_preview = #{isPreview} | |||
| AND date_format(starttime,'%Y-%m-%d 00:00:00.0') = #{starttime} AND date_format(endtime,'%Y-%m-%d 00:00:00.0') = #{endtime} | |||
| </select> | |||
| <delete id = "deleteById" parameterType="HashMap"> | |||
| delete from wx_bill_property where id = #{id} and tenant_id = #{tenantId} | |||
| </delete> | |||
| <!-- | |||
| <update id="insertBillAction"> | |||
| insert into wx_bill_action(id,user_name,`action`,bill_id,details,tenant_id,parent_tenant_id) | |||
| select | |||
| (select unix_timestamp(now()) + CEILING(RAND()*90000+10000) + CEILING(RAND()*90000+10000) + CEILING(RAND()*90000+10000)) id | |||
| ,'系统端' user_name,7 `action`,b.id bill_id, | |||
| CONCAT('系统计入', | |||
| if(b.late_pay_price is null, | |||
| round( | |||
| c.late_pay_ratio * DATEDIFF(now(), date_add(b.receive_date,interval(c.late_pay_day) day)) /10000 | |||
| ,2) | |||
| , | |||
| round( | |||
| (c.late_pay_ratio) /10000 | |||
| ,2) | |||
| ) | |||
| ,'元') details,b.tenant_id,b.parent_tenant_id | |||
| from wx_bill_property b left join wx_property_contract c on(b.`property_contract_id`=c.id) | |||
| where c.late_pay_ratio >0 | |||
| and DATEDIFF(now(), date_add(b.receive_date,interval(c.late_pay_day) day)) >0 | |||
| and b.status!=3 and b.status!=6 | |||
| </update> | |||
| <update id="autoAddLatePayPrice"> | |||
| update wx_bill_property b set b.late_pay_price = | |||
| if(b.late_pay_price is null, | |||
| round( | |||
| (select late_pay_ratio from wx_property_contract where id = b.`property_contract_id`) | |||
| * DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_property_contract where id = b.`property_contract_id`) day)) /100 | |||
| ,2) | |||
| , | |||
| b.late_pay_price + | |||
| round( | |||
| (select late_pay_ratio from wx_property_contract where id = b.`property_contract_id`) /100 | |||
| ,2) | |||
| ) | |||
| where b.status!=3 and b.status!=6 | |||
| and (select late_pay_ratio from wx_property_contract where id = b.`property_contract_id`) > 0 | |||
| and DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_property_contract where id = b.`property_contract_id`) day)) >0; | |||
| </update> | |||
| <update id="updateServiceCharge" parameterType="com.iformall.domain.po.WxPayAccountBill"> | |||
| update wx_bill_property | |||
| set service_charge_pay=round(receive_pay*#{serviceChargeRate}/10000) | |||
| where service_charge_pay=0 and status in(1,2,4) | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| --> | |||
| <!-- <update id="updateOwe"> | |||
| update wx_bill_property | |||
| set owe = receive_pay + service_charge_pay + ifnull(late_pay_price,0) - pay | |||
| where status in (1,2,4) | |||
| </update> --> | |||
| </mapper> | |||
| @@ -1,333 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxBillRentManageMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillRentManage"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="rent_contract_id" jdbcType="BIGINT" property="rentContractId"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate"/> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate"/> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/> | |||
| <result column="create_by" jdbcType="BIGINT" property="createBy"/> | |||
| <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/> | |||
| <result column="update_by" jdbcType="BIGINT" property="updateBy"/> | |||
| <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/> | |||
| <result column="expired_day" jdbcType="INTEGER" property="expiredDay"/> | |||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/> | |||
| <result column="apply_pay_img" jdbcType="INTEGER" property="applyPayImg"/> | |||
| <result column="apply_update_time" jdbcType="INTEGER" property="applyUpdateTime"/> | |||
| <result column="is_preview" jdbcType="INTEGER" property="isPreview"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="need_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="user_id" jdbcType="BIGINT" property="userId"/> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | |||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | |||
| <result column="late_pay_ratio" jdbcType="INTEGER" property="latePayRatio"/> | |||
| <result column="late_pay_time" jdbcType="TIMESTAMP" property="latePayTime"/> | |||
| <result column="late_pay_price" jdbcType="VARCHAR" property="latePayPrice"/> | |||
| <result column="period" jdbcType="INTEGER" property="period"/> | |||
| <result column="shop_info" jdbcType="VARCHAR" property="shopInfo"/> | |||
| <result column="pay_way" jdbcType="BIGINT" property="payWay"/> | |||
| <result column="late_pay_status" jdbcType="INTEGER" property="latePayStatus"/> | |||
| <result column="starttime" property="starttime"/> | |||
| <result column="endtime" property="endtime"/> | |||
| <result column="freeze" property="freeze"/> | |||
| <result column="service_charge_pay" property="serviceChargePay"/> | |||
| <result column="manage_fee_type" jdbcType="INTEGER" property="manageFeeType"/> | |||
| <result column="last_owe_call_time" jdbcType="TIMESTAMP" property="lastOweCallTime"/> | |||
| <result column="last_owe_call_user" jdbcType="VARCHAR" property="lastOweCallUser"/> | |||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/> | |||
| <result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/> | |||
| <result column="set_off" jdbcType="VARCHAR" property="setOff"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `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` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if> | |||
| <if test=" null != energyFeesId ">and `energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != receivePay ">and `receive_pay` = #{receivePay}</if> | |||
| <if test=" null != pay ">and `pay` = #{pay}</if> | |||
| <if test=" null != receiveDate ">and `receive_date` = #{receiveDate}</if> | |||
| <if test=" null != payDate ">and `pay_date` = #{payDate}</if> | |||
| <if test=" null != createtime ">and `createtime` = #{createtime}</if> | |||
| <if test=" null != expiredDay ">and `expired_day` = #{expiredDay}</if> | |||
| <if test=" null != status ">and `status` = #{status}</if> | |||
| <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isPreview ">and `is_preview` = #{isPreview}</if> | |||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||
| <if test=" null != needPay ">and `need_pay` = #{needPay}</if> | |||
| <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if> | |||
| <if test=" null != userId ">and `user_id` = #{userId}</if> | |||
| <if test=" null != shopId ">and `shop_id` = #{shopId}</if> | |||
| <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if> | |||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | |||
| <if test=" null != latePayStatus ">and `late_pay_status` = #{latePayStatus}</if> | |||
| <if test=" null != manageFeeType ">and `manage_fee_type` = #{manageFeeType}</if> | |||
| <if test=" 1 == notifyed ">and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) )</if> | |||
| <if test=" null != merchantIds "> | |||
| and merchant_id in | |||
| <foreach collection="merchantIds" index="index" item="midItem" open="(" separator="," close=")"> | |||
| #{midItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_bill_rent_manage | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_bill_rent_manage | |||
| where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <sql id="queryBillManageListConditions"> | |||
| <where> | |||
| br.`is_preview` = 0 | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> and br.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId">and br.`parent_tenant_id` = #{parentTenantId}</if> | |||
| <if test=" null != freeze ">and br.`freeze` = #{freeze}</if> | |||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != status ">and br.`status` = #{status}</if> | |||
| <if test=" null != applyStatus ">and br.`apply_status` = #{applyStatus}</if> | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | |||
| <if test=" null != isDel ">and br.`is_del` = #{isDel}</if> | |||
| <if test=" null != rentContractId ">and br.`rent_contract_id` = #{rentContractId}</if> | |||
| <if test=" null != energyFeesId ">and br.`energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | |||
| <if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if> | |||
| <if test=" null != starttime">and br.`starttime` <= #{starttime}</if> | |||
| <if test=" null != endtime">and br.`endtime` >= #{endtime}</if> | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| 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)) | |||
| </if> | |||
| <if test=" null != needPayStartDay"> | |||
| and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" null != manageFeeType ">and br.`manage_fee_type` = #{manageFeeType}</if> | |||
| <if test=" null != hasMerchant ">and br.`merchant_id` is not null</if> | |||
| <if test=" 1 == notifyed ">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) )</if> | |||
| <if test=" null != merchantIds "> | |||
| and br.merchant_id in | |||
| <foreach collection="merchantIds" index="index" item="midItem" open="(" separator="," close=")"> | |||
| #{midItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and br.status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| </where> | |||
| </sql> | |||
| <select id="queryBillManageList" parameterType="com.iformall.domain.po.WxBillRentManage" resultMap="BaseResultMap"> | |||
| select br.`id`,br.`tenant_id`,br.`parent_tenant_id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`, | |||
| br.`status`,br.`need_pay`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`,br.`last_owe_call_time`,br.`last_owe_call_user`, | |||
| br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`, | |||
| br.late_pay_price,br.shop_info,br.pay_way,br.late_pay_status,br.starttime,br.endtime,br.`create_by`,br.`create_by_name`,br.`update_by`,br.`update_by_name`, | |||
| br.freeze,br.service_charge_pay,br.manage_fee_type,br.`late_pay_ratio`,br.`energy_fees_id`,br.`set_off` | |||
| from wx_bill_rent_manage br | |||
| <include refid="queryBillManageListConditions"/> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| <if test="null != limitStart and null != limitEnd"> | |||
| limit #{limitStart},#{limitEnd} | |||
| </if> | |||
| </select> | |||
| <resultMap id="SumBaseResultMap" type="com.iformall.domain.vo.WxBillSum"> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="paid" jdbcType="VARCHAR" property="paid" /> | |||
| <result column="min_date" jdbcType="TIMESTAMP" property="minDate" /> | |||
| <result column="max_date" jdbcType="TIMESTAMP" property="maxDate" /> | |||
| <result column="service_pay" jdbcType="VARCHAR" property="servicePay"/> | |||
| <result column="late_pay" jdbcType="VARCHAR" property="latePay"/> | |||
| <result column="return_pay" jdbcType="VARCHAR" property="returnPay"/> | |||
| </resultMap> | |||
| <select id="getBillMonthSum" parameterType="com.iformall.domain.po.WxBillRentManage" resultMap="SumBaseResultMap"> | |||
| select | |||
| sum(CAST(br.receive_pay AS DECIMAL(20,2))) receive_pay , | |||
| sum(CAST(br.pay AS DECIMAL(20,2))) paid , | |||
| min(starttime) min_date, | |||
| max(endtime) max_date, | |||
| sum(CAST(br.service_charge_pay AS DECIMAL(20,2))) service_pay , | |||
| sum(CAST(br.late_pay_price AS DECIMAL(20,2))) late_pay, | |||
| '0' return_pay | |||
| from wx_bill_rent_manage br | |||
| <include refid="queryBillManageListConditions"/> | |||
| </select> | |||
| <select id="getMerchantIdList" parameterType="com.iformall.domain.po.WxBillRentManage" resultType="Long"> | |||
| select distinct merchant_id from wx_bill_rent_manage br | |||
| <include refid="queryBillManageListConditions"/> | |||
| </select> | |||
| <select id="queryRentContractIds" parameterType="com.iformall.domain.po.WxBillRentManage" resultType="Long"> | |||
| select distinct br.`rent_contract_id` from wx_bill_rent_manage br | |||
| <include refid="queryBillManageListConditions"/> | |||
| </select> | |||
| <resultMap id="HotNotifyBaseResultMap" type="com.iformall.domain.vo.WxBillHotNotify"> | |||
| <result column="total_count" jdbcType="INTEGER" property="totalCount"/> | |||
| <result column="total_money" jdbcType="VARCHAR" property="totalMoney" /> | |||
| <result column="min_begin_time" jdbcType="TIMESTAMP" property="minBeginTime"/> | |||
| </resultMap> | |||
| <select id="getBillHotNotify" parameterType="com.iformall.domain.po.WxBillRentManage" resultMap="HotNotifyBaseResultMap"> | |||
| select count(1) total_count , sum(CAST(br.`receive_pay` AS DECIMAL(20,2)) - CAST(br.`pay` AS DECIMAL(20,2)) - - CAST(IFNULL(br.`set_off`,'0') AS DECIMAL(20,2))) total_money,MIN(br.starttime) min_begin_time from wx_bill_rent_manage br | |||
| <include refid="queryBillManageListConditions"/> | |||
| </select> | |||
| <resultMap id="NotifyResultMap" type="com.iformall.domain.vo.WxBillNotify"> | |||
| <result column="bill_type" jdbcType="INTEGER" property="billType"/> | |||
| <result column="bill_type_name" jdbcType="VARCHAR" property="billTypeName" /> | |||
| <result column="bill_id" jdbcType="BIGINT" property="billId" /> | |||
| <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/> | |||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| </resultMap> | |||
| <select id="getBillNotifyList" parameterType="com.iformall.domain.po.WxBillRentManage" resultMap="NotifyResultMap"> | |||
| select #{billType} bill_type,#{billTypeName} bill_type_name,br.id as bill_id, br.starttime,br.endtime,br.receive_pay,br.pay,br.merchant_id from wx_bill_rent_manage br | |||
| <include refid="queryBillManageListConditions"/> | |||
| </select> | |||
| <update id="updatePreviewStatus" parameterType="com.iformall.domain.po.WxBillRentManage"> | |||
| update wx_bill_rent_manage set is_preview = #{isPreview} where rent_contract_id = #{rentContractId} | |||
| </update> | |||
| <select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent_manage | |||
| where status!=6 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and receive_date >= #{startdate} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and receive_date < #{enddate} | |||
| </if> | |||
| </select> | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| 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 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and b.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and b.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||
| 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} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and br.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and br.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and br.status!=6 and now() < br.receive_date | |||
| and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | |||
| </update> | |||
| <delete id="deletePreviewBill" parameterType="com.iformall.domain.po.WxBillRentManage"> | |||
| delete from wx_bill_rent_manage where rent_contract_id = #{rentContractId} and manage_fee_type = #{manageFeeType} | |||
| <if test=" null != isPreview ">and `is_preview` = #{isPreview}</if> | |||
| </delete> | |||
| <delete id="deleteNoNeedPayBill" parameterType="com.iformall.domain.po.WxBillRentManage"> | |||
| 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 | |||
| </delete> | |||
| <select id="oweBillCount" parameterType="java.lang.Long" resultType="java.lang.Long"> | |||
| select count(br.id) from wx_bill_rent_manage br,wx_rent_contract c where c.id = br.rent_contract_id | |||
| and br.status = 1 and c.id = #{contractId} | |||
| </select> | |||
| <insert id="insertBills" parameterType="HashMap"> | |||
| 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 | |||
| <foreach collection="list" item="item" index="index" separator=","> | |||
| ( | |||
| #{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} | |||
| ) | |||
| </foreach> | |||
| </insert> | |||
| <delete id = "deleteById" parameterType="HashMap"> | |||
| delete from wx_bill_rent_manage where id = #{id} and tenant_id = #{tenantId} | |||
| </delete> | |||
| </mapper> | |||
| @@ -1,486 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxBillRentMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillRent"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="rent_contract_id" jdbcType="BIGINT" property="rentContractId"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate"/> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate"/> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/> | |||
| <result column="create_by" jdbcType="BIGINT" property="createBy"/> | |||
| <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/> | |||
| <result column="expired_day" jdbcType="INTEGER" property="expiredDay"/> | |||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/> | |||
| <result column="apply_pay_img" jdbcType="INTEGER" property="applyPayImg"/> | |||
| <result column="apply_update_time" jdbcType="INTEGER" property="applyUpdateTime"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="contract_need_pay" jdbcType="VARCHAR" property="contractNeedPay"/> | |||
| <result column="rent_price_info" jdbcType="VARCHAR" property="rentPriceInfo"/> | |||
| <result column="need_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="bussiness_manage_fee_need_pay" jdbcType="VARCHAR" property="bussinessManageFeeNeedPay"/> | |||
| <result column="operating_manage_fee_need_pay" jdbcType="VARCHAR" property="operatingManageFeeNeedPay"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="user_id" jdbcType="BIGINT" property="userId"/> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | |||
| <result column="update_by" jdbcType="BIGINT" property="updateBy"/> | |||
| <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/> | |||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | |||
| <result column="revenue" jdbcType="VARCHAR" property="revenue"/> | |||
| <result column="late_pay_ratio" jdbcType="INTEGER" property="latePayRatio"/> | |||
| <result column="late_pay_time" jdbcType="TIMESTAMP" property="latePayTime"/> | |||
| <result column="late_pay_price" jdbcType="VARCHAR" property="latePayPrice"/> | |||
| <result column="period" jdbcType="INTEGER" property="period"/> | |||
| <result column="is_preview" property="isPreview"/> | |||
| <result column="shop_info" jdbcType="VARCHAR" property="shopInfo"/> | |||
| <result column="pay_way" jdbcType="BIGINT" property="payWay"/> | |||
| <result column="late_pay_status" jdbcType="INTEGER" property="latePayStatus"/> | |||
| <result column="comments" jdbcType="VARCHAR" property="comments"/> | |||
| <result column="starttime" property="starttime"/> | |||
| <result column="endtime" property="endtime"/> | |||
| <result column="last_owe_call_time" jdbcType="TIMESTAMP" property="lastOweCallTime"/> | |||
| <result column="last_owe_call_user" jdbcType="VARCHAR" property="lastOweCallUser"/> | |||
| <result column="merchant_name" property="merchantName"/> | |||
| <result column="deposit" property="deposit"/> | |||
| <result column="deposit_status" property="depositStatus"/> | |||
| <result column="rent_type" property="rentType"/> | |||
| <result column="all_period" property="allPeriod"/> | |||
| <result column="pay_ratio" property="payRatio"/> | |||
| <result column="bus_discount_ratio" property="busDiscountRatio"/> | |||
| <result column="late_pay_day" property="latePayDay"/> | |||
| <result column="late_pay_ratio" property="latePayRatio"/> | |||
| <result column="freeze" property="freeze"/> | |||
| <result column="bus_discount_ratio" property="busDiscountRatio"/> | |||
| <result column="join_rent_price" property="joinRentPrice"/> | |||
| <result column="service_charge_pay" property="serviceChargePay"/> | |||
| <result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/> | |||
| <result column="set_off" jdbcType="VARCHAR" property="setOff"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `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` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if> | |||
| <if test=" null != energyFeesId ">and `energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != receivePay ">and `receive_pay` = #{receivePay}</if> | |||
| <if test=" null != pay ">and `pay` = #{pay}</if> | |||
| <if test=" null != receiveDate ">and `receive_date` = #{receiveDate}</if> | |||
| <if test=" null != payDate ">and `pay_date` = #{payDate}</if> | |||
| <if test=" null != createtime ">and `createtime` = #{createtime}</if> | |||
| <if test=" null != expiredDay ">and `expired_day` = #{expiredDay}</if> | |||
| <if test=" null != status ">and `status` = #{status}</if> | |||
| <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if> | |||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||
| <if test=" null != needPay ">and `need_pay` = #{needPay}</if> | |||
| <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if> | |||
| <if test=" null != userId ">and `user_id` = #{userId}</if> | |||
| <if test=" null != shopId ">and `shop_id` = #{shopId}</if> | |||
| <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if> | |||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != isPreview ">and is_preview = #{isPreview}</if> | |||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | |||
| <if test=" null != latePayStatus ">and `late_pay_status` = #{latePayStatus}</if> | |||
| <if test=" null != starttime ">and `starttime` = #{starttime}</if> | |||
| <if test=" null != endtime ">and `endtime` = #{endtime}</if> | |||
| <if test=" null != endtimeBegin "> | |||
| and endtime >= #{endtimeBegin} | |||
| </if> | |||
| <if test=" null != endtimeEnd"> | |||
| and endtime < #{endtimeEnd} | |||
| </if> | |||
| <if test=" 1 == notifyed ">and (`last_owe_call_time` is not null and `receive_pay` - `pay` - IFNULL(`set_off`,'0') > 0 and status not in (3,6,7) )</if> | |||
| <if test=" null != statusList "> | |||
| and status in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_bill_rent | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_bill_rent where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <sql id="queryBillRentListCondition"> | |||
| <where> | |||
| br.is_preview = 0 | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> and br.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId">and br.`parent_tenant_id` = #{parentTenantId}</if> | |||
| <if test=" null != freeze ">and br.`freeze` = #{freeze}</if> | |||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != status ">and br.`status` = #{status}</if> | |||
| <if test=" null != applyStatus ">and br.`apply_status` = #{applyStatus}</if> | |||
| <if test=" null != id ">and br.`id` = #{id}</if> | |||
| <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if> | |||
| <if test=" null != isDel ">and br.`is_del` = #{isDel}</if> | |||
| <if test=" null != rentContractId ">and br.`rent_contract_id` = #{rentContractId}</if> | |||
| <if test=" null != energyFeesId ">and br.`energy_fees_id` = #{energyFeesId}</if> | |||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | |||
| <if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if> | |||
| <if test=" null != starttime">and br.`starttime` <= #{starttime}</if> | |||
| <if test=" null != endtime">and br.`endtime` >= #{endtime}</if> | |||
| <if test=" null != month and '' != month"> | |||
| and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month} | |||
| </if> | |||
| <if test=" null == nearBillLastTime and null != oweBillLastTime"> | |||
| and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" null != nearBillLastTime and null != oweBillLastTime"> | |||
| 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)) | |||
| </if> | |||
| <if test=" null != needPayStartDay"> | |||
| and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - IFNULL(br.`set_off`,'0') > 0 and br.status not in (3,6,7)) | |||
| </if> | |||
| <if test=" 1 == notifyed ">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) )</if> | |||
| <if test=" null != rentContractIdList "> | |||
| and br.`rent_contract_id` in | |||
| <foreach collection="rentContractIdList" index="index" item="ridItem" open="(" separator="," close=")"> | |||
| #{ridItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != merchantIdList "> | |||
| and br.`merchant_id` in | |||
| <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")"> | |||
| #{midItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and br.`status` in | |||
| <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")"> | |||
| #{stItem} | |||
| </foreach> | |||
| </if> | |||
| </where> | |||
| </sql> | |||
| <select id="queryBillRentList" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap"> | |||
| select br.`id`,br.`tenant_id`,br.`parent_tenant_id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`,br.`last_owe_call_user`, | |||
| br.`status`,br.`contract_need_pay`,br.`rent_price_info`,br.`need_pay`,br.`bussiness_manage_fee_need_pay`,br.`operating_manage_fee_need_pay`,br.`last_owe_call_time`, | |||
| br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,br.`revenue`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`, | |||
| br.late_pay_price,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime,br.bus_discount_ratio,br.freeze,br.join_rent_price,br.service_charge_pay, | |||
| br.`create_by`,br.`create_by_name`,br.`update_by`,br.`update_by_name`,br.`energy_fees_id`,br.`set_off` | |||
| from wx_bill_rent br | |||
| <include refid="queryBillRentListCondition"/> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| <if test="null != limitStart and null != limitEnd"> | |||
| limit #{limitStart},#{limitEnd} | |||
| </if> | |||
| </select> | |||
| <select id="queryBillRentContractIdList" parameterType="com.iformall.domain.po.WxBillRent" resultType="Long"> | |||
| select distinct rent_contract_id from wx_bill_rent br | |||
| <include refid="queryBillRentListCondition"/> | |||
| </select> | |||
| <resultMap id="SumBaseResultMap" type="com.iformall.domain.vo.WxBillSum"> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="paid" jdbcType="VARCHAR" property="paid" /> | |||
| <result column="min_date" jdbcType="TIMESTAMP" property="minDate" /> | |||
| <result column="max_date" jdbcType="TIMESTAMP" property="maxDate" /> | |||
| <result column="service_pay" jdbcType="VARCHAR" property="servicePay"/> | |||
| <result column="late_pay" jdbcType="VARCHAR" property="latePay"/> | |||
| <result column="return_pay" jdbcType="VARCHAR" property="returnPay"/> | |||
| </resultMap> | |||
| <select id="getBillMonthSum" parameterType="com.iformall.domain.po.WxBillRent" resultMap="SumBaseResultMap"> | |||
| select | |||
| sum(CAST(br.receive_pay AS DECIMAL(20,2))) receive_pay , | |||
| sum(CAST(br.pay AS DECIMAL(20,2))) paid, | |||
| min(starttime) min_date, | |||
| max(endtime) max_date, | |||
| sum(CAST(br.service_charge_pay AS DECIMAL(20,2))) service_pay , | |||
| sum(CAST(br.late_pay_price AS DECIMAL(20,2))) late_pay, | |||
| '0' return_pay | |||
| from wx_bill_rent br | |||
| <include refid="queryBillRentListCondition"/> | |||
| </select> | |||
| <select id="getMerchantIdList" parameterType="com.iformall.domain.po.WxBillRent" resultType="Long"> | |||
| select distinct merchant_id from wx_bill_rent br | |||
| <include refid="queryBillRentListCondition"/> | |||
| </select> | |||
| <resultMap id="HotNotifyBaseResultMap" type="com.iformall.domain.vo.WxBillHotNotify"> | |||
| <result column="total_count" jdbcType="INTEGER" property="totalCount"/> | |||
| <result column="total_money" jdbcType="VARCHAR" property="totalMoney" /> | |||
| <result column="min_begin_time" jdbcType="TIMESTAMP" property="minBeginTime"/> | |||
| </resultMap> | |||
| <select id="getBillHotNotify" parameterType="com.iformall.domain.po.WxBillRent" resultMap="HotNotifyBaseResultMap"> | |||
| select count(1) total_count , sum(CAST(br.`receive_pay` AS DECIMAL(20,2)) - CAST(br.`pay` AS DECIMAL(20,2)) - CAST(IFNULL(br.`set_off`,'0') AS DECIMAL(20,2))) total_money,MIN(br.starttime) min_begin_time from wx_bill_rent br | |||
| <include refid="queryBillRentListCondition"/> | |||
| </select> | |||
| <resultMap id="NotifyResultMap" type="com.iformall.domain.vo.WxBillNotify"> | |||
| <result column="bill_type" jdbcType="INTEGER" property="billType"/> | |||
| <result column="bill_type_name" jdbcType="VARCHAR" property="billTypeName" /> | |||
| <result column="bill_id" jdbcType="BIGINT" property="billId" /> | |||
| <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/> | |||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| </resultMap> | |||
| <select id="getBillNotifyList" parameterType="com.iformall.domain.po.WxBillRent" resultMap="NotifyResultMap"> | |||
| select #{billType} bill_type,#{billTypeName} bill_type_name,br.id as bill_id, br.starttime,br.endtime,br.receive_pay,br.pay,br.merchant_id from wx_bill_rent br | |||
| <include refid="queryBillRentListCondition"/> | |||
| </select> | |||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(CAST(receive_pay AS DECIMAL(20,2))),0) receivepay,IFNULL(sum(CAST(pay AS DECIMAL(20,2))),0) pay,tenant_id from wx_bill_rent | |||
| where is_preview = 0 | |||
| and status!=6 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and receive_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and receive_date < #{endTime} | |||
| </if> | |||
| </select> | |||
| <select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(CAST(receive_pay AS DECIMAL(20,2))),0) receivepay,IFNULL(sum(CAST(pay AS DECIMAL(20,2))),0) pay,tenant_id from wx_bill_rent | |||
| where is_preview = 0 and status!=6 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and receive_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and receive_date < #{endTime} | |||
| </if> | |||
| </select> | |||
| <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(receive_pay-pay),0) owe,tenant_id from wx_bill_rent | |||
| where status = 1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and receive_date between #{startdate} and #{enddate} and is_preview = 0 | |||
| </select> | |||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | |||
| 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 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and b.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and b.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </update> | |||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | |||
| 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} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and br.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and br.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and br.status!=6 and now() < br.receive_date | |||
| and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | |||
| </update> | |||
| <update id="updateInvalidStatus" parameterType="com.iformall.domain.po.WxBillRent"> | |||
| update wx_bill_rent set status = 6 where rent_contract_id = #{rentContractId} | |||
| and status != 3 | |||
| </update> | |||
| <delete id="deleteBillByContract" parameterType="com.iformall.domain.po.WxRentContract"> | |||
| delete from wx_bill_rent where rent_contract_id = #{id} | |||
| </delete> | |||
| <delete id="deletePreviewBill" parameterType="com.iformall.domain.po.WxBillRent"> | |||
| delete from wx_bill_rent where rent_contract_id = #{rentContractId} | |||
| <if test=" null != isPreview "> and is_preview = #{isPreview}</if> | |||
| </delete> | |||
| <delete id="deleteNoNeedPayBill" parameterType="com.iformall.domain.po.WxBillRent"> | |||
| 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 | |||
| </delete> | |||
| <update id="updateForReceiverPay" parameterType="com.iformall.domain.po.WxBillRent"> | |||
| update wx_bill_rent set updatetime = now() | |||
| <if test=" null != receivePay ">,receive_pay = #{receivePay}</if> | |||
| <if test=" null != comments ">,comments = #{comments}</if> | |||
| <if test=" null != receiveDate ">,receive_date = #{receiveDate}</if> | |||
| <if test="0 == receivePay or 0l == receivePay">,status = 3,pay_date=now()</if> | |||
| where id = #{id} | |||
| </update> | |||
| <update id="updatePreviewStatus" parameterType="com.iformall.domain.po.WxBillRent"> | |||
| update wx_bill_rent set is_preview = #{isPreview},merchant_id = #{merchantId},need_pay = receive_pay | |||
| where rent_contract_id = #{rentContractId} | |||
| </update> | |||
| <select id="oweBillCount" parameterType="java.lang.Long" resultType="java.lang.Long"> | |||
| select count(br.id) from wx_bill_rent br,wx_rent_contract c where c.id = br.rent_contract_id | |||
| and br.status = 1 and c.id = #{contractId} | |||
| </select> | |||
| <insert id="insertBills" parameterType="HashMap"> | |||
| 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 | |||
| <foreach collection="list" item="item" index="index" separator=","> | |||
| ( | |||
| #{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} | |||
| ) | |||
| </foreach> | |||
| </insert> | |||
| <update id="updateBills" parameterType="java.util.List"> | |||
| <foreach collection="bills" item="item" index="index" open="" close="" separator=";"> | |||
| update wx_bill_rent | |||
| <set> | |||
| <if test=" null != item.receivePay ">updatetime = now(),receive_pay = #{item.receivePay},</if> | |||
| <if test=" null != item.comments ">comments = #{item.comments},</if> | |||
| <if test=" null != item.receiveDate ">receive_date = #{item.receiveDate},</if> | |||
| <if test="0 == item.receivePay or 0l == item.receivePay">status = 3,pay_date=now()</if> | |||
| </set> | |||
| where id = #{item.id} | |||
| </foreach> | |||
| </update> | |||
| <select id="selectBillOne" parameterType="com.iformall.domain.po.WxBillRent" | |||
| resultType="com.iformall.domain.po.WxBillRent"> | |||
| select * from wx_bill_rent where merchant_id=#{merchantId} | |||
| AND rent_shop_type = #{rentShopType} AND is_preview = #{isPreview} | |||
| AND date_format(starttime,'%Y-%m-%d 00:00:00.0') = #{starttime} AND date_format(endtime,'%Y-%m-%d 00:00:00.0') = #{endtime} | |||
| </select> | |||
| <delete id = "deleteById" parameterType="HashMap"> | |||
| delete from wx_bill_rent where id = #{id} and tenant_id = #{tenantId} | |||
| </delete> | |||
| <!-- | |||
| <update id="insertBillAction"> | |||
| insert into wx_bill_action(id,user_name,`action`,bill_id,details,tenant_id,parent_tenant_id) | |||
| select | |||
| (select unix_timestamp(now()) + CEILING(RAND()*90000+10000) + CEILING(RAND()*90000+10000)+ CEILING(RAND()*90000+10000) ) id | |||
| ,'系统端' user_name,7 `action`,b.id bill_id, | |||
| CONCAT('系统计入', | |||
| if(b.late_pay_price is null, | |||
| round( | |||
| c.late_pay_ratio * DATEDIFF(now(), date_add(b.receive_date,interval(c.late_pay_day) day)) /10000 | |||
| ,2) | |||
| , | |||
| round( | |||
| (c.late_pay_ratio) /10000 | |||
| ,2) | |||
| ) | |||
| ,'元') details,b.tenant_id,b.parent_tenant_id | |||
| from wx_bill_rent b left join wx_rent_contract c on(b.rent_contract_id=c.id) | |||
| where c.late_pay_ratio >0 | |||
| and DATEDIFF(now(), date_add(b.receive_date,interval(c.late_pay_day) day)) >0 | |||
| and b.status!=3 and b.status!=6 | |||
| </update> | |||
| <update id="autoAddLatePayPrice"> | |||
| update wx_bill_rent b set b.late_pay_price = | |||
| if(b.late_pay_price is null, | |||
| round( | |||
| (select late_pay_ratio from wx_rent_contract where id = b.`rent_contract_id`) | |||
| * DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_rent_contract where id = b.`rent_contract_id`) day)) /100 | |||
| ,2) | |||
| , | |||
| b.late_pay_price + | |||
| round( | |||
| (select late_pay_ratio from wx_rent_contract where id = b.`rent_contract_id`) /100 | |||
| ,2) | |||
| ) | |||
| where b.status!=3 and b.status!=6 | |||
| and (select late_pay_ratio from wx_rent_contract where id = b.`rent_contract_id`) > 0 | |||
| and DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_rent_contract where id = b.`rent_contract_id`) day)) >0; | |||
| </update> | |||
| <update id="updateServiceCharge" parameterType="com.iformall.domain.po.WxPayAccountBill"> | |||
| update wx_bill_rent set service_charge_pay=round(receive_pay*#{serviceChargeRate}/10000) | |||
| where service_charge_pay=0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and status in(1,2,4) | |||
| </update>--> | |||
| <!-- <update id="updateOwe"> | |||
| update wx_bill_rent set owe = receive_pay + service_charge_pay + ifnull(late_pay_price,0) - pay where status in (1,2,4) | |||
| </update> --> | |||
| </mapper> | |||
| @@ -1,147 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxBillSettleScheduleMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillSettleSchedule"> | |||
| <id column="id" property="id"/> | |||
| <result column="tenant_id" property="tenantId"/> | |||
| <result column="parent_tenant_id" property="parentTenantId"/> | |||
| <result column="settle_number" property="settleNumber"/> | |||
| <result column="merchant_id" property="merchantId"/> | |||
| <result column="status" property="status"/> | |||
| <result column="apply_status" property="applyStatus"/> | |||
| <result column="receiveMoney" property="receiveMoney"/> | |||
| <result column="payMoney" property="payMoney"/> | |||
| <result column="settletime" property="settletime"/> | |||
| <result column="createtime" property="createtime"/> | |||
| <result column="updatetime" property="updatetime"/> | |||
| <result column="merchantName" property="merchantName"/> | |||
| <result column="settle_receive_pay" property="settleReceivePay"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`settle_number`,`merchant_id`,`status`,`apply_status`, | |||
| `receive_money`,`pay_money`,`settletime`,`createtime`,`updatetime`,`settle_receive_pay` | |||
| </sql> | |||
| <insert id = "createScheduleFromBillSettle" parameterType= "hashmap"> | |||
| 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} | |||
| </insert> | |||
| <select id="listToSettleBillIdList" resultType="Long" parameterType="com.iformall.domain.vo.WxBillAll"> | |||
| select s.id from wx_bill_settle s where has_recorded != 1 and s.status > 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and s.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and s.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="listBillSettleBillBillId" resultType="Long" parameterType="hashmap"> | |||
| select bb.bill_id from wx_bill_settle_bill bb where bb.settle_id = #{settleId} and bb.type=#{type} | |||
| </select> | |||
| <select id="calculteRentRecivePay" resultType="Double" parameterType="com.iformall.domain.po.WxBillRent"> | |||
| select IFNULL(sum( (receive_pay+service_charge_pay+ifnull(late_pay_price,0)-pay)),0) owe | |||
| from wx_bill_rent where is_preview = 0 and tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calculteRentDepositRecivePay" resultType="Double" parameterType="com.iformall.domain.po.WxBillRent"> | |||
| select IFNULL(sum( (receive_pay-pay)),0) owe | |||
| from wx_bill_rent_deposit where tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calcultePropertyRecivePay" resultType="Double" parameterType="com.iformall.domain.po.WxBillProperty"> | |||
| select IFNULL(sum( (receive_pay+service_charge_pay+ifnull(late_pay_price,0)-pay)),0) owe | |||
| from wx_bill_property where is_preview = 0 and tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calcultePropertyDepositRecivePay" resultType="Double" parameterType="com.iformall.domain.po.WxBillProperty"> | |||
| select IFNULL(sum( (receive_pay-pay)),0) owe | |||
| from wx_bill_property_deposit where tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calculteDailyRecivePay" resultType="Double" parameterType="com.iformall.domain.po.WxBillDaily"> | |||
| select IFNULL(sum( (receive_pay+service_charge_pay-pay)),0) owe | |||
| from wx_bill_daily where tenant_id = #{tenantId} and type in (1,2,3) | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calculteOtherRecivePay0" resultType="Double" parameterType="com.iformall.domain.po.WxBillOther"> | |||
| select IFNULL(sum( (receive_pay+service_charge_pay-pay)),0) owe | |||
| from wx_bill_other where tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calculteOtherRecivePay1" resultType="Double" parameterType="com.iformall.domain.po.WxBillOther"> | |||
| select IFNULL(sum( owe ),0) owe | |||
| from wx_bill_other where tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calculteOtherDepositRecivePay0" resultType="Double" parameterType="com.iformall.domain.po.WxBillOther"> | |||
| select IFNULL(sum( (receive_pay+service_charge_pay-pay)),0) owe | |||
| from wx_bill_other_deposit where tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="calculteMerchantSubsidyRecivePay1" resultType="Double" parameterType="com.iformall.domain.po.WxMerchantSubsidy"> | |||
| select IFNULL(sum( subsidy),0) owe | |||
| from wx_merchant_subsidy where tenant_id = #{tenantId} | |||
| <if test=" null != idList "> | |||
| and `id` in | |||
| <foreach collection="idList" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| </mapper> | |||
| @@ -430,9 +430,9 @@ | |||
| select * from wx_property_contract where rent_contract_id =#{id} order by createtime desc limit 1 | |||
| </select> | |||
| <select id="getByBill" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="BaseResultMap"> | |||
| <select id="getByBill" parameterType="com.iformall.domain.po.WxAllBill" resultMap="BaseResultMap"> | |||
| 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} | |||
| ) | |||
| </select> | |||
| @@ -444,10 +444,10 @@ | |||
| <if test=" null == sortColumns">order by rc.createtime desc,rc.id desc</if> | |||
| </select> | |||
| <select id="getByBill" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap"> | |||
| <select id="getByBill" parameterType="com.iformall.domain.po.WxAllBill" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> 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} | |||
| ) | |||
| </select> | |||