Bladeren bron

[业态][修改]:卡券,传递子业态

release_toaliyun_real
hupeng 7 jaren geleden
bovenliggende
commit
9e653216d5
6 gewijzigde bestanden met toevoegingen van 42 en 22 verwijderingen
  1. +0
    -7
      mallinkCApi/src/main/java/com/iformall/controller/WxBusinessController.java
  2. +9
    -0
      mallinkService/src/main/java/com/iformall/domain/dto/WxCouponMerchantDto.java
  3. +1
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java
  4. +1
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java
  5. +30
    -15
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  6. +1
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java

+ 0
- 7
mallinkCApi/src/main/java/com/iformall/controller/WxBusinessController.java Bestand weergeven

@@ -40,13 +40,6 @@ public class WxBusinessController extends BaseController {
return new ResultData(page); return new ResultData(page);
} }


//临时兼容的代码,过度更改接口名
@ApiOperation("业态全列表接口")
@GetMapping("allist")
public ResultData allist(@ModelAttribute WxBusiness wxBusiness) {
final List<WxBusiness> busList = wxBusinessService.findListAll();
return new ResultData(busList);
}


@ApiOperation("业态全列表接口") @ApiOperation("业态全列表接口")
@GetMapping("listAll") @GetMapping("listAll")


+ 9
- 0
mallinkService/src/main/java/com/iformall/domain/dto/WxCouponMerchantDto.java Bestand weergeven

@@ -9,6 +9,7 @@ public class WxCouponMerchantDto implements Serializable {
Long merchantId; Long merchantId;
String parameter; String parameter;
Integer business; Integer business;
Integer subBusiness;


public Long getMerchantId() { public Long getMerchantId() {
return merchantId; return merchantId;
@@ -33,4 +34,12 @@ public class WxCouponMerchantDto implements Serializable {
public void setBusiness(Integer business) { public void setBusiness(Integer business) {
this.business = business; this.business = business;
} }

public Integer getSubBusiness() {
return subBusiness;
}

public void setSubBusiness(Integer subBusiness) {
this.subBusiness = subBusiness;
}
} }

+ 1
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java Bestand weergeven

@@ -210,6 +210,7 @@ public class WxCampaignServiceImpl implements WxCampaignService {
wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode());
wxCouponChannel.setTenantId(wxCoupon.getTenantId()); wxCouponChannel.setTenantId(wxCoupon.getTenantId());
wxCouponChannel.setBusiness(wxCoupon.getBusiness()); wxCouponChannel.setBusiness(wxCoupon.getBusiness());
wxCouponChannel.setSubBusiness(wxCoupon.getSubBusiness());
wxCouponChannel.setTitle(wxCoupon.getTitle()); wxCouponChannel.setTitle(wxCoupon.getTitle());
wxCouponChannel.setSubTargetId(record.getId()); wxCouponChannel.setSubTargetId(record.getId());
final IdWorker idWorker = IdWorker.get(); final IdWorker idWorker = IdWorker.get();


+ 1
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java Bestand weergeven

@@ -214,6 +214,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
wxCouponChannel.setTargetAd(channelId); wxCouponChannel.setTargetAd(channelId);
wxCouponChannel.setTenantId(tanantId); wxCouponChannel.setTenantId(tanantId);
wxCouponChannel.setBusiness(wxCoupon.getBusiness()); wxCouponChannel.setBusiness(wxCoupon.getBusiness());
wxCouponChannel.setSubBusiness(wxCoupon.getSubBusiness());
wxCouponChannel.setTitle(wxCoupon.getTitle()); wxCouponChannel.setTitle(wxCoupon.getTitle());
saveOrUpdate(wxCouponChannel); saveOrUpdate(wxCouponChannel);
return null; return null;


+ 30
- 15
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java Bestand weergeven

@@ -156,7 +156,15 @@ public class WxCouponServiceImpl implements WxCouponService {
return merchantParam.getString("parameter"); return merchantParam.getString("parameter");
} }
private Integer parseBusiness(JSONObject merchantParam){ private Integer parseBusiness(JSONObject merchantParam){
return Integer.valueOf(merchantParam.getString("businessId"));
String businessIdStr = merchantParam.getString("businessId");
return Integer.valueOf(businessIdStr);

}
private Integer parseSubBusiness(JSONObject merchantParam){
String subBusinessIdStr = merchantParam.getString("subBusinessId");
if (subBusinessIdStr != null)
return Integer.valueOf(subBusinessIdStr);
return null;
} }


private WxCouponMerchantDto parseMerchantParam(JSONObject merchantParam){ private WxCouponMerchantDto parseMerchantParam(JSONObject merchantParam){
@@ -165,6 +173,7 @@ public class WxCouponServiceImpl implements WxCouponService {
wxCouponMerchantDto.setMerchantId(parseMerchantId(merchantParam)); wxCouponMerchantDto.setMerchantId(parseMerchantId(merchantParam));
wxCouponMerchantDto.setParameter(parseParameter(merchantParam)); wxCouponMerchantDto.setParameter(parseParameter(merchantParam));
wxCouponMerchantDto.setBusiness(parseBusiness(merchantParam)); wxCouponMerchantDto.setBusiness(parseBusiness(merchantParam));
wxCouponMerchantDto.setSubBusiness(parseSubBusiness(merchantParam));
}catch (Exception e) { }catch (Exception e) {
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR); throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR);
} }
@@ -204,7 +213,7 @@ public class WxCouponServiceImpl implements WxCouponService {
} }


final IdWorker idWorker = IdWorker.get(); final IdWorker idWorker = IdWorker.get();
List<JSONObject> merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class);
if (record.getId() == null) { if (record.getId() == null) {


// check 卡券补贴设置 // check 卡券补贴设置
@@ -232,9 +241,9 @@ public class WxCouponServiceImpl implements WxCouponService {
} }


record.setId(idWorker.nextId()); record.setId(idWorker.nextId());
List<JSONObject> merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class);
if (merchantParamList != null) {
List<Integer> businessList= new ArrayList<>();
if (merchantParamList != null && merchantParamList.size() > 0) {
List<WxCouponMerchantDto> wxCouponMerchantDtoList = new ArrayList<>();
merchantParamList.forEach(merchantParam -> { merchantParamList.forEach(merchantParam -> {
WxCouponMerchant cm = new WxCouponMerchant(); WxCouponMerchant cm = new WxCouponMerchant();
WxCouponMerchantDto wxCouponMerchantDto = parseMerchantParam(merchantParam); WxCouponMerchantDto wxCouponMerchantDto = parseMerchantParam(merchantParam);
@@ -245,13 +254,17 @@ public class WxCouponServiceImpl implements WxCouponService {
cm.setCreateDate(new Date()); cm.setCreateDate(new Date());
cm.setUpdateDate(new Date()); cm.setUpdateDate(new Date());
cm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); cm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode());
businessList.add(wxCouponMerchantDto.getBusiness());
wxCouponMerchantDtoList.add(wxCouponMerchantDto);
wxCouponMerchantMapper.insertSelective(cm); wxCouponMerchantMapper.insertSelective(cm);
}); });
if (businessList.stream().distinct().count() > 1) {
if (wxCouponMerchantDtoList.stream()
.mapToInt(WxCouponMerchantDto::getBusiness).distinct().count() > 1) {
record.setBusiness(EnumBusiness.BUSINESS_ID6.getCode()); record.setBusiness(EnumBusiness.BUSINESS_ID6.getCode());
} else if (wxCouponMerchantDtoList.size() > 1){
record.setBusiness(wxCouponMerchantDtoList.get(0).getBusiness());
} else { } else {
record.setBusiness(businessList.get(0));
record.setBusiness(wxCouponMerchantDtoList.get(0).getBusiness());
record.setSubBusiness(wxCouponMerchantDtoList.get(0).getSubBusiness());
} }


} else{ } else{
@@ -263,13 +276,11 @@ public class WxCouponServiceImpl implements WxCouponService {
wxCouponMapper.insertSelective(record); wxCouponMapper.insertSelective(record);


} else { } else {
if (record.getMerchantParams() != null) {
List<JSONObject> merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class);

if (merchantParamList != null && merchantParamList.size() > 0) {
WxCouponMerchant cmParam = new WxCouponMerchant(); WxCouponMerchant cmParam = new WxCouponMerchant();
cmParam.setProductId(record.getId()); cmParam.setProductId(record.getId());
List<WxCouponMerchant> oldList = wxCouponMerchantMapper.findList(cmParam); List<WxCouponMerchant> oldList = wxCouponMerchantMapper.findList(cmParam);
List<Integer> businessList= new ArrayList<>();
List<WxCouponMerchantDto> wxCouponMerchantDtoList = new ArrayList<>();
merchantParamList.stream().forEach(merchantParam -> { merchantParamList.stream().forEach(merchantParam -> {
WxCouponMerchant cm = new WxCouponMerchant(); WxCouponMerchant cm = new WxCouponMerchant();
WxCouponMerchantDto wxCouponMerchantDto = parseMerchantParam(merchantParam); WxCouponMerchantDto wxCouponMerchantDto = parseMerchantParam(merchantParam);
@@ -289,7 +300,7 @@ public class WxCouponServiceImpl implements WxCouponService {
cm.setUpdateDate(new Date()); cm.setUpdateDate(new Date());
wxCouponMerchantMapper.insertSelective(cm); wxCouponMerchantMapper.insertSelective(cm);
} }
businessList.add(Integer.valueOf(wxCouponMerchantDto.getBusiness()));
wxCouponMerchantDtoList.add(wxCouponMerchantDto);
oldList.removeIf( oldList.removeIf(
old->old.getProductId().equals(record.getId()) && old->old.getProductId().equals(record.getId()) &&
old.getMerchantId().equals(wxCouponMerchantDto.getMerchantId())); old.getMerchantId().equals(wxCouponMerchantDto.getMerchantId()));
@@ -301,10 +312,14 @@ public class WxCouponServiceImpl implements WxCouponService {
wxCouponMerchantMapper.updateByPrimaryKeySelective(old); wxCouponMerchantMapper.updateByPrimaryKeySelective(old);
}); });


if (businessList.stream().distinct().count() > 1) {
if (wxCouponMerchantDtoList.stream()
.mapToInt(WxCouponMerchantDto::getBusiness).distinct().count() > 1) {
record.setBusiness(EnumBusiness.BUSINESS_ID6.getCode()); record.setBusiness(EnumBusiness.BUSINESS_ID6.getCode());
} else if (wxCouponMerchantDtoList.size() > 1){
record.setBusiness(wxCouponMerchantDtoList.get(0).getBusiness());
} else { } else {
record.setBusiness(businessList.get(0));
record.setBusiness(wxCouponMerchantDtoList.get(0).getBusiness());
record.setSubBusiness(wxCouponMerchantDtoList.get(0).getSubBusiness());
} }
} }




+ 1
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java Bestand weergeven

@@ -285,6 +285,7 @@ public class WxGameServiceImpl implements WxGameService {
wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_GAME.getCode()); wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_GAME.getCode());
wxCouponChannel.setTenantId(wxCoupon.getTenantId()); wxCouponChannel.setTenantId(wxCoupon.getTenantId());
wxCouponChannel.setBusiness(wxCoupon.getBusiness()); wxCouponChannel.setBusiness(wxCoupon.getBusiness());
wxCouponChannel.setSubBusiness(wxCoupon.getSubBusiness());
wxCouponChannel.setTitle(wxCoupon.getTitle()); wxCouponChannel.setTitle(wxCoupon.getTitle());
wxCouponChannel.setSubTargetId(record.getId()); wxCouponChannel.setSubTargetId(record.getId());
final IdWorker idWorker = IdWorker.get(); final IdWorker idWorker = IdWorker.get();


Laden…
Annuleren
Opslaan