| @@ -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); | |||
| } | |||
| } | |||
| @@ -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; | |||
| @@ -51,4 +51,5 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long> | |||
| void updateInvalidContract(WxRentContract record); | |||
| List<WxRentContract> selectRentContractByMerchantId(WxRentContract wxRentContract); | |||
| } | |||
| @@ -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); | |||
| } | |||
| @@ -22,6 +22,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,6 +83,9 @@ 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(); | |||
| @@ -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); | |||
| @@ -565,4 +577,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); | |||
| } | |||
| } | |||
| @@ -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,5) | |||
| and merchant_id = #{merchantId} | |||
| </select> | |||
| </mapper> | |||