| @@ -212,6 +212,7 @@ public class WxMerchantController extends BaseController { | |||
| return new ResultData(wxMerchant); | |||
| } | |||
| @UserDataRuleAnnotation("merchant_list") | |||
| @ApiOperation("商户数据导出") | |||
| @GetMapping("/exportData") | |||
| @SystemControllerLog(description = "商户-商户数据导出") | |||
| @@ -94,6 +94,7 @@ public class WxMerchantTradeDailyController extends BaseController { | |||
| return wxMerchantTradeDailyService.queryTradeDaily(wxMerchantTradeDaily); | |||
| } | |||
| @UserDataRuleAnnotation("merchant_trade") | |||
| @GetMapping("exportData") | |||
| @SystemControllerLog(description = "商户解单数据-导出数据") | |||
| public void exportData(@ModelAttribute WxMerchantTradeDaily wxMerchantTradeDaily, HttpServletRequest request, HttpServletResponse response) { | |||
| @@ -2,10 +2,12 @@ package com.iformall.controller.rent; | |||
| 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.domain.po.BaseEntity; | |||
| import com.iformall.domain.po.WxBillSettle; | |||
| import com.iformall.domain.po.WxBillSettleRecord; | |||
| import com.iformall.service.WxBillSettleRecordService; | |||
| import com.iformall.service.WxBillSettleService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -48,6 +50,15 @@ public class WxBillSettleController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @ApiOperation("账单管理-结算单-id查找") | |||
| @SystemControllerLog(description = "账单管理-结算单-id查找") | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillSettleController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillSettleService.getById(id)); | |||
| } | |||
| @PostMapping("addOrUpdate") | |||
| @ApiOperation("账单管理-结算单-新增或编辑") | |||
| @SystemControllerLog(description = "账单管理-结算单-新增或编辑") | |||
| @@ -57,6 +68,15 @@ public class WxBillSettleController extends BaseController { | |||
| return wxBillSettleService.saveOrUpdate(wxBillSettle,getUser()); | |||
| } | |||
| @PostMapping("settle") | |||
| @ApiOperation("账单管理-结算单-结算") | |||
| @SystemControllerLog(description = "账单管理-结算单-结算") | |||
| public ResultData settle(@RequestBody WxBillSettleRecord wxBillSettleRecord) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillSettleController::settle"); | |||
| wxBillSettleRecord.setTenantId(getTenantId()); | |||
| return wxBillSettleRecordService.saveOrUpdate(wxBillSettleRecord,getUser()); | |||
| } | |||
| @GetMapping("exportSettle") | |||
| @SystemControllerLog(description = "账单管理-结算单-导出") | |||
| public void exportBill(@ModelAttribute WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response) { | |||
| @@ -0,0 +1,2 @@ | |||
| alter table wx_bill_rent | |||
| add column `bus_discount_ratio` varchar(500) NULL DEFAULT NULL COMMENT '联营扣点率'; | |||
| @@ -0,0 +1,28 @@ | |||
| INSERT INTO `mall_permission` (`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) | |||
| VALUES | |||
| (417, '结算管理', 415, 'Y', NULL, 1, NULL, NULL, 'auditManage', 'icon-jiesuan', 0, 417); | |||
| DROP TABLE IF EXISTS `mall_sale_type` ; | |||
| CREATE TABLE `mall_sale_type` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `name` varchar(32) DEFAULT NULL COMMENT '销售类型', | |||
| `type` tinyint(2) DEFAULT NULL COMMENT '资源类型1:尊享全能版 2:尊享营销版 3.速享版', | |||
| `period` tinyint(2) DEFAULT NULL COMMENT '有效期(单位月)', | |||
| `menus` json DEFAULT NULL COMMENT '菜单列表', | |||
| PRIMARY KEY (`id`), | |||
| UNIQUE `id_UNIQUE` USING BTREE (`id`) comment '' | |||
| ) ENGINE=`InnoDB` ROW_FORMAT=DYNAMIC COMMENT='系统销售表' CHECKSUM=0 DELAY_KEY_WRITE=0; | |||
| INSERT INTO `mall_sale_type` | |||
| (`id`,`name`, `type`, `period`, `menus`) | |||
| VALUES | |||
| (1, '尊享全能版', 1, 12, | |||
| '[1,2,3,4,5,6,7,8,9,10,50,101,102,103,104,105,106,107,108,201,202,203,204,205,206,211,212,221,222,251,301,302,303,304,305,306,401,402,403,404,405,406,407,408,409,410,411,412,413,414,417,501,502,503,504,505,506,507,508,509,511,512,513,521,522,523,531,532,533,591,595,601,602,603,604,605,606,607,608,609,610,611,612,621,622,623,624,625,626,627,641,642,643,644,645,651,661,662,663,671,672,673,674,681,682,683,684,685,691,692,693,694,695,701,702,711,712,713,901,902,903,931,932,951,952,961,962,965,966,967,968]' | |||
| ), | |||
| (2, '尊享营销版', 2, 12, | |||
| '[1,2,4,5,6,7,8,9,10,50,101,102,103,104,105,106,107,201,202,203,204,205,211,212,221,222,251,409,410,411,501,502,503,504,505,506,507,508,509,511,512,513,521,522,523,531,532,533,591,595,601,602,603,604,605,606,607,608,609,610,611,612,621,622,623,624,625,626,627,641,642,643,644,645,651,661,662,663,671,672,673,674,681,682,683,684,685,691,692,693,694,695,701,702,711,712,713,901,902,903,931,932,951,961]' | |||
| ), | |||
| (3, '速享版', 3, 1, | |||
| '[2,4,5,6,7,10,50,201,202,205,211,212,221,222,251,409,410,411,501,502,503,504,505,506,507,508,511,512,513,521,522,523,531,532,533,591,592,601,602,603,604,605,606,607,608,609,610,611,612,621,622,623,624,625,626,641,642,643,644,645,651,661,662,663,671,672,673,674,681,682,683,684,685,691,692,693,694,695,701,702,711,712,713,901,902,903,931,932]' | |||
| ) | |||
| ; | |||
| @@ -0,0 +1 @@ | |||
| update `mall_sale_type` set `menus`='[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 50, 101, 102, 103, 104, 105, 106, 107, 108, 201, 202, 203, 204, 205, 206, 211, 212, 221, 222, 251, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 521, 522, 523, 531, 532, 533, 591, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 651, 661, 662, 663, 671, 672, 673, 674, 681, 682, 683, 684, 685, 691, 692, 693, 694, 695, 701, 702, 711, 712, 713, 901, 902, 903, 931, 932, 951, 952, 961, 962, 965, 966, 967, 968]' where `id`='1'; | |||
| @@ -0,0 +1,2 @@ | |||
| alter table wx_rent_contract modify adjust_ratio_way smallint(2) default 1 comment '年租金调整方式1按比例2按金额3自定义'; | |||
| alter table wx_property_contract modify adjust_ratio_way smallint(2) default 1 comment '年租金调整方式1按比例2按金额3自定义'; | |||
| @@ -193,4 +193,5 @@ public class WxBillRent extends BaseEntity { | |||
| @Transient | |||
| private String latePayMoneyUpdate; | |||
| private String busDiscountRatio; | |||
| } | |||
| @@ -50,4 +50,12 @@ public class WxBillSettle extends BaseEntity { | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") | |||
| private Map<String, Object> flowParams; | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value = "收款账单列表", name = "receiveBillIds") | |||
| private List<WxBillSettleBill> receiveBillIds; | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value = "承付账单列表", name = "payBillIds") | |||
| private List<WxBillSettleBill> payBillIds; | |||
| } | |||
| @@ -0,0 +1,46 @@ | |||
| package com.iformall.domain.po; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| * @author luozukai | |||
| */ | |||
| @Table(name = "wx_bill_settle_bill") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxBillSettleBill extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="结算单id",name="settleId") | |||
| private Long settleId; | |||
| @io.swagger.annotations.ApiModelProperty(value="类型: 0收款1承付",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="账单id",name="billId") | |||
| private Long billId; | |||
| @io.swagger.annotations.ApiModelProperty(value="账单类型: 1租金2押金3物业4水费5电费6其他7空调费",name="billType") | |||
| private Integer billType; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") | |||
| private Date createtime; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") | |||
| private Date updatetime; | |||
| @Transient | |||
| private String billName; | |||
| @Transient | |||
| private String receivePay; | |||
| } | |||
| @@ -8,4 +8,6 @@ public class RatioVo { | |||
| private Integer ratio = 0; | |||
| //金额 | |||
| private Long price = 0l; | |||
| private String useRatio = ""; | |||
| } | |||
| @@ -12,6 +12,7 @@ public enum EnumBillRentStatus { | |||
| NOT_EXPIRED(4,"未到期"), | |||
| RETURN(5, "已退还"), | |||
| INVALID(6, "失效"), | |||
| FREEZE(7, "冻结(结算单审核过程中)"), | |||
| ; | |||
| public static EnumBillRentStatus getEnum(Integer code) { | |||
| @@ -13,7 +13,8 @@ public enum EnumBillType { | |||
| WATER(4, "水费"), | |||
| POWER(5, "电费"), | |||
| ROUTINE(6, "其他"), | |||
| AIR_CONDITIONING(7, "空调费") | |||
| AIR_CONDITIONING(7, "空调费"), | |||
| OTHER_DEPOSIT(8, "其他押金") | |||
| ; | |||
| public static EnumBillType getEnum(Integer code) { | |||
| @@ -0,0 +1,37 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumSettleBillType { | |||
| // 0收款1承付 | |||
| R(0, "收款"), | |||
| P(1, "承付"), | |||
| ; | |||
| public static EnumSettleBillType getEnum(Integer code) { | |||
| for (EnumSettleBillType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumSettleBillType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,18 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxBillSettle; | |||
| import com.iformall.domain.po.WxBillSettleBill; | |||
| import java.util.List; | |||
| /** | |||
| * @author luozukai | |||
| */ | |||
| public interface WxBillSettleBillMapper extends CommonMapper<WxBillSettleBill, Long> { | |||
| List<WxBillSettleBill> findBySettleId(WxBillSettleBill wxBillSettleBill); | |||
| void update(WxBillSettleBill record); | |||
| void delBySettleId(WxBillSettle record); | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillSettleRecord; | |||
| /** | |||
| @@ -17,12 +18,11 @@ public interface WxBillSettleRecordService { | |||
| */ | |||
| PageInfo<WxBillSettleRecord> listAsPage(WxBillSettleRecord record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| ResultData saveOrUpdate(WxBillSettleRecord record); | |||
| ResultData saveOrUpdate(WxBillSettleRecord record,MallUserInfo mallUserInfo); | |||
| } | |||
| @@ -321,7 +321,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| long newReceivePay; | |||
| if(ratioVo != null){ | |||
| newReceivePay = ratioVo.getPrice(); | |||
| ratio = ratioVo.getRatio(); | |||
| //ratio = ratioVo.getRatio(); | |||
| }else{ | |||
| BigDecimal hundred = new BigDecimal(100); | |||
| BigDecimal revenue = new BigDecimal(record.getRevenue() == null ? 0 : record.getRevenue()).divide(hundred); | |||
| @@ -340,6 +340,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| //如果在跳点区间中,修改扣点率 | |||
| if(StringUtils.isNotBlank(wxRentContract.getBusDiscountRatio())){ | |||
| wxBillRent.setBusDiscountRatio(ratioVo.getUseRatio()); | |||
| wxBillRent.setPayRatio(new Long(ratio)); | |||
| } | |||
| wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| @@ -2,6 +2,7 @@ package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillSettleRecord; | |||
| import com.iformall.mapper.WxBillSettleRecordMapper; | |||
| import com.iformall.service.WxBillSettleRecordService; | |||
| @@ -24,7 +25,9 @@ public class WxBillSettleRecordServiceImpl implements WxBillSettleRecordService | |||
| } | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillSettleRecord record) { | |||
| public ResultData saveOrUpdate(WxBillSettleRecord record,MallUserInfo mallUserInfo) { | |||
| return null; | |||
| } | |||
| } | |||
| @@ -4,16 +4,20 @@ import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxBillSettle; | |||
| import com.iformall.mapper.WxBillSettleMapper; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.enums.EnumBillType; | |||
| import com.iformall.enums.EnumSettleBillType; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.WxBillSettleService; | |||
| import com.iformall.service.WxFlowService; | |||
| import org.checkerframework.checker.units.qual.A; | |||
| 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.util.List; | |||
| /** | |||
| * @author luozukai | |||
| @@ -25,6 +29,22 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| private WxBillSettleMapper wxBillSettleMapper; | |||
| @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; | |||
| @Override | |||
| public PageInfo<WxBillSettle> listAsPage(WxBillSettle record, Integer pageIndex, Integer pageSize) { | |||
| @@ -32,20 +52,90 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| } | |||
| @Override | |||
| public WxBillSettle getById(Long id) { | |||
| return wxBillSettleMapper.selectByPrimaryKey(id); | |||
| public WxBillSettle getById(Long id){ | |||
| WxBillSettle billSettle = wxBillSettleMapper.selectByPrimaryKey(id); | |||
| if(billSettle != null) { | |||
| WxBillSettleBill wxBillSettleBill = new WxBillSettleBill(); | |||
| wxBillSettleBill.setTenantId(billSettle.getTenantId()); | |||
| wxBillSettleBill.setSettleId(billSettle.getId()); | |||
| wxBillSettleBill.setType(EnumSettleBillType.R.getCode()); | |||
| billSettle.setReceiveBillIds(wxBillSettleBillMapper.findBySettleId(wxBillSettleBill)); | |||
| wxBillSettleBill.setType(EnumSettleBillType.P.getCode()); | |||
| billSettle.setPayBillIds(wxBillSettleBillMapper.findBySettleId(wxBillSettleBill)); | |||
| } | |||
| return billSettle; | |||
| } | |||
| public void updateFreeze(List<WxBillSettleBill> billList){ | |||
| for (WxBillSettleBill bill:billList) { | |||
| if(EnumBillType.RENT.getCode().equals(bill.getBillType())) { | |||
| WxBillRent wxBillRent = new WxBillRent(); | |||
| wxBillRent.setId(bill.getBillId()); | |||
| wxBillRent.setStatus(EnumBillRentStatus.FREEZE.getCode()); | |||
| wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| }else if(EnumBillType.DEPOSIT.getCode().equals(bill.getBillType())) { | |||
| WxBillDeposit wxBillRent = new WxBillDeposit(); | |||
| wxBillRent.setId(bill.getBillId()); | |||
| wxBillRent.setStatus(EnumBillRentStatus.FREEZE.getCode()); | |||
| wxBillDepositMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| }else if(EnumBillType.PROPERTY.getCode().equals(bill.getBillType())) { | |||
| WxBillProperty wxBillRent = new WxBillProperty(); | |||
| wxBillRent.setId(bill.getBillId()); | |||
| wxBillRent.setStatus(EnumBillRentStatus.FREEZE.getCode()); | |||
| wxBillPropertyMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| WxBillPropertyDeposit propertyDeposit = new WxBillPropertyDeposit(); | |||
| propertyDeposit.setId(bill.getBillId()); | |||
| propertyDeposit.setStatus(EnumBillRentStatus.FREEZE.getCode()); | |||
| wxBillPropertyDepositMapper.updateByPrimaryKeySelective(propertyDeposit); | |||
| }else if(EnumBillType.ROUTINE.getCode().equals(bill.getBillType())) { | |||
| WxBillOther wxBillRent = new WxBillOther(); | |||
| wxBillRent.setId(bill.getBillId()); | |||
| wxBillRent.setStatus(EnumBillRentStatus.FREEZE.getCode()); | |||
| wxBillOtherMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| }else if(EnumBillType.OTHER_DEPOSIT.getCode().equals(bill.getBillType())) { | |||
| WxBillOtherDeposit wxBillRent = new WxBillOtherDeposit(); | |||
| wxBillRent.setId(bill.getBillId()); | |||
| wxBillRent.setStatus(EnumBillRentStatus.FREEZE.getCode()); | |||
| wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| }else{ | |||
| WxBillDaily wxBillRent = new WxBillDaily(); | |||
| wxBillRent.setId(bill.getBillId()); | |||
| wxBillRent.setStatus(EnumBillRentStatus.FREEZE.getCode()); | |||
| wxBillDailyMapper.updateByPrimaryKeySelective(wxBillRent); | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| @Transactional | |||
| public ResultData saveOrUpdate(WxBillSettle record, MallUserInfo userInfo) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| if (record.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxBillSettleMapper.insertSelective(record); | |||
| } else { | |||
| }else{ | |||
| wxBillSettleMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| wxBillSettleBillMapper.delBySettleId(record); | |||
| //保存中间表 | |||
| for (WxBillSettleBill bill:record.getReceiveBillIds()) { | |||
| bill.setId(idWorker.nextId()); | |||
| bill.setSettleId(record.getId()); | |||
| bill.setTenantId(record.getTenantId()); | |||
| wxBillSettleBillMapper.insertSelective(bill); | |||
| } | |||
| //改为冻结状态 | |||
| if (record.getFlowParams() != null && record.getFlowParams().size() > 0) { | |||
| updateFreeze(record.getReceiveBillIds()); | |||
| updateFreeze(record.getPayBillIds()); | |||
| } | |||
| //启动审批流 | |||
| record.getFlowParams().put("businessId",record.getId()); | |||
| if (record.getFlowParams() != null && record.getFlowParams().size() > 0) { | |||
| @@ -622,7 +622,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| return wxMerchantMapper.selectOne(wxMerchant); | |||
| } | |||
| @Override | |||
| public void exportData(WxMerchant wxMerchant, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxMerchant> list = wxMerchantMapper.findList(wxMerchant); | |||
| @@ -280,6 +280,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| List<String> ratioList = JSONArray.parseArray(busDiscountRatio, String.class); | |||
| ratioVo.setUseRatio("["); | |||
| for (int i = 0; i < ratioList.size(); i++) { | |||
| BigDecimal revenue = new BigDecimal(revenueLong).divide(new BigDecimal(1000000)).setScale(4, RoundingMode.HALF_EVEN); | |||
| String e = ratioList.get(i); | |||
| @@ -314,6 +316,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| if (revenue.compareTo(start) >= 0 && revenue.compareTo(end)<= 0){ | |||
| ratioVo.setRatio(ratio); | |||
| ratioVo.setPrice(countPrice(ratioVo.getRatio(),revenueLong,timeType,period,from)); | |||
| ratioVo.setUseRatio(ratioVo.getUseRatio()+e+","); | |||
| break; | |||
| } | |||
| }else if(e.indexOf(">") >= 0){ | |||
| @@ -340,6 +343,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| if (revenue.compareTo(end) >= 0){ | |||
| ratioVo.setRatio(ratio); | |||
| ratioVo.setUseRatio(ratioVo.getUseRatio()+e+","); | |||
| //计算超出部分 | |||
| BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000)); | |||
| @@ -365,10 +369,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| BigDecimal frontPrice = frontEnd.multiply(new BigDecimal(1000000).multiply(frontRatio).setScale(2, RoundingMode.HALF_EVEN)); | |||
| ratioVo.setPrice(price.add(frontPrice).longValue()); | |||
| return ratioVo; | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| ratioVo.setUseRatio(ratioVo.getUseRatio().substring(0,ratioVo.getUseRatio().lastIndexOf(","))+"]"); | |||
| return ratioVo; | |||
| } | |||
| @@ -39,7 +39,7 @@ | |||
| <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"/> | |||
| @@ -50,7 +50,7 @@ | |||
| `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | |||
| `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`, | |||
| `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`, | |||
| `pay_way`,`late_pay_status`,`comments`,starttime,endtime | |||
| `pay_way`,`late_pay_status`,`comments`,starttime,endtime,bus_discount_ratio | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -97,7 +97,7 @@ | |||
| select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`, | |||
| case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`need_pay`,r.merchant_name, | |||
| s.shop_number,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,r.type as rent_type, | |||
| br.pay_ratio,br.`revenue`,r.`late_pay_ratio`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`, | |||
| r.pay_ratio,br.`revenue`,r.`late_pay_ratio`,br.`late_pay_time`,br.`period`,br.`rent_contract_id`, | |||
| d.receive_pay deposit,d.`status` | |||
| deposit_status,br.late_pay_price,br.shop_info,br.pay_way,br.late_pay_status,br.`comments`,br.starttime,br.endtime, | |||
| r.late_pay_day,r.late_pay_ratio | |||
| @@ -0,0 +1,92 @@ | |||
| <?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.WxBillSettleBillMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillSettleBill"> | |||
| <id column="id" property="id"/> | |||
| <result column="tenant_id" property="tenantId"/> | |||
| <result column="settle_id" property="settleId"/> | |||
| <result column="type" property="type"/> | |||
| <result column="bill_id" property="billId"/> | |||
| <result column="bill_type" property="billType"/> | |||
| <result column="createtime" property="createtime"/> | |||
| <result column="updatetime" property="updatetime"/> | |||
| <result column="billName" property="billName"/> | |||
| <result column="receivePay" property="receivePay"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`settle_id`,`type`,`bill_id`,`bill_type` | |||
| ,`createtime`,`updatetime` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</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.WxBillSettleBill" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_bill_settle_bill | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findBySettleId" parameterType="com.iformall.domain.po.WxBillSettleBill" resultMap="BaseResultMap"> | |||
| select bl.bill_id,bl.bill_type,bill.bill_type billName,IFNULL(bill.receive_pay,0) receivePay from wx_bill_settle_bill bl left join | |||
| (select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_rent where is_preview = 0 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||
| wx_bill_rent_deposit | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||
| wx_bill_property where is_preview = 0 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||
| wx_bill_property_deposit | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||
| type=1 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||
| type=2 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,9 bill_type_value,'空调费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||
| type=3 | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他费用' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other | |||
| union all | |||
| select id,merchant_id,shop_id,tenant_id,8 bill_type_value,'其他押金' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit | |||
| ) bill | |||
| on(bl.bill_id = bill.id) | |||
| <if test=" null != tenantId ">and bl.`tenant_id` = #{tenantId}</if> | |||
| <if test=" null != settleId ">and bl.`settle_id` = #{settleId}</if> | |||
| <if test=" null != type ">and bl.`type` = #{type}</if> | |||
| </select> | |||
| <update id="delBySettleId" parameterType="com.iformall.domain.po.WxBillSettle"> | |||
| delete from wx_bill_settle_bill where settle_id = #{id} | |||
| </update> | |||
| </mapper> | |||
| @@ -124,12 +124,17 @@ | |||
| not null and status in(1,2,3,4) | |||
| ) | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <include refid="dataRule"/> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| @@ -150,6 +155,23 @@ | |||
| </select> | |||
| <sql id="dataRule"> | |||
| <if test="(null != floorForRule and '' != floorForRule) or (null != businessForRule and '' != businessForRule)"> | |||
| and m.id in( | |||
| select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms | |||
| inner join wx_merchant m on ms.merchant_id = m.id | |||
| inner join wx_shop s on s.id=ms.shop_id | |||
| where m.tenant_id=#{tenantId} and s.is_del=0 | |||
| <if test=" null != businessForRule and '' != businessForRule "> | |||
| and m.business_id in (${businessForRule}) | |||
| </if> | |||
| <if test=" null != floorForRule and '' != floorForRule "> | |||
| and s.`floor` in (${floorForRule}) | |||
| </if> | |||
| ) | |||
| </if> | |||
| </sql> | |||
| <sql id="dynamicWhereConditionsVo"> | |||
| where m.is_del = 0 | |||
| @@ -232,20 +254,7 @@ | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test="(null != floorForRule and '' != floorForRule) or (null != businessForRule and '' != businessForRule)"> | |||
| and m.id in( | |||
| select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms | |||
| inner join wx_merchant m on ms.merchant_id = m.id | |||
| inner join wx_shop s on s.id=ms.shop_id | |||
| where m.tenant_id=#{tenantId} and s.is_del=0 | |||
| <if test=" null != businessForRule and '' != businessForRule "> | |||
| and m.business_id in (${businessForRule}) | |||
| </if> | |||
| <if test=" null != floorForRule and '' != floorForRule "> | |||
| and s.`floor` in (${floorForRule}) | |||
| </if> | |||
| ) | |||
| </if> | |||
| <include refid="dataRule"/> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| @@ -340,6 +349,7 @@ | |||
| <if test=" null != id"> | |||
| and m.`id` = #{id} | |||
| </if> | |||
| order by m.top_time desc | |||
| </select> | |||