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

[卡券修改][修改]:状态查询问题

release_toaliyun_real
masterspirit 7 лет назад
Родитель
Сommit
5dc97ef9fe
13 измененных файлов: 79 добавлений и 10 удалений
  1. +1
    -10
      mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java
  2. +8
    -0
      mallinkAdmin/src/main/java/com/simple/controller/WxCouponSendController.java
  3. +2
    -0
      mallinkService/src/main/java/com/simple/mapper/WxCouponChannelMapper.java
  4. +2
    -0
      mallinkService/src/main/java/com/simple/mapper/WxCouponSendMapper.java
  5. +2
    -0
      mallinkService/src/main/java/com/simple/service/WxCouponChannelService.java
  6. +2
    -0
      mallinkService/src/main/java/com/simple/service/WxCouponSendService.java
  7. +3
    -0
      mallinkService/src/main/java/com/simple/service/WxCouponService.java
  8. +4
    -0
      mallinkService/src/main/java/com/simple/service/impl/CouponInjectServiceImpl.java
  9. +8
    -0
      mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java
  10. +9
    -0
      mallinkService/src/main/java/com/simple/service/impl/WxCouponSendServiceImpl.java
  11. +29
    -0
      mallinkService/src/main/java/com/simple/service/impl/WxCouponServiceImpl.java
  12. +5
    -0
      mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml
  13. +4
    -0
      mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml

+ 1
- 10
mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java Просмотреть файл

@@ -133,20 +133,11 @@ public class WxCouponController extends BaseController
if(wxCoupon.getId()==null) {
return new ResultData(ResultData.ERROR,"缺少id");
}
if(wxCoupon.getStatus()!=null){
if(wxCoupon.getStatus()==3){ //已作废
WxCoupon temp = wxCouponService.getById(wxCoupon.getId());
if(temp.getStatus()==1){
return new ResultData(Result.ERROR,"生效的卡券,不能修改");
}
}
}
if(StringUtils.isNotBlank(wxCoupon.getBusiness())) {
String[] arys = wxCoupon.getBusiness().split(",");
wxCoupon.setBusiness(JSON.toJSONString(arys));
}
Long id = wxCouponService.saveOrUpdate(wxCoupon);
return new ResultData(id);
return wxCouponService.updateCoupon(wxCoupon);
}

@ApiOperation("根据id删除接口")


+ 8
- 0
mallinkAdmin/src/main/java/com/simple/controller/WxCouponSendController.java Просмотреть файл

@@ -46,11 +46,19 @@ public class WxCouponSendController extends BaseController
@ApiOperation("新增接口")
@PostMapping("add")
public ResultData add(@RequestBody WxCouponSend wxCouponSend) {
if (null == wxCouponSend){
return new ResultData(Result.ERROR,"参数不对");
}
wxCouponSend.setTenantId(getTenantId());
wxCouponSend.setStatus(0);
List<WxCouponSend> wxCouponSendList = wxCouponSendService.listAsPage(wxCouponSend,1,1).getList();
if(wxCouponSendList!=null&&!wxCouponSendList.isEmpty()){
return new ResultData(Result.ERROR,"已经添加过该券");
}
WxCoupon wxCoupon = wxCouponService.getById(wxCouponSend.getCouponId());
if(wxCoupon.getStatus()!=0||wxCoupon.getSendType()!=2){
return new ResultData(Result.ERROR,"该券的状态有问题");
}

wxCouponSend.setMerchantId(wxCoupon.getMerchantId());
wxCouponSend.setType(wxCoupon.getType());


+ 2
- 0
mallinkService/src/main/java/com/simple/mapper/WxCouponChannelMapper.java Просмотреть файл

@@ -11,6 +11,8 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str
List<WxCouponChannel> findList(WxCouponChannel wxCouponChannel);

List<WxCouponChannelVo> findVoList(WxCouponChannel wxCouponChannel);

void updateStatusByCouponId(WxCouponChannel wxCouponChannel);



+ 2
- 0
mallinkService/src/main/java/com/simple/mapper/WxCouponSendMapper.java Просмотреть файл

@@ -8,6 +8,8 @@ import com.simple.domain.po.WxCouponSend;
public interface WxCouponSendMapper extends CommonMapper<WxCouponSend, String> {

List<WxCouponSend> findList(WxCouponSend wxCouponSend);

void updateStatusByCouponId(WxCouponSend wxCouponSend);



+ 2
- 0
mallinkService/src/main/java/com/simple/service/WxCouponChannelService.java Просмотреть файл

@@ -43,6 +43,8 @@ public interface WxCouponChannelService {
void deleteById(Long id);

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

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


+ 2
- 0
mallinkService/src/main/java/com/simple/service/WxCouponSendService.java Просмотреть файл

@@ -45,6 +45,8 @@ public interface WxCouponSendService {
* @param type 2:停车发券 3:核销发券
*/
void sendCouponToUser(String tenantId,Long cUserId,int type);

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


+ 3
- 0
mallinkService/src/main/java/com/simple/service/WxCouponService.java Просмотреть файл

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

import java.util.*;
import com.github.pagehelper.PageInfo;
import com.simple.common.ResultData;
import com.simple.domain.po.WxCoupon;
import com.simple.domain.po.WxCouponChannel;
import com.simple.domain.vo.WxCouponCVo;
@@ -64,4 +65,6 @@ public interface WxCouponService {

WxCouponCVo selectDetailForCUser(WxCouponChannel record);

ResultData updateCoupon(WxCoupon wxCoupon);

}

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

@@ -72,6 +72,10 @@ public class CouponInjectServiceImpl implements CouponInjectService {
return new ResultData(Result.ERROR,"已过期");
}
}
if(wxCoupon.getStatus()!=0||wxCoupon.getSendType()!=1){
return new ResultData(Result.ERROR,"券状态有问题,不能投放");
}

//解析前台tags,并转换json
String[] arys = record.getTags().split(",");
List<Long> tagids = new ArrayList<>();


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

@@ -74,6 +74,14 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {

}

@Override
public void updateStatusByCouponId(Long couponId, String tenantId, int status) {
WxCouponChannel wxCouponChannel = new WxCouponChannel();
wxCouponChannel.setTenantId(tenantId);
wxCouponChannel.setStatus(status);
wxCouponChannel.setCouponId(couponId);
}

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



+ 9
- 0
mallinkService/src/main/java/com/simple/service/impl/WxCouponSendServiceImpl.java Просмотреть файл

@@ -99,5 +99,14 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {

}

@Override
public void updateStatusByCouponId(Long couponId, String tenantId, int status) {
WxCouponSend wxCouponSend = new WxCouponSend();
wxCouponSend.setTenantId(tenantId);
wxCouponSend.setCouponId(couponId);
wxCouponSend.setStatus(status);
wxCouponSendMapper.updateStatusByCouponId(wxCouponSend);
}


}

+ 29
- 0
mallinkService/src/main/java/com/simple/service/impl/WxCouponServiceImpl.java Просмотреть файл

@@ -3,20 +3,33 @@ package com.simple.service.impl;
import java.util.*;
import com.github.pagehelper.PageHelper;
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.WxCouponChannel;
import com.simple.domain.po.WxCouponSend;
import com.simple.domain.vo.WxCouponCVo;
import com.simple.mapper.WxCouponChannelMapper;
import com.simple.mapper.WxCouponMapper;
import com.simple.service.WxCampaignService;
import com.simple.service.WxCouponChannelService;
import com.simple.service.WxCouponSendService;
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 WxCouponServiceImpl implements WxCouponService {
@Autowired
WxCouponMapper wxCouponMapper;
@Autowired
WxCouponChannelService wxCouponChannelService;

@Autowired
WxCouponSendService wxCouponSendService;


@Override
@@ -67,4 +80,20 @@ public class WxCouponServiceImpl implements WxCouponService {
return wxCouponMapper.selectDetailForCUser(record);
}

@Override
@Transactional
public ResultData updateCoupon(WxCoupon wxCoupon) {
WxCoupon query = wxCouponMapper.selectByPrimaryKey(wxCoupon.getId());
if(wxCoupon.getStatus()!=null){
if(wxCoupon.getStatus()==1){ //已作废
//作废所有投放频道
wxCouponChannelService.updateStatusByCouponId(wxCoupon.getId(),query.getTenantId(),1);
wxCouponSendService.updateStatusByCouponId(query.getId(),query.getTenantId(),1);
}
}
return new ResultData(saveOrUpdate(wxCoupon));

}


}

+ 5
- 0
mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml Просмотреть файл

@@ -121,6 +121,11 @@
<include refid="dynamicWhereConditions" />
</select>

<update id="updateStatusByCouponId" parameterType="com.simple.domain.po.WxCouponChannel">
update wx_coupon_channel set status=#{status} where tenant_id=#{tenantId} and coupon_id=#{couponId}
</update>


<resultMap id="CouponChannelVoMap" type="com.simple.domain.vo.WxCouponChannelVo">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />


+ 4
- 0
mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml Просмотреть файл

@@ -100,6 +100,10 @@
<include refid="dynamicWhereConditions" />
</select>

<update id="updateStatusByCouponId" parameterType="com.simple.domain.po.WxCouponChannel">
update wx_coupon_send set status=#{status} where tenant_id=#{tenantId} and coupon_id=#{couponId}
</update>






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