| @@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSONArray; | |||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxPayAccountBill; | |||||
| import com.iformall.domain.vo.WxBillAll; | import com.iformall.domain.vo.WxBillAll; | ||||
| import com.iformall.domain.vo.WxBillExcelTemplate; | import com.iformall.domain.vo.WxBillExcelTemplate; | ||||
| import com.iformall.service.WxBillAllService; | import com.iformall.service.WxBillAllService; | ||||
| import com.iformall.service.WxPayAccountBillService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| @@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.*; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -32,6 +35,9 @@ public class WxBillAllController extends BaseController { | |||||
| private Logger logger = LoggerFactory.getLogger(WxBillAllController.class); | private Logger logger = LoggerFactory.getLogger(WxBillAllController.class); | ||||
| @Autowired | |||||
| WxPayAccountBillService wxPayAccountBillService; | |||||
| @GetMapping("oweBillCount") | @GetMapping("oweBillCount") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "contractId", value = "合同id", dataType = "long", paramType = "query", required = true), | @ApiImplicitParam(name = "contractId", value = "合同id", dataType = "long", paramType = "query", required = true), | ||||
| @@ -49,6 +55,7 @@ public class WxBillAllController extends BaseController { | |||||
| @SystemControllerLog(description = "账单总览-列表") | @SystemControllerLog(description = "账单总览-列表") | ||||
| public ResultData list(@ModelAttribute WxBillAll wxBillAll, Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute WxBillAll wxBillAll, Integer pageNum, Integer pageSize) { | ||||
| logger.debug("[" + getIpAddr() + "] WxBillAllController::list"); | logger.debug("[" + getIpAddr() + "] WxBillAllController::list"); | ||||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(wxBillAll.getTenantId()); | |||||
| if (null == wxBillAll) { | if (null == wxBillAll) { | ||||
| wxBillAll = new WxBillAll(); | wxBillAll = new WxBillAll(); | ||||
| } | } | ||||
| @@ -0,0 +1,3 @@ | |||||
| alter table wx_coupon | |||||
| add column `score_price` BIGINT (12) NULL DEFAULT 0 COMMENT '积分售价'; | |||||
| @@ -9,14 +9,12 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; | |||||
| import com.iformall.interceptor.AuthorizationInterceptor; | import com.iformall.interceptor.AuthorizationInterceptor; | ||||
| import com.iformall.interceptor.HttpServletRequestWrapperFilter; | import com.iformall.interceptor.HttpServletRequestWrapperFilter; | ||||
| import com.iformall.interceptor.RequestInterceptor; | import com.iformall.interceptor.RequestInterceptor; | ||||
| import com.iformall.resolver.LoginUserHandlerMethodArgumentResolver; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.boot.web.servlet.FilterRegistrationBean; | import org.springframework.boot.web.servlet.FilterRegistrationBean; | ||||
| import org.springframework.context.annotation.Bean; | import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.context.annotation.Configuration; | import org.springframework.context.annotation.Configuration; | ||||
| import org.springframework.http.converter.HttpMessageConverter; | import org.springframework.http.converter.HttpMessageConverter; | ||||
| import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; | import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; | ||||
| import org.springframework.web.method.support.HandlerMethodArgumentResolver; | |||||
| import org.springframework.web.servlet.config.annotation.*; | import org.springframework.web.servlet.config.annotation.*; | ||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| @@ -38,8 +36,6 @@ public class WebMvcConfig implements WebMvcConfigurer { | |||||
| private AuthorizationInterceptor authorizationInterceptor; | private AuthorizationInterceptor authorizationInterceptor; | ||||
| @Autowired | @Autowired | ||||
| private RequestInterceptor requestInterceptor; | private RequestInterceptor requestInterceptor; | ||||
| @Autowired | |||||
| private LoginUserHandlerMethodArgumentResolver loginUserHandlerMethodArgumentResolver; | |||||
| @Override | @Override | ||||
| public void addInterceptors(InterceptorRegistry registry) { | public void addInterceptors(InterceptorRegistry registry) { | ||||
| @@ -47,11 +43,6 @@ public class WebMvcConfig implements WebMvcConfigurer { | |||||
| registry.addInterceptor(requestInterceptor).addPathPatterns("/api/**"); | registry.addInterceptor(requestInterceptor).addPathPatterns("/api/**"); | ||||
| } | } | ||||
| @Override | |||||
| public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { | |||||
| argumentResolvers.add(loginUserHandlerMethodArgumentResolver); | |||||
| } | |||||
| @Override | @Override | ||||
| public void addResourceHandlers(ResourceHandlerRegistry registry) { | public void addResourceHandlers(ResourceHandlerRegistry registry) { | ||||
| registry.addResourceHandler("swagger-ui.html") | registry.addResourceHandler("swagger-ui.html") | ||||
| @@ -1,47 +0,0 @@ | |||||
| package com.iformall.resolver; | |||||
| import com.iformall.annotation.LoginUser; | |||||
| import com.iformall.domain.po.WxCUser; | |||||
| import com.iformall.domain.po.WxMerchantBUser; | |||||
| import com.iformall.service.WxMerchantBUserService; | |||||
| import com.iformall.utils.Constant; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.core.MethodParameter; | |||||
| import org.springframework.stereotype.Component; | |||||
| import org.springframework.web.bind.support.WebDataBinderFactory; | |||||
| import org.springframework.web.context.request.NativeWebRequest; | |||||
| import org.springframework.web.context.request.RequestAttributes; | |||||
| import org.springframework.web.method.support.HandlerMethodArgumentResolver; | |||||
| import org.springframework.web.method.support.ModelAndViewContainer; | |||||
| /** | |||||
| * 有@LoginUser注解的方法参数,注入当前登录用户 | |||||
| * @author stormeye.wu | |||||
| * @email wugq@mippoint.com | |||||
| * @date 2017-03-23 22:02 | |||||
| */ | |||||
| @Component | |||||
| public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver { | |||||
| @Autowired | |||||
| private WxMerchantBUserService wxMerchantBUserService; | |||||
| @Override | |||||
| public boolean supportsParameter(MethodParameter parameter) { | |||||
| return parameter.getParameterType().isAssignableFrom(WxCUser.class) && parameter.hasParameterAnnotation(LoginUser.class); | |||||
| } | |||||
| @Override | |||||
| public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer container, | |||||
| NativeWebRequest request, WebDataBinderFactory factory) throws Exception { | |||||
| //获取用户ID | |||||
| Object object = request.getAttribute(Constant.LOGIN_USER_KEY, RequestAttributes.SCOPE_REQUEST); | |||||
| if(object == null){ | |||||
| return null; | |||||
| } | |||||
| //获取用户信息 | |||||
| WxMerchantBUser user = wxMerchantBUserService.getByToken((String)object); | |||||
| return user; | |||||
| } | |||||
| } | |||||
| @@ -197,14 +197,16 @@ public class WxBillRent extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "联营租金", name = "joinRentPrice") | @io.swagger.annotations.ApiModelProperty(value = "联营租金", name = "joinRentPrice") | ||||
| private Long joinRentPrice; | private Long joinRentPrice; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") | |||||
| private Integer serviceChargePay; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String serviceChargePayBefore; | private String serviceChargePayBefore; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String serviceChargePayUpdate; | private String serviceChargePayUpdate; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") | |||||
| private Integer serviceChargePay; | |||||
| @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="realReceivePay") | @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="realReceivePay") | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Long realReceivePay; | private Long realReceivePay; | ||||
| @@ -204,6 +204,8 @@ public class WxCoupon extends BaseEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Integer pressSuccCount; | private Integer pressSuccCount; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "积分售价", name = "scorePrice") | |||||
| private Long scorePrice; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "过滤可投放0不过滤 1过滤", name = "filterCanPut") | @io.swagger.annotations.ApiModelProperty(value = "过滤可投放0不过滤 1过滤", name = "filterCanPut") | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @@ -3,6 +3,7 @@ package com.iformall.domain.po; | |||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | import cn.afterturn.easypoi.excel.annotation.Excel; | ||||
| import com.baomidou.mybatisplus.annotation.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | ||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.iformall.common.SortColumn; | |||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.vo.WxShopVo; | import com.iformall.domain.vo.WxShopVo; | ||||
| import com.iformall.enums.EnumBusiness; | import com.iformall.enums.EnumBusiness; | ||||
| @@ -247,4 +248,19 @@ public class WxMerchant extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "积分锁定0正常1锁定", name = "creditLocked") | @io.swagger.annotations.ApiModelProperty(value = "积分锁定0正常1锁定", name = "creditLocked") | ||||
| private Integer creditLocked; | private Integer creditLocked; | ||||
| @TableField(exist = false) | |||||
| @SortColumn(column = "couponSale") | |||||
| private String couponSale; | |||||
| @TableField(exist = false) | |||||
| @SortColumn(column = "couponPrice") | |||||
| private String couponPrice; | |||||
| @TableField(exist = false) | |||||
| @SortColumn(column = "tradeAmt") | |||||
| private String tradeAmt; | |||||
| @TableField(exist = false) | |||||
| @SortColumn(column = "tradeDate") | |||||
| private String tradeDate; | |||||
| } | } | ||||
| @@ -113,4 +113,15 @@ public class WxBillAllVo { | |||||
| } | } | ||||
| return oweStr; | return oweStr; | ||||
| } | } | ||||
| @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") | |||||
| @TableField(exist = false) | |||||
| private Integer serviceChargePay; | |||||
| @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="realReceivePay") | |||||
| @TableField(exist = false) | |||||
| private Long realReceivePay; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "滞纳金", name = "latePayPrice") | |||||
| private Long latePayPrice; | |||||
| } | } | ||||
| @@ -131,11 +131,14 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| @Autowired | @Autowired | ||||
| WxBillSettleRecordMapper wxBillSettleRecordMapper; | WxBillSettleRecordMapper wxBillSettleRecordMapper; | ||||
| @Autowired | |||||
| WxPayAccountBillService wxPayAccountBillService; | |||||
| @Override | @Override | ||||
| public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { | public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { | ||||
| //更新各账单状态 | //更新各账单状态 | ||||
| //updateBillStatus(record); | //updateBillStatus(record); | ||||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); | |||||
| if (StringUtils.isNotEmpty(record.getTypeStr())) { | if (StringUtils.isNotEmpty(record.getTypeStr())) { | ||||
| List<Integer> typeList = JSONArray.parseArray(record.getTypeStr(), Integer.class); | List<Integer> typeList = JSONArray.parseArray(record.getTypeStr(), Integer.class); | ||||
| @@ -143,6 +146,23 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| } | } | ||||
| PageInfo<WxBillAllVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillAllMapper.list(record)); | PageInfo<WxBillAllVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillAllMapper.list(record)); | ||||
| //手续费 = 合同应收+手续费+滞纳金 | |||||
| pageInfo.getList().stream().forEach(e->{ | |||||
| //手续费 = 合同应收+手续费+滞纳金 | |||||
| if(e.getReceivePay() != null){ | |||||
| if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); | |||||
| BigDecimal servicePay; | |||||
| if(e.getServiceChargePay() != null){ | |||||
| servicePay = new BigDecimal(e.getServiceChargePay()); | |||||
| }else{ | |||||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||||
| } | |||||
| Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); | |||||
| e.setRealReceivePay(realReceivePay); | |||||
| e.setServiceChargePay(servicePay.intValue()); | |||||
| } | |||||
| }); | |||||
| Map<String, Object> result = new HashMap<>(); | Map<String, Object> result = new HashMap<>(); | ||||
| result.put("pageInfo", pageInfo); | result.put("pageInfo", pageInfo); | ||||
| return result; | return result; | ||||
| @@ -1676,6 +1696,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| @Override | @Override | ||||
| public Map<String, Object> getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { | public Map<String, Object> getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { | ||||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); | |||||
| PageInfo<Map<String, Object>> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxBillAllMapper.getOweBillAsPage(record)); | PageInfo<Map<String, Object>> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxBillAllMapper.getOweBillAsPage(record)); | ||||
| List<Map<String, Object>> list = pageInfo.getList(); | List<Map<String, Object>> list = pageInfo.getList(); | ||||
| for (Map<String, Object> map : list) { | for (Map<String, Object> map : list) { | ||||
| @@ -1684,6 +1705,11 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| map.put("depositOwe", subZeroAndDot(map.get("depositOwe").toString())); | map.put("depositOwe", subZeroAndDot(map.get("depositOwe").toString())); | ||||
| map.put("otherOwe", subZeroAndDot(map.get("otherOwe").toString())); | map.put("otherOwe", subZeroAndDot(map.get("otherOwe").toString())); | ||||
| map.put("totalOwe", subZeroAndDot(map.get("totalOwe").toString())); | map.put("totalOwe", subZeroAndDot(map.get("totalOwe").toString())); | ||||
| //加上手续费 | |||||
| //todo:把手续费率传进sql,在sql中算,汇总到max,直接出结果 | |||||
| map.put("totalReceivePay", subZeroAndDot(map.get("totalOwe").toString())); | |||||
| } | } | ||||
| pageInfo.setList(list); | pageInfo.setList(list); | ||||
| Map<String, Object> result = new HashMap<>(); | Map<String, Object> result = new HashMap<>(); | ||||
| @@ -40,10 +40,13 @@ | |||||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | ||||
| <result column="freeze" property="freeze"/> | <result column="freeze" property="freeze"/> | ||||
| <result column="late_pay_price" property="latePayPrice"/> | |||||
| </resultMap> | </resultMap> | ||||
| <select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap"> | <select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap"> | ||||
| select | select | ||||
| bill.id,bill.tenant_id tenantId,bill.merchant_id merchantId,bill.shop_id shopId, | bill.id,bill.tenant_id tenantId,bill.merchant_id merchantId,bill.shop_id shopId, | ||||
| bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, | bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, | ||||
| @@ -51,46 +54,46 @@ | |||||
| bill.pay_date payDate,expired_day expiredDay,bill.status,bill.starttime, | bill.pay_date payDate,expired_day expiredDay,bill.status,bill.starttime, | ||||
| bill.endtime,bill.name,bill.rent_shop_type rentShopType,m.name merchantName, | bill.endtime,bill.name,bill.rent_shop_type rentShopType,m.name merchantName, | ||||
| s.shop_number shopNumber, s.manager, s.manager_phone managerPhone,bill.shop_info | s.shop_number shopNumber, s.manager, s.manager_phone managerPhone,bill.shop_info | ||||
| shopInfo,bill.comments,bill.price_detail,updatetime,bill.freeze | |||||
| shopInfo,bill.comments,bill.price_detail,updatetime,bill.freeze,bill.late_pay_price | |||||
| from ( | from ( | ||||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | ||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, | bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, | ||||
| endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' | endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' | ||||
| price_detail,updatetime,freeze | |||||
| price_detail,updatetime,freeze,late_pay_price | |||||
| from wx_bill_rent where tenant_id=#{tenantId} and is_preview = 0 | from wx_bill_rent where tenant_id=#{tenantId} and is_preview = 0 | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' | select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' | ||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, | bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, | ||||
| endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze from wx_bill_rent_deposit where | |||||
| endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze,'' late_pay_price from wx_bill_rent_deposit where | |||||
| tenant_id=#{tenantId} | tenant_id=#{tenantId} | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' | select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' | ||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, | bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, | ||||
| endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' | endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' | ||||
| price_detail,updatetime,freeze | |||||
| price_detail,updatetime,freeze,late_pay_price | |||||
| from wx_bill_property where tenant_id=#{tenantId} and is_preview = 0 | from wx_bill_property where tenant_id=#{tenantId} and is_preview = 0 | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' | select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' | ||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, | bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, | ||||
| endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze from wx_bill_property_deposit where | |||||
| endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze,'' late_pay_price from wx_bill_property_deposit where | |||||
| tenant_id=#{tenantId} | tenant_id=#{tenantId} | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,case when type=1 then '水费' when type=2 then '电费' else '空调费' end name, | select id,merchant_id,shop_id,tenant_id,case when type=1 then '水费' when type=2 then '电费' else '空调费' end name, | ||||
| case when type=1 then 5 when type=2 then 6 else 9 end bill_type_value, | case when type=1 then 5 when type=2 then 6 else 9 end bill_type_value, | ||||
| case when type=1 then '水费' when type=2 then '电费' else '空调费' end bill_type,0 as | case when type=1 then '水费' when type=2 then '电费' else '空调费' end bill_type,0 as | ||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, | need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, | ||||
| rent_shop_type,'[]' shop_info, NULL comments,price_detail,updatetime,freeze | |||||
| rent_shop_type,'[]' shop_info, NULL comments,price_detail,updatetime,freeze,'' late_pay_price | |||||
| from wx_bill_daily where tenant_id=#{tenantId} | from wx_bill_daily where tenant_id=#{tenantId} | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as | select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as | ||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, | need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, | ||||
| rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze | |||||
| rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,'' late_pay_price | |||||
| from wx_bill_other where tenant_id=#{tenantId} | from wx_bill_other where tenant_id=#{tenantId} | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,comments as name,8 bill_type_value,concat('其他押金-',comments) as | select id,merchant_id,shop_id,tenant_id,comments as name,8 bill_type_value,concat('其他押金-',comments) as | ||||
| bill_type,0 as | bill_type,0 as | ||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, | need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, | ||||
| rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze | |||||
| rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,'' late_pay_price | |||||
| from wx_bill_other_deposit where tenant_id=#{tenantId} | from wx_bill_other_deposit where tenant_id=#{tenantId} | ||||
| ) bill | ) bill | ||||
| left join wx_merchant m on bill.merchant_id=m.id | left join wx_merchant m on bill.merchant_id=m.id | ||||
| @@ -642,6 +645,7 @@ | |||||
| round((bill.depositReceivePay-bill.depositPay)/100,2) depositReceivePay, | round((bill.depositReceivePay-bill.depositPay)/100,2) depositReceivePay, | ||||
| round((bill.otherReceivePay-bill.otherPay)/100,2) otherReceivePay, | round((bill.otherReceivePay-bill.otherPay)/100,2) otherReceivePay, | ||||
| round((bill.rentReceivePay+bill.propertyReceivePay+bill.depositReceivePay+bill.otherReceivePay | round((bill.rentReceivePay+bill.propertyReceivePay+bill.depositReceivePay+bill.otherReceivePay | ||||
| +bill.rentLatePay+bill.propertyLatePay+bill.depositLatePay+bill.otherLatePay | |||||
| -bill.rentPay-bill.propertyPay-bill.depositPay-bill.otherPay)/100,2) totalReceivePay | -bill.rentPay-bill.propertyPay-bill.depositPay-bill.otherPay)/100,2) totalReceivePay | ||||
| </when> | </when> | ||||
| <otherwise> | <otherwise> | ||||
| @@ -649,7 +653,7 @@ | |||||
| round(bill.propertyReceivePay/100,2) propertyReceivePay, | round(bill.propertyReceivePay/100,2) propertyReceivePay, | ||||
| round(bill.depositReceivePay/100,2) depositReceivePay, | round(bill.depositReceivePay/100,2) depositReceivePay, | ||||
| round(bill.otherReceivePay/100,2) otherReceivePay, | round(bill.otherReceivePay/100,2) otherReceivePay, | ||||
| round((bill.rentReceivePay+bill.propertyReceivePay+bill.depositReceivePay+bill.otherReceivePay)/100,2) totalReceivePay | |||||
| round((bill.rentReceivePay+bill.propertyReceivePay+bill.depositReceivePay+bill.otherReceivePay+bill.rentLatePay+bill.propertyLatePay+bill.depositLatePay+bill.otherLatePay )/100,2) totalReceivePay | |||||
| </otherwise> | </otherwise> | ||||
| </choose> | </choose> | ||||
| @@ -669,22 +673,28 @@ | |||||
| max(case oweList.bill_type when '租金' then oweList.pay else 0 end) rentPay, | max(case oweList.bill_type when '租金' then oweList.pay else 0 end) rentPay, | ||||
| max(case oweList.bill_type when '物业费' then oweList.pay else 0 end) propertyPay, | max(case oweList.bill_type when '物业费' then oweList.pay else 0 end) propertyPay, | ||||
| max(case oweList.bill_type when '欠缴押金' then oweList.pay else 0 end) depositPay, | max(case oweList.bill_type when '欠缴押金' then oweList.pay else 0 end) depositPay, | ||||
| max(case oweList.bill_type when '其他费用' then oweList.pay else 0 end) otherPay | |||||
| max(case oweList.bill_type when '其他费用' then oweList.pay else 0 end) otherPay, | |||||
| max(case oweList.bill_type when '租金' then oweList.latePayPrice else 0 end) rentLatePay, | |||||
| max(case oweList.bill_type when '物业费' then oweList.latePayPrice else 0 end) propertyLatePay, | |||||
| max(case oweList.bill_type when '欠缴押金' then oweList.latePayPrice else 0 end) depositLatePay, | |||||
| max(case oweList.bill_type when '其他费用' then oweList.latePayPrice else 0 end) otherLatePay | |||||
| from( | from( | ||||
| select bill.tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe,bill.receive_date,bill.expired_day,sum(bill.receive_pay) receive_pay,sum(bill.pay) pay from ( | |||||
| select bill.tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe,bill.receive_date,bill.expired_day,sum(bill.receive_pay) receive_pay,sum(bill.pay) pay,sum(bill.late_pay_price) latePayPrice from ( | |||||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | ||||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | ||||
| endtime,rent_shop_type from wx_bill_rent where tenant_id = #{tenantId} and is_preview = 0 | |||||
| endtime,rent_shop_type,late_pay_price from wx_bill_rent where tenant_id = #{tenantId} and is_preview = 0 | |||||
| <include refid="getOweBillAsPageConditions"/> | <include refid="getOweBillAsPageConditions"/> | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' | select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' | ||||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | ||||
| endtime,rent_shop_type from wx_bill_property where tenant_id = #{tenantId} and is_preview = 0 | |||||
| endtime,rent_shop_type,late_pay_price from wx_bill_property where tenant_id = #{tenantId} and is_preview = 0 | |||||
| <include refid="getOweBillAsPageConditions"/> | <include refid="getOweBillAsPageConditions"/> | ||||
| union all | union all | ||||
| select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, | select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, | ||||
| res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type from( | |||||
| res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type,0 late_pay_price from( | |||||
| select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,2 bill_type_value,'欠缴押金' | select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,2 bill_type_value,'欠缴押金' | ||||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | ||||
| endtime,rent_shop_type from wx_bill_rent_deposit where tenant_id = #{tenantId} | endtime,rent_shop_type from wx_bill_rent_deposit where tenant_id = #{tenantId} | ||||
| @@ -702,7 +712,7 @@ | |||||
| ) res | ) res | ||||
| union all | union all | ||||
| select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, | select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, | ||||
| res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type from( | |||||
| res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type,0 late_pay_price from( | |||||
| select id,merchant_id,shop_id,tenant_id,'其他费用' name,5 bill_type_value,'其他费用' bill_type,0 as | select id,merchant_id,shop_id,tenant_id,'其他费用' name,5 bill_type_value,'其他费用' bill_type,0 as | ||||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | ||||
| from wx_bill_daily where tenant_id = #{tenantId} and type in(1,2,3) | from wx_bill_daily where tenant_id = #{tenantId} and type in(1,2,3) | ||||
| @@ -44,6 +44,8 @@ | |||||
| <result column="conditions" jdbcType="VARCHAR" property="conditions"/> | <result column="conditions" jdbcType="VARCHAR" property="conditions"/> | ||||
| <result column="approval_type" property="approvalType"/> | <result column="approval_type" property="approvalType"/> | ||||
| <result column="password_support" property="passwordSupport"/> | <result column="password_support" property="passwordSupport"/> | ||||
| <result column="score_price" property="scorePrice"/> | |||||
| </resultMap> | </resultMap> | ||||
| <resultMap id="statisMap" type="com.iformall.domain.vo.WxCouponStatisVo"> | <resultMap id="statisMap" type="com.iformall.domain.vo.WxCouponStatisVo"> | ||||
| <id column="id" jdbcType="BIGINT" property="id"/> | <id column="id" jdbcType="BIGINT" property="id"/> | ||||
| @@ -89,14 +91,14 @@ | |||||
| <result column="sum_subsidy" property="sumSubsidy"/> | <result column="sum_subsidy" property="sumSubsidy"/> | ||||
| <result column="payment_rate" property="paymentRate"/> | <result column="payment_rate" property="paymentRate"/> | ||||
| <result column="change_rate" property="changeRate"/> | <result column="change_rate" property="changeRate"/> | ||||
| <result column="score_price" property="scorePrice"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`type`,`cover_img`,`cover_picture`,`detail_picture`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`, | `id`,`tenant_id`,`type`,`cover_img`,`cover_picture`,`detail_picture`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`, | ||||
| `valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`, | `valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`, | ||||
| `remark`,`status`,`create_date`,`update_date`,`business`,`sub_business`,`support_transfer`,`subsidy_num`,`subsidy_type`, | `remark`,`status`,`create_date`,`update_date`,`business`,`sub_business`,`support_transfer`,`subsidy_num`,`subsidy_type`, | ||||
| `press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund`,`put_apply_status`,`stock_apply_status`,`cancle_apply_status`,`conditions`,approval_type | |||||
| `press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund`,`put_apply_status`,`stock_apply_status`,`cancle_apply_status`,`conditions`,approval_type,score_price | |||||
| </sql> | </sql> | ||||
| <sql id="statusColumns"> | <sql id="statusColumns"> | ||||
| @@ -505,7 +505,9 @@ | |||||
| <if test="endtime != null"> | <if test="endtime != null"> | ||||
| and o.create_date <= #{endtime} | and o.create_date <= #{endtime} | ||||
| </if> | </if> | ||||
| order by o.create_date desc | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| <if test=" null == sortColumns">order by o.create_date desc</if> | |||||
| </select> | </select> | ||||
| <select id="findByTrade" parameterType="java.util.Map" resultMap="BaseResultMap"> | <select id="findByTrade" parameterType="java.util.Map" resultMap="BaseResultMap"> | ||||