Просмотр исходного кода

[bug][修改][1001682]

release_toaliyun_real
luozukai 7 лет назад
Родитель
Сommit
5925476dd7
4 измененных файлов: 68 добавлений и 8 удалений
  1. +44
    -4
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java
  2. +4
    -0
      mallinkService/src/main/java/com/iformall/domain/dto/MarkingCouponDataReportDto.java
  3. +6
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelAddVo.java
  4. +14
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java

+ 44
- 4
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java Просмотреть файл

@@ -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查询接口")


+ 4
- 0
mallinkService/src/main/java/com/iformall/domain/dto/MarkingCouponDataReportDto.java Просмотреть файл

@@ -37,6 +37,10 @@ public class MarkingCouponDataReportDto extends BaseEntity {
@Transient
private Integer uv;

@Transient
@SortColumn(column = "xTime")
private String xtime;

@Override
public String getSortColumns() {
super.setSortColumns(this.sortColumns);


+ 6
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelAddVo.java Просмотреть файл

@@ -3,6 +3,7 @@ package com.iformall.domain.vo;
import com.iformall.domain.po.WxCoupon;
import lombok.Data;

import java.beans.Transient;
import java.io.Serializable;
import java.util.Date;

@@ -19,6 +20,10 @@ public class WxCouponChannelAddVo implements Serializable {
private Date validEndDate;
private String errorMsg;

private boolean suc = false;
private Long id;
private Integer type;

public WxCouponChannelAddVo toCouponChannnelVo(WxCoupon wxCoupon, Integer channelId){
if ( wxCoupon != null ) {
this.couponId = wxCoupon.getId();
@@ -29,4 +34,5 @@ public class WxCouponChannelAddVo implements Serializable {
this.channelId = channelId;
return this;
}

}

+ 14
- 4
mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java Просмотреть файл

@@ -43,6 +43,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
WxScreenAdService wxScreenAdService;
@Autowired
WxOrderService wxOrderService;

/**
* B端业务端
* @param record
@@ -67,6 +68,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId());
wxCouponChannelMapper.insertSelective(record);
return new ResultData(record);
} else {
if (record.getCouponId() != null && record.getStatus() != null) {
WxCouponChannel orignal = getById(record.getId());
@@ -115,20 +117,24 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
public ResultData addBatch(String[] ids, String[] channelId, String tanantId, Date beginTime, Date endTime) {

List<WxCouponChannelAddVo> errorList = new ArrayList<>();
List<WxCouponChannelAddVo> sucList = new ArrayList<>();

for (String targetIdstr:channelId) {
Integer targetId = Integer.parseInt(targetIdstr);
for (String couponidstr:ids) {
Long couponid = Long.parseLong(couponidstr);
WxCouponChannelAddVo vo = addCouponChannel(couponid,targetId,tanantId,beginTime,endTime);
if(vo != null){
if(!vo.isSuc()){
errorList.add(vo);
}else{
sucList.add(vo);
}
}
}
if(errorList.size()>0) {
return new ResultData(errorList);
}else {
return new ResultData();
return new ResultData(sucList);
}
}

@@ -224,8 +230,12 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
wxCouponChannel.setBusiness(wxCoupon.getBusiness());
wxCouponChannel.setSubBusiness(wxCoupon.getSubBusiness());
wxCouponChannel.setTitle(wxCoupon.getTitle());
saveOrUpdate(wxCouponChannel);
return null;
ResultData resultData = saveOrUpdate(wxCouponChannel);
WxCouponChannel channel = (WxCouponChannel)resultData.data;
vo.setId(channel.getId());
vo.setType(channel.getType());
vo.setSuc(true);
return vo;
}

/**


Загрузка…
Отмена
Сохранить