Просмотр исходного кода

加上了券订单列表导出优化

release_toaliyun_real
winter 4 лет назад
Родитель
Сommit
b392844af8
26 измененных файлов: 594 добавлений и 183 удалений
  1. +28
    -30
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponOrderController.java
  2. +5
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java
  3. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxMerchantBUser.java
  4. +4
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxMerchantShop.java
  5. +9
    -2
      mallinkService/src/main/java/com/iformall/domain/vo/WxCouponOrderBVo.java
  6. +31
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantProductVo.java
  7. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java
  8. +4
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java
  9. +3
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMerchantMapper.java
  10. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java
  11. +3
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxMerchantBUserMapper.java
  12. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java
  13. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxMerchantShopMapper.java
  14. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java
  15. +2
    -1
      mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java
  16. +6
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java
  17. +333
    -33
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  18. +2
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  19. +13
    -0
      mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
  20. +11
    -0
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml
  21. +39
    -1
      mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml
  22. +37
    -115
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml
  23. +26
    -0
      mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml
  24. +6
    -0
      mallinkService/src/main/resources/mapper/WxMerchantMapper.xml
  25. +16
    -1
      mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml
  26. +6
    -0
      mallinkService/src/main/resources/mapper/WxShopMapper.xml

+ 28
- 30
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponOrderController.java Просмотреть файл

@@ -44,23 +44,22 @@ public class WxCouponOrderController extends BaseController {
@Autowired
private WxAppinfoService wxAppinfoService;

//TODO 待优化数据
// @ApiOperation("分页列表接口")
// @GetMapping("list")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
// @SystemControllerLog(description = "券包-列表")
// public ResultData list(@ModelAttribute WxCouponOrderBVo wxCouponOrder, Integer pageNum, Integer pageSize) {
// logger.debug("[" + getIpAddr() + "] WxCouponOrderController::list");
// if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrderBVo();
// wxCouponOrder.updateTenantInfo(getTenantInfo());
// if (wxCouponOrder.getMerchantName() != null &&
// wxCouponOrder.getMerchantName().isEmpty()) {
// wxCouponOrder.setMerchantName(null);
// }
// return wxCouponOrderService.listAdminAsPage(wxCouponOrder, pageNum, pageSize);
// }
@ApiOperation("分页列表接口")
@GetMapping("list")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
@SystemControllerLog(description = "券包-列表")
public ResultData list(@ModelAttribute WxCouponOrderBVo wxCouponOrder, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxCouponOrderController::list");
if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrderBVo();
wxCouponOrder.updateTenantInfo(getTenantInfo());
if (wxCouponOrder.getMerchantName() != null &&
wxCouponOrder.getMerchantName().isEmpty()) {
wxCouponOrder.setMerchantName(null);
}
return wxCouponOrderService.listAdminAsPage(wxCouponOrder, pageNum, pageSize);
}

@ApiOperation(value = "卡券详情接口")
@GetMapping("detail")
@@ -126,18 +125,17 @@ public class WxCouponOrderController extends BaseController {
return new ResultData(ErrorCode.REFUND_ORDER_ERROR.getCode(), "AppInfo获取失败");
}

//TODO 待优化数据
// @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.updateTenantInfo(getTenantInfo());
// if (wxCouponOrder.getMerchantName() != null &&
// wxCouponOrder.getMerchantName().isEmpty()) {
// wxCouponOrder.setMerchantName(null);
// }
// wxCouponOrderService.exportData(wxCouponOrder, request, response);
// }
@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.updateTenantInfo(getTenantInfo());
if (wxCouponOrder.getMerchantName() != null &&
wxCouponOrder.getMerchantName().isEmpty()) {
wxCouponOrder.setMerchantName(null);
}
wxCouponOrderService.exportData(wxCouponOrder, request, response);
}

}

+ 5
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java Просмотреть файл

@@ -43,6 +43,8 @@ public class WxCouponOrder extends TenantEntity {
private Integer couponOrderStatus;
@io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate")
private Date createDate;
@io.swagger.annotations.ApiModelProperty(value = "创建时间数值,供查询优化用", name = "createDateTimes")
private Long createDateTimes;
@io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate")
private Date updateDate;
@io.swagger.annotations.ApiModelProperty(value = "单券实际购买价格", name = "couponPrice")
@@ -70,6 +72,9 @@ public class WxCouponOrder extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="商品数量",name="couponNumber")
private Integer couponNumber;
@io.swagger.annotations.ApiModelProperty(value="补贴",name="subsidy")
private Integer subsidy;

@TableField(exist = false)
private String couponName;


+ 3
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxMerchantBUser.java Просмотреть файл

@@ -9,6 +9,7 @@ import lombok.EqualsAndHashCode;


import java.util.Date;
import java.util.List;
import java.util.UUID;

@TableName(value = "wx_merchant_b_user")
@@ -24,6 +25,8 @@ public class WxMerchantBUser extends TenantEntity {
private String userPwd;
@io.swagger.annotations.ApiModelProperty(value = "商户id", name = "merchantId")
private Long merchantId;
@TableField(exist = false)
private List<Long> merchantIds;
@io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate")
private Date createDate;
@io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate")


+ 4
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxMerchantShop.java Просмотреть файл

@@ -1,11 +1,13 @@
package com.iformall.domain.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;
import java.util.List;

@TableName(value = "wx_merchant_shop")
@Data
@@ -18,6 +20,8 @@ public class WxMerchantShop extends TenantEntity {
private Long merchantId;
@io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId")
private Long shopId;
@TableField(exist = false)
private List<Long> shopIdList;
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
private Date createDate;
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")


+ 9
- 2
mallinkService/src/main/java/com/iformall/domain/vo/WxCouponOrderBVo.java Просмотреть файл

@@ -55,7 +55,7 @@ public class WxCouponOrderBVo extends WxCouponOrder {
@Excel(name = "会员手机号", width = 20, orderNum = "13")
@io.swagger.annotations.ApiModelProperty(value="c用户绑定的手机号",name="cUserPhone")
private String cUserPhone;
@Excel(name = "微信昵称", width = 20, orderNum = "14")
@io.swagger.annotations.ApiModelProperty(value="微信昵称",name="userNickName")
private String userNickName;
@@ -141,7 +141,8 @@ public class WxCouponOrderBVo extends WxCouponOrder {
@Excel(name = "所属商户", width = 50, orderNum = "3")
@io.swagger.annotations.ApiModelProperty(value="使用券商户名",name="merchantName")
private String merchantName;
@TableField(exist = false)
private List<Long> bUserIdList;

@Excel(name = "发券商户(商户注券)", width = 50, orderNum = "3")
@io.swagger.annotations.ApiModelProperty(value="发券商户(商户注券)",name="sendMerchantName")
@@ -170,9 +171,13 @@ public class WxCouponOrderBVo extends WxCouponOrder {

@TableField(exist = false)
private Date startDate;
@TableField(exist = false)
private Long startDateTimes;

@TableField(exist = false)
private Date endDate;
@TableField(exist = false)
private Long endDateTimes;

@TableField(exist = false)
private Long merchantId;
@@ -192,6 +197,8 @@ public class WxCouponOrderBVo extends WxCouponOrder {

@TableField(exist = false)
private Long couponId;
@TableField(exist = false)
private List<Long> couponIds;

@Excel(name = "类型", width = 50, orderNum = "16", replace = {"满减券_1", "代金券_2", "团购券_3", "礼品券_4", "停车券_5", "通用券_6", "砍价券_8", "团购券_9", "预购商品_10", "可配送商品_11", "券礼包_12", "积分券_50", "积分停车券_51", "消费卡_100"})
@TableField(exist = false)


+ 31
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantProductVo.java Просмотреть файл

@@ -0,0 +1,31 @@
package com.iformall.domain.vo;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.iformall.domain.po.base.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;
import java.util.List;

@JsonIgnoreProperties(value = {"handler"})
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMerchantProductVo extends TenantEntity {

/**
*
*/
private static final long serialVersionUID = -367003237067255221L;


@io.swagger.annotations.ApiModelProperty(value = "券编码", name = "productId")
private Long productId;

@io.swagger.annotations.ApiModelProperty(value = "商户编码", name = "merchantId")
private Long merchantId;
@io.swagger.annotations.ApiModelProperty(value = "商户数", name = "merchantId")
private Integer mc;
}

+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java Просмотреть файл

@@ -22,6 +22,8 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S
List<WxCUserBasicInfo> findList(WxCUserBasicInfo wxCUserBasicInfo);
List<WxCUserBasicInfo> findList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo wxCUserBasicInfo);
List<WxCUserBasicInfo> findListPhoneAndNameByIds(WxCUserBasicInfo wxCUserBasicInfo);
WxCUserBasicInfo selectById(@Param("id")Long id,@Param("finalTenantId")String finalTenantId);

void updateScore(WxCUserBasicInfo record);


+ 4
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java Просмотреть файл

@@ -15,6 +15,10 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
List<WxCouponStatisVo> findCountData(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCoupon")WxCoupon wxCoupon);

List<WxCoupon> findList(WxCoupon wxCoupon);
List<WxCoupon> findTenantSimpleList(WxCoupon wxCoupon);
List<Long> findIdList(WxCoupon wxCoupon);
List<WxCoupon> findCouponList(WxCoupon wxCoupon);

WxCoupon selectById(@Param("id")Long id,@Param("tenantId")String tenantId);


+ 3
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponMerchantMapper.java Просмотреть файл

@@ -3,6 +3,7 @@ package com.iformall.mapper;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxCouponMerchant;
import com.iformall.domain.vo.WxMerchantProductVo;
import com.iformall.domain.vo.WxMerchantVo;

import java.util.List;
@@ -16,4 +17,6 @@ public interface WxCouponMerchantMapper extends CommonMapper<WxCouponMerchant, L
List<WxMerchantVo> findMerchantVoList(@Param("productId")Long productId,@Param("tenantId")String tenantId);
List<WxMerchantVo> findMerchantNameList(@Param("productId")Long productId,@Param("tenantId")String tenantId);
List<WxMerchantVo> findMerchantBaseList(@Param("productId")Long productId,@Param("tenantId")String tenantId);
List<WxMerchantProductVo> findMerchantProduct(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList);
List<Long> findMerchantProductIds(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList);
}

+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java Просмотреть файл

@@ -32,6 +32,7 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> {
int updateVerifyCouponOrderStatus(WxCouponOrder wxCouponOrder);
int updateVerifyCouponOrderStatusForMicroPay(WxCouponOrder wxCouponOrder);
int cancelVerifyCouponOrder(WxCouponOrder wxCouponOrder);
int updateVerifyCouponOrderSubsidy(WxCouponOrder wxCouponOrder);

//统一的计数接口
int findCount(WxCouponOrder wxCouponOrder);


+ 3
- 0
mallinkService/src/main/java/com/iformall/mapper/WxMerchantBUserMapper.java Просмотреть файл

@@ -8,6 +8,9 @@ import com.iformall.domain.vo.WxMerchantBuInfoVo;
public interface WxMerchantBUserMapper extends CommonMapper<WxMerchantBUser, Long> {

List<WxMerchantBUser> findList(WxMerchantBUser wxMerchantBUser);
List<Long> findIdList(WxMerchantBUser wxMerchantBUser);
List<WxMerchantBUser> findMerchantIdListByIds(WxMerchantBUser wxMerchantBUser);

List<WxMerchantBuInfoVo> findSelMerchantList(WxMerchantBUser wxMerchantBUser);



+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java Просмотреть файл

@@ -16,6 +16,7 @@ import java.util.Map;
public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> {

List<WxMerchant> findList(WxMerchant wxMerchant);
List<Long> findIdList(WxMerchant wxMerchant);
List<WxMerchant> findIdNameList(WxMerchant wxMerchant);


+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxMerchantShopMapper.java Просмотреть файл

@@ -11,6 +11,8 @@ public interface WxMerchantShopMapper extends CommonMapper<WxMerchantShop, Strin

List<WxMerchantShop> findList(WxMerchantShop wxMerchantShop);
List<Long> findMerchantIdList(WxMerchantShop wxMerchantShop);
List<Long> findShopIds(@Param("merchantId") Long merchantId);

void delShops(@Param("merchantId") Long merchantId,@Param("shopList") List<Long> shopIds);


+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java Просмотреть файл

@@ -16,6 +16,7 @@ import java.util.Map;
public interface WxShopMapper extends CommonMapper<WxShop, String> {

List<WxShop> findList(WxShop wxShop);
List<Long> findIdList(WxShop wxShop);

List<Map<String,Object>> findListMap(WxShop record);



+ 2
- 1
mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java Просмотреть файл

@@ -44,7 +44,8 @@ public interface WxCUserBasicInfoService {
*/
PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize);
PageInfo<WxCUserBasicInfo> listAsPage(TenantEntity tenantInfo, WxCUserBasicInfo wxCUserBasicInfo, Integer pageIndex, Integer pageSize);

List<WxCUserBasicInfo> listPhoneAndNameByIds(WxCUserBasicInfo record);
/**
* 根据实体查询列表
* @param record


+ 6
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java Просмотреть файл

@@ -591,6 +591,12 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc
return wxCUserBasicInfoMapper.selectCount(new QueryWrapper(record));
}

@Override
public List<WxCUserBasicInfo> listPhoneAndNameByIds(WxCUserBasicInfo record) {
return wxCUserBasicInfoMapper.findListPhoneAndNameByIds(record);
}
@Override
public List<WxCUserBasicInfo> findByPhone(TenantEntity tenantEntity, String phone) {
WxCUserBasicInfo basicQ = new WxCUserBasicInfo();


+ 333
- 33
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java Просмотреть файл

@@ -171,6 +171,12 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
SysConfigService sysConfigService;
@Autowired
WxMerchantBUserService wxMerchantBUserService;
@Autowired
WxShopMapper wxShopMapper;
@Autowired
WxMerchantShopMapper wxMerchantShopMapper;

private final SimpleDateFormat mydateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

@@ -335,9 +341,326 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {

@Override
public ResultData listAdminAsPage(WxCouponOrderBVo wxCouponOrderBVo, Integer pageIndex, Integer pageSize) {
handleWxCouponOrderBVoQueryParam(wxCouponOrderBVo);
PageInfo<WxCouponOrderBVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfAdmin(wxCouponOrderBVo));
if (null != pageInfo && null != pageInfo.getList()){
handleQueryResult(pageInfo.getList(), wxCouponOrderBVo);
}
return new ResultData(pageInfo);
}
private void handleQueryResult(List<WxCouponOrderBVo> list,TenantEntity tenantEntity) {
if (null != list ) {
WxMerchant merchantQ = new WxMerchant();
merchantQ.updateTenantInfo(tenantEntity);
List<WxMerchant> merchantList = wxMerchantMapper.findIdNameList(merchantQ);
Map<Long,String> merchantNameMap = new HashMap<Long,String>();
if (null != merchantList) {
for (int i = 0 ; i < merchantList.size() ; i ++) {
WxMerchant m = merchantList.get(i);
merchantNameMap.put(m.getId(), m.getName());
}
}
WxCoupon couponQ = new WxCoupon();
couponQ.updateTenantInfo(tenantEntity);
List<WxCoupon> couponList = wxCouponMapper.findTenantSimpleList(couponQ);
Map<Long,WxCoupon> couponMap = new HashMap<Long,WxCoupon>();
if (null != couponList) {
for (int i = 0 ; i < couponList.size() ; i ++) {
WxCoupon c = couponList.get(i);
couponMap.put(c.getId(), c);
}
}
List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(tenantEntity.getTenantId(), null);
Map<Long,Long> merchantProductIdMap = new HashMap<Long,Long>();
if (null != merchantProductVos) {
for (int i = 0 ; i < merchantProductVos.size(); i ++) {
WxMerchantProductVo mp = merchantProductVos.get(i);
if (mp.getMc() > 1) {
merchantProductIdMap.put(mp.getProductId(), -999L);
}else {
merchantProductIdMap.put(mp.getProductId(), mp.getMerchantId());
}
}
}
//循环list,获取 cUserId
List<Long> cUserIdList = new ArrayList<Long>();
List<Long> bUserIdList = new ArrayList<Long>();
for (int i = 0 ; i < list.size() ; i ++ ) {
WxCouponOrderBVo bo = list.get(i);
Long cusrid = bo.getcUserId();
if (null != cusrid && (!cUserIdList.contains(cusrid))) {
cUserIdList.add(cusrid);
}
Long busrid = bo.getBUserId();
if (null != busrid && (!bUserIdList.contains(busrid))) {
bUserIdList.add(busrid);
}
}
Map<Long,WxCUserBasicInfo> cUserMap = new HashMap<Long,WxCUserBasicInfo>();
if (cUserIdList.size() > 0) {
WxCUserBasicInfo cUserBasicInfoQ = new WxCUserBasicInfo();
cUserBasicInfoQ.setIds(cUserIdList);
cUserBasicInfoQ.setFinalTenantId(tenantEntity.getFinalTenantId());
List<WxCUserBasicInfo> cuserList = wxCUserBasicInfoService.listPhoneAndNameByIds(cUserBasicInfoQ);
if (null != cuserList) {
for (int i = 0 ; i < cuserList.size() ; i++) {
WxCUserBasicInfo cbi = cuserList.get(i);
cUserMap.put(cbi.getId(), cbi);
}
}
}
Map<Long,Long> buserMerchantIdMap = new HashMap<Long,Long>();
if (bUserIdList.size() > 0 ) {
WxMerchantBUser merchantBUserQ = new WxMerchantBUser();
merchantBUserQ.setIds(bUserIdList);
merchantBUserQ.updateTenantInfo(tenantEntity);
List<WxMerchantBUser> busrlist = wxMerchantBUserMapper.findMerchantIdListByIds(merchantBUserQ);
if (null != busrlist ) {
for (int i = 0 ; i < busrlist.size() ; i ++) {
WxMerchantBUser buser = busrlist.get(i);
buserMerchantIdMap.put(buser.getId(), buser.getMerchantId());
}
}
}

for (int i = 0 ; i < list.size() ; i ++) {
WxCouponOrderBVo co = list.get(i);
if (co.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode())) {
co.setUpdateDate(null);
}
if (null != co.getSendMerchantId()) {
co.setSendMerchantName(merchantNameMap.get(co.getSendMerchantId()));
}
WxCoupon coupon = couponMap.get(co.getCouponId());
if (null != coupon) {
co.setTitle(coupon.getTitle());
co.setSalePrice(coupon.getSalePrice());
co.setUsePrice(coupon.getUsePrice());
co.setPrice(coupon.getPrice());
co.setAutoRefund(coupon.getAutoRefund());
co.setBusiness(coupon.getBusiness());
co.setSubsidyType(coupon.getSubsidyType());
co.setSourceType(coupon.getSourceType());
}
// WxMerchantSubsidy merchantSubsidyQ = new WxMerchantSubsidy();
// merchantSubsidyQ.setCouponOrderId(co.getId());
// merchantSubsidyQ.setCouponType(co.getCouponType());
// merchantSubsidyQ.setType(EnumMerchantSubsidyType.MANUAL.getCode());
// merchantSubsidyQ.updateTenantInfo(co);
// List<WxMerchantSubsidy> msList = wxMerchantSubsidyMapper.selectList(new QueryWrapper<WxMerchantSubsidy>(merchantSubsidyQ));
// if (msList.size() > 0) {
// co.setSubsidyNum(msList.get(0).getSubsidy());
// }
co.setSubsidyNum(co.getSubsidy());
Long merchanId = merchantProductIdMap.get(co.getCouponId());
if (null != merchanId) {
if (merchanId == -999L) {
co.setMerchantName("多商户通用");
co.setMerchantId(0L);
}else {
co.setMerchantName(merchantNameMap.get(merchanId));
co.setMerchantId(merchanId);
}
}
//WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(co.getCUserId(), co.getFinalTenantId());
WxCUserBasicInfo basicInfo = cUserMap.get(co.getCUserId());
if (null != basicInfo) {
co.setcuserPhone(basicInfo.getPhone());
co.setUserNickName(basicInfo.getNickName());
}
//WxMerchantBUser buser = wxMerchantBUserService.getById(co.getBUserId());
Long buserMechantId = buserMerchantIdMap.get(co.getBUserId());
if (null != buserMechantId) {
co.setVerifyMerchantName(merchantNameMap.get(buserMechantId));
}
//co.setChannelType();)
}
}
}
private List<Long> getMerchantIdsQueryParam(WxCouponOrderBVo wxCouponOrder) {
List<Long> retMerchantIdList = new ArrayList<Long>();
boolean isConditiondQquery = false;
//根据名称查询商户
String merchantName = StringUtils.trimToNull(wxCouponOrder.getMerchantName());
if (null != merchantName) {
WxMerchant merchantQ1 = new WxMerchant();
merchantQ1.updateTenantInfo(wxCouponOrder);
merchantQ1.setName(merchantName);
List<Long> merchantIdList = wxMerchantMapper.findIdList(merchantQ1);
if (null == merchantIdList || merchantIdList.size() <= 0) {
//throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"商户名称查询不到商户。");
retMerchantIdList.add(-999L);
return retMerchantIdList;
}
retMerchantIdList.addAll(merchantIdList);
isConditiondQquery = true;
}
//楼层楼座查询商户
if (null != wxCouponOrder.getBuilding() || null != wxCouponOrder.getFloor()) {
WxShop shopQ = new WxShop();
shopQ.updateTenantInfo(wxCouponOrder);
if (null != wxCouponOrder.getBuilding()) {
shopQ.setBuilding(Long.parseLong(String.valueOf(wxCouponOrder.getBuilding())));
}
if (null != wxCouponOrder.getFloor()) {
shopQ.setFloor(Long.parseLong(String.valueOf(wxCouponOrder.getFloor())));
}
List<Long> shopIds = wxShopMapper.findIdList(shopQ);
if (null == shopIds || shopIds.size() <= 0 ){
//throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"楼座楼层提交查询不到店铺信息.");
retMerchantIdList.add(-999L);
return retMerchantIdList;
}
WxMerchantShop wxMerchantShopQ = new WxMerchantShop();
wxMerchantShopQ.updateTenantInfo(wxCouponOrder);
wxMerchantShopQ.setShopIdList(shopIds);
wxMerchantShopQ.setIsDel(0);
List<Long> buildMerchantIdList = wxMerchantShopMapper.findMerchantIdList(wxMerchantShopQ);
if (null == buildMerchantIdList || buildMerchantIdList.size() <= 0 ){
//throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"楼座楼层对应店铺无商户绑定记录.");
retMerchantIdList.add(-999L);
return retMerchantIdList;
}
retMerchantIdList.retainAll(buildMerchantIdList);
isConditiondQquery = true;
}
if (isConditiondQquery) {
if (retMerchantIdList.size() <= 0 ) {
//throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"根据条件交集未查询到商户记录.");
retMerchantIdList.add(-999L);
return retMerchantIdList;
}else {
return retMerchantIdList;
}
}else {
return null;
}
}
private void handleWxCouponOrderBVoQueryParam(WxCouponOrderBVo wxCouponOrder) {
if(null == wxCouponOrder.getStartDate()) {
wxCouponOrder.setStartDate(DateUtils.getFirstDayForCurrMonth());
}
wxCouponOrder.setStartDateTimes(wxCouponOrder.getStartDate().getTime());
wxCouponOrder.setStartDate(null);
if(null == wxCouponOrder.getEndDate()) {
wxCouponOrder.setEndDate(DateUtils.getLastDayForMonth(new Date()));
}
wxCouponOrder.setEndDateTimes(wxCouponOrder.getEndDate().getTime());
wxCouponOrder.setEndDate(null);
String cuserPhone = StringUtils.trimToNull(wxCouponOrder.getcuserPhone());
if (null != cuserPhone) {
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(wxCouponOrder, cuserPhone);
if (null != basicInfo) {
wxCouponOrder.setCUserId(basicInfo.getId());
}else {
//throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"手机号查询不到会员信息。");
wxCouponOrder.setCUserId(-999L);
return;
}
}
List<Long> merchantIdListQueryParam = getMerchantIdsQueryParam(wxCouponOrder);
List<Long> merchantProductIds = null;
if (null != merchantIdListQueryParam) {
//查询商户券
merchantProductIds = wxCouponMerchantMapper.findMerchantProductIds(wxCouponOrder.getTenantId(), merchantIdListQueryParam);
if (null == merchantProductIds || merchantProductIds.size() <= 0) {
//throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"商户下查询不到券信息。");
List<Long> tempCouponIds = new ArrayList<Long>();
tempCouponIds.add(-999L);
wxCouponOrder.setCouponIds(tempCouponIds);
return;
}
}
List<Long> couponIds = null;
String title = StringUtils.trimToNull(wxCouponOrder.getTitle());
if (null != title || null != wxCouponOrder.getType() || null != wxCouponOrder.getBusiness() || null != wxCouponOrder.getSourceType()) {
WxCoupon wxCouponQuery = new WxCoupon();
wxCouponQuery.updateTenantInfo(wxCouponOrder);
wxCouponQuery.setTitle(title);
wxCouponQuery.setType(wxCouponOrder.getType());
wxCouponQuery.setBusiness(wxCouponOrder.getBusiness());
wxCouponQuery.setSourceType(wxCouponOrder.getSourceType());
couponIds = wxCouponMapper.findIdList(wxCouponQuery);
if (null == couponIds || couponIds.size() <= 0) {
//throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"根据券条件搜索不到券信息。");
List<Long> tempCouponIds = new ArrayList<Long>();
tempCouponIds.add(-999L);
wxCouponOrder.setCouponIds(tempCouponIds);
return;
}
}
//merchantProducts 和 couponIds 取交集
if (null != merchantProductIds) {
if (null != couponIds) {
//取交集
merchantProductIds.retainAll(couponIds);
}
wxCouponOrder.setCouponIds(merchantProductIds);
}else {
if (null != couponIds) {
wxCouponOrder.setCouponIds(couponIds);
}
}
//核销商户
String verifyMerchantName = StringUtils.trimToNull(wxCouponOrder.getVerifyMerchantName());
if (null != verifyMerchantName) {
WxMerchant merchantQ2 = new WxMerchant();
merchantQ2.updateTenantInfo(wxCouponOrder);
merchantQ2.setName(verifyMerchantName);
List<Long> merchantIds = wxMerchantMapper.findIdList(merchantQ2);
if (null == merchantIds || merchantIds.size() <= 0 ){
//throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"核销商户名称查询不到商户记录.");
List<Long> tempBUserIds = new ArrayList<Long>();
tempBUserIds.add(-999L);
wxCouponOrder.setBUserIdList(tempBUserIds);
return;
}
WxMerchantBUser merchantBUserQ = new WxMerchantBUser();
merchantBUserQ.setMerchantIds(merchantIds);
List<Long> bUserIdList = wxMerchantBUserMapper.findIdList(merchantBUserQ);
if (null == bUserIdList || bUserIdList.size() <= 0 ){
//throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"核销商户下查询不到员工信息.");
List<Long> tempBUserIds = new ArrayList<Long>();
tempBUserIds.add(-999L);
wxCouponOrder.setBUserIdList(tempBUserIds);
return;
}
wxCouponOrder.setBUserIdList(bUserIdList);
}
}

@Override
public ResultData detailAdminVo(Long couponOrderId,TenantEntity tenantinfo) {
@@ -354,40 +677,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
if(EnumCouponType.COUPON_DISTRIBUTION.getCode().equals(wxCouponOrder.getCouponType())){
filename = "商品订单";
}
WxMerchant merchantQ = new WxMerchant();
merchantQ.updateTenantInfo(wxCouponOrder);
List<WxMerchant> merchantList = wxMerchantMapper.findIdNameList(merchantQ);
Map<Long,String> merchantNameMap = new HashMap<Long,String>();
if (null != merchantList) {
merchantList.parallelStream().forEach(m -> {
merchantNameMap.put(m.getId(), m.getName());
});
}
handleWxCouponOrderBVoQueryParam(wxCouponOrder);
List<WxCouponOrderBVo> list = wxCouponOrderMapper.findListOfAdmin(wxCouponOrder);
list.parallelStream().forEach(c -> {
if (c.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode())) {
c.setUpdateDate(null);
}
if (null != c.getSendMerchantId()) {
c.setSendMerchantName(merchantNameMap.get(c.getSendMerchantId()));
}
// 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());
// }
// }
});
handleQueryResult(list,wxCouponOrder);
excelService.exportCsv(list, null, filename, WxCouponOrderBVo.class, filename + ".csv", response, false);
}

@@ -1027,6 +1319,14 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
logger.error("数据库插入错误:" + e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL);
}
try {
couponOrder.setSubsidy(subsidyNum);
wxCouponOrderMapper.updateVerifyCouponOrderSubsidy(couponOrder);
} catch (Exception e) {
logger.error("数据库插入错误:" + e.getMessage(),e);
throw new MallinkException(ErrorCode.DB_FAIL);
}
}
}



+ 2
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java Просмотреть файл

@@ -1087,6 +1087,7 @@ public class WxOrderServiceImpl implements WxOrderService {
couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.CARD_USING.getCode());
}
couponOrder.setCreateDate(curr);
couponOrder.setCreateDateTimes(curr.getTime());
couponOrder.setUpdateDate(curr);
couponOrder.setCouponPrice(order.getPayment());
wxCouponOrderMapper.insert(couponOrder);
@@ -1193,6 +1194,7 @@ public class WxOrderServiceImpl implements WxOrderService {
couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.CARD_USING.getCode());
}
couponOrder.setCreateDate(curr);
couponOrder.setCreateDateTimes(curr.getTime());
couponOrder.setUpdateDate(curr);
couponOrder.setCouponPrice(order.getPayment());
couponOrder.setComposeOrderType(order.getComposeOrderType());


+ 13
- 0
mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml Просмотреть файл

@@ -252,6 +252,19 @@

</sql>

<select id="findListPhoneAndNameByIds" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap">
select id, phone, nick_name
from wx_c_user_basic_info wcubi
where wcubi.`final_tenant_id` = #{finalTenantId}
<if test=" null != ids ">
and wcubi.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
</select>


<select id="findList1" resultMap="BaseResultMap">
select r.* from (
select


+ 11
- 0
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Просмотреть файл

@@ -313,6 +313,17 @@
select <include refid="allColumns"/> ,c.html from wx_coupon c where id = #{id} and tenant_id = #{tenantId}
</select>
<select id="findTenantSimpleList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select id,title,sale_price,use_price,price,auto_refund,business,subsidy_type,source_type
from wx_coupon where c.`tenant_id` = #{tenantId}
</select>
<select id="findIdList" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
select id
from wx_coupon c
<include refid="dynamicWhereConditions"/>
</select>
<delete id="deleteById" parameterType="java.util.HashMap">
update wx_coupon set is_del = 1 where id = #{id} and tenant_id = #{tenantId}
</delete>


+ 39
- 1
mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml Просмотреть файл

@@ -134,5 +134,43 @@
and cm.product_id = #{productId} and cm.tenant_id = #{tenantId}
</select>


<resultMap id="MerchantProductVoResultMap" type="com.iformall.domain.vo.WxMerchantProductVo">
<result column="product_id" jdbcType="BIGINT" property="productId"/>
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
<result column="mc" jdbcType="INTEGER" property="mc"/>
</resultMap>
<select id = "findMerchantProduct" parameterType="java.util.Map" resultMap="MerchantProductVoResultMap">
SELECT wcm.product_id,wcm.merchant_id,COUNT(1) AS mc
FROM wx_coupon_merchant wcm
WHERE wcm.STATUS = 0
<if test=" null != tenantId and '' != tenantId">
and wcm.`tenant_id` = #{tenantId}
</if>
<if test=" null != merchantIdList">
and wcm.merchant_id in
<foreach collection="merchantIdList" index="index" item="merchantIdItem" open="(" separator="," close=")">
#{merchantIdItem}
</foreach>
</if>
GROUP BY product_id
</select>
<select id = "findMerchantProductIds" parameterType="java.util.Map" resultType="Long">
SELECT distinct wcm.product_id
FROM wx_coupon_merchant wcm
WHERE wcm.STATUS = 0
<if test=" null != tenantId and '' != tenantId">
and wcm.`tenant_id` = #{tenantId}
</if>
<if test=" null != merchantIdList">
and wcm.merchant_id in
<foreach collection="merchantIdList" index="index" item="merchantIdItem" open="(" separator="," close=")">
#{merchantIdItem}
</foreach>
</if>
</select>
</mapper>

+ 37
- 115
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml Просмотреть файл

@@ -15,6 +15,7 @@
<result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" />
<result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="create_date_times" jdbcType="BIGINT" property="createDateTimes" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
<result column="coupon_price" jdbcType="INTEGER" property="couponPrice" />
<result column="auto_refund" jdbcType="INTEGER" property="autoRefund" />
@@ -27,7 +28,7 @@
<result column="compose_order_id" jdbcType="BIGINT" property="composeOrderId" />
<result column="parent_coupon_order_id" jdbcType="BIGINT" property="parentCouponOrderId" />
<result column="coupon_number" jdbcType="BIGINT" property="couponNumber" />
<result column="subsidy" jdbcType="INTEGER" property="subsidy" />
<result column="freight_price" jdbcType="INTEGER" property="freightPrice"/>
<result column="shipping_type" jdbcType="INTEGER" property="shippingType"/>
<result column="shipping_address" jdbcType="VARCHAR" property="shippingAddress"/>
@@ -38,7 +39,7 @@
<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_type`,`c_user_id`,`owner_id`,`b_user_id`,`order_id`,`expired_time`,`coupon_order_status`,`create_date`,`update_date`,`coupon_price`, `auto_refund`,
`verify_type`,`verify_remark`,`pay_vendor`,`send_merchant_id`,`send_merchant_user_id`,`compose_order_type`,`compose_order_id`,`parent_coupon_order_id`,`coupon_number`,
`freight_price`,`shipping_type`,`shipping_address`,`shipping_status`,`delivery_info`
`freight_price`,`shipping_type`,`shipping_address`,`shipping_status`,`delivery_info`,`subsidy`
</sql>

<sql id="dynamicWhereConditions">
@@ -241,6 +242,12 @@
and `parent_tenant_id` = #{parentTenantId}
</if>
</update>
<update id="updateVerifyCouponOrderSubsidy" parameterType="com.iformall.domain.po.WxCouponOrder">
update wx_coupon_order
set `subsidy` = #{subsidy}
where id=#{id}
</update>

<select id="couponDataMap" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap">
SELECT DATE_FORMAT(create_date,'%m/%d') as createTime,
@@ -430,7 +437,7 @@
</select>

<select id="findCount" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer">
select COUNT(*) FROM wx_coupon_order co
select COUNT(1) FROM wx_coupon_order co
<if test=" null != businessId ">
inner join wx_coupon c
on c.id = co.coupon_id
@@ -841,13 +848,12 @@
<result column="pay_vendor" jdbcType="INTEGER" property="payVendor" />
<result column="verify_type" jdbcType="INTEGER" property="verifyType" />
<result column="verify_remark" jdbcType="VARCHAR" property="verifyRemark" />

<result column="freight_price" jdbcType="INTEGER" property="freightPrice"/>
<result column="shipping_type" jdbcType="INTEGER" property="shippingType"/>
<result column="shipping_address" jdbcType="VARCHAR" property="shippingAddress"/>
<result column="shipping_status" jdbcType="INTEGER" property="shippingStatus"/>
<result column="delivery_info" jdbcType="VARCHAR" property="deliveryInfo"/>
<result column="subsidy" jdbcType="INTEGER" property="subsidy"/>
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>

<result column="type" jdbcType="INTEGER" property="type" />
@@ -872,34 +878,6 @@
<result column="send_merchant_id" jdbcType="INTEGER" property="sendMerchantId" />
</resultMap>

<sql id="allAdminCouponOrderListColumns">
<!--
co.id,co.tenant_id,co.parent_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

(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.parent_tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.order_id,
co.create_date,co.update_date,co.coupon_price, co.verify_type, co.verify_remark,co.pay_vendor,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,
c.title,c.sale_price,c.use_price,c.price,
co.send_merchant_id,c.unit,c.auto_refund,c.business,c.subsidy_type,c.source_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,cu.nick_name,m2.name AS verify_merchant_name,cal.channel_type
</sql>

<sql id="allAdminCouponOrderDetailColumns">
co.id,co.tenant_id,co.parent_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,co.verify_type,co.verify_remark, co.pay_vendor,
@@ -911,39 +889,10 @@
</sql>

<select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="AdminBVoResultMap">
select <include refid="allAdminCouponOrderListColumns" />

FROM (
SELECT wcm.product_id,wcm.merchant_id,COUNT(1) AS mc
FROM wx_coupon_merchant wcm
WHERE STATUS = 0
<if test=" null != tenantId and '' != tenantId">
and wcm.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and wcm.`parent_tenant_id` = #{parentTenantId}
</if>
GROUP BY product_id) couc
RIGHT JOIN (
SELECT co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.coupon_type,
co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.auto_refund,co.verify_type,co.verify_remark,co.pay_vendor
,co.send_merchant_id,co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`
FROM wx_coupon_order co WHERE 1=1
<if test=" null != tenantId and '' != tenantId">
and co.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and co.`parent_tenant_id` = #{parentTenantId}
</if>
) co
ON co.coupon_id = couc.product_id
LEFT JOIN wx_c_user_basic_info 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
select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.expired_time,co.coupon_order_status,co.order_id,
co.create_date,co.update_date,co.coupon_price, co.verify_type, co.verify_remark,co.pay_vendor,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.send_merchant_id,co.subsidy
FROM wx_coupon_order co where co.`tenant_id` = #{tenantId}
<choose>
<when test=" null != couponType">
and co.coupon_type = #{couponType}
@@ -956,16 +905,9 @@
and co.coupon_type &lt; 100
</otherwise>
</choose>
<if test=" null != tenantId and '' != tenantId">
and co.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and co.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != cUserPhone and '' != cUserPhone">
and cu.`phone` = #{cUserPhone}
</if>

<if test=" null != couponOrderStatus ">
and co.coupon_order_status = #{couponOrderStatus}
</if>
@@ -978,27 +920,22 @@
and co.`shipping_status` = #{shippingStatus}
</if>
<if test=" null != merchantName and merchantName!=''">

and (case when couc.mc=1
then
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">
AND co.create_date &gt; #{startDate,jdbcType=TIMESTAMP}
</if>
<if test="startDateTimes != null">
AND co.create_date_times &gt; #{startDateTimes}
</if>

<if test="endDate != null">
AND co.create_date &lt; #{endDate,jdbcType=TIMESTAMP}
</if>
<if test="endDateTimes != null">
AND co.create_date_times &lt; #{endDateTimes}
</if>
<if test="verifyStartDate != null">
AND co.update_date &gt; #{verifyStartDate,jdbcType=TIMESTAMP}
</if>
@@ -1016,39 +953,24 @@
<if test=" null != couponId ">
and c.id = #{couponId}
</if>
<if test=" null != title ">
and c.title like concat('%', #{title},'%')
</if>
<if test=" null != type ">
and c.`type` = #{type}
</if>
<if test=" null != business ">
and c.business = #{business}
</if>
<if test=" null != sourceType ">
and c.`source_type` = #{sourceType}
<if test=" null != cUserId and '' != cUserId">
and co.c_user_id = #{cUserId}
</if>
<if test=" null != verifyMerchantName and ''!= verifyMerchantName ">
and bu.verify_merchant_name = #{verifyMerchantName}
<if test=" null != couponIds">
and co.coupon_id in
<foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">
#{couponIdItem}
</foreach>
</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 '' != tenantId">
and ms.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and ms.`parent_tenant_id` = #{parentTenantId}
</if>
<if test="null!=floor">
and s.floor=#{floor}
</if>
)
<if test=" null != bUserIdList">
and co.b_user_id in
<foreach collection="bUserIdList" index="index" item="bUserIdItem" open="(" separator="," close=")">
#{bUserIdItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<if test=" null == sortColumns">order by co.create_date desc,co.id desc</if>


+ 26
- 0
mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml Просмотреть файл

@@ -78,6 +78,14 @@
#{idItem}
</foreach>
</if>
<if test=" null != merchantIds ">
and merchant_id in
<foreach collection="merchantIds" index="index" item="merchantIdItem" open="(" separator="," close=")">
#{merchantIdItem}
</foreach>
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>

</sql>
@@ -88,6 +96,24 @@
from wx_merchant_b_user
<include refid="dynamicWhereConditions"/>
</select>
<select id="findMerchantIdListByIds" parameterType="com.iformall.domain.po.WxMerchantBUser" resultMap="BaseResultMap">
select id, merchant_id
from wx_merchant_b_user
where `tenant_id` = #{tenantId}
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
</select>
<select id="findIdList" parameterType="com.iformall.domain.po.WxMerchantBUser" resultType="Long">
select id
from wx_merchant_b_user
<include refid="dynamicWhereConditions"/>
</select>

<select id="findSelMerchantList" parameterType="com.iformall.domain.po.WxMerchantBUser" resultType="com.iformall.domain.vo.WxMerchantBuInfoVo">
select


+ 6
- 0
mallinkService/src/main/resources/mapper/WxMerchantMapper.xml Просмотреть файл

@@ -207,6 +207,12 @@
from wx_merchant m
<include refid="dynamicWhereConditions"/>
</select>
<select id="findIdList" parameterType="com.iformall.domain.po.WxMerchant" resultType="Long">
select id
from wx_merchant m
<include refid="dynamicWhereConditions"/>
</select>

<select id="findFollowList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
select


+ 16
- 1
mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml Просмотреть файл

@@ -60,7 +60,15 @@
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
</if>
<if test=" null != shopIdList ">
and shop_id in
<foreach collection="shopIdList" index="index" item="shopIdItem" open="(" separator="," close=")">
#{shopIdItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
</sql>
@@ -71,6 +79,13 @@
<include refid="dynamicWhereConditions" />
</select>
<select id="findMerchantIdList" parameterType="com.iformall.domain.po.WxMerchantShop" resultType="Long">
select distinct merchant_id
from wx_merchant_shop
<include refid="dynamicWhereConditions" />
</select>
<select id="findShopIds" parameterType="Long" resultType="Long">
select shop_id from wx_merchant_shop where `merchant_id` = #{merchantId} and is_del = 0
</select>


+ 6
- 0
mallinkService/src/main/resources/mapper/WxShopMapper.xml Просмотреть файл

@@ -146,6 +146,12 @@
<include refid="dynamicWhereConditions"/>
</select>

<select id="findIdList" parameterType="com.iformall.domain.po.WxShop" resultType="Long">
select id
from wx_shop
<include refid="dynamicWhereConditions"/>
</select>

<select id="selectBatchByIds" resultMap="BaseResultMap">
select
s.`id`,s.`tenant_id`,s.`parent_tenant_id`,s.`shop_number`,s.`build_area`,s.`operation_area`,s.building,b.building_name building_name,s.floor,f.floor_name floor_name,s.`status`,s.`x`,s.`y`,s.`sid`,s.`addr`,


Загрузка…
Отмена
Сохранить