zhengfangyuan 3 лет назад
Родитель
Сommit
1f627f1313
5 измененных файлов: 56 добавлений и 3 удалений
  1. +3
    -1
      mallinkAdmin/src/main/resources/db/migration/V2022111500001__plat_coupon.sql
  2. +15
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java
  3. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMallMapper.java
  4. +34
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  5. +3
    -0
      mallinkService/src/main/resources/mapper/WxCouponMallMapper.xml

+ 3
- 1
mallinkAdmin/src/main/resources/db/migration/V2022111500001__plat_coupon.sql Просмотреть файл

@@ -110,4 +110,6 @@ create table wx_coupon_mall_95 like wx_coupon_mall;
create table wx_coupon_mall_96 like wx_coupon_mall;
create table wx_coupon_mall_97 like wx_coupon_mall;
create table wx_coupon_mall_98 like wx_coupon_mall;
create table wx_coupon_mall_99 like wx_coupon_mall;
create table wx_coupon_mall_99 like wx_coupon_mall;

drop table wx_coupon_mall;

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

@@ -394,6 +394,9 @@ public class WxCoupon extends TenantEntity {
@TableField(exist = false)
private Long[] merchantIds;
@TableField(exist = false)
private String[] mallTenantIds;

public String getSalePriceStr() {
if(salePrice!=null) {
@@ -496,6 +499,7 @@ public class WxCoupon extends TenantEntity {
return valid_date;
}
//是不是必须要有商户
public boolean checkCreateWithMerchants() {
if(type == null) {
return true;
@@ -505,5 +509,16 @@ public class WxCoupon extends TenantEntity {
}
return true;
}
//是不是必须要有商场
public boolean checkCreateWithMalls() {
if(type == null) {
return false;
}
if(type == EnumCouponType.COUPON_DOUYIN_PLAT.getCode()) {
return true;
}
return false;
}
}

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

@@ -14,4 +14,5 @@ public interface WxCouponMallMapper extends CommonMapper<WxCouponMall, Long> {

List<WxCouponMall> findList(WxCouponMall wxCouponMall);
void updateStatus(WxCouponMall wxCouponMall);
void delteAllByProductId(WxCouponMall wxCouponMall);
}

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

@@ -147,6 +147,9 @@ public class WxCouponServiceImpl implements WxCouponService {

@Autowired
PayServiceFactory payServiceFactory;
@Autowired
WxCouponMallMapper wxCouponMallMapper;

@Override
public ResultData list(TenantEntity tenantEntity,WxCoupon wxCoupon, Integer pageNum, Integer pageSize) {
@@ -520,9 +523,12 @@ public class WxCouponServiceImpl implements WxCouponService {
return new ResultData(Result.ERROR,e.getMessage());
}
merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class);
}else if (record.checkCreateWithMalls()) {
String[] mallTenantIds = record.getMallTenantIds();
if (null == mallTenantIds || mallTenantIds.length <= 0 ) {
return new ResultData(Result.ERROR,"请选择商场");
}
}

final IdWorker idWorker = IdWorker.get();
if (record.getId() == null) {
@@ -541,6 +547,17 @@ public class WxCouponServiceImpl implements WxCouponService {
cm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode());
wxCouponMerchantMapper.insert(cm);
});
}else if (record.checkCreateWithMalls()) {
for (String mt : record.getMallTenantIds()) {
WxCouponMall mall = new WxCouponMall();
mall.updateTenantInfo(record);
mall.setMallTenantId(mt);
mall.setProductId(record.getId());
mall.setCreateDate(new Date());
mall.setUpdateDate(new Date());
mall.setStatus(EnumCouponMallStatus.UNFINISED.getCode());
wxCouponMallMapper.insert(mall);
}
}

if (record.getPasswordSupport() != null && record.getPasswordSupport().equals(EnumCouponPasswordSupport.SUPPORTED.getCode())) {
@@ -571,6 +588,21 @@ public class WxCouponServiceImpl implements WxCouponService {
}
if (record.checkCreateWithMerchants()) {
updateCouponMerchants(record,merchantParamList,idWorker);
}else if (record.checkCreateWithMalls()) {
WxCouponMall couponMall = new WxCouponMall();
couponMall.updateTenantInfo(record);
couponMall.setProductId(record.getId());
wxCouponMallMapper.delteAllByProductId(couponMall);
for (String mt : record.getMallTenantIds()) {
WxCouponMall mall = new WxCouponMall();
mall.updateTenantInfo(record);
mall.setMallTenantId(mt);
mall.setProductId(record.getId());
mall.setCreateDate(new Date());
mall.setUpdateDate(new Date());
mall.setStatus(EnumCouponMallStatus.UNFINISED.getCode());
wxCouponMallMapper.insert(mall);
}
}

record.setUpdateDate(new Date());


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

@@ -82,4 +82,7 @@
and `tenant_id` = #{tenantId} and `mall_tenant_id` = #{mallTenantId}
</update>
<update id = "delteAllByProductId" parameterType="com.iformall.domain.po.WxCouponMall">
delete from wx_coupon_mall where `product_id` = #{productId} and `tenant_id` = #{tenantId}
</update>
</mapper>

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