Browse Source

支持批量投放多个频道

release_toaliyun_real
masterspirit 7 years ago
parent
commit
d00bb905cf
4 changed files with 18 additions and 14 deletions
  1. +2
    -1
      mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java
  2. +3
    -3
      mallinkService/src/main/java/com/simple/domain/dto/WxCouponChannelDto.java
  3. +1
    -1
      mallinkService/src/main/java/com/simple/service/WxCouponChannelService.java
  4. +12
    -9
      mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java

+ 2
- 1
mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java View File

@@ -75,9 +75,10 @@ public class WxCouponChannelController extends BaseController
@PostMapping("/addbatch")
public ResultData findById(@RequestBody WxCouponChannelDto wxCouponChannelDto) {
String[] ids = wxCouponChannelDto.getCouponIds().split(",");
String[] channelId = wxCouponChannelDto.getChannelId().split(",");
List<WxCouponChannel> list = new ArrayList<>();
MallUserInfo user = getUser();
wxCouponChannelService.addBatch(ids,wxCouponChannelDto.getChannelId(),user.getTenantId());
wxCouponChannelService.addBatch(ids,channelId,user.getTenantId());
return new ResultData();
}



+ 3
- 3
mallinkService/src/main/java/com/simple/domain/dto/WxCouponChannelDto.java View File

@@ -7,15 +7,15 @@ public class WxCouponChannelDto implements Serializable {
private static final long serialVersionUID = 1L;
private Long couponId;
private String couponIds;
private Integer channelId;
private String channelId;



public Integer getChannelId() {
public String getChannelId() {
return channelId;
}

public void setChannelId(Integer channelId) {
public void setChannelId(String channelId) {
this.channelId = channelId;
}



+ 1
- 1
mallinkService/src/main/java/com/simple/service/WxCouponChannelService.java View File

@@ -38,7 +38,7 @@ public interface WxCouponChannelService {
*/
void deleteById(Long id);

void addBatch(String[] ids,Integer channelId,String tanantId);
void addBatch(String[] ids,String[] channelId,String tanantId);


+ 12
- 9
mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java View File

@@ -11,6 +11,7 @@ import com.simple.service.WxCouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.simple.common.IdWorker;
import org.springframework.transaction.annotation.Transactional;

@Service
public class WxCouponChannelServiceImpl implements WxCouponChannelService {
@@ -49,29 +50,31 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
}

@Override
public void addBatch(String[] ids,Integer channelId,String tanantId) {
for (String couponidstr:ids) {
Long couponid = Long.parseLong(couponidstr);
addCuponChannel(couponid,channelId,tanantId);
@Transactional
public void addBatch(String[] ids,String[] channelId,String tanantId) {

for (String targetIdstr:channelId) {
Integer targetId = Integer.parseInt(targetIdstr);
for (String couponidstr:ids) {
Long couponid = Long.parseLong(couponidstr);
addCuponChannel(couponid,targetId,tanantId);
}
}

}

private void addCuponChannel(Long couponid,Integer channelId,String tanantId){
}

public void addCuponChannel(Long couponid,Integer channelId,String tanantId){
WxCoupon wxCouponUP = new WxCoupon();
wxCouponUP.setId(couponid);
wxCouponUP.setStatus(1);
wxCouponService.saveOrUpdate(wxCouponUP);

WxCouponChannel wxCouponChannel = new WxCouponChannel();
wxCouponChannel.setCouponId(couponid);
wxCouponChannel.setCouponStatus(1);
wxCouponChannel.setTargetAd(channelId);
wxCouponChannel.setTenantId(tanantId);
saveOrUpdate(wxCouponChannel);


}




Loading…
Cancel
Save