| @@ -56,9 +56,9 @@ public class BillDailyAsyncTask { | |||||
| public void importExcelData(File file, MallUserInfo user, String importKey, String tenantId) { | public void importExcelData(File file, MallUserInfo user, String importKey, String tenantId) { | ||||
| ImportParams params = new ImportParams(); | ImportParams params = new ImportParams(); | ||||
| // 需要验证 | // 需要验证 | ||||
| params.setImportFields(new String[]{"商铺号", "费用类型", "实际应收金额", "实收金额", "欠缴金额", "截止收款日期", "逾期天数"}); | |||||
| params.setImportFields(new String[]{"商铺号", "费用类型", "实际应收金额", "实收金额", "截止收款日期", "逾期天数"}); | |||||
| IExcelDataHandler<WxBillDailyVo> handler = new BillDailyAsyncTask.BillDailyExcelHandler(); | IExcelDataHandler<WxBillDailyVo> handler = new BillDailyAsyncTask.BillDailyExcelHandler(); | ||||
| handler.setNeedHandlerFields(new String[]{"商铺号", "费用类型", "实际应收金额", "实收金额", "欠缴金额", "截止收款日期", "逾期天数"}); | |||||
| handler.setNeedHandlerFields(new String[]{"商铺号", "费用类型", "实际应收金额", "实收金额", "截止收款日期", "逾期天数"}); | |||||
| params.setNeedVerify(true); | params.setNeedVerify(true); | ||||
| ExcelImportResult<WxBillDailyVo> datalist = null; | ExcelImportResult<WxBillDailyVo> datalist = null; | ||||
| @@ -119,7 +119,7 @@ public class WxBillDailyController extends BaseController { | |||||
| @PostMapping(value = "/importTemplate", consumes = "multipart/*") | @PostMapping(value = "/importTemplate", consumes = "multipart/*") | ||||
| @SystemControllerLog(description = "会员管理-导入数据") | @SystemControllerLog(description = "会员管理-导入数据") | ||||
| public ResultData importTemplate(@RequestParam("file") MultipartFile mFile) { | public ResultData importTemplate(@RequestParam("file") MultipartFile mFile) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::importTemplate"); | |||||
| logger.debug("[" + getIpAddr() + "] wxBillDailyService::importTemplate"); | |||||
| if (mFile.isEmpty()) { | if (mFile.isEmpty()) { | ||||
| throw new MallinkException(Result.ERROR, "上传文件不能为空"); | throw new MallinkException(Result.ERROR, "上传文件不能为空"); | ||||
| } | } | ||||
| @@ -16,7 +16,8 @@ public class UrlCheck { | |||||
| || url.contains("/wxCUserBasicInfo/listByFilter") | || url.contains("/wxCUserBasicInfo/listByFilter") | ||||
| || url.contains("wxMsgCallback") | || url.contains("wxMsgCallback") | ||||
| || url.contains("notify") | || url.contains("notify") | ||||
| || url.contains("pvlog"); | |||||
| || url.contains("pvlog") | |||||
| || url.contains("/wxBillDaily/importTemplate"); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,12 +1,11 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import com.iformall.common.SortColumn; | import com.iformall.common.SortColumn; | ||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import javax.persistence.Table; | import javax.persistence.Table; | ||||
| import javax.persistence.Transient; | import javax.persistence.Transient; | ||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import javax.validation.constraints.NotNull; | import javax.validation.constraints.NotNull; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| @@ -74,7 +73,7 @@ public class WxBillDaily extends BaseEntity{ | |||||
| @io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay") | @io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay") | ||||
| private Long pay; | private Long pay; | ||||
| @Excel(name = "截止收款日期", orderNum = "6", width = 20, format = "yyyy-MM-dd") | |||||
| @Excel(name = "截止收款日期", orderNum = "5", width = 20, format = "yyyy-MM-dd") | |||||
| @NotNull | @NotNull | ||||
| @io.swagger.annotations.ApiModelProperty(value="截止收款日期",name="receiveDate") | @io.swagger.annotations.ApiModelProperty(value="截止收款日期",name="receiveDate") | ||||
| @SortColumn(column = "receiveDate") | @SortColumn(column = "receiveDate") | ||||
| @@ -87,7 +86,7 @@ public class WxBillDaily extends BaseEntity{ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") | ||||
| private Date createtime; | private Date createtime; | ||||
| @Excel(name = "逾期天数", orderNum = "7", width = 20, numFormat = "#") | |||||
| @Excel(name = "逾期天数", orderNum = "6", width = 20, numFormat = "#") | |||||
| @NotNull | @NotNull | ||||
| @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") | @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") | ||||
| @SortColumn(column = "expiredDay") | @SortColumn(column = "expiredDay") | ||||
| @@ -26,11 +26,6 @@ public class WxBillDailyVo extends WxBillDaily { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "实收金额", name = "payStr") | @io.swagger.annotations.ApiModelProperty(value = "实收金额", name = "payStr") | ||||
| private String payStr; | private String payStr; | ||||
| @Excel(name = "欠缴金额", orderNum = "5", width = 20, numFormat = "#.##") | |||||
| @NotNull | |||||
| @io.swagger.annotations.ApiModelProperty(value = "欠缴金额", name = "oweStr") | |||||
| private String oweStr; | |||||
| public String getShopNumber() { | public String getShopNumber() { | ||||
| return shopNumber; | return shopNumber; | ||||
| } | } | ||||
| @@ -55,11 +50,4 @@ public class WxBillDailyVo extends WxBillDaily { | |||||
| this.payStr = payStr; | this.payStr = payStr; | ||||
| } | } | ||||
| public String getOweStr() { | |||||
| return oweStr; | |||||
| } | |||||
| public void setOweStr(String oweStr) { | |||||
| this.oweStr = oweStr; | |||||
| } | |||||
| } | } | ||||
| @@ -224,7 +224,6 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||||
| v1.setType(1); | v1.setType(1); | ||||
| v1.setReceivePayStr("1"); | v1.setReceivePayStr("1"); | ||||
| v1.setPayStr("0"); | v1.setPayStr("0"); | ||||
| v1.setOweStr("0"); | |||||
| v1.setReceiveDate(new Date()); | v1.setReceiveDate(new Date()); | ||||
| v1.setExpiredDay(0L); | v1.setExpiredDay(0L); | ||||
| list.add(v1); | list.add(v1); | ||||
| @@ -233,7 +232,6 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||||
| v2.setType(2); | v2.setType(2); | ||||
| v2.setReceivePayStr("1000"); | v2.setReceivePayStr("1000"); | ||||
| v2.setPayStr("0"); | v2.setPayStr("0"); | ||||
| v2.setOweStr("1000"); | |||||
| v2.setReceiveDate(new Date()); | v2.setReceiveDate(new Date()); | ||||
| v2.setExpiredDay(0L); | v2.setExpiredDay(0L); | ||||
| list.add(v2); | list.add(v2); | ||||
| @@ -263,7 +261,7 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||||
| return; | return; | ||||
| } | } | ||||
| Integer type = billDaily.getType(); | Integer type = billDaily.getType(); | ||||
| if (type != null) { | |||||
| if (type == null) { | |||||
| stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); | stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); | ||||
| logger.error("账单类型为空", billDaily.toString()); | logger.error("账单类型为空", billDaily.toString()); | ||||
| return; | return; | ||||
| @@ -292,51 +290,57 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||||
| logger.error("实收金额小于0", billDaily.toString()); | logger.error("实收金额小于0", billDaily.toString()); | ||||
| return; | return; | ||||
| } | } | ||||
| String oweStr = billDaily.getOweStr(); | |||||
| if (StringUtils.isBlank(oweStr)) { | |||||
| stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); | |||||
| logger.error("欠缴金额为空", billDaily.toString()); | |||||
| return; | |||||
| } | |||||
| double oweD = new BigDecimal(oweStr).doubleValue(); | |||||
| if (oweD < 0) { | |||||
| if (receivePayD < payD) { | |||||
| stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); | stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); | ||||
| logger.error("欠缴金额小于0", billDaily.toString()); | |||||
| logger.error("实际应收金额小于实收金额", billDaily.toString()); | |||||
| return; | return; | ||||
| } | } | ||||
| long owe = new BigDecimal(oweD).multiply(new BigDecimal(100)).longValue(); | |||||
| billDaily.setOwe(owe); | |||||
| WxBillDaily wxBillDaily = new WxBillDaily(); | |||||
| long receivePay = new BigDecimal(receivePayD).multiply(new BigDecimal(100)).longValue(); | |||||
| wxBillDaily.setReceivePay(receivePay); | |||||
| long pay = new BigDecimal(payD).multiply(new BigDecimal(100)).longValue(); | |||||
| wxBillDaily.setPay(pay); | |||||
| wxBillDaily.setOwe(receivePay - pay); | |||||
| wxBillDaily.setType(type); | |||||
| Date receiveDate = billDaily.getReceiveDate(); | Date receiveDate = billDaily.getReceiveDate(); | ||||
| wxBillDaily.setReceiveDate(receiveDate); | |||||
| Date date = new Date(); | Date date = new Date(); | ||||
| if (pay > 0) { | |||||
| wxBillDaily.setPayDate(date); | |||||
| } | |||||
| int expiredDay = DateUtils.daysBetween(receiveDate, date); | int expiredDay = DateUtils.daysBetween(receiveDate, date); | ||||
| billDaily.setExpiredDay((long) expiredDay); | |||||
| wxBillDaily.setExpiredDay((long) expiredDay); | |||||
| if (expiredDay > 0) { | if (expiredDay > 0) { | ||||
| billDaily.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); | |||||
| wxBillDaily.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); | |||||
| } else { | } else { | ||||
| billDaily.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); | |||||
| wxBillDaily.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); | |||||
| } | } | ||||
| if (receivePayD == payD) { | if (receivePayD == payD) { | ||||
| billDaily.setStatus(EnumBillRentStatus.PAID.getCode()); | |||||
| wxBillDaily.setStatus(EnumBillRentStatus.PAID.getCode()); | |||||
| } | } | ||||
| billDaily.setUserId(user.getId()); | |||||
| billDaily.setShopId(wxShop.getId()); | |||||
| billDaily.setRentShopType(wxShop.getType()); | |||||
| billDaily.setPayWay(EnumBillPayWay.OTHER.getCode()); | |||||
| billDaily.setCreatetime(date); | |||||
| billDaily.setUpdatetime(date); | |||||
| wxBillDaily.setUserId(user.getId()); | |||||
| wxBillDaily.setShopId(wxShop.getId()); | |||||
| wxBillDaily.setRentShopType(wxShop.getType()); | |||||
| wxBillDaily.setPayWay(EnumBillPayWay.OTHER.getCode()); | |||||
| wxBillDaily.setCreatetime(date); | |||||
| wxBillDaily.setUpdatetime(date); | |||||
| wxBillDaily.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||||
| //商户 | //商户 | ||||
| WxMerchantShop merchantShop = new WxMerchantShop(); | WxMerchantShop merchantShop = new WxMerchantShop(); | ||||
| merchantShop.setShopId(wxShop.getId()); | merchantShop.setShopId(wxShop.getId()); | ||||
| merchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | merchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | ||||
| WxMerchantShop wxMerchantShop = wxMerchantShopMapper.selectOne(merchantShop); | WxMerchantShop wxMerchantShop = wxMerchantShopMapper.selectOne(merchantShop); | ||||
| billDaily.setMerchantId(wxMerchantShop.getMerchantId()); | |||||
| wxBillDaily.setMerchantId(wxMerchantShop.getMerchantId()); | |||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| billDaily.setId(idWorker.nextId()); | |||||
| wxBillDailyMapper.insertSelective(billDaily); | |||||
| wxBillDaily.setId(idWorker.nextId()); | |||||
| wxBillDailyMapper.insertSelective(wxBillDaily); | |||||
| //记数 | //记数 | ||||
| stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); | stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); | ||||