|
|
|
@@ -5,11 +5,13 @@ import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.controller.base.BaseController; |
|
|
|
import com.iformall.domain.po.WxBusiness; |
|
|
|
import com.iformall.domain.po.WxMerchant; |
|
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
|
import com.iformall.domain.po.tt.TtCoupon; |
|
|
|
import com.iformall.domain.po.tt.TtVideoLibrary; |
|
|
|
import com.iformall.enums.*; |
|
|
|
import com.iformall.service.WxBusinessService; |
|
|
|
import com.iformall.service.WxFlowService; |
|
|
|
import com.iformall.service.WxMerchantService; |
|
|
|
import com.iformall.service.tt.TtCouponService; |
|
|
|
@@ -64,7 +66,7 @@ public class TtCouponController extends BaseController { |
|
|
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) |
|
|
|
@SystemControllerLog(description = "-列表") |
|
|
|
public ResultData list(@ModelAttribute TtCoupon record, Integer pageNum, Integer pageSize, Integer dataType) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxCouponController::list"); |
|
|
|
logger.debug("[" + getIpAddr() + "] TtCouponController::list"); |
|
|
|
if (record == null) record = new TtCoupon(); |
|
|
|
return new ResultData(ttCouponService.listAsPage(record, pageNum, pageSize)); |
|
|
|
} |
|
|
|
@@ -73,7 +75,7 @@ public class TtCouponController extends BaseController { |
|
|
|
@PostMapping("add") |
|
|
|
@SystemControllerLog(description = "-新增") |
|
|
|
public ResultData add(@RequestBody TtCoupon record) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxCouponController::add"); |
|
|
|
logger.debug("[" + getIpAddr() + "] TtCouponController::add"); |
|
|
|
if(record == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); |
|
|
|
} |
|
|
|
@@ -121,12 +123,12 @@ public class TtCouponController extends BaseController { |
|
|
|
} |
|
|
|
|
|
|
|
//启动投放审批 |
|
|
|
if(record.getFlowParams() !=null && record.getFlowParams().size()>0) { |
|
|
|
record.getFlowParams().put("businessId",record.getId()); |
|
|
|
wxFlowService.start(record.getFlowParams(), getUserId(), getUser().getName(), tenantEntity); |
|
|
|
//修改coupon applyStatus状态为审核中 |
|
|
|
record.setStatus(EnumTtCouponStatus.TTCOUPON_STATUS_EXAMINE.getCode()); |
|
|
|
} |
|
|
|
// if(record.getFlowParams() !=null && record.getFlowParams().size()>0) { |
|
|
|
// record.getFlowParams().put("businessId",record.getId()); |
|
|
|
// wxFlowService.start(record.getFlowParams(), getUserId(), getUser().getName(), tenantEntity); |
|
|
|
// //修改coupon applyStatus状态为审核中 |
|
|
|
// record.setStatus(EnumTtCouponStatus.TTCOUPON_STATUS_EXAMINE.getCode()); |
|
|
|
// } |
|
|
|
|
|
|
|
return resultData; |
|
|
|
} |
|
|
|
@@ -135,7 +137,7 @@ public class TtCouponController extends BaseController { |
|
|
|
@PostMapping("update") |
|
|
|
@SystemControllerLog(description = "更新") |
|
|
|
public ResultData update(@RequestBody TtCoupon record) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxCouponController::update"); |
|
|
|
logger.debug("[" + getIpAddr() + "] TtCouponController::update"); |
|
|
|
if (record.getId() == null) { |
|
|
|
return new ResultData(ResultData.ERROR, "缺少id"); |
|
|
|
} |
|
|
|
@@ -191,12 +193,12 @@ public class TtCouponController extends BaseController { |
|
|
|
} |
|
|
|
|
|
|
|
//启动投放审批 |
|
|
|
if(record.getFlowParams() !=null && record.getFlowParams().size()>0) { |
|
|
|
record.getFlowParams().put("businessId",record.getId()); |
|
|
|
wxFlowService.start(record.getFlowParams(), getUserId(), getUser().getName(), tenantEntity); |
|
|
|
//修改coupon applyStatus状态为审核中 |
|
|
|
record.setStatus(EnumTtCouponStatus.TTCOUPON_STATUS_EXAMINE.getCode()); |
|
|
|
} |
|
|
|
// if(record.getFlowParams() !=null && record.getFlowParams().size()>0) { |
|
|
|
// record.getFlowParams().put("businessId",record.getId()); |
|
|
|
// wxFlowService.start(record.getFlowParams(), getUserId(), getUser().getName(), tenantEntity); |
|
|
|
// //修改coupon applyStatus状态为审核中 |
|
|
|
// record.setStatus(EnumTtCouponStatus.TTCOUPON_STATUS_EXAMINE.getCode()); |
|
|
|
// } |
|
|
|
|
|
|
|
return resultData; |
|
|
|
} |
|
|
|
@@ -204,9 +206,12 @@ public class TtCouponController extends BaseController { |
|
|
|
@ApiOperation("根据id删除接口") |
|
|
|
@GetMapping("/del") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
|
@SystemControllerLog(description = "券投放-删除") |
|
|
|
public ResultData delete(Long id) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxCouponController::delete"); |
|
|
|
@SystemControllerLog(description = "-删除") |
|
|
|
public ResultData delete(@RequestParam Long id) { |
|
|
|
logger.debug("[" + getIpAddr() + "] TtCouponController::delete"); |
|
|
|
if (id == null) { |
|
|
|
return new ResultData(ResultData.ERROR, "缺少id"); |
|
|
|
} |
|
|
|
ttCouponService.deleteById(id); |
|
|
|
return new ResultData(Result.SUCCESS, "删除成功", null); |
|
|
|
} |
|
|
|
@@ -214,10 +219,37 @@ public class TtCouponController extends BaseController { |
|
|
|
@ApiOperation("根据id查询接口") |
|
|
|
@GetMapping("/findById") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
|
@SystemControllerLog(description = "券投放-查询") |
|
|
|
@SystemControllerLog(description = "") |
|
|
|
public ResultData findById(@RequestParam Long id) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxCouponController::findById"); |
|
|
|
return new ResultData(ttCouponService.getById(id)); |
|
|
|
logger.debug("[" + getIpAddr() + "] TtCouponController::findById"); |
|
|
|
if (id == null) { |
|
|
|
return new ResultData(ResultData.ERROR, "缺少id"); |
|
|
|
} |
|
|
|
return new ResultData(ttCouponService.detail(id)); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("根据上架") |
|
|
|
@GetMapping("/puton") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
|
@SystemControllerLog(description = "") |
|
|
|
public ResultData puton(@RequestParam Long id) { |
|
|
|
logger.debug("[" + getIpAddr() + "] TtCouponController::findById");if (id == null) { |
|
|
|
return new ResultData(ResultData.ERROR, "缺少id"); |
|
|
|
} |
|
|
|
|
|
|
|
return ttCouponService.puton(id); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("根据下架") |
|
|
|
@GetMapping("/putoff") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
|
@SystemControllerLog(description = "") |
|
|
|
public ResultData putoff(@RequestParam Long id) { |
|
|
|
logger.debug("[" + getIpAddr() + "] TtCouponController::findById"); |
|
|
|
if (id == null) { |
|
|
|
return new ResultData(ResultData.ERROR, "缺少id"); |
|
|
|
} |
|
|
|
return ttCouponService.putoff(id); |
|
|
|
} |
|
|
|
|
|
|
|
} |