Просмотр исходного кода

Merge branch 'release_toaliyun_real_202211' of https://git.malls.iformall.com/server/formallProject into release_toaliyun_real_202211

release_toaliyun_real
lin 3 лет назад
Родитель
Сommit
e32910172c
8 измененных файлов: 91 добавлений и 50 удалений
  1. +2
    -1
      mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java
  2. +10
    -1
      mallinkService/src/main/java/com/iformall/service/WxCouponService.java
  3. +8
    -0
      mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java
  4. +1
    -39
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java
  5. +60
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  6. +2
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  7. +6
    -4
      mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/v1/BaseTtPayAdapterService.java
  8. +2
    -2
      mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/v1/miniApp/TtMiniAppPayAdapterService.java

+ 2
- 1
mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java Просмотреть файл

@@ -140,7 +140,8 @@ public class WxOrderController extends BaseController {
}
return wxOrderService.composeSaveOrder(false,EnumComposeOrder.ONE_NUMBER_ORDER_BATCH,orderSaveDto,memberId,getPayWay(),getTenantInfo(),this.getPayVersion());
}

@TenantIgnore
@ApiOperation(value = "单个券单个订单,卡(分账导致无法批量下单)、拼团,砍价用", notes = "{\"couponChannelId\":\"String\",\"couponId\":\"String\",\"press\":\"String\",\"orderGroupId\":\"String\",\"formId\":\"String\"}")
@PostMapping("save")
public ResultData saveOrder(@RequestBody OrderSaveDto orderSaveDto) {


+ 10
- 1
mallinkService/src/main/java/com/iformall/service/WxCouponService.java Просмотреть файл

@@ -291,5 +291,14 @@ public interface WxCouponService {
void setParentCouponMallMerchants(TenantEntity mallTenantEntity,WxCoupon wxCoupon) throws Exception;
Map<Long,Boolean> couponMerchantAutoShare(TenantEntity tenantEntity,WxCoupon wxCoupon) throws Exception;
Map<Long,Boolean> couponMerchantAutoShare(TenantEntity tenantEntity,WxCoupon wxCoupon) throws Exception;

/**
* 判断门店商户是否可用
* @param couponId
* @param couponType
* @param couponTenantEntity
* @return
*/
boolean isCouponMerchantValid(Long couponId,Integer couponType,TenantEntity couponTenantEntity);
}

+ 8
- 0
mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java Просмотреть файл

@@ -161,6 +161,14 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
@Override
@Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
public ResultData productSave(WxCoupon coupon) throws Exception {
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(coupon.getTenantId(),coupon.getId());
if(ttCouponChannelPoi != null &&
(EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus())
|| EnumSpuSyncStatus.sync_put_on.getCode().equals(ttCouponChannelPoi.getLastStatus())
|| EnumSpuSyncStatus.sync_audit_disable.getCode().equals(ttCouponChannelPoi.getLastStatus()))){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该券状态不允许提交审核");
}

WxCoupon ttattrs = wxCouponService.getAttrsById(coupon.getId(), coupon.getTenantId());
if(ttattrs.getProductType() == null || ttattrs.getCategoryId() == null
|| ttattrs.getProductAttrKeyValueMap().isEmpty()


+ 1
- 39
mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java Просмотреть файл

@@ -596,44 +596,6 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
}
return retList;
}

private boolean isCouponMerchantValid(Long couponId,Integer couponType,TenantEntity couponTenantEntity) {
if (EnumCouponType.isParentCoupon(couponType)) {
WxCouponMall couponMall = new WxCouponMall();
couponMall.updateTenantInfo(couponTenantEntity);
couponMall.setProductId(couponId);
couponMall.setStatus(EnumCouponMallStatus.FINISED.getCode()) ;
List<WxCouponMall> couponMallList = wxCouponMallMapper.findList(couponMall);
if (null == couponMallList ) {
return false;
}
for (int i = 0 ; i < couponMallList.size(); i++) {
WxCouponMall wcm = couponMallList.get(i);
TenantEntity mallTenantEntity = new TenantEntity();
mallTenantEntity.setTenantId(wcm.getMallTenantId());
mallTenantEntity.setParentTenantId(couponTenantEntity.getTenantId());
List<WxMerchantVo> merchantVoList = wxMerchantService.findMerchantListByProduct(mallTenantEntity,couponId,false);
if (null != merchantVoList && merchantVoList.size() > 0 ) {
if (merchantVoList.stream().anyMatch((cm->cm.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())))){
return true;
}
}
}
return false;
}else {
List<WxMerchantVo> merchantVoList = wxMerchantService.findMerchantListByProduct(couponTenantEntity,couponId,false);
if (null == merchantVoList || merchantVoList.size() <=0 ) {
return false;
}
if (merchantVoList.stream().anyMatch((cm->cm.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())))){
return true;
}
}
return false;
}

@Override
public WxCouponChannelAddVo addCouponChannel(Long couponid,Integer channelId, TenantEntity tenantEntity,Date showBeginTime,Date beginTime,Date endTime,Integer channelPrice,Integer channelStock){
@@ -684,7 +646,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
}

if(!EnumCouponType.COUPON_GIFT.getCode().equals(wxCoupon.getType())
&& !isCouponMerchantValid(wxCoupon.getId(),wxCoupon.getType(),wxCoupon)) {
&& !wxCouponService.isCouponMerchantValid(wxCoupon.getId(),wxCoupon.getType(),wxCoupon)) {
logger.debug(wxCoupon.getId()+couponid+ErrorCode.MERCHANT_INFO_NOT_FOUND.getMessage());
vo.toCouponChannnelVo(wxCoupon,channelId);
vo.setErrorMsg(ErrorCode.MERCHANT_INFO_NOT_FOUND.getMessage());


+ 60
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java Просмотреть файл

@@ -147,6 +147,9 @@ public class WxCouponServiceImpl implements WxCouponService {

@Autowired
PayServiceFactory payServiceFactory;

@Autowired
TtCouponChannelPoiMapper ttCouponChannelPoiMapper;
@Autowired
WxCouponMallMapper wxCouponMallMapper;
@@ -590,6 +593,15 @@ public class WxCouponServiceImpl implements WxCouponService {
wxCouponMapper.insert(record);

} else {
if(EnumCouponType.getDouYinType().contains(record.getType())){
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(record.getTenantId(),record.getId());
if(ttCouponChannelPoi != null &&
(EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus())
|| EnumSpuSyncStatus.sync_put_on.getCode().equals(ttCouponChannelPoi.getLastStatus())
|| EnumSpuSyncStatus.sync_audit_disable.getCode().equals(ttCouponChannelPoi.getLastStatus()))){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该券状态不允许修改");
}
}

if(record.getInventory() != null && record.getRemainInventory() != null) {
// 库存修改检查
@@ -908,6 +920,16 @@ public class WxCouponServiceImpl implements WxCouponService {

@Override
public ResultData updateTtProduct(WxCoupon record) {
if(EnumCouponType.getDouYinType().contains(record.getType())){
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(record.getTenantId(),record.getId());
if(ttCouponChannelPoi != null &&
(EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus())
|| EnumSpuSyncStatus.sync_put_on.getCode().equals(ttCouponChannelPoi.getLastStatus())
|| EnumSpuSyncStatus.sync_audit_disable.getCode().equals(ttCouponChannelPoi.getLastStatus()))){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该券状态不允许修改");
}
}
if(StringUtils.isBlank(record.getProductAttrs()) || StringUtils.isBlank(record.getSkuAttrs())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);
}
@@ -1713,6 +1735,43 @@ public class WxCouponServiceImpl implements WxCouponService {
}
}
}

@Override
public boolean isCouponMerchantValid(Long couponId, Integer couponType, TenantEntity couponTenantEntity) {
if (EnumCouponType.isParentCoupon(couponType)) {
WxCouponMall couponMall = new WxCouponMall();
couponMall.updateTenantInfo(couponTenantEntity);
couponMall.setProductId(couponId);
couponMall.setStatus(EnumCouponMallStatus.FINISED.getCode()) ;
List<WxCouponMall> couponMallList = wxCouponMallMapper.findList(couponMall);
if (null == couponMallList ) {
return false;
}
for (int i = 0 ; i < couponMallList.size(); i++) {
WxCouponMall wcm = couponMallList.get(i);
TenantEntity mallTenantEntity = new TenantEntity();
mallTenantEntity.setTenantId(wcm.getMallTenantId());
mallTenantEntity.setParentTenantId(couponTenantEntity.getTenantId());
List<WxMerchantVo> merchantVoList = wxMerchantService.findMerchantListByProduct(mallTenantEntity,couponId,false);
if (null != merchantVoList && merchantVoList.size() > 0 ) {
if (merchantVoList.stream().anyMatch((cm->cm.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())))){
return true;
}
}
}
return false;

}else {
List<WxMerchantVo> merchantVoList = wxMerchantService.findMerchantListByProduct(couponTenantEntity,couponId,false);
if (null == merchantVoList || merchantVoList.size() <=0 ) {
return false;
}
if (merchantVoList.stream().anyMatch((cm->cm.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())))){
return true;
}
}
return false;
}


}

+ 2
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java Просмотреть файл

@@ -3235,8 +3235,8 @@ public class WxOrderServiceImpl implements WxOrderService {
throw new MallinkException(ErrorCode.COUPON_IS_EMPTY.getCode(),premsg+"不存在");
}
if (EnumCouponType.mustHasMerchant(coupon.getType())) {
// 检查券商户信息
if (!isCouponMerchantValid(coupon.getId(),coupon)) {
// 检查券商户信息isCouponMerchantValid
if (!wxCouponService.isCouponMerchantValid(coupon.getId(),coupon.getType(),coupon)) {
throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),premsg+"商户信息没找到");
}
}


+ 6
- 4
mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/v1/BaseTtPayAdapterService.java Просмотреть файл

@@ -12,6 +12,7 @@ import com.iformall.douyin.pay.orderQuery.OrderQueryResult;
import com.iformall.douyin.payv2.result.TtPayOrderQueryV2Result;
import com.iformall.enums.EnumPayStatus;
import com.iformall.exception.MallinkException;
import com.iformall.service.order.entity.WxComposeOrder;
import com.iformall.service.pay.service.pay.entity.PayAdapterResult;
import com.iformall.service.pay.service.pay.entity.PayQueryAdapterResult;
import com.iformall.utils.MaUtil;
@@ -33,12 +34,13 @@ public class BaseTtPayAdapterService {

/**
* 做为支付的扩展数据
* @param payOrder
* @param
* @return
*/
protected String getCpExtra(WxPayOrder payOrder) {
Map<String,String> map = new HashMap<>();
map.put("tenantId",payOrder.getTenantId());
protected String getCallbackData(WxPayOrder record) {
Map<String,Object> map = new HashMap<>();
map.put("composeOrderId",record.getOrderId());
map.put("tenantId",record.getTenantId());
return JSON.toJSONString(map);
}



+ 2
- 2
mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/v1/miniApp/TtMiniAppPayAdapterService.java Просмотреть файл

@@ -138,7 +138,7 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen
pageEntry.setParams(JSON.toJSONString(paramMap));
request.setOrderEntrySchema(pageEntry);

request.setCpExtra(getCpExtra(record));
request.setCpExtra(getCallbackData(record));

TtPayUnifiedOrderV2Result orderV2 = ttPayService.createOrderV2(request);

@@ -454,7 +454,7 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen
map.put("outOrderNo",record.getOrderId());
map.put("createPay",record.isCreatPay());
if(record.isCreatPay()){
map.put("callbackData",JSONObject.parseObject(getCpExtra(record),Map.class));
map.put("callbackData",JSONObject.parseObject(getCallbackData(record),Map.class));
Map<String,Integer> payment = new HashMap();
payment.put("totalAmount",composeOrder.getPayment());
map.put("payment",payment);


Загрузка…
Отмена
Сохранить