| @@ -20,6 +20,8 @@ import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.List; | |||
| /** | |||
| @@ -175,4 +177,12 @@ public class WxMerchantController extends BaseController { | |||
| return new ResultData(wxMerchant); | |||
| } | |||
| @ApiOperation("商户数据导出") | |||
| @GetMapping("/exportData") | |||
| @SystemControllerLog(description = "商户-商户数据导出") | |||
| public void exportData(@ModelAttribute WxMerchant wxMerchant, HttpServletRequest request, HttpServletResponse response) { | |||
| wxMerchant.setTenantId(getTenantId()); | |||
| wxMerchantService.exportData(wxMerchant,request,response); | |||
| } | |||
| } | |||
| @@ -0,0 +1,3 @@ | |||
| alter table wx_pay_bill | |||
| change column pay_amount pay_amount bigint(12) | |||
| ; | |||
| @@ -1,5 +1,7 @@ | |||
| package com.iformall.domain.po; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| @@ -54,9 +56,11 @@ public class WxMerchant extends BaseEntity { | |||
| /*租期开始时间**/ | |||
| @Transient | |||
| @Excel(name="租期开始时间",width = 20,format="yyyy-MM-dd",orderNum = "4") | |||
| private Date rentalStartDate; | |||
| /*租期结束时间**/ | |||
| @Transient | |||
| @Excel(name="租期结束时间",width = 20,format="yyyy-MM-dd",orderNum = "5") | |||
| private Date rentalEndDate; | |||
| /*单价**/ | |||
| @@ -69,14 +73,17 @@ public class WxMerchant extends BaseEntity { | |||
| /*账户类型**/ | |||
| @Transient | |||
| @Excel(name="账户类型",width = 20,orderNum = "7",replace = {"_null","商户号_0","微信号_1"}) | |||
| private Integer accountTypeValue; | |||
| /*账户ID**/ | |||
| @Transient | |||
| @Excel(name="账户号",width = 20,orderNum = "8") | |||
| private String accountId; | |||
| /*账户名**/ | |||
| @Transient | |||
| @Excel(name="账户名",width = 20,orderNum = "9") | |||
| private String accountName; | |||
| /*账户参数**/ | |||
| @@ -104,14 +111,25 @@ public class WxMerchant extends BaseEntity { | |||
| /*商户图片**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户图片",name="imgUrl") | |||
| private String imgUrl; | |||
| /*商户名**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") | |||
| @Excel(name="商户名",width = 20,orderNum = "1") | |||
| private String name; | |||
| /*联系人**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="联系人",name="linkPerson") | |||
| @Excel(name="联系人",width = 20,orderNum = "2") | |||
| private String linkPerson; | |||
| /*联系方式**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="联系方式",name="linkPhone") | |||
| @Excel(name="联系方式",width = 20,orderNum = "3") | |||
| private String linkPhone; | |||
| /*创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| @Excel(name="创建时间",width = 20,format="yyyy-MM-dd",orderNum = "10") | |||
| private Date createDate; | |||
| /*更新时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| @@ -124,10 +142,9 @@ public class WxMerchant extends BaseEntity { | |||
| private String carParams; | |||
| /*商户状态**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="状态1可用0停用",name="status") | |||
| @Excel(name="商户状态",width = 20,orderNum = "6",replace = {"停用_0","正常_1"}) | |||
| private Integer status; | |||
| @io.swagger.annotations.ApiModelProperty(value="联系人",name="linkPerson") | |||
| private String linkPerson; | |||
| @io.swagger.annotations.ApiModelProperty(value="经营业态ID:参照wx_business表",name="businessId") | |||
| private Integer businessId; | |||
| @@ -145,6 +162,7 @@ public class WxMerchant extends BaseEntity { | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否显示在C端", name = "isPublic") | |||
| @Excel(name="是否展示",width = 20,orderNum = "11",replace = {"否_0","是_1"}) | |||
| private Integer isPublic; | |||
| @io.swagger.annotations.ApiModelProperty(value = "邮件", name = "email") | |||
| @@ -161,6 +179,7 @@ public class WxMerchant extends BaseEntity { | |||
| private Integer isAdmin; | |||
| @io.swagger.annotations.ApiModelProperty(value = "待缴提醒", name = "billSetting") | |||
| @Excel(name="待缴提醒(提前X天)",width = 20,orderNum = "12") | |||
| private Integer billSetting; | |||
| public Integer getBillSetting() { | |||
| @@ -55,12 +55,7 @@ public class WxMerchantShop implements Serializable { | |||
| /*更新时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| /*租期开始时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租期开始时间",name="rentalStartDate") | |||
| private Date rentalStartDate; | |||
| /*租期结束时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租期结束时间",name="rentalEndDate") | |||
| private Date rentalEndDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="删除状态",name="isDel") | |||
| private Integer isDel; | |||
| @@ -95,18 +90,7 @@ public class WxMerchantShop implements Serializable { | |||
| public void setUpdateDate(Date _updateDate) { | |||
| updateDate = _updateDate; | |||
| } | |||
| public Date getRentalStartDate() { | |||
| return rentalStartDate; | |||
| } | |||
| public void setRentalStartDate(Date _rentalStartDate) { | |||
| rentalStartDate = _rentalStartDate; | |||
| } | |||
| public Date getRentalEndDate() { | |||
| return rentalEndDate; | |||
| } | |||
| public void setRentalEndDate(Date _rentalEndDate) { | |||
| rentalEndDate = _rentalEndDate; | |||
| } | |||
| public Integer getIsDel() { | |||
| return isDel; | |||
| @@ -65,7 +65,7 @@ public class WxPayBill implements Serializable { | |||
| private String ip; | |||
| /**支付金额(分)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="支付金额(分)",name="payAmount") | |||
| private Integer payAmount; | |||
| private Long payAmount; | |||
| /**支付发起时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="支付发起时间",name="payTimeStart") | |||
| private Date payTimeStart; | |||
| @@ -149,10 +149,12 @@ public class WxPayBill implements Serializable { | |||
| public void setIp(String _ip) { | |||
| ip = _ip; | |||
| } | |||
| public Integer getPayAmount() { | |||
| public Long getPayAmount() { | |||
| return payAmount; | |||
| } | |||
| public void setPayAmount(Integer _payAmount) { | |||
| public void setPayAmount(Long _payAmount) { | |||
| payAmount = _payAmount; | |||
| } | |||
| public Date getPayTimeStart() { | |||
| @@ -51,4 +51,5 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long> | |||
| void updateInvalidContract(WxRentContract record); | |||
| List<WxRentContract> selectRentContractByMerchantId(WxRentContract wxRentContract); | |||
| } | |||
| @@ -17,7 +17,7 @@ public class WxPayOrderSP { | |||
| private String sign_type; // 签名类型 | |||
| private String body; // 商品简单描述 128 | |||
| private String out_trade_no; // 商户订单号 | |||
| private Integer total_fee; // 支付金额 | |||
| private String total_fee; // 支付金额 | |||
| private String spbill_create_ip; // 支付IP | |||
| private String goods_tag; // 优惠标识 | |||
| private String notify_url; // 通知地址 | |||
| @@ -7,6 +7,8 @@ import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.vo.WxMerchantSimpleVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| @@ -84,4 +86,5 @@ public interface WxMerchantService { | |||
| WxMerchant findOne(WxMerchant wxMerchant); | |||
| void exportData(WxMerchant wxMerchant, HttpServletRequest request, HttpServletResponse response); | |||
| } | |||
| @@ -198,8 +198,8 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { | |||
| //账单审批 | |||
| Integer billType = (Integer) getVariableByKey(variables, "billType"); | |||
| Long oldPrice = (Long) getVariableByKey(variables, "oldPrice"); | |||
| Long newPrice = (Long) getVariableByKey(variables, "newPrice"); | |||
| Long oldPrice = Long.parseLong((String) getVariableByKey(variables, "oldPrice")); | |||
| Long newPrice =Long.parseLong((String) getVariableByKey(variables, "newPrice")); | |||
| Date updateDate = new Date(); | |||
| MallUserInfo mallUserInfo = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); | |||
| if (billType.equals(EnumBillTypeParam.RENT.getCode())) { | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.service.impl; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| @@ -22,6 +23,8 @@ import org.springframework.transaction.annotation.Isolation; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.*; | |||
| import java.util.stream.Collectors; | |||
| @@ -81,22 +84,24 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Autowired | |||
| WxLevelConfigService wxLevelConfigService; | |||
| @Autowired | |||
| ExcelService excelService; | |||
| @Override | |||
| public PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.setTenantId(record.getTenantId()); | |||
| List<WxRentContract> list = wxRentContractMapper.findList(wxRentContract); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<WxMerchant> merchants = wxMerchantMapper.findList(record); | |||
| for (WxMerchant merchant : merchants) { | |||
| List<WxRentContract> collect = list.stream().filter(ms -> ms.getMerchantId() != null && ms.getMerchantId().equals(merchant.getId()) | |||
| && !ms.getStatus().equals(EnumRentContractStatus.WAIT_SIGN.getCode()) | |||
| && !ms.getStatus().equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()) | |||
| && !ms.getStatus().equals(EnumRentContractStatus.INTENTION.getCode())).collect(Collectors.toList()); | |||
| if (collect != null && collect.size() > 0) { | |||
| merchant.setRentalStartDate(collect.get(0).getRentalStartDate()); | |||
| merchant.setRentalEndDate(collect.get(0).getRentalEndDate()); | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.setMerchantId(merchant.getId()); | |||
| List<WxRentContract> lrc = wxRentContractMapper.selectRentContractByMerchantId(wxRentContract); | |||
| if (!lrc.isEmpty()) { | |||
| merchant.setRentalStartDate(lrc.get(0).getRentalStartDate()); | |||
| merchant.setRentalEndDate(lrc.get(0).getRentalEndDate()); | |||
| } | |||
| if (record.getRentShopType() != null) { | |||
| List<Map<String, Object>> shops = new ArrayList<>(); | |||
| WxMerchantShop wxMerchantShop = new WxMerchantShop(); | |||
| @@ -139,7 +144,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| public List<WxMerchantSimpleVo> findList(String tenantId) { | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.setTenantId(tenantId); | |||
| wxMerchant.setStatus(1); | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| List<WxMerchant> wxMerchantList = wxMerchantMapper.findList(wxMerchant); | |||
| return BeanMapping.mapList(wxMerchantList,WxMerchantSimpleVo.class,(s, t)->t.setMerchantName(s.getName())); | |||
| } | |||
| @@ -155,10 +160,17 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||
| List<Map<String, Object>> shops = new ArrayList<>(); | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.setMerchantId(wxMerchant.getId()); | |||
| List<WxRentContract> lrc = wxRentContractMapper.selectRentContractByMerchantId(wxRentContract); | |||
| if (!lrc.isEmpty()) { | |||
| wxMerchant.setRentalStartDate(lrc.get(0).getRentalStartDate()); | |||
| wxMerchant.setRentalEndDate(lrc.get(0).getRentalEndDate()); | |||
| } | |||
| List<WxMerchantShop> wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShop); | |||
| for (WxMerchantShop merchantShop : wxMerchantShopList) { | |||
| wxMerchant.setRentalStartDate(merchantShop.getRentalStartDate()); | |||
| wxMerchant.setRentalEndDate(merchantShop.getRentalEndDate()); | |||
| WxShop record = new WxShop(); | |||
| record.setId(merchantShop.getShopId()); | |||
| List<Map<String, Object>> shoplist = wxShopMapper.findListMap(record); | |||
| @@ -327,6 +339,10 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| wxMerchant.setUpdateDate(date); | |||
| wxMerchant.setCreateDate(date); | |||
| List<String> coverPicture = JSONArray.parseArray(wxMerchant.getCoverPicture(), String.class); | |||
| if (!coverPicture.isEmpty()) { | |||
| wxMerchant.setImgUrl(coverPicture.get(0)); | |||
| } | |||
| wxMerchantMapper.insertSelective(wxMerchant); | |||
| //关联合同 | |||
| @@ -374,6 +390,10 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| } | |||
| //更新商户 | |||
| List<String> coverPicture = JSONArray.parseArray(wxMerchant.getCoverPicture(), String.class); | |||
| if (!coverPicture.isEmpty()) { | |||
| wxMerchant.setImgUrl(coverPicture.get(0)); | |||
| } | |||
| Date date = new Date(); | |||
| wxMerchant.setUpdateDate(date); | |||
| wxMerchantMapper.updateByPrimaryKeySelective(wxMerchant); | |||
| @@ -565,4 +585,28 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| public WxMerchant findOne(WxMerchant wxMerchant) { | |||
| return wxMerchantMapper.selectOne(wxMerchant); | |||
| } | |||
| public void exportData(WxMerchant wxMerchant, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxMerchant> list = wxMerchantMapper.findList(wxMerchant); | |||
| list.stream().forEach(m->{ | |||
| //分账信息 | |||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(m); | |||
| if (receiver != null) { | |||
| m.setAccountId(receiver.getReceiverAccount()); | |||
| m.setAccountName(receiver.getTrueName()); | |||
| m.setAccountTypeValue(receiver.getReceiverType()); | |||
| } | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.setMerchantId(m.getId()); | |||
| List<WxRentContract> lrc = wxRentContractMapper.selectRentContractByMerchantId(wxRentContract); | |||
| if (!lrc.isEmpty()) { | |||
| m.setRentalStartDate(lrc.get(0).getRentalStartDate()); | |||
| m.setRentalEndDate(lrc.get(0).getRentalEndDate()); | |||
| } | |||
| }); | |||
| excelService.exportExcel(list,null,"商户信息",WxMerchant.class,"商户信息数据.xls",response); | |||
| } | |||
| } | |||
| @@ -97,8 +97,8 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||
| } | |||
| //获取账单数据 | |||
| Map<String, Object> bill = bills.get(0); | |||
| Integer owe = (Integer)bill.get("owe"); | |||
| if(owe.intValue()<=0){ | |||
| Long owe = (Long) bill.get("owe"); | |||
| if (owe.longValue() <= 0) { | |||
| logger.info("账单欠缴为0"); | |||
| return new ResultData(ErrorCode.BILL_OWE_ZERO); | |||
| } | |||
| @@ -124,7 +124,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||
| record.setPayTimeEnd(new Date(endtime)); | |||
| // 支付单号 | |||
| record.setPayBillNo(payBillNo); | |||
| record.setPayAmount((Integer) bill.get("owe")); | |||
| record.setPayAmount((Long) bill.get("owe")); | |||
| record.setPayVendor(EnumPayWay.PAY_WAY_WEAPP.getCode()); | |||
| record.setPayBillStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); | |||
| record.setShare(isShare.getCode()); | |||
| @@ -165,7 +165,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||
| long endtime = currentDate.getTime() + 120 * 60 * 1000; | |||
| record.setPayTimeEnd(new Date(endtime)); | |||
| record.setPayBillNo(payBillNo); | |||
| record.setPayAmount((Integer) bill.get("owe")); | |||
| record.setPayAmount((Long) bill.get("owe")); | |||
| record.setUpdateTime(currentDate); | |||
| sqlRow = wxPayBillMapper.updateByPrimaryKeySelective(record); | |||
| if (sqlRow != 1) { | |||
| @@ -208,7 +208,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||
| long endtime = currentDate.getTime() + 120 * 60 * 1000; | |||
| record.setPayTimeEnd(new Date(endtime)); | |||
| record.setPayBillNo(payBillNo); | |||
| record.setPayAmount((Integer) bill.get("owe")); | |||
| record.setPayAmount((Long) bill.get("owe")); | |||
| record.setUpdateTime(currentDate); | |||
| sqlRow = wxPayBillMapper.updateByPrimaryKeySelective(record); | |||
| if (sqlRow != 1) { | |||
| @@ -233,7 +233,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||
| wxPayBillSP.setNonce_str(noncestr); | |||
| wxPayBillSP.setBody(bill.get("billType").toString()); | |||
| wxPayBillSP.setOut_trade_no(record.getPayBillNo()); | |||
| wxPayBillSP.setTotal_fee((Integer) bill.get("owe")); | |||
| wxPayBillSP.setTotal_fee(bill.get("owe").toString()); | |||
| // 终端IP | |||
| wxPayBillSP.setSpbill_create_ip(record.getIp()); | |||
| wxPayBillSP.setNotify_url(payAccount.getPayNotifyUrl()); | |||
| @@ -315,7 +315,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| wxPayOrderSP.setNonce_str(noncestr); | |||
| wxPayOrderSP.setBody(order.getDetail()); | |||
| wxPayOrderSP.setOut_trade_no(record.getPayOrderNo()); | |||
| wxPayOrderSP.setTotal_fee(order.getPayment()); | |||
| wxPayOrderSP.setTotal_fee(order.getPayment().toString()); | |||
| wxPayOrderSP.setSpbill_create_ip(record.getIp()); // 终端IP | |||
| wxPayOrderSP.setGoods_tag(String.valueOf(order.getProductId())); // 券ID | |||
| wxPayOrderSP.setNotify_url(payAccount.getPayNotifyUrl()); | |||
| @@ -290,13 +290,16 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| record.setPreviewBillRentList(billList); | |||
| //生成预览账单 | |||
| if(CollectionUtils.isEmpty(billList) || | |||
| (!wxPropertyContract.getReceivePeriod().equals(record.getReceivePeriod()) | |||
| ||!wxPropertyContract.getPrice().equals(record.getPrice()) | |||
| ||!wxPropertyContract.getDeposit().equals(record.getDeposit()) | |||
| ||!wxPropertyContract.getAdjustPeriod().equals(record.getAdjustPeriod()) | |||
| || !DateUtils.date2String(wxPropertyContract.getRentalStartDate(),"yyyy-MM-dd").equals(DateUtils.date2String(record.getRentalStartDate(),"yyyy-MM-dd")) | |||
| )){ | |||
| // if(CollectionUtils.isEmpty(billList) || | |||
| // (!wxPropertyContract.getReceivePeriod().equals(record.getReceivePeriod()) | |||
| // ||!wxPropertyContract.getPrice().equals(record.getPrice()) | |||
| // ||!wxPropertyContract.getDeposit().equals(record.getDeposit()) | |||
| // ||!wxPropertyContract.getAdjustPeriod().equals(record.getAdjustPeriod()) | |||
| // || !DateUtils.date2String(wxPropertyContract.getRentalStartDate(),"yyyy-MM-dd").equals(DateUtils.date2String(record.getRentalStartDate(),"yyyy-MM-dd")) | |||
| // )){ | |||
| if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null | |||
| && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0)) { | |||
| //删除预账单,重新生成 | |||
| wxBillPropertyMapper.deletePreviewBill(record); | |||
| //重新生成 | |||
| wxPropertyContract.setPrice(record.getPrice()); | |||
| @@ -344,7 +344,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return resultData; | |||
| } | |||
| //有改变,删除预账单,重新生成 | |||
| if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null | |||
| && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0)) { | |||
| //删除预账单,重新生成 | |||
| wxBillRentMapper.deletePreviewBill(record); | |||
| resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode()); | |||
| } | |||
| /* //有改变,删除预账单,重新生成 | |||
| if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null | |||
| && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0)) { | |||
| boolean change = false; | |||
| @@ -389,7 +395,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxBillRentMapper.deletePreviewBill(record); | |||
| resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode()); | |||
| } | |||
| } | |||
| }*/ | |||
| //启动审批流 | |||
| if(record.getFlowParams() != null){ | |||
| @@ -477,9 +483,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| WxRentContract wxRentContractQuery = new WxRentContract(); | |||
| wxRentContractQuery.setTenantId(record.getTenantId()); | |||
| Long shopId = rentInfoObject.getLong("shopId"); | |||
| String shopNumber = rentInfoObject.getString("shopNumber"); | |||
| if (shopId == null) { | |||
| return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND.getCode(), "店铺 " + shopNumber + " 已删除"); | |||
| } | |||
| wxRentContractQuery.setShopId(shopId); | |||
| int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContractQuery); | |||
| String shopNumber = rentInfoObject.getString("shopNumber"); | |||
| if (count > 0) { | |||
| return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); | |||
| } | |||
| @@ -959,13 +968,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| Date receiveDate = DateUtils.getFirstDayOfNextMonth(startdate,receivePeriod * i); | |||
| wxBillRent.setReceiveDate(receiveDate); | |||
| wxBillRent.setStarttime(receiveDate); | |||
| wxBillRent.setEndtime(DateUtils.getLastDayForMonth(receiveDate,receivePeriod * i)); | |||
| wxBillRent.setEndtime(DateUtils.getLastDayForMonth(wxBillRent.getStarttime(),receivePeriod * i)); | |||
| instance.clear(); | |||
| instance.setTime(receiveDate); | |||
| instance.add(dayType, receivePeriod); | |||
| instance.add(Calendar.DAY_OF_MONTH, -1); | |||
| wxBillRent.setEndtime(instance.getTime()); | |||
| // instance.clear(); | |||
| // instance.setTime(receiveDate); | |||
| // instance.add(dayType, receivePeriod); | |||
| // instance.add(Calendar.DAY_OF_MONTH, -1); | |||
| // wxBillRent.setEndtime(instance.getTime()); | |||
| }else if(i == paycount - 1) {//最后周期 | |||
| Date receiveDate = DateUtils.getFirstDayOfNextMonth(startdate,receivePeriod * i); | |||
| wxBillRent.setReceiveDate(receiveDate); | |||
| @@ -975,6 +984,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| instance.clear(); | |||
| instance.setTime(firstDay); | |||
| if(new SimpleDateFormat("yyyy-MM-dd").format(wxBillRent.getEndtime()).equals("2020-02-29")){ | |||
| System.out.println( "-----------"+receivePeriod * i); | |||
| System.out.println("-----------"+new SimpleDateFormat("yyyy-MM-dd").format(wxBillRent.getReceiveDate())); | |||
| System.out.println("-----------"+new SimpleDateFormat("yyyy-MM-dd").format(wxBillRent.getEndtime())); | |||
| System.out.println(); | |||
| } | |||
| //最后一期有余,加上残月,(不整除时,最后一个月有余,否则为0) | |||
| if(isFirstDay(wxRentContract.getRentalStartDate())){ | |||
| if(receivePeriod > 1) { | |||
| @@ -8,14 +8,12 @@ | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="rental_start_date" jdbcType="TIMESTAMP" property="rentalStartDate" /> | |||
| <result column="rental_end_date" jdbcType="TIMESTAMP" property="rentalEndDate" /> | |||
| <result column="is_del" jdbcType="SMALLINT" property="isDel" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`merchant_id`,`shop_id`,`create_date`,`update_date`,`rental_start_date`,`rental_end_date`,`is_del` | |||
| `id`,`tenant_id`,`merchant_id`,`shop_id`,`create_date`,`update_date`,`is_del` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -51,14 +49,6 @@ | |||
| </if> | |||
| <if test=" null != rentalStartDate "> | |||
| and `rental_start_date` = #{rentalStartDate} | |||
| </if> | |||
| <if test=" null != rentalEndDate "> | |||
| and `rental_end_date` = #{rentalEndDate} | |||
| </if> | |||
| <if test=" null != isDel "> | |||
| and `is_del` = #{isDel} | |||
| </if> | |||
| @@ -240,4 +240,12 @@ | |||
| select id from wx_rent_contract where json_contains(json_extract(rent_info,'$[*].shopId'),concat('"',${shopId},'"')) | |||
| and rent_shop_type=1 and status in(0,1) and status!=7)r) | |||
| </update> | |||
| <select id="selectRentContractByMerchantId" parameterType="com.iformall.domain.po.WxRentContract" | |||
| resultType="com.iformall.domain.po.WxRentContract"> | |||
| select * from wx_rent_contract | |||
| where status in(2,3,4) | |||
| and merchant_id = #{merchantId} | |||
| </select> | |||
| </mapper> | |||