|
|
@@ -6,6 +6,7 @@ import com.iformall.common.Result; |
|
|
import com.iformall.common.ResultData; |
|
|
import com.iformall.common.ResultData; |
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
import com.iformall.domain.po.WxCouponSend; |
|
|
import com.iformall.domain.po.WxCouponSend; |
|
|
|
|
|
import com.iformall.enums.EnumCouponSendStatus; |
|
|
import com.iformall.enums.EnumCouponSendType; |
|
|
import com.iformall.enums.EnumCouponSendType; |
|
|
import com.iformall.enums.EnumCouponStatus; |
|
|
import com.iformall.enums.EnumCouponStatus; |
|
|
import com.iformall.service.WxCouponSendService; |
|
|
import com.iformall.service.WxCouponSendService; |
|
|
@@ -18,6 +19,7 @@ import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
@RestController |
|
|
@RestController |
|
|
@@ -38,6 +40,7 @@ public class WxCouponSendController extends BaseController { |
|
|
public ResultData list(@ModelAttribute WxCouponSend wxCouponSend, Integer pageNum, Integer pageSize) { |
|
|
public ResultData list(@ModelAttribute WxCouponSend wxCouponSend, Integer pageNum, Integer pageSize) { |
|
|
if (null == wxCouponSend) wxCouponSend = new WxCouponSend(); |
|
|
if (null == wxCouponSend) wxCouponSend = new WxCouponSend(); |
|
|
wxCouponSend.setTenantId(getTenantId()); |
|
|
wxCouponSend.setTenantId(getTenantId()); |
|
|
|
|
|
wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode()); |
|
|
final PageInfo<WxCouponSend> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); |
|
|
final PageInfo<WxCouponSend> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); |
|
|
return new ResultData(page); |
|
|
return new ResultData(page); |
|
|
} |
|
|
} |
|
|
@@ -49,7 +52,7 @@ public class WxCouponSendController extends BaseController { |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); |
|
|
} |
|
|
} |
|
|
wxCouponSend.setTenantId(getTenantId()); |
|
|
wxCouponSend.setTenantId(getTenantId()); |
|
|
wxCouponSend.setStatus(0); |
|
|
|
|
|
|
|
|
wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode()); |
|
|
List<WxCouponSend> wxCouponSendList = wxCouponSendService.listAsPage(wxCouponSend, 1, 1).getList(); |
|
|
List<WxCouponSend> wxCouponSendList = wxCouponSendService.listAsPage(wxCouponSend, 1, 1).getList(); |
|
|
if (wxCouponSendList != null && wxCouponSendList.size() > 0) { |
|
|
if (wxCouponSendList != null && wxCouponSendList.size() > 0) { |
|
|
return new ResultData(ErrorCode.COUPON_SEND_IS_EXISTED); |
|
|
return new ResultData(ErrorCode.COUPON_SEND_IS_EXISTED); |
|
|
@@ -68,9 +71,9 @@ public class WxCouponSendController extends BaseController { |
|
|
wxCouponSend.setType(wxCoupon.getType()); |
|
|
wxCouponSend.setType(wxCoupon.getType()); |
|
|
wxCouponSend.setTenantId(wxCoupon.getTenantId()); |
|
|
wxCouponSend.setTenantId(wxCoupon.getTenantId()); |
|
|
wxCouponSend.setTitle(wxCoupon.getTitle()); |
|
|
wxCouponSend.setTitle(wxCoupon.getTitle()); |
|
|
|
|
|
wxCouponSend.setCreateDate(new Date()); |
|
|
|
|
|
wxCouponSend.setUpdateDate(new Date()); |
|
|
|
|
|
|
|
|
//Assert.notNull(wxCouponSend.getName(), "角色名不能为空"); |
|
|
|
|
|
//Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); |
|
|
|
|
|
wxCouponSendService.saveOrUpdate(wxCouponSend); |
|
|
wxCouponSendService.saveOrUpdate(wxCouponSend); |
|
|
return new ResultData(); |
|
|
return new ResultData(); |
|
|
} |
|
|
} |
|
|
@@ -87,8 +90,15 @@ public class WxCouponSendController extends BaseController { |
|
|
@GetMapping("/del") |
|
|
@GetMapping("/del") |
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
public ResultData delete(Long id) { |
|
|
public ResultData delete(Long id) { |
|
|
wxCouponSendService.deleteById(id); |
|
|
|
|
|
return new ResultData(Result.SUCCESS, "删除成功", null); |
|
|
|
|
|
|
|
|
//wxCouponSendService.deleteById(id); |
|
|
|
|
|
//return new ResultData(Result.SUCCESS, "删除成功", null); |
|
|
|
|
|
WxCouponSend wxCouponSend = wxCouponSendService.getById(id); |
|
|
|
|
|
if (wxCouponSend == null) |
|
|
|
|
|
return new ResultData(ErrorCode.COUPON_SEND_IS_INVALID); |
|
|
|
|
|
wxCouponSend.setStatus(EnumCouponSendStatus.INVALID.getCode()); |
|
|
|
|
|
wxCouponSend.setUpdateDate(new Date()); |
|
|
|
|
|
wxCouponSendService.saveOrUpdate(wxCouponSend); |
|
|
|
|
|
return new ResultData(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ApiOperation("根据id查询接口") |
|
|
@ApiOperation("根据id查询接口") |
|
|
|