Browse Source

Merge branch 'devlocal' into develop

release_toaliyun_real
Burce 6 years ago
parent
commit
5cba45dc6c
3 changed files with 23 additions and 20 deletions
  1. +19
    -15
      mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java
  2. +1
    -2
      mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java
  3. +3
    -3
      mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml

+ 19
- 15
mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java View File

@@ -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<String, Object> 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<WxCouponActionLogVo> data = wxCouponActionLogService.getActionLog(params, pageNum, pageSize);
return new ResultData(data);
}


+ 1
- 2
mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java View File

@@ -326,9 +326,8 @@ public class CouponSendSchedule {
WxCouponSendConfig queryConfig = new WxCouponSendConfig();
queryConfig.setSendType(sendType);
List<WxCouponSendConfig> couponSendConfigList = couponSendConfigMapper.findList(queryConfig);
Map<String, Integer> mallConfigMap = CollectionUtils.isNotEmpty(couponSendConfigList) ?
return CollectionUtils.isNotEmpty(couponSendConfigList) ?
couponSendConfigList.stream().collect(Collectors.toMap(WxCouponSendConfig::getTenantId, WxCouponSendConfig::getValue)) : null;
return mallConfigMap;
}

private boolean isCouponSendDisable(Map<String, Integer> mallConfigMap, WxMall mall) {


+ 3
- 3
mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml View File

@@ -87,7 +87,7 @@
and cs.conditions -> '$.merchantLnventory'> #{merchantLnventory}
</if>
<if test=" null != ids ">
and id in
and cs.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
@@ -112,10 +112,10 @@
where 1=1
<choose>
<when test="expired == 0">
and <![CDATA[ tt.valid_end_date <= now() ]]>
and <![CDATA[ tt.valid_end_date >= now() ]]>
</when>
<when test="expired == 1">
and <![CDATA[ tt.valid_end_date > now() ]]>
and <![CDATA[ tt.valid_end_date < now() ]]>
</when>
<otherwise>
</otherwise>


Loading…
Cancel
Save