Sfoglia il codice sorgente

fix bug

release_toaliyun_real
zhengfangyuan 3 anni fa
parent
commit
1f627f1313
5 ha cambiato i file con 56 aggiunte e 3 eliminazioni
  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 Vedi File

@@ -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_96 like wx_coupon_mall;
create table wx_coupon_mall_97 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_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 Vedi File

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


public String getSalePriceStr() { public String getSalePriceStr() {
if(salePrice!=null) { if(salePrice!=null) {
@@ -496,6 +499,7 @@ public class WxCoupon extends TenantEntity {
return valid_date; return valid_date;
} }
//是不是必须要有商户
public boolean checkCreateWithMerchants() { public boolean checkCreateWithMerchants() {
if(type == null) { if(type == null) {
return true; return true;
@@ -505,5 +509,16 @@ public class WxCoupon extends TenantEntity {
} }
return true; 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 Vedi File

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


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

+ 34
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java Vedi File

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


@Autowired @Autowired
PayServiceFactory payServiceFactory; PayServiceFactory payServiceFactory;
@Autowired
WxCouponMallMapper wxCouponMallMapper;


@Override @Override
public ResultData list(TenantEntity tenantEntity,WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { 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()); return new ResultData(Result.ERROR,e.getMessage());
} }
merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class); 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(); final IdWorker idWorker = IdWorker.get();
if (record.getId() == null) { if (record.getId() == null) {
@@ -541,6 +547,17 @@ public class WxCouponServiceImpl implements WxCouponService {
cm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); cm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode());
wxCouponMerchantMapper.insert(cm); 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())) { if (record.getPasswordSupport() != null && record.getPasswordSupport().equals(EnumCouponPasswordSupport.SUPPORTED.getCode())) {
@@ -571,6 +588,21 @@ public class WxCouponServiceImpl implements WxCouponService {
} }
if (record.checkCreateWithMerchants()) { if (record.checkCreateWithMerchants()) {
updateCouponMerchants(record,merchantParamList,idWorker); 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()); record.setUpdateDate(new Date());


+ 3
- 0
mallinkService/src/main/resources/mapper/WxCouponMallMapper.xml Vedi File

@@ -82,4 +82,7 @@
and `tenant_id` = #{tenantId} and `mall_tenant_id` = #{mallTenantId} and `tenant_id` = #{tenantId} and `mall_tenant_id` = #{mallTenantId}
</update> </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> </mapper>

Caricamento…
Annulla
Salva