|
|
|
@@ -5,17 +5,21 @@ import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.annotation.SystemControllerLog; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.controller.app.WxAppinfoController; |
|
|
|
import com.iformall.controller.base.BaseController; |
|
|
|
import com.iformall.domain.dto.WxCouponChannelDto; |
|
|
|
import com.iformall.domain.po.MallUserInfo; |
|
|
|
import com.iformall.domain.po.WxCouponChannel; |
|
|
|
import com.iformall.domain.vo.WxCouponChannelAddVo; |
|
|
|
import com.iformall.domain.vo.WxCouponChannelVo; |
|
|
|
import com.iformall.mapper.WxCouponChannelMapper; |
|
|
|
import com.iformall.service.WxCouponChannelService; |
|
|
|
import com.iformall.service.WxCouponService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@@ -23,6 +27,7 @@ import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
@RestController |
|
|
|
@@ -35,8 +40,9 @@ public class WxCouponChannelController extends BaseController { |
|
|
|
private WxCouponChannelService wxCouponChannelService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxCouponService wxCouponService; |
|
|
|
|
|
|
|
private WxAppinfoController wxAppinfoController; |
|
|
|
@Autowired |
|
|
|
private WxCouponChannelMapper wxCouponChannelMapper; |
|
|
|
|
|
|
|
@ApiOperation("分页列表接口") |
|
|
|
@GetMapping("list") |
|
|
|
@@ -64,7 +70,19 @@ public class WxCouponChannelController extends BaseController { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxCouponChannelController::update"); |
|
|
|
wxCouponChannel.setTenantId(getTenantId()); |
|
|
|
|
|
|
|
return wxCouponChannelService.saveOrUpdate(wxCouponChannel); |
|
|
|
ResultData resultData = wxCouponChannelService.saveOrUpdate(wxCouponChannel); |
|
|
|
WxCouponChannel couponChannel = (WxCouponChannel)resultData.data; |
|
|
|
//生成二维码 |
|
|
|
if(couponChannel!=null){ |
|
|
|
String pageUrl = "pages/index/index"; |
|
|
|
String param = couponChannel.getWeappScene(); |
|
|
|
ResultData resultDataQ = wxAppinfoController.exportQrcode(null,null,couponChannel.getTenantId(),1,pageUrl,param,0,"","","卷",true); |
|
|
|
Map<String,String> map = (Map)resultDataQ.data; |
|
|
|
String url = map.get("url"); |
|
|
|
couponChannel.setQrCode(url); |
|
|
|
wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); |
|
|
|
} |
|
|
|
return resultData; |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("根据id删除接口") |
|
|
|
@@ -93,7 +111,29 @@ public class WxCouponChannelController extends BaseController { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxCouponChannelController::addbatch"); |
|
|
|
String[] ids = wxCouponChannelDto.getCouponIds().split(","); |
|
|
|
String[] channelId = wxCouponChannelDto.getChannelId().split(","); |
|
|
|
return wxCouponChannelService.addBatch(ids, channelId, getTenantId(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime()); |
|
|
|
ResultData resultData = wxCouponChannelService.addBatch(ids, channelId, getTenantId(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime()); |
|
|
|
List<WxCouponChannelAddVo> list = (List<WxCouponChannelAddVo>)resultData.data; |
|
|
|
|
|
|
|
//生成二维码 |
|
|
|
if(CollectionUtils.isNotEmpty(list)){ |
|
|
|
String pageUrl = "pages/index/index"; |
|
|
|
|
|
|
|
for (WxCouponChannelAddVo vo:list) { |
|
|
|
WxCouponChannel couponChannel = new WxCouponChannel(); |
|
|
|
couponChannel.setId(vo.getId()); |
|
|
|
couponChannel.setType(vo.getType()); |
|
|
|
|
|
|
|
String param = couponChannel.getWeappScene(); |
|
|
|
ResultData resultDataQ = wxAppinfoController.exportQrcode(null,null,couponChannel.getTenantId(),1,pageUrl,param,0,"","","卷",true); |
|
|
|
Map<String,String> map = (Map)resultDataQ.data; |
|
|
|
String url = map.get("url"); |
|
|
|
couponChannel.setQrCode(url); |
|
|
|
wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return resultData; |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("根据id查询接口") |
|
|
|
|