| @@ -6,7 +6,6 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.domain.vo.WxCouponOrderBVo; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.enums.EnumPayType; | |||
| @@ -26,7 +25,6 @@ import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Map; | |||
| @RestController | |||
| @@ -74,47 +72,6 @@ public class WxCouponOrderController extends BaseController { | |||
| return wxCouponOrderService.detailAdminVo(couponOrderId); | |||
| } | |||
| @RequestMapping("/exportData") | |||
| @SystemControllerLog(description = "券包-导出") | |||
| public void exportData( | |||
| @RequestParam("endDate") String endDate, | |||
| @RequestParam("startDate") String startDate, | |||
| @RequestParam("merchantName") String merchantName, | |||
| @RequestParam("couponOrderStatus") String couponOrderStatus, | |||
| @RequestParam("id") String id, | |||
| HttpServletRequest request, HttpServletResponse response) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponOrderController::exportData"); | |||
| WxCouponOrderBVo wxCouponOrder = new WxCouponOrderBVo(); | |||
| wxCouponOrder.setTenantId(getTenantId()); | |||
| wxCouponOrder.setMerchantName(merchantName); | |||
| try { | |||
| wxCouponOrder.setId(Long.valueOf(id)); | |||
| }catch (Exception e){ | |||
| wxCouponOrder.setId(null); | |||
| } | |||
| try { | |||
| wxCouponOrder.setCouponOrderStatus(Integer.valueOf(couponOrderStatus)); | |||
| }catch (Exception e){ | |||
| wxCouponOrder.setCouponOrderStatus(null); | |||
| } | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| try { | |||
| wxCouponOrder.setStartTime( sdf.parse(startDate)); | |||
| } catch (Exception e) { | |||
| wxCouponOrder.setStartTime(null); | |||
| } | |||
| try { | |||
| wxCouponOrder.setEndTime( sdf.parse(endDate)); | |||
| } catch (Exception e) { | |||
| wxCouponOrder.setEndTime(null); | |||
| } | |||
| wxCouponOrder.setSortColumns(WxCouponOrder.Field.Id_DESC); | |||
| wxCouponOrderService.exportData(request, response, wxCouponOrder); | |||
| } | |||
| @ApiOperation(value = "退券退款", notes = "{\"couponOrderId\":\"string\"}") | |||
| @PostMapping("/refund") | |||
| @SystemControllerLog(description = "券包-退券退款") | |||
| @@ -158,4 +115,17 @@ public class WxCouponOrderController extends BaseController { | |||
| return new ResultData(ErrorCode.REFUND_ORDER_ERROR.getCode(), "AppInfo获取失败"); | |||
| } | |||
| @GetMapping("exportData") | |||
| @SystemControllerLog(description = "券订单数据-导出数据") | |||
| public void exportData(@ModelAttribute WxCouponOrderBVo wxCouponOrder, HttpServletRequest request, HttpServletResponse response) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponOrderController::exportData"); | |||
| if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrderBVo(); | |||
| wxCouponOrder.setTenantId(getTenantId()); | |||
| if (wxCouponOrder.getMerchantName() != null && | |||
| wxCouponOrder.getMerchantName().isEmpty()) { | |||
| wxCouponOrder.setMerchantName(null); | |||
| } | |||
| wxCouponOrderService.exportData(wxCouponOrder, request, response); | |||
| } | |||
| } | |||
| @@ -9,6 +9,8 @@ import lombok.ToString; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Transient; | |||
| import java.math.BigDecimal; | |||
| import java.math.RoundingMode; | |||
| import java.text.DecimalFormat; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @@ -20,7 +22,7 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||
| private static final long serialVersionUID = 6687954932922444531L; | |||
| @Id | |||
| @Excel(name="券码",width = 20) | |||
| @Excel(name = "券码", width = 20, orderNum = "1") | |||
| protected Long id; | |||
| @Override | |||
| @@ -40,31 +42,31 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||
| @io.swagger.annotations.ApiModelProperty(value = "该订单对应券的实际过期时间 ", name = "expiredTime") | |||
| private Date expiredTime; | |||
| @Excel(name="券名称",width = 50) | |||
| @Excel(name = "券名称", width = 50, orderNum = "2") | |||
| @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") | |||
| private String title; | |||
| @Excel(name="用户手机号",width = 20) | |||
| @Excel(name = "会员手机号", width = 20, orderNum = "13") | |||
| @io.swagger.annotations.ApiModelProperty(value="c用户绑定的手机号",name="cUserPhone") | |||
| private String cUserPhone; | |||
| @Excel(name="交易时间",width = 20,exportFormat="yyyy-MM-dd HH:mm:ss") | |||
| @Excel(name = "交易时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate") | |||
| private Date createDate; | |||
| @Transient | |||
| @Excel(name="面额",width = 20) | |||
| @Excel(name = "面额(元)", width = 20, orderNum = "6") | |||
| private String priceStr; | |||
| @Transient | |||
| @Excel(name="交易价格",width = 20) | |||
| @Excel(name = "交易价格(元)", width = 20, orderNum = "5") | |||
| private String salePriceStr; | |||
| @Excel(name="订单状态",width = 20,replace = { "可以退款_0", "已经使用_1","已经过期_2","已经退款_3"}) | |||
| @Excel(name = "状态", width = 20, replace = {"可以退款_0", "已经使用_1", "已经过期_2", "已经退款_3"}, orderNum = "14") | |||
| @io.swagger.annotations.ApiModelProperty(value = "状态:0,待使用 1,已核销 2,已过期 3,已作废 ", name = "couponOrderStatus") | |||
| private Integer couponOrderStatus; | |||
| @Excel(name="核销/过期/退款时间",width = 20,exportFormat="yyyy-MM-dd HH:mm:ss") | |||
| @Excel(name = "核销/过期/退款时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "9") | |||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "updateDate") | |||
| private Date updateDate; | |||
| @@ -81,6 +83,23 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||
| @io.swagger.annotations.ApiModelProperty(value="面额",name="price") | |||
| private Integer price; | |||
| @Excel(name = "所属业态", width = 50, orderNum = "11", replace = {"餐饮_1", "娱乐_2", "服饰_3", "亲子_4", "超市_5", "其它_6", "美妆_7", "珠宝_8", "服务_9", "家居_10"}) | |||
| @io.swagger.annotations.ApiModelProperty(value = "业态", name = "business") | |||
| private Integer business; | |||
| @io.swagger.annotations.ApiModelProperty(value = "补贴额", name = "subsidySum") | |||
| private Integer subsidySum; | |||
| public String getSubsidySumStr() { | |||
| return new BigDecimal(subsidySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).toPlainString(); | |||
| } | |||
| @Excel(name = "补贴额(元)", width = 50, orderNum = "7") | |||
| @io.swagger.annotations.ApiModelProperty(value = "补贴额", name = "subsidySum") | |||
| private String subsidySumStr; | |||
| @io.swagger.annotations.ApiModelProperty(value = "补贴类型", name = "subsidyType") | |||
| private Integer subsidyType; | |||
| @Excel(name="商户管理员(核销人)姓名",width = 50) | |||
| @io.swagger.annotations.ApiModelProperty(value="b端用户姓名",name="bUserName") | |||
| @@ -88,10 +107,14 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||
| @Excel(name="商户管理员手机",width = 20) | |||
| @io.swagger.annotations.ApiModelProperty(value="b端用户手机号",name="bUserPhone") | |||
| private String bUserPhone; | |||
| @Excel(name="使用券商户名",width = 50) | |||
| @Excel(name = "商户名", width = 50, orderNum = "3") | |||
| @io.swagger.annotations.ApiModelProperty(value="使用券商户名",name="merchantName") | |||
| private String merchantName; | |||
| @Excel(name = "商铺号", width = 50, orderNum = "4") | |||
| @Transient | |||
| private String shopNumber; | |||
| /**发券商户信息*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户列表",name="merchantVoList") | |||
| private List<WxMerchantVo> merchantVoList; | |||
| @@ -102,12 +125,30 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||
| @Transient | |||
| private Date endDate; | |||
| @Transient | |||
| private Long merchantId; | |||
| @Transient | |||
| private Date verifyStartDate; | |||
| @Transient | |||
| private Date verifyEndDate; | |||
| @Transient | |||
| private Long couponId; | |||
| @Transient | |||
| private Integer couponType; | |||
| @Override | |||
| @Transient | |||
| private Integer floor; | |||
| @Transient | |||
| private Integer building; | |||
| @Excel(name = "楼层楼座", width = 50, orderNum = "12") | |||
| @Transient | |||
| private String buildingStr; | |||
| @Override | |||
| public Long getCouponId() { | |||
| return couponId; | |||
| } | |||
| @@ -152,9 +152,6 @@ public interface WxCouponOrderService { | |||
| ResultData detailAdminVo(Long couponOrderId); | |||
| void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponOrderBVo wxCouponOrder); | |||
| /** | |||
| * 日期分组 消费总数 | |||
| * @param tenantId | |||
| @@ -190,4 +187,6 @@ public interface WxCouponOrderService { | |||
| ResultData queryCardStatus(WxCouponOrder wxCouponOrder); | |||
| void exportData(WxCouponOrderBVo wxCouponOrder, HttpServletRequest request, HttpServletResponse response); | |||
| } | |||
| @@ -20,7 +20,6 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.PayUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| @@ -272,12 +271,27 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| } | |||
| @Override | |||
| public void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponOrderBVo wxCouponOrder) { | |||
| WxMall wxMall = new WxMall(); | |||
| wxMall.setTenantId(wxCouponOrder.getTenantId()); | |||
| wxMall = wxMallMapper.findList(wxMall).get(0); | |||
| String filename = wxMall.getName() + DateUtils.getSystemTime("yyyyMMDDHHmmss"); | |||
| public void exportData(WxCouponOrderBVo wxCouponOrder, HttpServletRequest request, HttpServletResponse response) { | |||
| String filename = "券订单"; | |||
| List<WxCouponOrderBVo> list = wxCouponOrderMapper.findListOfAdmin(wxCouponOrder); | |||
| list.parallelStream().forEach(c -> { | |||
| if (!c.getMerchantId().equals(0L)) { | |||
| List<WxMerchantVo> merchantVoList = c.getMerchantVoList(); | |||
| if (!merchantVoList.isEmpty()) { | |||
| StringBuffer shopNumber = new StringBuffer(); | |||
| StringBuffer building = new StringBuffer(); | |||
| WxMerchantVo wxMerchantVo = merchantVoList.get(0); | |||
| List<WxShopVo> shopVoList = wxMerchantVo.getShopVoList(); | |||
| for (int j = 0, s_size = shopVoList.size(); j < s_size; j++) { | |||
| WxShopVo wxShopVo = shopVoList.get(j); | |||
| shopNumber.append(wxShopVo.getShopNumber()).append(";"); | |||
| building.append(wxShopVo.getBuildingName()).append(wxShopVo.getFloorName()).append(";"); | |||
| } | |||
| c.setShopNumber(shopNumber.toString()); | |||
| c.setBuildingStr(building.toString()); | |||
| } | |||
| } | |||
| }); | |||
| excelService.exportExcel(list, null, filename, WxCouponOrderBVo.class, filename + ".xlsx", response, false); | |||
| } | |||
| @@ -360,19 +360,24 @@ | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="coupon_price" jdbcType="INTEGER" property="couponPrice" /> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice" /> | |||
| <result column="use_price" jdbcType="INTEGER" property="usePrice" /> | |||
| <result column="price" jdbcType="INTEGER" property="price" /> | |||
| <result column="auto_refund" jdbcType="INTEGER" property="autoRefund" /> | |||
| <result column="business" jdbcType="INTEGER" property="business"/> | |||
| <result column="subsidy_sum" jdbcType="INTEGER" property="subsidySum"/> | |||
| <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/> | |||
| <result column="name" jdbcType="VARCHAR" property="bUserName" /> | |||
| <result column="bphone" jdbcType="VARCHAR" property="bUserPhone" /> | |||
| <result column="phone" jdbcType="VARCHAR" property="cUserPhone" /> | |||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> | |||
| <collection column="{productId=coupon_id}" property="merchantVoList" | |||
| ofType="com.iformall.domain.vo.WxMerchantVo" | |||
| javaType="java.util.List" | |||
| @@ -382,15 +387,18 @@ | |||
| <sql id="allAdminCouponOrderListColumns"> | |||
| co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, | |||
| c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund, | |||
| c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,c.subsidy_sum, | |||
| (case when com.mc=1 then | |||
| (select m.name from wx_merchant m, wx_coupon_merchant cm | |||
| where m.id = cm.merchant_id and cm.product_id=co.coupon_id and cm.status = 0) else '[多商户通用]' end) as merchant_name | |||
| where m.id = cm.merchant_id and cm.product_id=co.coupon_id and cm.status = 0) else '[多商户通用]' end) as merchant_name, | |||
| case when com.mc = 1 then (select m.id from wx_merchant m, | |||
| wx_coupon_merchant cm where m.id = cm.merchant_id and cm.product_id = co.coupon_id | |||
| and cm.status = 0) else 0 end) as merchant_id | |||
| </sql> | |||
| <sql id="allAdminCouponOrderDetailColumns"> | |||
| co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, | |||
| c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund, | |||
| c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,c.subsidy_sum, | |||
| bu.name, bu.phone as bphone, | |||
| cu.phone, | |||
| m.name as merchant_name | |||
| @@ -443,13 +451,37 @@ | |||
| AND co.create_date < #{endDate,jdbcType=TIMESTAMP} | |||
| </if> | |||
| <if test="verifyStartDate != null"> | |||
| AND co.update_date > #{verifyStartDate,jdbcType=TIMESTAMP} | |||
| </if> | |||
| <if test="verifyEndDate != null"> | |||
| AND co.update_date < #{verifyEndDate,jdbcType=TIMESTAMP} | |||
| </if> | |||
| <if test=" null != id "> | |||
| and co.id = #{id} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and c.id = #{couponId} | |||
| </if> | |||
| <if test=" null != business "> | |||
| and c.business = #{business} | |||
| </if> | |||
| <if test="null!=building"> | |||
| and co.coupon_id in( | |||
| select cm.product_id from wx_merchant_shop ms left join wx_merchant m on ms.merchant_id=m.id | |||
| left join wx_shop s on ms.shop_id=s.id | |||
| left join wx_coupon_merchant cm on ms.merchant_id=cm.merchant_id | |||
| where ms.is_del=0 and s.building=#{building} | |||
| <if test=" null != tenantId "> | |||
| and ms.tenant_id=#{tenant_id} | |||
| </if> | |||
| <if test="null!=floor"> | |||
| and s.floor=#{floor} | |||
| </if> | |||
| ) | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <if test=" null == sortColumns"> order by id desc </if> | |||