| @@ -128,5 +128,12 @@ public class WxBillRentManageController extends BaseController { | |||
| return wxBillRentManageService.updateLatePayStatus(wxBillRent); | |||
| } | |||
| @GetMapping("exportBill") | |||
| @SystemControllerLog(description = "租赁押金账单-导出") | |||
| public void exportBill(@ModelAttribute WxBillRentManage wxBillRent, HttpServletRequest request, HttpServletResponse response) { | |||
| wxBillRent.updateTenantInfo(getTenantInfo()); | |||
| wxBillRentManageService.exportBill(request, response, wxBillRent); | |||
| } | |||
| } | |||
| @@ -31,6 +31,8 @@ import com.alibaba.fastjson.JSON; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.common.SysConfigConstant; | |||
| import com.iformall.domain.po.SysConfig; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.po.WxMall; | |||
| @@ -38,6 +40,7 @@ import com.iformall.domain.vo.WxCouponCVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.enums.EnumCouponChannelActivityStatus; | |||
| import com.iformall.enums.EnumCouponChannelType; | |||
| import com.iformall.service.SysConfigService; | |||
| import com.iformall.service.WxCouponChannelService; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.service.WxMerchantService; | |||
| @@ -70,6 +73,9 @@ public class WxCouponController extends BaseController { | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> redisTemplate; | |||
| @Autowired | |||
| private SysConfigService sysConfigService; | |||
| @ApiOperation("根据id(couponChannel)查询详情接口") | |||
| @@ -179,7 +185,13 @@ public class WxCouponController extends BaseController { | |||
| }else { | |||
| sb.append(coupon.getRemainInventory()); | |||
| } | |||
| sb.append(",\"inventory\":").append(coupon.getInventory()).append(",\"price\":").append(coupon.getPrice()).append(",\"creditPrice\":").append(coupon.getCreditPrice()).append("}"); | |||
| sb.append(",\"inventory\":").append(coupon.getInventory()).append(",\"price\":").append(coupon.getPrice()).append(",\"creditPrice\":").append(coupon.getCreditPrice()); | |||
| //如果配置显示已售数量 | |||
| SysConfig config = sysConfigService.getByKey(SysConfigConstant.coupon_detail_show_selled, channelPriceAndStock); | |||
| if (null != config && config.getConfigItemValue().equals("1")) { | |||
| sb.append(",\"selledCount\":").append(coupon.getInventory()-coupon.getRemainInventory()); | |||
| } | |||
| sb.append("}"); | |||
| return new ResultData(sb.toString()); | |||
| } | |||
| @@ -246,6 +258,8 @@ public class WxCouponController extends BaseController { | |||
| WxCoupon cc = couponList.get(i); | |||
| couponMap.put(cc.getId(), cc); | |||
| } | |||
| //如果配置显示已售数量 | |||
| SysConfig config = sysConfigService.getByKey(SysConfigConstant.coupon_detail_show_selled, this.getTenantInfo()); | |||
| StringBuffer sb = new StringBuffer("["); | |||
| for (int i = 0 ; i < couponChannelList.size() ; i ++) { | |||
| Long ccid = couponChannelList.get(i); | |||
| @@ -271,8 +285,12 @@ public class WxCouponController extends BaseController { | |||
| }else { | |||
| sb.append(coupon.getRemainInventory()); | |||
| } | |||
| sb.append(",\"inventory\":").append(coupon.getInventory()).append(",\"price\":").append(coupon.getPrice()).append(",\"creditPrice\":").append(coupon.getCreditPrice()).append("}"); | |||
| sb.append(",\"inventory\":").append(coupon.getInventory()).append(",\"price\":").append(coupon.getPrice()).append(",\"creditPrice\":").append(coupon.getCreditPrice()); | |||
| if (null != config && config.getConfigItemValue().equals("1")) { | |||
| sb.append(",\"selledCount\":").append(coupon.getInventory()-coupon.getRemainInventory()); | |||
| } | |||
| sb.append("}"); | |||
| if (i < (couponChannelList.size()-1)) { | |||
| sb.append(","); | |||
| } | |||
| @@ -413,6 +431,7 @@ public class WxCouponController extends BaseController { | |||
| } | |||
| wxCouponCVo.setRemainInventory(couponCVo.getRemainInventory()); | |||
| wxCouponCVo.setStatus(couponCVo.getStatus()); | |||
| } else { | |||
| // 更新状态 | |||
| // WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelIdL); | |||
| @@ -4,4 +4,5 @@ public class SysConfigConstant { | |||
| public static final String vierfy_seconds_key="vierfySeconds"; | |||
| public static final String default_merchant_b_user = "defaultMerchantBUserId"; | |||
| public static final String coupon_detail_show_selled = "couponDetailShowSelled"; | |||
| } | |||
| @@ -1,5 +1,8 @@ | |||
| package com.iformall.service; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| @@ -61,5 +64,7 @@ public interface WxBillRentManageService { | |||
| void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillRentManage deposit); | |||
| ResultData updateLatePayStatus(WxBillRentManage wxBillRent); | |||
| void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillRentManage wxBillRentManage); | |||
| } | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.service.impl; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| @@ -17,6 +18,7 @@ import com.iformall.enums.EnumBillDailyStatus; | |||
| import com.iformall.enums.EnumBillPayWay; | |||
| import com.iformall.enums.EnumBillRentStatus; | |||
| import com.iformall.enums.EnumDelStatus; | |||
| import com.iformall.enums.EnumRentShopType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBillActionMapper; | |||
| import com.iformall.mapper.WxBillDepositMapper; | |||
| @@ -26,6 +28,8 @@ import com.iformall.service.WxBillDepositService; | |||
| import com.iformall.service.WxBillRentManageService; | |||
| import com.iformall.service.WxPayAccountBillService; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -33,10 +37,16 @@ import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.Set; | |||
| import java.util.stream.Collectors; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| /** | |||
| * @author gongbiao | |||
| @@ -309,4 +319,42 @@ public class WxBillRentManageServiceImpl implements WxBillRentManageService { | |||
| return new ResultData(Result.SUCCESS, "滞纳金结单成功", record); | |||
| } | |||
| @Override | |||
| public void exportBill(HttpServletRequest request, HttpServletResponse response, | |||
| WxBillRentManage wxBillRentManage) { | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillRentManage); | |||
| String billName = wxBillRentManage.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) ? "商铺租金账单" : "多经点位租金账单"; | |||
| List<WxBillRentManage> billRentList = wxBillRentManageMapper.queryBillManageList(wxBillRentManage); | |||
| billRentList.stream().forEach(e->{ | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| Map<Long, List<WxBillRentManage>> collect = billRentList.parallelStream() | |||
| .collect(Collectors.groupingBy(WxBillRentManage::getMerchantId)); | |||
| Set<Map.Entry<Long, List<WxBillRentManage>>> entries = collect.entrySet(); | |||
| List<WxBillRentManage> datalist = new ArrayList<>(); | |||
| for (Map.Entry<Long, List<WxBillRentManage>> entry : entries) { | |||
| List<WxBillRentManage> list = entry.getValue(); | |||
| for (WxBillRentManage rent : list) { | |||
| String shopNumber = rent.getShopNumber(); | |||
| if (StringUtils.isEmpty(shopNumber)) { | |||
| String shopInfo = rent.getShopInfo(); | |||
| if (StringUtils.isNotEmpty(shopInfo) && !shopInfo.equals("[]")) { | |||
| JSONObject jsonObject = JSONObject.parseObject(shopInfo); | |||
| StringBuffer sb = new StringBuffer(); | |||
| Set<Map.Entry<String, Object>> sets = jsonObject.entrySet(); | |||
| sets.forEach(x -> sb.append(x.getKey()).append(",")); | |||
| if(StringUtils.isNotBlank(sb)){ | |||
| rent.setShopNumber(sb.deleteCharAt(sb.length() - 1).toString()); | |||
| } | |||
| } | |||
| } | |||
| datalist.add(rent); | |||
| } | |||
| } | |||
| excelService.exportExcel(datalist, null, billName, WxBillRentManage.class, billName + ".xlsx", response, false); | |||
| } | |||
| } | |||