| @@ -4,6 +4,7 @@ import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.domain.vo.WxBillExcelTemplate; | |||
| import com.iformall.service.WxBillAllService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| @@ -153,4 +154,12 @@ public class WxBillAllController extends BaseController { | |||
| return wxBillAllService.updateReceivePay(wxBillAll, getUser()); | |||
| } | |||
| @GetMapping("exportTemplate") | |||
| @SystemControllerLog(description = "账单-导出模板") | |||
| public void exportTemplate(@ModelAttribute WxBillExcelTemplate wxBillExcelTemplate, HttpServletRequest request, HttpServletResponse response) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillAllController::exportTemplate"); | |||
| wxBillAllService.exportTemplate(wxBillExcelTemplate, request, response); | |||
| } | |||
| } | |||
| @@ -3,7 +3,6 @@ package com.iformall.domain.vo; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import lombok.Data; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| /** | |||
| @@ -12,75 +11,28 @@ import java.util.Date; | |||
| @Data | |||
| public class WxBillExcelTemplate { | |||
| @Excel(name = "商户名", width = 20, orderNum = "2") | |||
| @Excel(name = "商户名*", width = 20, orderNum = "1") | |||
| private String merchantName; | |||
| @Excel(name = "商户类型", width = 20, orderNum = "3", replace = {"店铺_1", "多经点位_2"}) | |||
| private Integer rentShopType; | |||
| @Excel(name = "费用类型*", width = 20, orderNum = "2", replace = {"商铺租金_1", "多经点位租金_2", "商铺物业费_3", "多经点位物业费_4", "日常费用_5", "其他费用_6", "其他押金_7"}) | |||
| private Integer billType; | |||
| @Excel(name = "费用类型", width = 20, orderNum = "4") | |||
| private String billType; | |||
| @Excel(name = "费用所属期-开始时间*", width = 20, orderNum = "4", format = "yyyy-MM-dd") | |||
| private Date starttime; | |||
| @Excel(name = "实际应收金额(元)", width = 20, orderNum = "5") | |||
| private String receivePayStr; | |||
| @Excel(name = "费用所属期-结束时间*", width = 20, orderNum = "5", format = "yyyy-MM-dd") | |||
| private Date endtime; | |||
| @Excel(name = "实收金额(元)", width = 20, orderNum = "6") | |||
| @Excel(name = "收款金额(元)*", width = 20, orderNum = "6") | |||
| private String payStr; | |||
| @Excel(name = "欠缴金额(元)", width = 20, orderNum = "7") | |||
| private String oweStr; | |||
| @Excel(name = "缴款截止日期", width = 20, orderNum = "8", format = "yyyy-MM-dd") | |||
| private Date receiveDate; | |||
| @Excel(name = "逾期天数", width = 20, orderNum = "9") | |||
| private Integer expiredDay; | |||
| @Excel(name = "账单状态", width = 20, orderNum = "10", replace = {"欠缴_1", "待缴_2", "已结清_3", "未到期_4", "已退还_5", "失效_6", "_7"}) | |||
| private Integer status; | |||
| private Integer billTypeValue; | |||
| private Long needPay; | |||
| private Long receivePay; | |||
| private Long pay; | |||
| private Long owe; | |||
| @Excel(name = "收款日期*", width = 20, orderNum = "7", format = "yyyy-MM-dd") | |||
| private Date payDate; | |||
| private Date starttime; | |||
| private Date endtime; | |||
| private String manager; | |||
| private String managerPhone; | |||
| private String shopInfo; | |||
| private String name; | |||
| @io.swagger.annotations.ApiModelProperty(value = "评论", name = "comments") | |||
| private String comments; | |||
| 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; | |||
| } | |||
| @Excel(name = "截止缴款日*", width = 20, orderNum = "8", format = "yyyy-MM-dd") | |||
| private Date receiveDate; | |||
| public String getPayStr() { | |||
| if (getPay() != null) { | |||
| payStr = new BigDecimal(getPay()).divide(new BigDecimal(100)).toString(); | |||
| } | |||
| return payStr; | |||
| } | |||
| @Excel(name = "收款方式", width = 20, orderNum = "9") | |||
| private String payWay; | |||
| public String getOweStr() { | |||
| if (getOwe() != null) { | |||
| oweStr = new BigDecimal(getOwe()).divide(new BigDecimal(100)).toString(); | |||
| } | |||
| return oweStr; | |||
| } | |||
| } | |||
| @@ -0,0 +1,15 @@ | |||
| package com.iformall.domain.vo; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import lombok.Data; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @Data | |||
| public class WxBillExcelTemplateDaily extends WxBillExcelTemplate { | |||
| @Excel(name = "费用属性*", width = 20, orderNum = "3", replace = {"租金_1", "物业费_2", "水费_3", "电费_4", "空调费_5", "其他费用_6", "其他押金_7"}) | |||
| private Integer billAttr; | |||
| } | |||
| @@ -0,0 +1,15 @@ | |||
| package com.iformall.domain.vo; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import lombok.Data; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @Data | |||
| public class WxBillExcelTemplateOther extends WxBillExcelTemplate { | |||
| @Excel(name = "费用属性*", width = 20, orderNum = "3") | |||
| private String billAttr; | |||
| } | |||
| @@ -11,7 +11,8 @@ public enum EnumBillAction { | |||
| OFFLINE_PAY(3, "线下缴费"), | |||
| DEPOSIT_PAY(4, "押金缴费"), | |||
| DEPOSIT_RETURN(5, "押金退款"), | |||
| DEPOSIT_MODIFY(6, "押金变更"),; | |||
| DEPOSIT_MODIFY(6, "押金变更"), | |||
| IMPORT_PAY(6, "导入缴费"),; | |||
| public static EnumBillAction getEnum(Integer code) { | |||
| for (EnumBillAction value : values()) { | |||
| @@ -0,0 +1,42 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public enum EnumBillExcelTemplate { | |||
| SHOP_RENT(1, "商铺租金"), | |||
| POINT_RENT(2, "多经点位租金"), | |||
| SHOP_PROPERTY(3, "商铺物业费"), | |||
| POINT_PROPERTY(4, "多经点位物业费"), | |||
| DAILY(5, "日常费用"), | |||
| OTHER(6, "其他费用"), | |||
| OTHER_DEPOSIT(7, "其他押金"),; | |||
| public static EnumBillExcelTemplate getEnum(Integer code) { | |||
| for (EnumBillExcelTemplate value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumBillExcelTemplate(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,42 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public enum EnumBillExcelTemplateDaily { | |||
| RENT(1, "租金"), | |||
| PROPERTY(2, "物业费"), | |||
| WATER(3, "水费"), | |||
| POWER(4, "电费"), | |||
| AIR_CONDITIONING(5, "空调费"), | |||
| OTHER(6, "其他费用"), | |||
| OTHER_DEPOSIT(7, "其他押金"),; | |||
| public static EnumBillExcelTemplateDaily getEnum(Integer code) { | |||
| for (EnumBillExcelTemplateDaily value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumBillExcelTemplateDaily(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -58,7 +58,7 @@ public class ExcelService { | |||
| cellStyle.setFont(font); | |||
| Row row = sheetAt.createRow(sheetAt.getLastRowNum() + 2); | |||
| Cell cell = row.createCell(0); | |||
| cell.setCellValue("*为必填字段(此段文字导入数据时请删除)"); | |||
| cell.setCellValue("*为必填字段(导入数据时此行文字请删除)"); | |||
| cell.setCellStyle(cellStyle); | |||
| } | |||
| } | |||
| @@ -3,6 +3,8 @@ package com.iformall.service; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.domain.vo.WxBillExcelTemplate; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.List; | |||
| @@ -55,4 +57,7 @@ public interface WxBillAllService { | |||
| ResultData updateReceivePay(WxBillAll wxBillAll, MallUserInfo user); | |||
| void addBillAction(Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo); | |||
| void exportTemplate(WxBillExcelTemplate wxBillExcelTemplate, HttpServletRequest request, HttpServletResponse response); | |||
| } | |||
| @@ -872,6 +872,74 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| wxBillActionService.modifyBill(wxBillAction, mallUserInfo); | |||
| } | |||
| @Override | |||
| public void exportTemplate(WxBillExcelTemplate WxBillExcelTemplate, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxBillExcelTemplateOther> datalist = new ArrayList<>(); | |||
| Integer billType = WxBillExcelTemplate.getBillType(); | |||
| if (billType.equals(EnumBillExcelTemplate.DAILY.getCode())) { | |||
| WxBillExcelTemplateOther one = new WxBillExcelTemplateOther(); | |||
| Date date = new Date(); | |||
| one.setMerchantName("商户1"); | |||
| one.setBillType(billType); | |||
| one.setBillAttr("水费"); | |||
| one.setStarttime(date); | |||
| one.setEndtime(date); | |||
| one.setPayStr("1000"); | |||
| one.setPayDate(date); | |||
| one.setReceiveDate(date); | |||
| one.setPayWay("微信"); | |||
| datalist.add(one); | |||
| WxBillExcelTemplateOther two = new WxBillExcelTemplateOther(); | |||
| two.setMerchantName("商户2"); | |||
| two.setBillType(billType); | |||
| two.setBillAttr("电费"); | |||
| two.setStarttime(date); | |||
| two.setEndtime(date); | |||
| two.setPayStr("2000.50"); | |||
| two.setPayDate(date); | |||
| two.setReceiveDate(date); | |||
| two.setPayWay("支付宝"); | |||
| datalist.add(two); | |||
| WxBillExcelTemplateOther three = new WxBillExcelTemplateOther(); | |||
| three.setMerchantName("商户3"); | |||
| three.setBillType(billType); | |||
| three.setBillAttr("空调费"); | |||
| three.setStarttime(date); | |||
| three.setEndtime(date); | |||
| three.setPayStr("3333"); | |||
| three.setPayDate(date); | |||
| three.setReceiveDate(date); | |||
| three.setPayWay("其他"); | |||
| datalist.add(three); | |||
| } else { | |||
| WxBillExcelTemplateOther one = new WxBillExcelTemplateOther(); | |||
| Date date = new Date(); | |||
| one.setMerchantName("商户"); | |||
| one.setBillType(billType); | |||
| if (billType.equals(EnumBillExcelTemplate.SHOP_RENT.getCode()) || billType.equals(EnumBillExcelTemplate.POINT_RENT.getCode())) { | |||
| one.setBillAttr("租金"); | |||
| } else if (billType.equals(EnumBillExcelTemplate.SHOP_PROPERTY.getCode()) || billType.equals(EnumBillExcelTemplate.POINT_PROPERTY.getCode())) { | |||
| one.setBillAttr("物业费"); | |||
| } else if (billType.equals(EnumBillExcelTemplate.OTHER.getCode())) { | |||
| one.setBillAttr("其他费用"); | |||
| } else { | |||
| one.setBillAttr("其他押金"); | |||
| } | |||
| one.setStarttime(date); | |||
| one.setEndtime(date); | |||
| one.setPayStr("2000.50"); | |||
| one.setReceiveDate(date); | |||
| one.setPayDate(date); | |||
| one.setPayWay("微信"); | |||
| datalist.add(one); | |||
| } | |||
| excelService.exportExcel(datalist, null, "账单模板", WxBillExcelTemplateOther.class, "账单模板.xlsx", response, true); | |||
| } | |||
| public void updateDailyBill(Long businessId, Long newPrice, Date updateDate) { | |||
| WxBillDaily dbBill = wxBillDailyMapper.selectByPrimaryKey(businessId); | |||
| WxBillDaily wxBillDaily = new WxBillDaily(); | |||