| @@ -235,7 +235,7 @@ public class WxOrderController extends BaseController { | |||
| wxOrderQueryVo = new WxOrderQueryVo(); | |||
| } | |||
| wxOrderQueryVo.setTenantId(getTenantId()); | |||
| Map<String, Object> data = wxOrderService.summary(wxOrderQueryVo); | |||
| Map<String, Long> data = wxOrderService.summary(wxOrderQueryVo); | |||
| return new ResultData(data); | |||
| } | |||
| @@ -0,0 +1 @@ | |||
| alter table wx_merchant_subsidy add column type tinyint(2) not null default 1 comment '结算类型1线上2线下3银行卡转账'; | |||
| @@ -299,6 +299,7 @@ public class WxInfoController extends BaseController { | |||
| * @param map | |||
| * @return | |||
| */ | |||
| @AuthIgnore | |||
| @PostMapping("/getUserPhone") | |||
| @ApiOperation(value = "授权后获取用户的手机号", notes="{\"appId\":\"string\",\"encryptedData\":\"string\",\"iv\":\"string\",\"openId\":\"string\",\"session_key\":\"string\"}") | |||
| public ResultData getUserPhone(@RequestBody Map<String, String> map) { | |||
| @@ -321,6 +322,69 @@ public class WxInfoController extends BaseController { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "openId 不能为空"); | |||
| } | |||
| WxMaService wxMaService = getWeappService(appId); | |||
| WxAppinfo wxAppinfo = getAppInfo(appId); | |||
| try { | |||
| // 解密 | |||
| WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService().getPhoneNoInfo(session_key, encryptedData, iv); | |||
| if (null != phoneNoInfo) { | |||
| logger.info(phoneNoInfo.toString()); | |||
| String phone = phoneNoInfo.getPhoneNumber(); | |||
| resultMap.put("phone", phone); | |||
| MallUserInfo user = mallUserInfoService.getByPhone(phone, wxAppinfo.getTenantId()); | |||
| if(user == null) { | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION, resultMap); | |||
| } | |||
| if (mallUserRoleService.checkIsMobileAdmin(user)) { | |||
| resultMap.put("phone", user.getPhone()); | |||
| resultMap.put("admin", "1"); | |||
| user.setBopenId(openId); | |||
| mallUserInfoService.saveOrUpdate(user); | |||
| return new ResultData(resultMap); | |||
| } else { | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION, resultMap); | |||
| } | |||
| } else { | |||
| return new ResultData(ErrorCode.PHONE_DECODE_ERR, resultMap); | |||
| } | |||
| } catch (Exception e) { | |||
| this.logger.error(e.getMessage(), e); | |||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "解密并保存出错", resultMap); | |||
| } | |||
| } | |||
| /** | |||
| * 授权后获取用户的手机号等信息 | |||
| * @param map | |||
| * @return | |||
| */ | |||
| @PostMapping("/getUserPhoneForBuser") | |||
| @ApiOperation(value = "登录后授权获取用户的手机号", notes="{\"appId\":\"string\",\"encryptedData\":\"string\",\"iv\":\"string\",\"openId\":\"string\",\"session_key\":\"string\"}") | |||
| public ResultData getUserPhoneForBuser(@RequestBody Map<String, String> map) { | |||
| logger.debug(map.toString()); | |||
| Map resultMap = new HashMap(); | |||
| String appId = map.get("appId"); | |||
| String encryptedData = map.get("encryptedData"); | |||
| String iv = map.get("iv"); | |||
| String openId = map.get("openId"); | |||
| String session_key = map.get("session_key"); | |||
| //登录凭证不能为空 | |||
| if (StringUtils.isBlank(encryptedData)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "encryptedData 不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(iv)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "iv 不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(openId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "openId 不能为空"); | |||
| } | |||
| WxMaService wxMaService = getWeappService(appId); | |||
| WxBuser buser = getBuser(); | |||
| try { | |||
| @@ -263,4 +263,16 @@ public class WxMerchant extends BaseEntity { | |||
| @TableField(exist = false) | |||
| @SortColumn(column = "tradeDate") | |||
| private String tradeDate; | |||
| @TableField(exist = false) | |||
| @SortColumn(column = "consumeCountP") | |||
| private String consumeCountP; | |||
| @TableField(exist = false) | |||
| @SortColumn(column = "consumeCount") | |||
| private String consumeCount; | |||
| @io.swagger.annotations.ApiModelProperty(value = "1已关联合同", name = "hasContract") | |||
| @TableField(exist = false) | |||
| private Integer hasContract; | |||
| } | |||
| @@ -8,6 +8,7 @@ import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @@ -23,6 +24,10 @@ public class WxOrder extends BaseEntity { | |||
| @TableField(exist = false) | |||
| private String merchantName; | |||
| public String getcUserName() { | |||
| return cUserName; | |||
| } | |||
| @Excel(name = "会员", width = 20, orderNum = "2") | |||
| @TableField(exist = false) | |||
| private String cUserName; | |||
| @@ -47,13 +52,12 @@ public class WxOrder extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="0: 付款 1: 退款",name="paymentType") | |||
| private Integer paymentType; | |||
| @Excel(name = "订单金额(元)", width = 20, orderNum = "6") | |||
| @io.swagger.annotations.ApiModelProperty(value="支付金额(分):允许有负数,退款时为负值。",name="payment") | |||
| private Integer payment; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付时间",name="paymentTime") | |||
| private Date paymentTime; | |||
| @Excel(name = "订单状态", width = 20, orderNum = "9", replace = {"待付款_0", "已支付_1", "已取消_2", "待退款_3", "已退款_4", "退款失败_5"}) | |||
| @Excel(name = "订单状态", width = 20, orderNum = "9", replace = {"待付款_0", "已支付_1", "已取消_2", "待退款_3", "已退款_4", "退款失败_5", " _-1"}) | |||
| @io.swagger.annotations.ApiModelProperty(value="订单状态:-1全部;正向交易:0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款)反向交易:3-已退款; 4-退款失败,5-退款失败; 砍价:6-砍价中,7-砍价完成,8-砍价失败",name="orderStatus") | |||
| private Integer orderStatus; | |||
| @@ -95,11 +99,27 @@ public class WxOrder extends BaseEntity { | |||
| @TableField(exist = false) | |||
| private String title; | |||
| @Excel(name = "商品属性", width = 20, orderNum = "4", replace = {"消费卡_1", "优惠券_2", "砍价_3", "拼团_4"}) | |||
| @Excel(name = "商品属性", width = 20, orderNum = "4", replace = {"消费卡_1", "优惠券_2", "砍价_3", "拼团_4", " _-1"}) | |||
| @TableField(exist = false) | |||
| private Integer attribute; | |||
| @Excel(name = "支付金额(元)", width = 20, orderNum = "8") | |||
| @TableField(exist = false) | |||
| private Integer pay; | |||
| @Excel(name = "支付金额(元)", width = 20, orderNum = "8") | |||
| @TableField(exist = false) | |||
| private String payStr; | |||
| public String getPayStr() { | |||
| return pay != null ? new BigDecimal(pay).divide(new BigDecimal(100)).toPlainString() : payStr; | |||
| } | |||
| public String getPaymentStr() { | |||
| return payment != null ? new BigDecimal(payment).divide(new BigDecimal(100)).toPlainString() : payStr; | |||
| } | |||
| @Excel(name = "订单金额(元)", width = 20, orderNum = "6") | |||
| @TableField(exist = false) | |||
| private String paymentStr; | |||
| } | |||
| @@ -0,0 +1,37 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumHasContract { | |||
| NO(0, "无"), | |||
| HAS(1, "有"), | |||
| ; | |||
| public static EnumHasContract getEnum(Integer code) { | |||
| for (EnumHasContract value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumHasContract(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -191,7 +191,7 @@ public interface WxOrderService { | |||
| */ | |||
| void actionAfterCouponOrderSuccess(WxOrder updateOrder, WxCoupon coupon, WxCUser user); | |||
| Map<String, Object> summary(WxOrderQueryVo wxOrderQueryVo); | |||
| Map<String, Long> summary(WxOrderQueryVo wxOrderQueryVo); | |||
| void exportData(WxOrderQueryVo wxOrderQueryVo, HttpServletRequest request, HttpServletResponse response); | |||
| @@ -184,7 +184,8 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| String price = ""; | |||
| String message = ""; | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| wxBillDaily.setServiceChargePay(Integer.parseInt(record.getServiceChargePayUpdate()) * 100); | |||
| Double l = Double.valueOf(record.getServiceChargePayUpdate())*100; | |||
| wxBillDaily.setServiceChargePay(l.intValue()); | |||
| }else{ | |||
| Long addpay = wxBillDaily.getPay(); | |||
| wxBillDaily.setPayDate(record.getPayDate()); | |||
| @@ -346,7 +347,23 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| @Override | |||
| public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillDaily record) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); | |||
| List<WxBillDaily> billDailyList = wxBillDailyMapper.queryBillDailyList(record); | |||
| billDailyList.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()); | |||
| } | |||
| }); | |||
| List<WxBillDailyExportVo> datalist = new ArrayList<>(); | |||
| WxBillDailyExportVo wxBillDailyExportVo; | |||
| for (int i = 0, size = billDailyList.size(); i < size; i++) { | |||
| @@ -179,7 +179,8 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| String message = ""; | |||
| String price = ""; | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| wxBillOtherDeposit.setServiceChargePay(Integer.parseInt(record.getServiceChargePayUpdate()) * 100); | |||
| Double l = Double.valueOf(record.getServiceChargePayUpdate())*100; | |||
| wxBillOtherDeposit.setServiceChargePay(l.intValue()); | |||
| }else{ | |||
| Long addpay = wxBillOtherDeposit.getPay(); | |||
| wxBillOtherDeposit.setPayDate(record.getPayDate()); | |||
| @@ -319,7 +320,23 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| @Override | |||
| public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillOtherDeposit wxBillDeposit) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(wxBillDeposit.getTenantId()); | |||
| List<WxBillOtherDeposit> datalist = wxBillOtherDepositMapper.queryBillList(wxBillDeposit); | |||
| datalist.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()); | |||
| } | |||
| }); | |||
| excelService.exportExcel(datalist, null, "其他押金账单", WxBillOtherDeposit.class, "其他押金账单.xlsx", response, false); | |||
| } | |||
| @@ -180,7 +180,8 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| String message = ""; | |||
| String price = ""; | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| wxBillOther.setServiceChargePay(Integer.parseInt(record.getServiceChargePayUpdate()) * 100); | |||
| Double l = Double.valueOf(record.getServiceChargePayUpdate())*100; | |||
| wxBillOther.setServiceChargePay(l.intValue()); | |||
| }else{ | |||
| Long addpay = wxBillOther.getPay(); | |||
| wxBillOther.setPayDate(record.getPayDate()); | |||
| @@ -264,7 +265,23 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| @Override | |||
| public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillOther wxBillOther) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(wxBillOther.getTenantId()); | |||
| List<WxBillOther> datalist = wxBillOtherMapper.queryBillList(wxBillOther); | |||
| datalist.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()); | |||
| } | |||
| }); | |||
| excelService.exportExcel(datalist, null, "其他费用账单", WxBillOther.class, "其他费用账单.xlsx", response, false); | |||
| } | |||
| @@ -161,7 +161,8 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| String message = ""; | |||
| String price = ""; | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| property.setServiceChargePay(Integer.parseInt(record.getServiceChargePayUpdate()) * 100); | |||
| Double l = Double.valueOf(record.getServiceChargePayUpdate())*100; | |||
| property.setServiceChargePay(l.intValue()); | |||
| }else{ | |||
| Long addpay = property.getPay(); | |||
| property.setRevenue(record.getRevenue()); | |||
| @@ -325,9 +326,25 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| @Override | |||
| public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillProperty wxBillProperty) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(wxBillProperty.getTenantId()); | |||
| String billName = wxBillProperty.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺物业账单" : "多经点位物业账单"; | |||
| List<WxBillProperty> billPropertyList = wxBillPropertyMapper.queryBillPropertyList(wxBillProperty); | |||
| billPropertyList.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<Long, List<WxBillProperty>> collect = billPropertyList.parallelStream() | |||
| .collect(Collectors.groupingBy(WxBillProperty::getMerchantId)); | |||
| Set<Map.Entry<Long, List<WxBillProperty>>> entries = collect.entrySet(); | |||
| @@ -165,7 +165,8 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| String price = ""; | |||
| String message =""; | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| wxBillRent.setServiceChargePay(Integer.parseInt(record.getServiceChargePayUpdate()) * 100); | |||
| Double l = Double.valueOf(record.getServiceChargePayUpdate())*100; | |||
| wxBillRent.setServiceChargePay(l.intValue()); | |||
| }else{ | |||
| Long addpay = wxBillRent.getPay(); | |||
| wxBillRent.setRevenue(record.getRevenue()); | |||
| @@ -438,8 +439,25 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| @Override | |||
| public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillRent wxBillRent) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(wxBillRent.getTenantId()); | |||
| String billName = wxBillRent.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺租金账单" : "多经点位租金账单"; | |||
| List<WxBillRent> billRentList = wxBillRentMapper.queryBillRentList(wxBillRent); | |||
| billRentList.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<Long, List<WxBillRent>> collect = billRentList.parallelStream() | |||
| .collect(Collectors.groupingBy(WxBillRent::getMerchantId)); | |||
| Set<Map.Entry<Long, List<WxBillRent>>> entries = collect.entrySet(); | |||
| @@ -21,6 +21,8 @@ import com.iformall.mapper.*; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.EventUtil; | |||
| import jodd.util.CollectionUtil; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -748,6 +750,16 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| } | |||
| merchant.setShoplist(shops); | |||
| } | |||
| WxRentContract rc = new WxRentContract(); | |||
| rc.setMerchantId(record.getId()); | |||
| rc.setTenantId(record.getTenantId()); | |||
| List<WxRentContract> rentContractList = wxRentContractMapper.findList(rc); | |||
| if(CollectionUtils.isEmpty(rentContractList)){ | |||
| merchant.setHasContract(EnumHasContract.NO.getCode()); | |||
| }else{ | |||
| merchant.setHasContract(EnumHasContract.HAS.getCode()); | |||
| } | |||
| } | |||
| PageInfo<WxMerchant> pageInfo = new PageInfo<>(merchants); | |||
| return pageInfo; | |||
| @@ -983,11 +983,11 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| } | |||
| @Override | |||
| public Map<String, Object> summary(WxOrderQueryVo wxOrderQueryVo) { | |||
| public Map<String, Long> summary(WxOrderQueryVo wxOrderQueryVo) { | |||
| List<WxOrder> listOrder = wxOrderMapper.findListOrder(wxOrderQueryVo); | |||
| Long payment = listOrder.stream().collect(Collectors.summingLong(WxOrder::getPayment)); | |||
| Long pay = listOrder.stream().collect(Collectors.summingLong(WxOrder::getPay)); | |||
| Map<String, Object> data = new HashMap<>(); | |||
| Map<String, Long> data = new HashMap<>(); | |||
| data.put("payment", payment); | |||
| data.put("pay", pay); | |||
| return data; | |||
| @@ -996,6 +996,17 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| @Override | |||
| public void exportData(WxOrderQueryVo wxOrderQueryVo, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxOrder> list = wxOrderMapper.findListOrder(wxOrderQueryVo); | |||
| Map<String, Long> summary = summary(wxOrderQueryVo); | |||
| Long payment = summary.get("payment"); | |||
| Long pay = summary.get("pay"); | |||
| String paymentStr = new BigDecimal(payment).divide(new BigDecimal(100)).toPlainString(); | |||
| String payStr = new BigDecimal(pay).divide(new BigDecimal(100)).toPlainString(); | |||
| WxOrder order = new WxOrder(); | |||
| order.setPayStr(payStr); | |||
| order.setPaymentStr(paymentStr); | |||
| order.setOrderStatus(-1); | |||
| order.setAttribute(-1); | |||
| list.add(order); | |||
| excelService.exportExcel(list, null, "线上交易", WxOrder.class, "线上交易.xlsx", response, false); | |||
| } | |||
| @@ -751,7 +751,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| //生成金额直接计算 | |||
| if(!saveDb){ | |||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); | |||
| return needpay; | |||
| } | |||
| @@ -766,7 +766,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| months++; | |||
| needpay = new Double(months * priceD).longValue(); | |||
| }else { | |||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); | |||
| } | |||
| }else if(i == 0){//第一期 | |||
| if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ | |||
| @@ -775,7 +775,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| months++; | |||
| needpay = new Double(months * priceD).longValue(); | |||
| }else{ | |||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); | |||
| } | |||
| }else{ | |||
| if(isFirstDay(startDate)){ | |||
| @@ -785,7 +785,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| } | |||
| needpay = new Double(months * priceD).longValue(); | |||
| }else{ | |||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||
| needpay = new Double(WxRentContractServiceImpl.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); | |||
| } | |||
| } | |||
| }else{//中间 | |||
| @@ -1258,18 +1258,18 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| long needpayAfter = 0; | |||
| //同一天,算一天 | |||
| if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){ | |||
| needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod); | |||
| needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb,dayType,receivePeriod,false); | |||
| }else{ | |||
| if(billTimeVo.getStartDate().before(endDate)){ | |||
| if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(wxRentContract.getType()) && EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) { | |||
| //设置跳点率为年周期 price不变 | |||
| needpayFront = priceArrs[index - 1]; | |||
| }else { | |||
| needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); | |||
| needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod); | |||
| needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1], billTimeVo.getStartDate(), DateUtils.getDaySet(endDate, Calendar.DATE, -1), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true); | |||
| needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb, dayType, receivePeriod,true); | |||
| } | |||
| }else{ | |||
| needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod); | |||
| needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb,dayType,receivePeriod,false); | |||
| } | |||
| } | |||
| needpay = needpayFront+needpayAfter; | |||
| @@ -1288,7 +1288,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| //计算金额 | |||
| if(!flag){ | |||
| needpay = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod); | |||
| needpay = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(),saveDb,dayType,receivePeriod,false); | |||
| } | |||
| WxBillRent wxBillRent = new WxBillRent(); | |||
| @@ -1332,7 +1332,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return resultMap; | |||
| } | |||
| public long getNeedPayMoney(WxRentContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb,int dayType,int receivePeriod){ | |||
| public long getNeedPayMoney(WxRentContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize,boolean saveDb,int dayType,int receivePeriod,boolean part){ | |||
| long needpay; | |||
| //按日 | |||
| if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ | |||
| @@ -1360,7 +1360,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| //生成金额直接计算 | |||
| if(!saveDb){ | |||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,part)).longValue(); | |||
| return needpay; | |||
| } | |||
| @@ -1377,7 +1377,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| int months = getMonths(sdM.format(startDate)+"-01",sdM.format(DateUtils.getDaySet(endDate,Calendar.DATE,1))+"-01"); | |||
| needpay = new Double(months * priceD).longValue(); | |||
| }else{ | |||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); | |||
| } | |||
| }else if(i == 0){//第一期 | |||
| if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ | |||
| @@ -1386,7 +1386,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| months++; | |||
| needpay = new Double(months * priceD).longValue(); | |||
| }else{ | |||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); | |||
| } | |||
| }else{ | |||
| if(isFirstDay(startDate)){ | |||
| @@ -1396,7 +1396,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| needpay = new Double(months * priceD).longValue(); | |||
| }else{ | |||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod)).longValue(); | |||
| needpay = new Double(getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); | |||
| } | |||
| } | |||
| }else{//中间 | |||
| @@ -2253,7 +2253,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return wxRentContractMapper.getShopType(wxRentContract); | |||
| } | |||
| public static double getMonthNeedPay(Double price,Date start,Date end,int dayType,int receivePeriod){ | |||
| public static double getMonthNeedPay(Double price,Date start,Date end,int dayType,int receivePeriod,boolean part){ | |||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | |||
| SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); | |||
| SimpleDateFormat sdD = new SimpleDateFormat("d"); | |||
| @@ -2276,11 +2276,24 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| //判断是否满足整月 | |||
| Calendar instance = Calendar.getInstance(); | |||
| instance.setTime(start); | |||
| instance.add(dayType, receivePeriod); | |||
| instance.add(Calendar.DATE, -1); | |||
| if(sd.format(instance.getTime()).equals(sd.format(end))){ | |||
| boolean isFullMonth = false; | |||
| if(part){ | |||
| int startInt = Integer.parseInt(sdD.format(start)); | |||
| int endInt = Integer.parseInt(sdD.format(DateUtils.getDaySet(end,Calendar.DATE,1))); | |||
| if(startInt == endInt){ | |||
| isFullMonth = true; | |||
| } | |||
| }else{ | |||
| Calendar instance = Calendar.getInstance(); | |||
| instance.setTime(start); | |||
| instance.add(dayType, receivePeriod); | |||
| instance.add(Calendar.DATE, -1); | |||
| if(sd.format(instance.getTime()).equals(sd.format(end))){ | |||
| isFullMonth = true; | |||
| } | |||
| } | |||
| if(isFullMonth){ | |||
| int months = getMonths(sdM.format(start)+"-01",sdM.format(DateUtils.getDaySet(end,Calendar.DATE,1))+"-01"); | |||
| return (months) * price; | |||
| } | |||
| @@ -475,6 +475,8 @@ | |||
| <if test=" null != linkPerson and ''!=linkPerson "> | |||
| and `link_person` like concat('%', #{linkPerson},'%') | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </select> | |||
| <select id="userTradeDetailList" parameterType="com.iformall.domain.po.WxMerchant" resultType="com.iformall.domain.vo.WxMerchantTradeDetailVo"> | |||
| @@ -498,7 +498,7 @@ | |||
| </if> | |||
| <if test="null!=status and status==1 and type!=null and type==2"> | |||
| and s.id not in( | |||
| SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status in(1,2,3,4) | |||
| SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status in(1,2,3,4,8) | |||
| and rent_shop_type=2 | |||
| ) | |||
| </if> | |||