Quellcode durchsuchen

[卡券投放][修改]:标记是否成功

release_toaliyun_real
masterspirit vor 7 Jahren
Ursprung
Commit
489154fdd2
3 geänderte Dateien mit 22 neuen und 10 gelöschten Zeilen
  1. +1
    -2
      mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java
  2. +2
    -1
      mallinkService/src/main/java/com/simple/service/WxCouponChannelService.java
  3. +19
    -7
      mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java

+ 1
- 2
mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java Datei anzeigen

@@ -76,8 +76,7 @@ public class WxCouponChannelController extends BaseController
String[] ids = wxCouponChannelDto.getCouponIds().split(","); String[] ids = wxCouponChannelDto.getCouponIds().split(",");
String[] channelId = wxCouponChannelDto.getChannelId().split(","); String[] channelId = wxCouponChannelDto.getChannelId().split(",");
MallUserInfo user = getUser(); MallUserInfo user = getUser();
wxCouponChannelService.addBatch(ids,channelId,user.getTenantId(),wxCouponChannelDto.getBeginTime(),wxCouponChannelDto.getEndTime());
return new ResultData();
return wxCouponChannelService.addBatch(ids,channelId,user.getTenantId(),wxCouponChannelDto.getBeginTime(),wxCouponChannelDto.getEndTime());
} }




+ 2
- 1
mallinkService/src/main/java/com/simple/service/WxCouponChannelService.java Datei anzeigen

@@ -1,6 +1,7 @@
package com.simple.service; package com.simple.service;


import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.simple.common.ResultData;
import com.simple.domain.po.WxCouponChannel; import com.simple.domain.po.WxCouponChannel;
import com.simple.domain.vo.WxCouponChannelVo; import com.simple.domain.vo.WxCouponChannelVo;


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


void addBatch(String[] ids, String[] channelId, String tanantId, Date beginTime,Date endTime);
ResultData addBatch(String[] ids, String[] channelId, String tanantId, Date beginTime, Date endTime);


void updateStatusByCouponId(Long couponId,String tenantId,int status); void updateStatusByCouponId(Long couponId,String tenantId,int status);


+ 19
- 7
mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java Datei anzeigen

@@ -5,6 +5,8 @@ import java.util.stream.Collectors;


import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.simple.common.Result;
import com.simple.common.ResultData;
import com.simple.domain.po.WxCoupon; import com.simple.domain.po.WxCoupon;
import com.simple.domain.po.WxCouponChannel; import com.simple.domain.po.WxCouponChannel;
import com.simple.domain.vo.WxCouponChannelVo; import com.simple.domain.vo.WxCouponChannelVo;
@@ -62,14 +64,23 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
} }


@Override @Override
public void addBatch(String[] ids,String[] channelId,String tanantId,Date beginTime,Date endTime) {
public ResultData addBatch(String[] ids, String[] channelId, String tanantId, Date beginTime, Date endTime) {
boolean result = false;
for (String targetIdstr:channelId) { for (String targetIdstr:channelId) {
Integer targetId = Integer.parseInt(targetIdstr); Integer targetId = Integer.parseInt(targetIdstr);
for (String couponidstr:ids) { for (String couponidstr:ids) {
Long couponid = Long.parseLong(couponidstr); Long couponid = Long.parseLong(couponidstr);
addCuponChannel(couponid,targetId,tanantId,beginTime,endTime);
boolean addResult = addCuponChannel(couponid,targetId,tanantId,beginTime,endTime);
if(addResult){
result = true;
}
} }
} }
if(result) {
return new ResultData();
}else {
return new ResultData(Result.ERROR,"请确认券状态,及有效期");
}




} }
@@ -82,8 +93,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
wxCouponChannel.setCouponId(couponId); wxCouponChannel.setCouponId(couponId);
} }


@Transactional
public void addCuponChannel(Long couponid,Integer channelId,String tanantId,Date beginTime,Date endTime){
public boolean addCuponChannel(Long couponid,Integer channelId,String tanantId,Date beginTime,Date endTime){


WxCouponChannel wxCouponChannelQuery = new WxCouponChannel(); WxCouponChannel wxCouponChannelQuery = new WxCouponChannel();
wxCouponChannelQuery.setTenantId(tanantId); wxCouponChannelQuery.setTenantId(tanantId);
@@ -93,18 +104,18 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
List<WxCouponChannel> wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery); List<WxCouponChannel> wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery);
if(wxCouponChannels.size()>0){ if(wxCouponChannels.size()>0){
logger.debug(couponid+"已经投放过了"); logger.debug(couponid+"已经投放过了");
return;
return false;
} }


WxCoupon wxCoupon = wxCouponService.getById(couponid); WxCoupon wxCoupon = wxCouponService.getById(couponid);
if(wxCoupon.getStatus()!=0) { if(wxCoupon.getStatus()!=0) {
logger.debug(wxCoupon.getId()+"状态不对"); logger.debug(wxCoupon.getId()+"状态不对");
return;
return false;
} }


if(wxCoupon.getValidEndDate().before(endTime)){ if(wxCoupon.getValidEndDate().before(endTime)){
logger.debug(wxCoupon.getId()+"发放时间不能晚于使用时间"); logger.debug(wxCoupon.getId()+"发放时间不能晚于使用时间");
return;
return false;
} }
WxCouponChannel wxCouponChannel = new WxCouponChannel(); WxCouponChannel wxCouponChannel = new WxCouponChannel();
wxCouponChannel.setEndTime(endTime); wxCouponChannel.setEndTime(endTime);
@@ -119,6 +130,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
wxCouponChannel.setBusiness(wxCoupon.getBusiness()); wxCouponChannel.setBusiness(wxCoupon.getBusiness());
wxCouponChannel.setTitle(wxCoupon.getTitle()); wxCouponChannel.setTitle(wxCoupon.getTitle());
saveOrUpdate(wxCouponChannel); saveOrUpdate(wxCouponChannel);
return true;
} }


/** /**


Laden…
Abbrechen
Speichern