Procházet zdrojové kódy

tt

release_toaliyun_real
xhxu před 5 roky
rodič
revize
84b7a41c1f
5 změnil soubory, kde provedl 127 přidání a 3 odebrání
  1. +3
    -0
      mallinkService/src/main/java/com/iformall/service/WxMerchantService.java
  2. +21
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  3. +2
    -0
      mallinkService/src/main/java/com/iformall/service/tt/impl/TtCouponServiceImpl.java
  4. +2
    -2
      mallinkTTCApi/src/main/java/com/iformall/controller/TtCouponController.java
  5. +99
    -0
      mallinkTTCApi/src/main/java/com/iformall/controller/WxMerchantController.java

+ 3
- 0
mallinkService/src/main/java/com/iformall/service/WxMerchantService.java Zobrazit soubor

@@ -13,6 +13,7 @@ import com.iformall.domain.vo.WxMerchantTradeVo;
import com.iformall.domain.vo.WxMerchantVo;
import com.iformall.enums.EnumPayWay;

import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.ModelAttribute;

import javax.servlet.http.HttpServletRequest;
@@ -160,4 +161,6 @@ public interface WxMerchantService {
List<Long> getMerchantShopIds(Long merchantId);

@Async
void collectCoupon(TenantEntity tenantInfo, Long memberId, Long id);
}

+ 21
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java Zobrazit soubor

@@ -12,13 +12,13 @@ import com.iformall.domain.dto.WxMerchantDto;
import com.iformall.domain.po.*;
import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.tt.TtUserFollow;
import com.iformall.domain.vo.*;
import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.*;
import com.iformall.service.*;
import com.iformall.utils.DateUtils;
import com.iformall.utils.EventUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@@ -102,6 +102,9 @@ public class WxMerchantServiceImpl implements WxMerchantService {
@Autowired
WxPropertyContractService wxPropertyContractService;

@Autowired
TtUserFollowMapper ttUserFollowMapper;

@Override
public PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) {
PageHelper.startPage(pageIndex, pageSize);
@@ -940,4 +943,21 @@ public class WxMerchantServiceImpl implements WxMerchantService {
public List<Long> getMerchantShopIds(Long merchantId) {
return wxMerchantShopMapper.findShopIds(merchantId);
}

@Override
public void collectCoupon(TenantEntity tenantEntity, Long memberId, Long id) {
final IdWorker idWorker = IdWorker.get();
TtUserFollow userFollow = new TtUserFollow();
userFollow.setId(idWorker.nextId());
userFollow.updateTenantInfo(tenantEntity);
userFollow.setUserId(memberId);
userFollow.setMerchernId(id);
userFollow.setCreateDate(new Date());
userFollow.setUpdateDate(new Date());
try {
ttUserFollowMapper.insert(userFollow);
} catch (Exception e) {
// e.printStackTrace();
}
}
}

+ 2
- 0
mallinkService/src/main/java/com/iformall/service/tt/impl/TtCouponServiceImpl.java Zobrazit soubor

@@ -173,6 +173,7 @@ public class TtCouponServiceImpl implements TtCouponService {
}

@Override
// @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public void collectCoupon(TenantEntity tenantEntity,Long memberId, Long id) {
final IdWorker idWorker = IdWorker.get();
TtUserCollect userCollect = new TtUserCollect();
@@ -187,6 +188,7 @@ public class TtCouponServiceImpl implements TtCouponService {
} catch (Exception e) {
// e.printStackTrace();
}
ttCouponMapper.addCollectCount(id);
}

@Override


+ 2
- 2
mallinkTTCApi/src/main/java/com/iformall/controller/TtCouponController.java Zobrazit soubor

@@ -16,7 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("ttCoupon")
@RequestMapping("api/ttCoupon")
@Api(description = "")
public class TtCouponController extends BaseController {

@@ -52,7 +52,7 @@ public class TtCouponController extends BaseController {
@GetMapping("/collectCoupon")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
public ResultData collectCoupon(@RequestParam Long id) {
logger.debug("[" + getIpAddr() + "] TtCouponController::findById");
logger.debug("[" + getIpAddr() + "] TtCouponController::collectCoupon");
if (id == null) {
return new ResultData(ResultData.ERROR, "缺少id");
}


+ 99
- 0
mallinkTTCApi/src/main/java/com/iformall/controller/WxMerchantController.java Zobrazit soubor

@@ -0,0 +1,99 @@
package com.iformall.controller;

import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.dto.WxMerchantDto;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxMerchantVo;
import com.iformall.enums.EnumMerchantPublic;
import com.iformall.enums.EnumMerchantStatus;
import com.iformall.exception.MallinkException;
import com.iformall.service.WxMerchantService;
import com.iformall.utils.HashUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
* @author Stormeye
*/
@RestController
@RequestMapping("/api/merchant")
public class WxMerchantController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private WxMerchantService wxMerchantService;

@ApiOperation("分页列表接口")
@GetMapping("list")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData list(@ModelAttribute WxMerchantDto wxMerchantDto, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxMerchantController::list");
if (null == wxMerchantDto) wxMerchantDto = new WxMerchantDto();
wxMerchantDto.updateTenantInfo(getTenantInfo());
wxMerchantDto.setMerchantStatus(EnumMerchantStatus.VALID.getCode());
wxMerchantDto.setIsPublic(EnumMerchantPublic.PUBLIC.getCode());
return new ResultData(wxMerchantService.listAsPageCVo(wxMerchantDto, pageNum, pageSize));
}

@ApiOperation("根据code查询接口")
@GetMapping("/findByCode")
@ApiImplicitParam(name = "merchantCode", value = "merchantCode", dataType = "String", paramType = "query", required = true)
public ResultData findByCode(String merchantCode) {
logger.debug("[" + getIpAddr() + "] WxMerchantController::findByCode");
if(merchantCode == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
String codeMD5 = HashUtil.DecodeByMD5(merchantCode);
if(StringUtils.isBlank(codeMD5)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
HashMap<String, String> params = new HashMap<String, String>();
TenantEntity tenantEntity = getTenantInfo();
params.put("tenantId", tenantEntity.getTenantId());
if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) {
params.put("parentTenantId", tenantEntity.getParentTenantId());
}
params.put("merchantCode", codeMD5);
WxMerchantVo wxMerchant = wxMerchantService.getMerchantInfo(params);
return new ResultData(wxMerchant);
}



@ApiOperation("关注")
@GetMapping("/collectCoupon")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
public ResultData collectCoupon(@RequestParam Long id) {
logger.debug("[" + getIpAddr() + "] WxMerchantController::collectCoupon");
if (id == null) {
return new ResultData(ResultData.ERROR, "缺少id");
}
WxMerchant byId = wxMerchantService.getById(id);
if(byId == null){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"找不到数据");
}
Long memberId;
try {
memberId = getMemberId();
} catch (MallinkException e) {
return new ResultData(e.getErrorCode(), e.getMessage());
}

wxMerchantService.collectCoupon(getTenantInfo(),memberId,byId.getId());
return new ResultData();
}

}

Načítá se…
Zrušit
Uložit