| @@ -122,6 +122,7 @@ public class WxCouponSendController extends BaseController { | |||
| wxCouponSend.setUpdateDate(new Date()); | |||
| try { | |||
| wxCouponSend.setOperatorId(getUserId()); | |||
| wxCouponSendService.saveOrUpdate(wxCouponSend); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| @@ -4,16 +4,16 @@ import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import com.iformall.annotation.RedisCache; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.exception.MallinkException; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import me.chanjar.weixin.common.error.WxErrorException; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.concurrent.TimeUnit; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @RestController | |||
| @RequestMapping("/api/live") | |||
| @@ -27,7 +27,7 @@ public class WxLiveController extends BaseController { | |||
| * @return | |||
| */ | |||
| @ApiOperation("获取所有直播间和商品信息") | |||
| @RedisCache(expireTime = 5, dateUnit = TimeUnit.MINUTES) | |||
| @RedisCache(expireTime = 10) | |||
| @GetMapping("/roomList") | |||
| public ResultData getLiveinfos(String appId, Integer start, Integer limit) { | |||
| ResultData resultData = new ResultData(); | |||
| @@ -52,7 +52,7 @@ public class WxLiveController extends BaseController { | |||
| * @return | |||
| */ | |||
| @ApiOperation("获取直播房间回放数据和商品信息") | |||
| @RedisCache(expireTime = 5, dateUnit = TimeUnit.MINUTES) | |||
| @RedisCache(expireTime = 10) | |||
| @GetMapping("/replayList") | |||
| public ResultData getLiveReplay(Integer room_id, Integer start, Integer limit) { | |||
| ResultData resultData = new ResultData(); | |||
| @@ -112,6 +112,14 @@ public class WxCouponSend extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="0:有效 1:无效,全部时不传",name="status") | |||
| private Integer status; | |||
| @JsonIgnore | |||
| @io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId") | |||
| private Long operatorId; | |||
| @io.swagger.annotations.ApiModelProperty(value="操作人",name="operator") | |||
| @TableField(exist = false) | |||
| private String operator; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| @@ -130,7 +130,16 @@ public class WxCouponOrderBVo extends WxCouponOrder { | |||
| @io.swagger.annotations.ApiModelProperty(value="使用券商户名",name="merchantName") | |||
| private String merchantName; | |||
| @Excel(name = "商铺号", width = 50, orderNum = "5") | |||
| // public String getMerchantName() { | |||
| // if(this.getCmCount() != null && this.getCmCount() > 1){ | |||
| // this.merchantName = "[多商户通用]"; | |||
| // } | |||
| // return merchantName; | |||
| // } | |||
| // private Integer cmCount; | |||
| // @Excel(name = "商铺号", width = 50, orderNum = "5") | |||
| @TableField(exist = false) | |||
| private String shopNumber; | |||
| @@ -151,6 +160,13 @@ public class WxCouponOrderBVo extends WxCouponOrder { | |||
| @TableField(exist = false) | |||
| private Long merchantId; | |||
| // public Long getmerchantId(){ | |||
| // if(this.getCmCount() != null && this.getCmCount() > 1){ | |||
| // this.merchantId = Long.valueOf(0); | |||
| // } | |||
| // return merchantId; | |||
| // } | |||
| @TableField(exist = false) | |||
| private Date verifyStartDate; | |||
| @@ -173,7 +189,7 @@ public class WxCouponOrderBVo extends WxCouponOrder { | |||
| @TableField(exist = false) | |||
| private Integer building; | |||
| @Excel(name = "楼层楼座", width = 50, orderNum = "12") | |||
| // @Excel(name = "楼层楼座", width = 50, orderNum = "12") | |||
| @TableField(exist = false) | |||
| private String buildingStr; | |||
| @@ -312,21 +312,21 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| if (c.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode())) { | |||
| c.setUpdateDate(null); | |||
| } | |||
| if (!c.getMerchantId().equals(0L)) { | |||
| List<WxMerchantVo> merchantVoList = c.getMerchantVoList(); | |||
| if (!CollectionUtils.isEmpty(merchantVoList)) { | |||
| StringBuilder shopNumber = new StringBuilder(); | |||
| StringBuilder building = new StringBuilder(); | |||
| WxMerchantVo wxMerchantVo = merchantVoList.get(0); | |||
| List<WxShopVo> shopVoList = wxMerchantVo.getShopVoList(); | |||
| for (WxShopVo wxShopVo : shopVoList) { | |||
| shopNumber.append(wxShopVo.getShopNumber()).append(";"); | |||
| building.append(wxShopVo.getBuildingName()).append(wxShopVo.getFloorName()).append(";"); | |||
| } | |||
| c.setShopNumber(shopNumber.toString()); | |||
| c.setBuildingStr(building.toString()); | |||
| } | |||
| } | |||
| // if (!c.getMerchantId().equals(0L)) { | |||
| // List<WxMerchantVo> merchantVoList = c.getMerchantVoList(); | |||
| // if (!CollectionUtils.isEmpty(merchantVoList)) { | |||
| // StringBuilder shopNumber = new StringBuilder(); | |||
| // StringBuilder building = new StringBuilder(); | |||
| // WxMerchantVo wxMerchantVo = merchantVoList.get(0); | |||
| // List<WxShopVo> shopVoList = wxMerchantVo.getShopVoList(); | |||
| // for (WxShopVo wxShopVo : shopVoList) { | |||
| // shopNumber.append(wxShopVo.getShopNumber()).append(";"); | |||
| // building.append(wxShopVo.getBuildingName()).append(wxShopVo.getFloorName()).append(";"); | |||
| // } | |||
| // c.setShopNumber(shopNumber.toString()); | |||
| // c.setBuildingStr(building.toString()); | |||
| // } | |||
| // } | |||
| }); | |||
| excelService.exportCsv(list, null, filename, WxCouponOrderBVo.class, filename + ".csv", response, false); | |||
| } | |||
| @@ -198,7 +198,8 @@ | |||
| <select id="findVoList" parameterType="com.iformall.domain.vo.WxCardVo" resultMap="VoBaseResultMap"> | |||
| select <include refid="allVoColumns" /> | |||
| from wx_card_info ci | |||
| from (select ci.`id`, ci.`tenant_id`, ci.`coupon_id`, ci.`transaction_id`, ci.`amount`, ci.`sale_amount`, ci.`remaining_amount`, ci.`service_fee_amount`, ci.`share_fee_amount`, ci.`remaining_share_fee_amount`, ci.`rate_amount`, ci.`create_date`, ci.`update_date` from wx_card_info ci where ci.`tenant_id` = #{tenantId}) ci | |||
| <!--from wx_card_info ci --> | |||
| left join wx_coupon c on c.id = ci.coupon_id | |||
| left join wx_coupon_order co on co.id = ci.id | |||
| left join wx_c_user cu on cu.id = co.c_user_id | |||
| @@ -634,14 +634,29 @@ | |||
| </resultMap> | |||
| <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.business,c.subsidy_type,ms.subsidy subsidy_num, | |||
| (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, | |||
| (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,cu.phone,bu.verify_merchant_name,cal.channel_type | |||
| and cm.status = 0) else 0 end) as merchant_id, | |||
| cu.phone,bu.verify_merchant_name,cal.channel_type | |||
| (case when couc.mc = 1 then m1.name else '[多商户通用]' end) as merchant_name, | |||
| (case when couc.mc = 1 then m1.id else 0 end) as merchant_id, | |||
| cu.phone,m2.name as verify_merchant_name,cal.channel_type | |||
| --> | |||
| 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.business,c.subsidy_type,ms.subsidy subsidy_num, | |||
| (CASE WHEN couc.mc = 1 THEN m1.name ELSE '[多商户通用]' END) AS merchant_name, | |||
| (CASE WHEN couc.mc = 1 THEN m1.id ELSE 0 END) AS merchant_id, | |||
| cu.phone,m2.name AS verify_merchant_name,cal.channel_type | |||
| </sql> | |||
| <sql id="allAdminCouponOrderDetailColumns"> | |||
| @@ -654,6 +669,7 @@ | |||
| <select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="AdminBVoResultMap"> | |||
| select <include refid="allAdminCouponOrderListColumns" /> | |||
| <!-- | |||
| from wx_coupon_order co | |||
| inner join wx_coupon c on c.id = co.coupon_id | |||
| inner join (select tco.id as tcoid, | |||
| @@ -669,6 +685,34 @@ | |||
| ) bu on bu.bu_id = co.b_user_id | |||
| left join wx_merchant_subsidy ms on co.id = ms.coupon_order_id and ms.type = 1 | |||
| left join wx_coupon_action_log cal on co.id = cal.coupon_order_id and co.coupon_id = cal.coupon_id | |||
| --> | |||
| <!-- | |||
| from (select wcm.product_id,wcm.merchant_id,count(1) as mc from wx_coupon_merchant wcm where status = 0 and wcm.tenant_id = #{tenantId} group by product_id) couc | |||
| right join (select co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price from wx_coupon_order co where co.tenant_id = #{tenantId}) co on co.coupon_id = couc.product_id | |||
| inner join wx_c_user cu on cu.id=co.c_user_id | |||
| left join wx_coupon c on c.id = co.coupon_id | |||
| left join wx_merchant m1 on m1.id = couc.merchant_id | |||
| left join wx_merchant_subsidy ms on co.id = ms.coupon_order_id and ms.type = 1 | |||
| left join wx_merchant_b_user mbu on mbu.id = co.b_user_id | |||
| left join wx_merchant m2 on m2.id = mbu.merchant_id | |||
| left join wx_coupon_action_log cal on cal.coupon_order_id = co.id and cal.coupon_id = co.coupon_id | |||
| where 1=1--> | |||
| FROM ( | |||
| SELECT wcm.product_id,wcm.merchant_id,COUNT(1) AS mc | |||
| FROM wx_coupon_merchant wcm | |||
| WHERE STATUS = 0 AND wcm.tenant_id = #{tenantId} GROUP BY product_id) couc | |||
| RIGHT JOIN ( | |||
| SELECT co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.coupon_type, | |||
| co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price | |||
| FROM wx_coupon_order co | |||
| WHERE co.tenant_id = #{tenantId}) co | |||
| ON co.coupon_id = couc.product_id | |||
| INNER JOIN wx_c_user cu ON cu.id=co.c_user_id | |||
| LEFT JOIN wx_coupon c ON c.id = co.coupon_id | |||
| LEFT JOIN wx_merchant m1 ON m1.id = couc.merchant_id | |||
| LEFT JOIN wx_merchant_subsidy ms ON co.id = ms.coupon_order_id AND ms.type = 1 | |||
| LEFT JOIN wx_merchant_b_user mbu ON mbu.id = co.b_user_id LEFT JOIN wx_merchant m2 ON m2.id = mbu.merchant_id | |||
| LEFT JOIN wx_coupon_action_log cal ON cal.coupon_order_id = co.id AND cal.coupon_id = co.coupon_id | |||
| where 1=1 | |||
| <choose> | |||
| <when test=" null != couponType"> | |||
| @@ -687,14 +731,16 @@ | |||
| </if> | |||
| <if test=" null != merchantName and merchantName!=''"> | |||
| and (case when com.mc=1 | |||
| and (case when couc.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) | |||
| like concat('%', #{merchantName},'%') | |||
| m1.name | |||
| <!--(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) | |||
| like concat('%', #{merchantName},'%') | |||
| </if> | |||
| <if test="startDate != null"> | |||
| @@ -107,8 +107,10 @@ | |||
| <select id="findListVoByValidType" parameterType="com.iformall.domain.vo.WxCouponSendVo" resultMap="BaseResultMap"> | |||
| select tt.* from (select | |||
| <include refid="allColumns"/> | |||
| , mui.name as operator | |||
| from wx_coupon_send cs | |||
| left join wx_coupon c on c.id = cs.coupon_id | |||
| left join mall_user_info mui on mui.id = cs.operator_id | |||
| <include refid="dynamicWhereConditions"/>) as tt | |||
| where 1=1 | |||
| and ((tt.valid_type=1 | |||