| @@ -0,0 +1,265 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.Date; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public class WxBillAllVo { | |||||
| Long id; | |||||
| String tenantId; | |||||
| Long merchantId; | |||||
| Long shopId; | |||||
| //@Excel(name="商铺号",width = 20,orderNum = "1") | |||||
| String shopNumber; | |||||
| //@Excel(name="商户名称",width = 20,orderNum = "2") | |||||
| String merchantName; | |||||
| //@Excel(name="商铺类型",width = 20,orderNum = "3", replace = {"店铺_1","多经点位_2"}) | |||||
| Integer rentShopType; | |||||
| @Excel(name="费用类型",width = 20,orderNum = "4") | |||||
| String billType; | |||||
| @Excel(name="实际应收金额(元)",width = 20,orderNum = "5") | |||||
| String receivePayStr; | |||||
| @Excel(name="实收金额(元)",width = 20,orderNum = "6") | |||||
| String payStr; | |||||
| @Excel(name="欠缴金额(元)",width = 20,orderNum = "7") | |||||
| String oweStr; | |||||
| @Excel(name="缴款截止日期",width = 20,orderNum = "8", format="yyyy-MM-dd") | |||||
| Date receiveDate; | |||||
| @Excel(name="逾期天数",width = 20,orderNum = "9") | |||||
| Integer expiredDay; | |||||
| @Excel(name="账单状态",width = 20,orderNum = "10", replace = {"欠缴_1","待缴_2","已结清_3","未到期_4","已退还_5","失效_6"}) | |||||
| Integer status; | |||||
| Integer billTypeValue; | |||||
| Integer needPay; | |||||
| Integer receivePay; | |||||
| Integer pay; | |||||
| Integer owe; | |||||
| Date payDate; | |||||
| Date starttime; | |||||
| Date endtime; | |||||
| String manager; | |||||
| String managerPhone; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public Long getMerchantId() { | |||||
| return merchantId; | |||||
| } | |||||
| public void setMerchantId(Long merchantId) { | |||||
| this.merchantId = merchantId; | |||||
| } | |||||
| public Long getShopId() { | |||||
| return shopId; | |||||
| } | |||||
| public void setShopId(Long shopId) { | |||||
| this.shopId = shopId; | |||||
| } | |||||
| public Integer getBillTypeValue() { | |||||
| return billTypeValue; | |||||
| } | |||||
| public void setBillTypeValue(Integer billTypeValue) { | |||||
| this.billTypeValue = billTypeValue; | |||||
| } | |||||
| public String getBillType() { | |||||
| return billType; | |||||
| } | |||||
| public void setBillType(String billType) { | |||||
| this.billType = billType; | |||||
| } | |||||
| public Integer getNeedPay() { | |||||
| return needPay; | |||||
| } | |||||
| public void setNeedPay(Integer needPay) { | |||||
| this.needPay = needPay; | |||||
| } | |||||
| public Integer getReceivePay() { | |||||
| return receivePay; | |||||
| } | |||||
| public void setReceivePay(Integer receivePay) { | |||||
| this.receivePay = receivePay; | |||||
| } | |||||
| public Integer getPay() { | |||||
| return pay; | |||||
| } | |||||
| public void setPay(Integer pay) { | |||||
| this.pay = pay; | |||||
| } | |||||
| public Integer getOwe() { | |||||
| return owe; | |||||
| } | |||||
| public void setOwe(Integer owe) { | |||||
| this.owe = owe; | |||||
| } | |||||
| public Date getReceiveDate() { | |||||
| return receiveDate; | |||||
| } | |||||
| public void setReceiveDate(Date receiveDate) { | |||||
| this.receiveDate = receiveDate; | |||||
| } | |||||
| public Date getPayDate() { | |||||
| return payDate; | |||||
| } | |||||
| public void setPayDate(Date payDate) { | |||||
| this.payDate = payDate; | |||||
| } | |||||
| public Integer getExpiredDay() { | |||||
| return expiredDay; | |||||
| } | |||||
| public void setExpiredDay(Integer expiredDay) { | |||||
| this.expiredDay = expiredDay; | |||||
| } | |||||
| public Integer getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(Integer status) { | |||||
| this.status = status; | |||||
| } | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String tenantId) { | |||||
| this.tenantId = tenantId; | |||||
| } | |||||
| public Date getStarttime() { | |||||
| return starttime; | |||||
| } | |||||
| public void setStarttime(Date starttime) { | |||||
| this.starttime = starttime; | |||||
| } | |||||
| public Date getEndtime() { | |||||
| return endtime; | |||||
| } | |||||
| public void setEndtime(Date endtime) { | |||||
| this.endtime = endtime; | |||||
| } | |||||
| public Integer getRentShopType() { | |||||
| return rentShopType; | |||||
| } | |||||
| public void setRentShopType(Integer rentShopType) { | |||||
| this.rentShopType = rentShopType; | |||||
| } | |||||
| public String getMerchantName() { | |||||
| return merchantName; | |||||
| } | |||||
| public void setMerchantName(String merchantName) { | |||||
| this.merchantName = merchantName; | |||||
| } | |||||
| public String getShopNumber() { | |||||
| return shopNumber; | |||||
| } | |||||
| public void setShopNumber(String shopNumber) { | |||||
| this.shopNumber = shopNumber; | |||||
| } | |||||
| public String getManager() { | |||||
| return manager; | |||||
| } | |||||
| public void setManager(String manager) { | |||||
| this.manager = manager; | |||||
| } | |||||
| public String getManagerPhone() { | |||||
| return managerPhone; | |||||
| } | |||||
| public void setManagerPhone(String managerPhone) { | |||||
| this.managerPhone = managerPhone; | |||||
| } | |||||
| public String getReceivePayStr() { | |||||
| if(getReceivePay()!=null) { | |||||
| receivePayStr = new BigDecimal(getReceivePay()).divide(new BigDecimal(100)).toString(); | |||||
| } | |||||
| return receivePayStr; | |||||
| } | |||||
| public void setReceivePayStr(String receivePayStr) { | |||||
| this.receivePayStr = receivePayStr; | |||||
| } | |||||
| public String getPayStr() { | |||||
| if(getPay()!=null) { | |||||
| payStr = new BigDecimal(getPay()).divide(new BigDecimal(100)).toString(); | |||||
| } | |||||
| return payStr; | |||||
| } | |||||
| public void setPayStr(String payStr) { | |||||
| this.payStr = payStr; | |||||
| } | |||||
| public String getOweStr() { | |||||
| if(getOwe()!=null) { | |||||
| oweStr = new BigDecimal(getOwe()).divide(new BigDecimal(100)).toString(); | |||||
| } | |||||
| return oweStr; | |||||
| } | |||||
| public void setOweStr(String oweStr) { | |||||
| this.oweStr = oweStr; | |||||
| } | |||||
| } | |||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.mapper; | package com.iformall.mapper; | ||||
| import com.iformall.domain.vo.WxBillAll; | import com.iformall.domain.vo.WxBillAll; | ||||
| import com.iformall.domain.vo.WxBillAllVo; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -11,7 +12,7 @@ import java.util.Map; | |||||
| public interface WxBillAllMapper { | public interface WxBillAllMapper { | ||||
| List<Map<String,Object>> list(WxBillAll record); | |||||
| List<WxBillAllVo> list(WxBillAll record); | |||||
| Map<String,Object> queryOweInfo(WxBillAll record); | Map<String,Object> queryOweInfo(WxBillAll record); | ||||
| @@ -1,22 +1,18 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import cn.afterturn.easypoi.excel.entity.ExportParams; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| 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.WxBillAll; | import com.iformall.domain.vo.WxBillAll; | ||||
| import com.iformall.domain.vo.WxBillAllVo; | |||||
| import com.iformall.enums.*; | 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.*; | import com.iformall.service.*; | ||||
| import com.iformall.utils.Constant; | |||||
| import com.iformall.utils.DateUtils; | |||||
| import org.apache.commons.io.FileUtils; | |||||
| import org.apache.poi.ss.usermodel.Cell; | |||||
| import org.apache.poi.ss.usermodel.Row; | |||||
| import org.apache.poi.xssf.usermodel.XSSFSheet; | |||||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -24,8 +20,7 @@ import org.springframework.stereotype.Service; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.io.*; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.*; | import java.util.*; | ||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| @@ -81,13 +76,15 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| @Autowired | @Autowired | ||||
| WxBillOtherDepositMapper wxBillOtherDepositMapper; | WxBillOtherDepositMapper wxBillOtherDepositMapper; | ||||
| @Autowired | |||||
| ExcelService excelService; | |||||
| @Override | @Override | ||||
| public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { | public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { | ||||
| //更新各账单状态 | //更新各账单状态 | ||||
| updateBillStatus(record); | updateBillStatus(record); | ||||
| PageHelper.startPage(pageIndex, pageSize); | |||||
| List<Map<String, Object>> billList = wxBillAllMapper.list(record); | |||||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billList); | |||||
| PageInfo<WxBillAllVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillAllMapper.list(record)); | |||||
| Map<String, Object> result = new HashMap<>(); | Map<String, Object> result = new HashMap<>(); | ||||
| result.put("pageInfo", pageInfo); | result.put("pageInfo", pageInfo); | ||||
| return result; | return result; | ||||
| @@ -193,6 +190,37 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll) { | |||||
| Map<Long, List<WxBillAllVo>> billMapList = wxBillAllMapper.list(wxBillAll) | |||||
| .parallelStream() | |||||
| .collect(Collectors.groupingBy(WxBillAllVo::getMerchantId)); | |||||
| List<Map<String, Object>> list = new ArrayList<>(); | |||||
| Iterator<Map.Entry<Long, List<WxBillAllVo>>> entries = billMapList.entrySet().iterator(); | |||||
| while (entries.hasNext()) { | |||||
| Map.Entry<Long, List<WxBillAllVo>> entry = entries.next(); | |||||
| Map<String,Object> map = new HashMap<>(); | |||||
| ExportParams deptExportParams = new ExportParams(); | |||||
| WxBillAllVo first = ((List<WxBillAllVo>)(entry.getValue())).get(0); | |||||
| deptExportParams.setSheetName(first.getMerchantName()); | |||||
| deptExportParams.setTitle(first.getMerchantName() | |||||
| + "(" | |||||
| + EnumRentShopType.getEnum((Integer)first.getRentShopType()).getMessage() | |||||
| + "-"+first.getShopNumber() | |||||
| + ")"); | |||||
| //deptExportParams.setSecondTitle(); | |||||
| map.put("title", deptExportParams); | |||||
| map.put("entity", WxBillAllVo.class); | |||||
| map.put("data", entry.getValue()); | |||||
| list.add(map); | |||||
| } | |||||
| excelService.exportExcel(list, "账单数据.xls", response); | |||||
| } | |||||
| /* | |||||
| @Override | @Override | ||||
| public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll) { | public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll) { | ||||
| //得到当前月 | //得到当前月 | ||||
| @@ -332,7 +360,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| } | } | ||||
| } | } | ||||
| */ | |||||
| private int updateBillOther(Map<String, Object> bill) { | private int updateBillOther(Map<String, Object> bill) { | ||||
| logger.info("updateBillOther params:"+bill.toString()); | logger.info("updateBillOther params:"+bill.toString()); | ||||
| Object id = bill.get("id"); | Object id = bill.get("id"); | ||||
| @@ -594,7 +594,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| } | } | ||||
| } | } | ||||
| */ | |||||
| public void downFile(String filePath, String filename, String exportFileName, | public void downFile(String filePath, String filename, String exportFileName, | ||||
| HttpServletResponse response, HttpServletRequest req) throws IOException { | HttpServletResponse response, HttpServletRequest req) throws IOException { | ||||
| try { | try { | ||||
| @@ -624,5 +624,5 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| } | } | ||||
| } | } | ||||
| */ | |||||
| } | } | ||||
| @@ -167,7 +167,7 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService { | |||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| } | } | ||||
| } | } | ||||
| */ | |||||
| public void downFile(String filePath, String filename, String exportFileName, | public void downFile(String filePath, String filename, String exportFileName, | ||||
| HttpServletResponse response, HttpServletRequest req) throws IOException { | HttpServletResponse response, HttpServletRequest req) throws IOException { | ||||
| @@ -198,6 +198,6 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService { | |||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| } | } | ||||
| } | } | ||||
| */ | |||||
| } | } | ||||
| @@ -1,13 +1,48 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="com.iformall.mapper.WxBillAllMapper"> | <mapper namespace="com.iformall.mapper.WxBillAllMapper"> | ||||
| <select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | |||||
| select bill.id,bill.merchant_id merchantId,bill.shop_id shopId,bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, | |||||
| bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate,bill.expired_day expiredDay,bill.status, | |||||
| bill.tenant_id tenantId,m.name merchantName,s.shop_number | |||||
| shopNumber,bill.starttime,bill.endtime,bill.name,s.manager,s.manager_phone managerPhone, | |||||
| bill.rent_shop_type rentShopType from ( | |||||
| <resultMap id="allVoResultMap" type="com.iformall.domain.vo.WxBillAllVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenantId" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="merchantId" jdbcType="INTEGER" property="merchantId" /> | |||||
| <result column="shopId" jdbcType="INTEGER" property="shopId" /> | |||||
| <result column="billTypeValue" jdbcType="INTEGER" property="billTypeValue"/> | |||||
| <result column="billType" jdbcType="VARCHAR" property="billType"/> | |||||
| <result column="needPay" jdbcType="INTEGER" property="needPay" /> | |||||
| <result column="merchantName" jdbcType="VARCHAR" property="merchantName" /> | |||||
| <result column="rentShopType" jdbcType="INTEGER" property="rentShopType"/> | |||||
| <result column="receiveDate" jdbcType="TIMESTAMP" property="receiveDate" /> | |||||
| <result column="expiredDay" jdbcType="INTEGER" property="expiredDay" /> | |||||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||||
| <result column="receivePay" jdbcType="INTEGER" property="receivePay" /> | |||||
| <result column="owe" jdbcType="INTEGER" property="owe" /> | |||||
| <result column="pay" jdbcType="INTEGER" property="pay" /> | |||||
| <result column="payDate" jdbcType="TIMESTAMP" property="payDate" /> | |||||
| <result column="starttime" jdbcType="TIMESTAMP" property="starttime" /> | |||||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime" /> | |||||
| <result column="shopNumber" jdbcType="VARCHAR" property="shopNumber"/> | |||||
| <result column="manager" jdbcType="VARCHAR" property="manager"/> | |||||
| <result column="managerPhone" jdbcType="VARCHAR" property="managerPhone"/> | |||||
| </resultMap> | |||||
| <select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap"> | |||||
| select | |||||
| bill.id,bill.tenant_id tenantId,bill.merchant_id merchantId,bill.shop_id shopId, | |||||
| bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, | |||||
| bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate, | |||||
| bill.expired_day expiredDay,bill.status, | |||||
| bill.starttime,bill.endtime,bill.name,bill.rent_shop_type rentShopType, | |||||
| m.name merchantName, | |||||
| s.shop_number shopNumber, s.manager, s.manager_phone managerPhone | |||||
| from ( | |||||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | ||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | ||||
| endtime,rent_shop_type from wx_bill_rent where is_preview = 0 | endtime,rent_shop_type from wx_bill_rent where is_preview = 0 | ||||