| @@ -1,5 +1,6 @@ | |||||
| .idea/** | .idea/** | ||||
| */target/** | */target/** | ||||
| logs/** | |||||
| */logs/** | */logs/** | ||||
| logPath_IS_UNDEFINED/** | logPath_IS_UNDEFINED/** | ||||
| uploads/** | uploads/** | ||||
| @@ -10,6 +10,7 @@ import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.controller.mem.BillDailyAsyncTask; | import com.iformall.controller.mem.BillDailyAsyncTask; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.WxBillDaily; | import com.iformall.domain.po.WxBillDaily; | ||||
| import com.iformall.enums.EnumBillDailyBuildWay; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.WxBillDailyService; | import com.iformall.service.WxBillDailyService; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| @@ -75,6 +76,7 @@ public class WxBillDailyController extends BaseController { | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxBillDaily.setTenantId(user.getTenantId()); | wxBillDaily.setTenantId(user.getTenantId()); | ||||
| wxBillDaily.setUserId(user.getId()); | wxBillDaily.setUserId(user.getId()); | ||||
| wxBillDaily.setBuildWay(EnumBillDailyBuildWay.HAND.getCode()); | |||||
| return wxBillDailyService.saveOrUpdate(wxBillDaily, user); | return wxBillDailyService.saveOrUpdate(wxBillDaily, user); | ||||
| } | } | ||||
| @@ -8,6 +8,7 @@ import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.domain.po.BaseEntity; | import com.iformall.domain.po.BaseEntity; | ||||
| import com.iformall.domain.po.WxBillSettle; | import com.iformall.domain.po.WxBillSettle; | ||||
| import com.iformall.domain.po.WxBillSettleRecord; | import com.iformall.domain.po.WxBillSettleRecord; | ||||
| import com.iformall.service.WxBillAllService; | |||||
| import com.iformall.service.WxBillSettleRecordService; | import com.iformall.service.WxBillSettleRecordService; | ||||
| import com.iformall.service.WxBillSettleService; | import com.iformall.service.WxBillSettleService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -32,6 +33,8 @@ public class WxBillSettleController extends BaseController { | |||||
| private WxBillSettleService wxBillSettleService; | private WxBillSettleService wxBillSettleService; | ||||
| @Autowired | @Autowired | ||||
| private WxBillSettleRecordService wxBillSettleRecordService; | private WxBillSettleRecordService wxBillSettleRecordService; | ||||
| @Autowired | |||||
| private WxBillAllService wxBillAllService; | |||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiOperation("账单管理-结算对冲列表") | @ApiOperation("账单管理-结算对冲列表") | ||||
| @@ -88,6 +91,6 @@ public class WxBillSettleController extends BaseController { | |||||
| @SystemControllerLog(description = "账单管理-结算单-下载") | @SystemControllerLog(description = "账单管理-结算单-下载") | ||||
| public void downloadSettle(@ModelAttribute WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response) { | public void downloadSettle(@ModelAttribute WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response) { | ||||
| wxBillSettle.setTenantId(getTenantId()); | wxBillSettle.setTenantId(getTenantId()); | ||||
| wxBillSettleService.exportBill(request, response, wxBillSettle); | |||||
| wxBillAllService.exportSettleBill(wxBillSettle,request,response); | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1 @@ | |||||
| alter table wx_bill_daily add column build_way tinyint(3) default 1 comment '创建方式1手动2自动3导入'; | |||||
| @@ -133,6 +133,7 @@ public class PowerBillAutoBuildSchedule { | |||||
| wxBillDaily.setStarttime(startdate); | wxBillDaily.setStarttime(startdate); | ||||
| wxBillDaily.setEndtime(enddate); | wxBillDaily.setEndtime(enddate); | ||||
| wxBillDaily.setPriceDetail(priceDetals.toJSONString()); | wxBillDaily.setPriceDetail(priceDetals.toJSONString()); | ||||
| wxBillDaily.setBuildWay(EnumBillDailyBuildWay.AUTO.getCode()); | |||||
| wxBillDailyService.saveOrUpdate(wxBillDaily, mallUserInfo); | wxBillDailyService.saveOrUpdate(wxBillDaily, mallUserInfo); | ||||
| } | } | ||||
| @@ -108,4 +108,8 @@ public class WxBillDaily extends BaseEntity{ | |||||
| private Date endtime; | private Date endtime; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") | @io.swagger.annotations.ApiModelProperty(value = "冻结状态,0正常1冻结", name = "freeze") | ||||
| private Integer freeze; | private Integer freeze; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "创建方式1手动2自动3导入", name = "buildWay") | |||||
| private Integer buildWay; | |||||
| } | } | ||||
| @@ -77,14 +77,20 @@ public class WxBillSettle extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "结单记录", name = "settleRecordList") | @io.swagger.annotations.ApiModelProperty(value = "结单记录", name = "settleRecordList") | ||||
| private List<WxBillSettleRecord> settleRecordList; | private List<WxBillSettleRecord> settleRecordList; | ||||
| @Transient | @Transient | ||||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="starttime") | |||||
| private Date startTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "开始时间", name = "starttime") | |||||
| private Date starttime; | |||||
| @Transient | @Transient | ||||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endtime") | |||||
| private Date endTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "结束时间", name = "endtime") | |||||
| private Date endtime; | |||||
| @Transient | @Transient | ||||
| @io.swagger.annotations.ApiModelProperty(value="清算方向 1商场结款 2商户结款",name="settleWay") | @io.swagger.annotations.ApiModelProperty(value="清算方向 1商场结款 2商户结款",name="settleWay") | ||||
| private Integer settleWay; | private Integer settleWay; | ||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value="流向 0流入 1流出",name="direction") | |||||
| private Integer direction; | |||||
| } | } | ||||
| @@ -0,0 +1,19 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| import java.util.List; | |||||
| @Data | |||||
| public class WordDocTableVo implements Serializable{ | |||||
| private static final long serialVersionUID = 1L; | |||||
| private List<List<String>> params; | |||||
| private int tableIndex = 0; | |||||
| //替换的行 | |||||
| private int rowIndex = 0; | |||||
| } | |||||
| @@ -0,0 +1,38 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumBillDailyBuildWay { | |||||
| HAND(1, "手动"), | |||||
| AUTO(2, "自动"), | |||||
| IMPORT(3, "导入"),; | |||||
| public static EnumBillDailyBuildWay getEnum(Integer code) { | |||||
| for (EnumBillDailyBuildWay value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumBillDailyBuildWay(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -29,7 +29,49 @@ public enum EnumSubBusiness { | |||||
| SUB_BUSINESS_ID18(18,"东北菜"), | SUB_BUSINESS_ID18(18,"东北菜"), | ||||
| SUB_BUSINESS_ID19(19,"面包店"), | SUB_BUSINESS_ID19(19,"面包店"), | ||||
| SUB_BUSINESS_ID20(20,"咖啡厅"), | SUB_BUSINESS_ID20(20,"咖啡厅"), | ||||
| SUB_BUSINESS_ID21(21,"饮品店") | |||||
| SUB_BUSINESS_ID21(21,"饮品店"), | |||||
| SUB_BUSINESS_ID22(22,"男装"), | |||||
| SUB_BUSINESS_ID23(23,"女装"), | |||||
| SUB_BUSINESS_ID24(24,"童装"), | |||||
| SUB_BUSINESS_ID25(25,"鞋帽"), | |||||
| SUB_BUSINESS_ID26(26,"配饰"), | |||||
| SUB_BUSINESS_ID27(27,"内衣"), | |||||
| SUB_BUSINESS_ID28(28,"亲子摄影"), | |||||
| SUB_BUSINESS_ID29(29,"亲子游乐"), | |||||
| SUB_BUSINESS_ID30(30,"幼儿教育"), | |||||
| SUB_BUSINESS_ID31(31,"孕产护理"), | |||||
| SUB_BUSINESS_ID32(32,"童车童床"), | |||||
| SUB_BUSINESS_ID33(33,"玩具"), | |||||
| SUB_BUSINESS_ID34(34,"喂养用品"), | |||||
| SUB_BUSINESS_ID35(35,"面部护肤"), | |||||
| SUB_BUSINESS_ID36(36,"香水彩妆"), | |||||
| SUB_BUSINESS_ID37(37,"男士护肤"), | |||||
| SUB_BUSINESS_ID38(38,"营养保健"), | |||||
| SUB_BUSINESS_ID39(39,"黄金"), | |||||
| SUB_BUSINESS_ID40(40,"钻石"), | |||||
| SUB_BUSINESS_ID41(41,"时尚饰品"), | |||||
| SUB_BUSINESS_ID42(42,"翡翠玉石"), | |||||
| SUB_BUSINESS_ID43(43,"钟表"), | |||||
| SUB_BUSINESS_ID44(44,"KTV"), | |||||
| SUB_BUSINESS_ID45(45,"轰趴馆"), | |||||
| SUB_BUSINESS_ID46(46,"DIY手工"), | |||||
| SUB_BUSINESS_ID47(47,"文化艺术"), | |||||
| SUB_BUSINESS_ID48(48,"游艺娱乐"), | |||||
| SUB_BUSINESS_ID49(49,"桌游"), | |||||
| SUB_BUSINESS_ID50(50,"运动健身"), | |||||
| SUB_BUSINESS_ID51(51,"婚纱摄影"), | |||||
| SUB_BUSINESS_ID52(52,"美容美发"), | |||||
| SUB_BUSINESS_ID53(53,"学习培训"), | |||||
| SUB_BUSINESS_ID54(54,"家具"), | |||||
| SUB_BUSINESS_ID55(55,"家饰"), | |||||
| SUB_BUSINESS_ID56(56,"家纺"), | |||||
| SUB_BUSINESS_ID57(57,"生活用品"), | |||||
| SUB_BUSINESS_ID58(58,"厨具"), | |||||
| SUB_BUSINESS_ID59(59,"家用电器"), | |||||
| SUB_BUSINESS_ID60(60,"数码产品"), | |||||
| SUB_BUSINESS_ID61(61,"手机通信"), | |||||
| SUB_BUSINESS_ID62(62,"电脑办公"), | |||||
| SUB_BUSINESS_ID63(63,"影音娱乐"), | |||||
| ; | ; | ||||
| private static Map<Integer,EnumSubBusiness> map | private static Map<Integer,EnumSubBusiness> map | ||||
| @@ -786,7 +786,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| String filepath = fmUploadDir; | String filepath = fmUploadDir; | ||||
| String filename = UUID.randomUUID() + ".docx"; | String filename = UUID.randomUUID() + ".docx"; | ||||
| String exportFileName = "催缴单.docx"; | String exportFileName = "催缴单.docx"; | ||||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response); | |||||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response,null); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -814,31 +814,43 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| result.put("payMU", PriceUtil.digitUppercase(payM.doubleValue())); | result.put("payMU", PriceUtil.digitUppercase(payM.doubleValue())); | ||||
| result.put("bMU", PriceUtil.digitUppercase(bM.doubleValue())); | result.put("bMU", PriceUtil.digitUppercase(bM.doubleValue())); | ||||
| List<Map<String,String>> rowsParams = new ArrayList<>(); | |||||
| WordDocTableVo wordDocTableVo = new WordDocTableVo(); | |||||
| List<List<String>> rowsParams = new ArrayList<>(); | |||||
| int size = wxBillSettle.getReceiveBillIds().size() > wxBillSettle.getPayBillIds().size()?wxBillSettle.getReceiveBillIds().size():wxBillSettle.getPayBillIds().size(); | int size = wxBillSettle.getReceiveBillIds().size() > wxBillSettle.getPayBillIds().size()?wxBillSettle.getReceiveBillIds().size():wxBillSettle.getPayBillIds().size(); | ||||
| int count = 1; | int count = 1; | ||||
| for (int i = 0; i < size ; i++) { | for (int i = 0; i < size ; i++) { | ||||
| WxBillSettleBill bill = wxBillSettle.getReceiveBillIds().get(i); | |||||
| Map<String,String> map = new HashedMap(); | |||||
| WxBillSettleBill bill = i>wxBillSettle.getReceiveBillIds().size()-1?null:wxBillSettle.getReceiveBillIds().get(i); | |||||
| List<String> cellList = new ArrayList<>(); | |||||
| cellList.add(count+""); | |||||
| if(bill != null){ | if(bill != null){ | ||||
| map.put("s1",count+""); | |||||
| map.put("bn1",bill.getBillName()); | |||||
| map.put("money1",bill.getReceivePay()); | |||||
| cellList.add(bill.getBillName()); | |||||
| cellList.add(bill.getReceivePay()); | |||||
| }else{ | |||||
| cellList.add(""); | |||||
| cellList.add(""); | |||||
| } | } | ||||
| WxBillSettleBill payBill = wxBillSettle.getPayBillIds().get(i); | |||||
| cellList.add(count+""); | |||||
| WxBillSettleBill payBill = i>wxBillSettle.getPayBillIds().size()-1?null:wxBillSettle.getPayBillIds().get(i); | |||||
| if(payBill != null){ | if(payBill != null){ | ||||
| map.put("bn2",payBill.getBillName()); | |||||
| map.put("money2",payBill.getReceivePay()); | |||||
| cellList.add(payBill.getBillName()); | |||||
| cellList.add(payBill.getReceivePay()); | |||||
| }else{ | |||||
| cellList.add(""); | |||||
| cellList.add(""); | |||||
| } | } | ||||
| rowsParams.add(map); | |||||
| rowsParams.add(cellList); | |||||
| count++; | count++; | ||||
| } | } | ||||
| wordDocTableVo.setParams(rowsParams); | |||||
| wordDocTableVo.setTableIndex(0); | |||||
| wordDocTableVo.setRowIndex(1); | |||||
| String templatePath = "contract-word-template/settle.docx"; | String templatePath = "contract-word-template/settle.docx"; | ||||
| String filepath = fmUploadDir; | String filepath = fmUploadDir; | ||||
| String filename = UUID.randomUUID() + ".docx"; | String filename = UUID.randomUUID() + ".docx"; | ||||
| String exportFileName = "催缴单.docx"; | |||||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response); | |||||
| String exportFileName = "结算单.docx"; | |||||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response,wordDocTableVo); | |||||
| } | } | ||||
| @@ -1157,6 +1169,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, pay, false); | WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, pay, false); | ||||
| daily.setExpiredDay(expiredDayAndStatus.getExpiredDay()); | daily.setExpiredDay(expiredDayAndStatus.getExpiredDay()); | ||||
| daily.setStatus(expiredDayAndStatus.getStatus()); | daily.setStatus(expiredDayAndStatus.getStatus()); | ||||
| daily.setBuildWay(EnumBillDailyBuildWay.IMPORT.getCode()); | |||||
| wxBillDailyMapper.insertSelective(daily); | wxBillDailyMapper.insertSelective(daily); | ||||
| if (pay > 0) { | if (pay > 0) { | ||||
| addActionImport(daily.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); | addActionImport(daily.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); | ||||
| @@ -60,11 +60,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| @Override | @Override | ||||
| public PageInfo<WxBillSettle> listAsPage(WxBillSettle record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxBillSettle> listAsPage(WxBillSettle record, Integer pageIndex, Integer pageSize) { | ||||
| PageInfo<WxBillSettle> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillSettleMapper.findList(record)); | |||||
| pageInfo.getList().stream().forEach(e->{ | |||||
| e.setBalance(e.getReceiveMoney() - e.getPayMoney()); | |||||
| }); | |||||
| return pageInfo; | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillSettleMapper.findList(record)); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -8,10 +8,7 @@ import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxOrderGroupMarketing; | import com.iformall.domain.vo.WxOrderGroupMarketing; | ||||
| import com.iformall.enums.EnumAppType; | |||||
| import com.iformall.enums.EnumCouponStatus; | |||||
| import com.iformall.enums.EnumOrderStatus; | |||||
| import com.iformall.enums.EnumRefundStatus; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxOrderGroupService; | import com.iformall.service.WxOrderGroupService; | ||||
| @@ -66,6 +63,9 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||||
| @Autowired | @Autowired | ||||
| RedisLock redisLock; | RedisLock redisLock; | ||||
| @Autowired | |||||
| WxCouponChannelMapper wxCouponChannelMapper; | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| public void createOrderGroup(WxOrder order, WxCoupon wxCoupon) { | public void createOrderGroup(WxOrder order, WxCoupon wxCoupon) { | ||||
| @@ -227,6 +227,14 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| public ResultData toOrderGroup(WxOrderGroup wxOrderGroup) { | public ResultData toOrderGroup(WxOrderGroup wxOrderGroup) { | ||||
| WxOrder orderTemp = wxOrderMapper.selectByPrimaryKey(wxOrderGroup.getOrderId()); | |||||
| if (orderTemp == null) { | |||||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | |||||
| } | |||||
| WxCouponChannel wxCouponChannel = wxCouponChannelMapper.selectByPrimaryKey(orderTemp.getCouponChannelId()); | |||||
| if (wxCouponChannel.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode())) { | |||||
| return new ResultData(ErrorCode.COUPON_CHANNEL_IS_TAKE_OFF); | |||||
| } | |||||
| WxOrder wxOrder = new WxOrder(); | WxOrder wxOrder = new WxOrder(); | ||||
| wxOrder.setTenantId(wxOrderGroup.getTenantId()); | wxOrder.setTenantId(wxOrderGroup.getTenantId()); | ||||
| wxOrder.setId(wxOrderGroup.getOrderId()); | wxOrder.setId(wxOrderGroup.getOrderId()); | ||||
| @@ -189,6 +189,30 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| return new ResultData(resultMap); | return new ResultData(resultMap); | ||||
| } | } | ||||
| /** | |||||
| * 拼团数量 | |||||
| * | |||||
| * @param user | |||||
| * @param counpon | |||||
| * @return | |||||
| */ | |||||
| private int getUserOrderGroupCount(WxCUser user, WxCoupon counpon) { | |||||
| // + Order 待支付 | |||||
| try { | |||||
| WxOrder orderQ = new WxOrder(); | |||||
| orderQ.setTenantId(user.getTenantId()); | |||||
| orderQ.setProductId(counpon.getId()); | |||||
| orderQ.setType(EnumOrderType.COUPON.getCode()); | |||||
| orderQ.setCUserId(user.getId()); | |||||
| orderQ.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING.getCode()); | |||||
| return wxOrderMapper.countList(orderQ); | |||||
| } catch (Exception e) { | |||||
| logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * 用户购买的订单数量 | * 用户购买的订单数量 | ||||
| @@ -418,6 +442,21 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| throw new MallinkException(ErrorCode.ORDER_UNPAID); | throw new MallinkException(ErrorCode.ORDER_UNPAID); | ||||
| } | } | ||||
| } | } | ||||
| //检查拼团中的数量 | |||||
| try { | |||||
| count = getUserOrderGroupCount(user, coupon); | |||||
| } catch (Exception e) { | |||||
| //解锁 | |||||
| redisLock.unlock(couponIdStr, timeStr); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||||
| } | |||||
| if (count >= coupon.getUseLimitQuantity()) { | |||||
| //解锁 | |||||
| redisLock.unlock(couponIdStr, timeStr); | |||||
| logger.error("此券购买数量已超限, couponId: " + couponIdStr + ", count: " + count); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_LIMITED); | |||||
| } | |||||
| // 检查用户已购买数量 | // 检查用户已购买数量 | ||||
| try { | try { | ||||
| count = getUserCouponOrderCount(user, coupon); | count = getUserCouponOrderCount(user, coupon); | ||||
| @@ -1585,8 +1624,8 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| record.setCUserId(user.getId()); | record.setCUserId(user.getId()); | ||||
| record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | ||||
| record.setDetail(bodyStr); | record.setDetail(bodyStr); | ||||
| record.setCreateDate(curr); | |||||
| record.setUpdateDate(curr); | record.setUpdateDate(curr); | ||||
| record.setCreateDate(curr); | |||||
| if (isPress) { | if (isPress) { | ||||
| // 初始砍价信息 | // 初始砍价信息 | ||||
| record.setPressCurrentNum(0); | record.setPressCurrentNum(0); | ||||
| @@ -1612,7 +1612,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| String filepath = fmUploadDir; | String filepath = fmUploadDir; | ||||
| String filename = UUID.randomUUID() + ".docx"; | String filename = UUID.randomUUID() + ".docx"; | ||||
| String exportFileName = result.get("merchantName").toString() + "合同.docx"; | String exportFileName = result.get("merchantName").toString() + "合同.docx"; | ||||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response); | |||||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response,null); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.utils; | package com.iformall.utils; | ||||
| import cn.afterturn.easypoi.word.WordExportUtil; | import cn.afterturn.easypoi.word.WordExportUtil; | ||||
| import com.iformall.domain.vo.WordDocTableVo; | |||||
| import org.apache.commons.io.FileUtils; | import org.apache.commons.io.FileUtils; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.apache.poi.xwpf.usermodel.*; | import org.apache.poi.xwpf.usermodel.*; | ||||
| @@ -8,6 +9,7 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.util.Assert; | import org.springframework.util.Assert; | ||||
| import org.springframework.util.CollectionUtils; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| @@ -35,7 +37,7 @@ public class WordUtil { | |||||
| * @param request HttpServletRequest | * @param request HttpServletRequest | ||||
| * @param response HttpServletResponse | * @param response HttpServletResponse | ||||
| */ | */ | ||||
| public static void exportWord(String templatePath, String temDir, String fileName, String exportFileName, Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) { | |||||
| public static void exportWord(String templatePath, String temDir, String fileName, String exportFileName, Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, WordDocTableVo wordDocTableVo) { | |||||
| Assert.notNull(templatePath, "模板路径不能为空"); | Assert.notNull(templatePath, "模板路径不能为空"); | ||||
| Assert.notNull(temDir, "临时文件路径不能为空"); | Assert.notNull(temDir, "临时文件路径不能为空"); | ||||
| Assert.notNull(exportFileName, "导出文件名不能为空"); | Assert.notNull(exportFileName, "导出文件名不能为空"); | ||||
| @@ -57,6 +59,9 @@ public class WordUtil { | |||||
| XWPFDocument doc = WordExportUtil.exportWord07(templatePath, params); | XWPFDocument doc = WordExportUtil.exportWord07(templatePath, params); | ||||
| if(wordDocTableVo != null) | |||||
| insertValueToTable(doc,wordDocTableVo); | |||||
| String tmpPath = temDir + fileName; | String tmpPath = temDir + fileName; | ||||
| FileOutputStream fos = new FileOutputStream(tmpPath); | FileOutputStream fos = new FileOutputStream(tmpPath); | ||||
| doc.write(fos); | doc.write(fos); | ||||
| @@ -84,217 +89,69 @@ public class WordUtil { | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * 循环填充表格内容 | * 循环填充表格内容 | ||||
| * @param xwpfDocument | * @param xwpfDocument | ||||
| * @param params | |||||
| * @param tableIndex | |||||
| * @throws Exception | * @throws Exception | ||||
| */ | */ | ||||
| private void insertValueToTable(XWPFDocument xwpfDocument, List<Map<String,String>> params, int tableIndex) throws Exception { | |||||
| public static void insertValueToTable(XWPFDocument xwpfDocument, WordDocTableVo wordDocTableVo) throws Exception { | |||||
| List<XWPFTable> tableList = xwpfDocument.getTables(); | List<XWPFTable> tableList = xwpfDocument.getTables(); | ||||
| if(tableList.size()<=tableIndex){ | |||||
| throw new Exception("tableIndex对应的表格不存在"); | |||||
| } | |||||
| XWPFTable table = tableList.get(tableIndex); | |||||
| XWPFTable table = tableList.get(wordDocTableVo.getTableIndex()); | |||||
| List<XWPFTableRow> rows = table.getRows(); | List<XWPFTableRow> rows = table.getRows(); | ||||
| if(rows.size()<2){ | |||||
| throw new Exception("tableIndex对应表格应该为2行"); | |||||
| } | |||||
| //模板的那一行 | |||||
| XWPFTableRow tmpRow = rows.get(1); | |||||
| List<XWPFTableCell> tmpCells = null; | |||||
| List<XWPFTableCell> cells = null; | |||||
| XWPFTableCell tmpCell = null; | |||||
| tmpCells = tmpRow.getTableCells(); | |||||
| String cellText = null; | |||||
| String cellTextKey = null; | |||||
| Map<String,Object> totalMap = null; | |||||
| for (int i = 0, len = params.size(); i < len; i++) { | |||||
| Map<String,String> map = params.get(i); | |||||
| // 创建新的一行 | |||||
| XWPFTableRow row = table.createRow(); | |||||
| // 获取模板的行高 设置为新一行的行高 | |||||
| row.setHeight(tmpRow.getHeight()); | |||||
| cells = row.getTableCells(); | |||||
| for (int k = 0, klen = cells.size(); k < klen; k++) { | |||||
| tmpCell = tmpCells.get(k); | |||||
| XWPFTableCell cell = cells.get(k); | |||||
| cellText = tmpCell.getText(); | |||||
| if (StringUtils.isNotBlank(cellText)) { | |||||
| //转换为mapkey对应的字段 | |||||
| cellTextKey = cellText.replace("$", "").replace("{", "").replace("}", ""); | |||||
| if (map.containsKey(cellTextKey)) { | |||||
| // 填充内容 并且复制模板行的属性 | |||||
| setCellText(tmpCell,cell,map.get(cellTextKey)); | |||||
| } | |||||
| } | |||||
| } | |||||
| int rowIndex = wordDocTableVo.getRowIndex(); | |||||
| XWPFTableRow tmpRow = rows.get(rowIndex); | |||||
| } | |||||
| // 删除模版行 | |||||
| table.removeRow(1); | |||||
| } | |||||
| /** | |||||
| * 复制模板行的属性 | |||||
| * @param tmpCell | |||||
| * @param cell | |||||
| * @param text | |||||
| * @throws Exception | |||||
| */ | |||||
| private void setCellText(XWPFTableCell tmpCell, XWPFTableCell cell,String text) throws Exception { | |||||
| CTTc cttc2 = tmpCell.getCTTc(); | |||||
| CTTcPr ctPr2 = cttc2.getTcPr(); | |||||
| CTTc cttc = cell.getCTTc(); | |||||
| CTTcPr ctPr = cttc.addNewTcPr(); | |||||
| if (ctPr2.getTcW() != null) { | |||||
| ctPr.addNewTcW().setW(ctPr2.getTcW().getW()); | |||||
| } | |||||
| if (ctPr2.getVAlign() != null) { | |||||
| ctPr.addNewVAlign().setVal(ctPr2.getVAlign().getVal()); | |||||
| } | |||||
| if (cttc2.getPList().size() > 0) { | |||||
| CTP ctp = cttc2.getPList().get(0); | |||||
| if (ctp.getPPr() != null) { | |||||
| if (ctp.getPPr().getJc() != null) { | |||||
| cttc.getPList().get(0).addNewPPr().addNewJc() | |||||
| .setVal(ctp.getPPr().getJc().getVal()); | |||||
| } | |||||
| for (List<String> stringList : wordDocTableVo.getParams()) { | |||||
| table.addRow(tmpRow,rowIndex); | |||||
| rowIndex++; | |||||
| //替换新行内容 | |||||
| XWPFTableRow tableRow = rows.get(rowIndex); | |||||
| for (int i = 0; i < stringList.size(); i++) { | |||||
| tableRow.getTableCells().get(i).setText(stringList.get(i)); | |||||
| } | } | ||||
| } | } | ||||
| if (ctPr2.getTcBorders() != null) { | |||||
| ctPr.setTcBorders(ctPr2.getTcBorders()); | |||||
| } | |||||
| tmpRow.getTableCells().get(0).setText("aaaa"); | |||||
| // //模板的那一行 | |||||
| // XWPFTableRow tmpRow = rows.get(2); | |||||
| // List<XWPFTableCell> tmpCells = null; | |||||
| // List<XWPFTableCell> cells2 = null; | |||||
| // XWPFTableCell tmpCell = null; | |||||
| // tmpCells = tmpRow.getTableCells(); | |||||
| // | |||||
| // String cellText = null; | |||||
| // String cellTextKey = null; | |||||
| // Map<String,Object> totalMap = null; | |||||
| // for (int i = 0, len = params.size(); i < len; i++) { | |||||
| // Map<String,String> map = params.get(i); | |||||
| // // 创建新的一行 | |||||
| // XWPFTableRow row = table.createRow(); | |||||
| // // 获取模板的行高 设置为新一行的行高 | |||||
| // row.setHeight(tmpRow.getHeight()); | |||||
| // cells = row.a(); | |||||
| // for (int k = 0, klen = tmpCells.size(); k < klen; k++) { | |||||
| // tmpCell = tmpCells.get(k); | |||||
| // XWPFTableCell cell = cells.get(k); | |||||
| // cellText = tmpCell.getText(); | |||||
| // if (StringUtils.isNotBlank(cellText)) { | |||||
| // //转换为mapkey对应的字段 | |||||
| // cellTextKey = cellText.replace("$", "").replace("{", "").replace("}", ""); | |||||
| // if (map.containsKey(cellTextKey)) { | |||||
| // // 填充内容 并且复制模板行的属性 | |||||
| // setCellText(tmpCell,cell,map.get(cellTextKey)); | |||||
| // } | |||||
| // } | |||||
| // } | |||||
| // | |||||
| // } | |||||
| // // 删除模版行 | |||||
| // table.removeRow(2); | |||||
| } | |||||
| XWPFParagraph tmpP = tmpCell.getParagraphs().get(0); | |||||
| XWPFParagraph cellP = cell.getParagraphs().get(0); | |||||
| XWPFRun tmpR = null; | |||||
| if (tmpP.getRuns() != null && tmpP.getRuns().size() > 0) { | |||||
| tmpR = tmpP.getRuns().get(0); | |||||
| } | |||||
| XWPFRun cellR = cellP.createRun(); | |||||
| cellR.setText(text); | |||||
| // 复制字体信息 | |||||
| if (tmpR != null) { | |||||
| if(!cellR.isBold()){ | |||||
| cellR.setBold(tmpR.isBold()); | |||||
| } | |||||
| cellR.setItalic(tmpR.isItalic()); | |||||
| cellR.setUnderline(tmpR.getUnderline()); | |||||
| cellR.setColor(tmpR.getColor()); | |||||
| cellR.setTextPosition(tmpR.getTextPosition()); | |||||
| if (tmpR.getFontSize() != -1) { | |||||
| cellR.setFontSize(tmpR.getFontSize()); | |||||
| } | |||||
| if (tmpR.getFontFamily() != null) { | |||||
| cellR.setFontFamily(tmpR.getFontFamily()); | |||||
| } | |||||
| if (tmpR.getCTR() != null) { | |||||
| if (tmpR.getCTR().isSetRPr()) { | |||||
| CTRPr tmpRPr = tmpR.getCTR().getRPr(); | |||||
| if (tmpRPr.isSetRFonts()) { | |||||
| CTFonts tmpFonts = tmpRPr.getRFonts(); | |||||
| CTRPr cellRPr = cellR.getCTR().isSetRPr() ? cellR | |||||
| .getCTR().getRPr() : cellR.getCTR().addNewRPr(); | |||||
| CTFonts cellFonts = cellRPr.isSetRFonts() ? cellRPr | |||||
| .getRFonts() : cellRPr.addNewRFonts(); | |||||
| cellFonts.setAscii(tmpFonts.getAscii()); | |||||
| cellFonts.setAsciiTheme(tmpFonts.getAsciiTheme()); | |||||
| cellFonts.setCs(tmpFonts.getCs()); | |||||
| cellFonts.setCstheme(tmpFonts.getCstheme()); | |||||
| cellFonts.setEastAsia(tmpFonts.getEastAsia()); | |||||
| cellFonts.setEastAsiaTheme(tmpFonts.getEastAsiaTheme()); | |||||
| cellFonts.setHAnsi(tmpFonts.getHAnsi()); | |||||
| cellFonts.setHAnsiTheme(tmpFonts.getHAnsiTheme()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| // 复制段落信息 | |||||
| cellP.setAlignment(tmpP.getAlignment()); | |||||
| cellP.setVerticalAlignment(tmpP.getVerticalAlignment()); | |||||
| cellP.setBorderBetween(tmpP.getBorderBetween()); | |||||
| cellP.setBorderBottom(tmpP.getBorderBottom()); | |||||
| cellP.setBorderLeft(tmpP.getBorderLeft()); | |||||
| cellP.setBorderRight(tmpP.getBorderRight()); | |||||
| cellP.setBorderTop(tmpP.getBorderTop()); | |||||
| cellP.setPageBreak(tmpP.isPageBreak()); | |||||
| if (tmpP.getCTP() != null) { | |||||
| if (tmpP.getCTP().getPPr() != null) { | |||||
| CTPPr tmpPPr = tmpP.getCTP().getPPr(); | |||||
| CTPPr cellPPr = cellP.getCTP().getPPr() != null ? cellP | |||||
| .getCTP().getPPr() : cellP.getCTP().addNewPPr(); | |||||
| // 复制段落间距信息 | |||||
| CTSpacing tmpSpacing = tmpPPr.getSpacing(); | |||||
| if (tmpSpacing != null) { | |||||
| CTSpacing cellSpacing = cellPPr.getSpacing() != null ? cellPPr | |||||
| .getSpacing() : cellPPr.addNewSpacing(); | |||||
| if (tmpSpacing.getAfter() != null) { | |||||
| cellSpacing.setAfter(tmpSpacing.getAfter()); | |||||
| } | |||||
| if (tmpSpacing.getAfterAutospacing() != null) { | |||||
| cellSpacing.setAfterAutospacing(tmpSpacing | |||||
| .getAfterAutospacing()); | |||||
| } | |||||
| if (tmpSpacing.getAfterLines() != null) { | |||||
| cellSpacing.setAfterLines(tmpSpacing.getAfterLines()); | |||||
| } | |||||
| if (tmpSpacing.getBefore() != null) { | |||||
| cellSpacing.setBefore(tmpSpacing.getBefore()); | |||||
| } | |||||
| if (tmpSpacing.getBeforeAutospacing() != null) { | |||||
| cellSpacing.setBeforeAutospacing(tmpSpacing | |||||
| .getBeforeAutospacing()); | |||||
| } | |||||
| if (tmpSpacing.getBeforeLines() != null) { | |||||
| cellSpacing.setBeforeLines(tmpSpacing.getBeforeLines()); | |||||
| } | |||||
| if (tmpSpacing.getLine() != null) { | |||||
| cellSpacing.setLine(tmpSpacing.getLine()); | |||||
| } | |||||
| if (tmpSpacing.getLineRule() != null) { | |||||
| cellSpacing.setLineRule(tmpSpacing.getLineRule()); | |||||
| } | |||||
| } | |||||
| // 复制段落缩进信息 | |||||
| CTInd tmpInd = tmpPPr.getInd(); | |||||
| if (tmpInd != null) { | |||||
| CTInd cellInd = cellPPr.getInd() != null ? cellPPr.getInd() | |||||
| : cellPPr.addNewInd(); | |||||
| if (tmpInd.getFirstLine() != null) { | |||||
| cellInd.setFirstLine(tmpInd.getFirstLine()); | |||||
| } | |||||
| if (tmpInd.getFirstLineChars() != null) { | |||||
| cellInd.setFirstLineChars(tmpInd.getFirstLineChars()); | |||||
| } | |||||
| if (tmpInd.getHanging() != null) { | |||||
| cellInd.setHanging(tmpInd.getHanging()); | |||||
| } | |||||
| if (tmpInd.getHangingChars() != null) { | |||||
| cellInd.setHangingChars(tmpInd.getHangingChars()); | |||||
| } | |||||
| if (tmpInd.getLeft() != null) { | |||||
| cellInd.setLeft(tmpInd.getLeft()); | |||||
| } | |||||
| if (tmpInd.getLeftChars() != null) { | |||||
| cellInd.setLeftChars(tmpInd.getLeftChars()); | |||||
| } | |||||
| if (tmpInd.getRight() != null) { | |||||
| cellInd.setRight(tmpInd.getRight()); | |||||
| } | |||||
| if (tmpInd.getRightChars() != null) { | |||||
| cellInd.setRightChars(tmpInd.getRightChars()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -27,13 +27,14 @@ | |||||
| <result column="starttime" property="starttime"/> | <result column="starttime" property="starttime"/> | ||||
| <result column="endtime" property="endtime"/> | <result column="endtime" property="endtime"/> | ||||
| <result column="freeze" property="freeze"/> | <result column="freeze" property="freeze"/> | ||||
| <result column="build_way" property="buildWay"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`, | `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`, | ||||
| `tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`type`, | `tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`type`, | ||||
| `rent_shop_type`,`pay_way`,`price_detail`,`starttime`,`endtime`,freeze | |||||
| `rent_shop_type`,`pay_way`,`price_detail`,`starttime`,`endtime`,freeze,build_way | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -56,6 +57,8 @@ | |||||
| <if test=" null != type "> and `type` = #{type} </if> | <if test=" null != type "> and `type` = #{type} </if> | ||||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | ||||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | ||||
| <if test=" null != buildWay ">and `build_way` = #{buildWay}</if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| @@ -74,7 +77,7 @@ | |||||
| select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day` , | 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`,m.`name` merchant_name,s.shop_number, | case when br.status=1 then br.owe else 0 end owe,br.`status`,m.`name` merchant_name,s.shop_number, | ||||
| br.`updatetime`,br.`merchant_id`,br.shop_id,br.type,br.`rent_shop_type`,br.pay_way,br.price_detail, | br.`updatetime`,br.`merchant_id`,br.shop_id,br.type,br.`rent_shop_type`,br.pay_way,br.price_detail, | ||||
| br.`starttime`,br.`endtime` | |||||
| br.`starttime`,br.`endtime`,br.`build_way` | |||||
| from wx_bill_daily br left join wx_merchant m on br.merchant_id=m.id | from wx_bill_daily br left join wx_merchant m on br.merchant_id=m.id | ||||
| left join wx_shop s on br.shop_id=s.id | left join wx_shop s on br.shop_id=s.id | ||||
| <where> | <where> | ||||
| @@ -88,6 +91,8 @@ | |||||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | ||||
| <if test=" null != starttime and null!=endtime ">and br.`receive_date` between #{starttime} and #{endtime} | <if test=" null != starttime and null!=endtime ">and br.`receive_date` between #{starttime} and #{endtime} | ||||
| </if> | </if> | ||||
| <if test=" null != buildWay ">and br.`build_way` = #{buildWay}</if> | |||||
| </where> | </where> | ||||
| @@ -24,23 +24,32 @@ | |||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1=1 | where 1=1 | ||||
| <if test=" null != id ">and s.`id` = #{id}</if> | |||||
| <if test=" null != tenantId ">and s.`tenant_id` = #{tenantId}</if> | |||||
| <if test=" null != merchantName and merchantName !='' ">and m.name like concat('%', #{merchantName},'%')</if> | |||||
| <if test="startTime != null and startTime !=''"> | |||||
| and createtime >= #{startTime} | |||||
| <if test=" null != id ">and tt.`id` = #{id}</if> | |||||
| <if test=" null != tenantId ">and tt.`tenant_id` = #{tenantId}</if> | |||||
| <if test=" null != merchantName and merchantName !='' ">and tt.merchantName like concat('%', #{merchantName},'%')</if> | |||||
| <if test="starttime != null and starttime !=''"> | |||||
| and tt.createtime >= #{starttime} | |||||
| </if> | </if> | ||||
| <if test="endTime != null and endTime !=''"> | |||||
| and createtime <= #{endTime} | |||||
| <if test="endtime != null and endtime !=''"> | |||||
| and tt.createtime <= #{endtime} | |||||
| </if> | |||||
| <if test=" null != settleNumber and settleNumber !='' ">and tt.`settle_number` = #{settleNumber}</if> | |||||
| <if test=" null != status and status !=''">and tt.`status` = #{status}</if> | |||||
| <if test=" null != applyStatus and applyStatus !=''">and tt.`apply_status` = #{applyStatus}</if> | |||||
| <if test=" null != direction and direction !=''"> | |||||
| <if test="0 == direction"> | |||||
| balance >0 | |||||
| </if> | |||||
| <if test="1 == direction"> | |||||
| balance <0 | |||||
| </if> | |||||
| </if> | </if> | ||||
| <if test=" null != settleNumber and settleNumber !='' ">and s.`settle_number` = #{settleNumber}</if> | |||||
| <if test=" null != status and status !=''">and s.`status` = #{status}</if> | |||||
| <if test=" null != applyStatus and applyStatus !=''">and s.`apply_status` = #{applyStatus}</if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | <if test=" null != sortColumns">order by ${sortColumns}</if> | ||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillSettle" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxBillSettle" resultMap="BaseResultMap"> | ||||
| select tt.*,(tt.receiveMoney-tt.payMoney) balance from ( | |||||
| select s.*,m.name merchantName, | select s.*,m.name merchantName, | ||||
| (select IFNULL(sum(bill.receive_pay),0) from wx_bill_settle_bill bb left join | (select IFNULL(sum(bill.receive_pay),0) from wx_bill_settle_bill bb left join | ||||
| (select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' | (select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' | ||||
| @@ -115,6 +124,10 @@ | |||||
| on(bb.bill_id=bill.id) where bb.settle_id = s.id and bb.type=1 | on(bb.bill_id=bill.id) where bb.settle_id = s.id and bb.type=1 | ||||
| ) payMoney | ) payMoney | ||||
| from wx_bill_settle s left JOIN wx_merchant m on(s.merchant_id=m.id) | from wx_bill_settle s left JOIN wx_merchant m on(s.merchant_id=m.id) | ||||
| ) tt | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| @@ -106,7 +106,7 @@ | |||||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> | <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> | ||||
| <result column="business_id" jdbcType="VARCHAR" property="businessId" /> | <result column="business_id" jdbcType="VARCHAR" property="businessId" /> | ||||
| <result column="subBusiness_id" jdbcType="VARCHAR" property="subBusinessId" /> | |||||
| <result column="sub_business_id" jdbcType="VARCHAR" property="subBusinessId" /> | |||||
| <result column="b_user_name" jdbcType="VARCHAR" property="bUserName" /> | <result column="b_user_name" jdbcType="VARCHAR" property="bUserName" /> | ||||
| <result column="b_user_phone" jdbcType="VARCHAR" property="bUserPhone"/> | <result column="b_user_phone" jdbcType="VARCHAR" property="bUserPhone"/> | ||||