diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java index 00f917af1..e9ec98fc9 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java @@ -21,9 +21,8 @@ import org.apache.commons.lang3.ArrayUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.*; @@ -56,7 +55,7 @@ public class WxCouponSendController extends BaseController { } wxCouponSend.setTenantId(getTenantId()); wxCouponSend.setMerchantId(getUser().getMerchantId()); - if (Objects.nonNull(wxCouponSend.getExpired()) && Objects.equals(wxCouponSend.getStatus(), 0)) { + if (Objects.nonNull(wxCouponSend.getExpired()) && Objects.equals(wxCouponSend.getExpired(), 0)) { wxCouponSend.setMerchantLnventory(0); } wxCouponSend.setStatus(wxCouponSend.getStatus()); @@ -71,9 +70,9 @@ public class WxCouponSendController extends BaseController { } @ApiOperation("商户注券") - @GetMapping("/handSel") + @PostMapping("/handSel") @ApiImplicitParams({ - @ApiImplicitParam(name = "wxCouponSendIds", value = "wxCouponSendIds", dataType = "string", paramType = "query", required = true), + @ApiImplicitParam(name = "wxCouponSendIds", value = "CouponSend ID数组", dataType = "string[]",allowMultiple=true, paramType = "query", required = true), @ApiImplicitParam(name = "cUserId", value = "用户ID", dataType = "long", paramType = "query", required = true), }) public ResultData handSel(String[] wxCouponSendIds, Long cUserId) { @@ -82,7 +81,7 @@ public class WxCouponSendController extends BaseController { if (Objects.isNull(cu)) { throw new MallinkException(ErrorCode.USER_IS_EMPTY); } - if (ArrayUtils.isEmpty(wxCouponSendIds) || Objects.isNull(cUserId)) { + if (ArrayUtils.isEmpty(wxCouponSendIds)) { throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); } @@ -98,7 +97,7 @@ public class WxCouponSendController extends BaseController { @ApiOperation("注券记录") @GetMapping("/actionLog") @ApiImplicitParams({ - @ApiImplicitParam(name = "channelType", value = "开始日期 yyyy-MM-dd", dataType = "int", paramType = "query", required = true), + @ApiImplicitParam(name = "channelType", value = "注券类型,商户注券=7", dataType = "int", paramType = "query", required = true), @ApiImplicitParam(name = "beginDate", value = "开始日期 yyyy-MM-dd", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "endDate", value = "结束日期 yyyy-MM-dd", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), @@ -106,17 +105,22 @@ public class WxCouponSendController extends BaseController { }) public ResultData sendLog(Integer channelType, String beginDate, String endDate, Integer pageNum, Integer pageSize) { logger.debug("[" + getIpAddr() + "] WxCouponSendController::actionLog"); - Date begin = DateUtils.stringToDate(beginDate); - Date end = DateUtils.stringToDate(endDate); - Calendar cal = Calendar.getInstance(); - cal.setTime(end); - cal.add(Calendar.DATE, 1); Map params = new HashMap<>(); + if (Objects.nonNull(beginDate)) { + Date begin = DateUtils.stringToDate(beginDate); + params.put("beginDate", begin); + } + + if (Objects.nonNull(endDate)) { + Date end = DateUtils.stringToDate(endDate); + Calendar cal = Calendar.getInstance(); + cal.setTime(end); + cal.add(Calendar.DATE, 1); + params.put("endDate", cal.getTime()); + } params.put("tenantId", getTenantId()); params.put("channelType", channelType); params.put("merchantId", getUser().getMerchantId()); - params.put("beginDate", begin); - params.put("endDate", cal.getTime()); PageInfo data = wxCouponActionLogService.getActionLog(params, pageNum, pageSize); return new ResultData(data); } diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java index e5494d883..9386d1df4 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java @@ -326,9 +326,8 @@ public class CouponSendSchedule { WxCouponSendConfig queryConfig = new WxCouponSendConfig(); queryConfig.setSendType(sendType); List couponSendConfigList = couponSendConfigMapper.findList(queryConfig); - Map mallConfigMap = CollectionUtils.isNotEmpty(couponSendConfigList) ? + return CollectionUtils.isNotEmpty(couponSendConfigList) ? couponSendConfigList.stream().collect(Collectors.toMap(WxCouponSendConfig::getTenantId, WxCouponSendConfig::getValue)) : null; - return mallConfigMap; } private boolean isCouponSendDisable(Map mallConfigMap, WxMall mall) { diff --git a/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml index 93dd8ed2c..b80c584d4 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml @@ -87,7 +87,7 @@ and cs.conditions -> '$.merchantLnventory'> #{merchantLnventory} - and id in + and cs.id in #{idItem} @@ -112,10 +112,10 @@ where 1=1 - and + and = now() ]]> - and now() ]]> + and