## 海粉确认订单接口;
This commit is contained in:
parent
c73476a192
commit
cb9e558c28
|
@ -1,22 +1,16 @@
|
|||
package com.hzs.common.util;
|
||||
|
||||
import com.hzs.common.core.service.RedisService;
|
||||
import com.hzs.common.core.utils.SpringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 国际化翻译工具
|
||||
*
|
||||
* @author hzs
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class TransactionUtils implements InitializingBean {
|
||||
|
||||
// private static RedisService redisService;
|
||||
|
||||
/**
|
||||
* 获取国际化翻译内容
|
||||
*
|
||||
|
@ -49,7 +43,6 @@ public class TransactionUtils implements InitializingBean {
|
|||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
// redisService = SpringUtils.getBean(RedisService.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,10 +3,9 @@ package com.hzs.member.base.controller.api;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.hzs.common.core.annotation.RepeatSubmitSimple;
|
||||
import com.hzs.common.core.constant.SystemFieldConstants;
|
||||
import com.hzs.common.core.enums.EDelFlag;
|
||||
import com.hzs.common.core.utils.StringUtils;
|
||||
import com.hzs.common.core.web.controller.BaseController;
|
||||
|
@ -28,11 +27,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 会员地址控制器
|
||||
* @Author: jiang chao
|
||||
* @Time: 2023/1/18 9:52
|
||||
* @Classname: ApiMemberAddressController
|
||||
* @PackageName: com.hzs.member.base.controller.api
|
||||
* 会员地址控制器
|
||||
*/
|
||||
@Slf4j
|
||||
@RequestMapping("/api/member-address")
|
||||
|
@ -52,9 +47,9 @@ public class ApiMemberAddressController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list() {
|
||||
QueryWrapper<CuMemberReceiving> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("PK_MEMBER", SecurityUtils.getUserId());
|
||||
queryWrapper.orderByDesc("IS_DEFAULT", SystemFieldConstants.CREATION_TIME);
|
||||
LambdaQueryWrapper<CuMemberReceiving> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CuMemberReceiving::getPkMember, SecurityUtils.getUserId());
|
||||
queryWrapper.orderByDesc(CuMemberReceiving::getIsDefault, CuMemberReceiving::getCreationTime);
|
||||
List<CuMemberReceiving> list = iCuMemberReceivingService.list(queryWrapper);
|
||||
|
||||
List<MemberAddressVO> resultList = new ArrayList<>();
|
||||
|
@ -99,9 +94,9 @@ public class ApiMemberAddressController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/detail/{id}")
|
||||
public AjaxResult detail(@PathVariable("id") Long id) {
|
||||
QueryWrapper<CuMemberReceiving> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(SystemFieldConstants.PK_ID, id);
|
||||
queryWrapper.eq("PK_MEMBER", SecurityUtils.getUserId());
|
||||
LambdaQueryWrapper<CuMemberReceiving> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CuMemberReceiving::getPkId, id);
|
||||
queryWrapper.eq(CuMemberReceiving::getPkMember, SecurityUtils.getUserId());
|
||||
CuMemberReceiving cuMemberReceiving = iCuMemberReceivingService.getOne(queryWrapper);
|
||||
if (null == cuMemberReceiving) {
|
||||
return AjaxResult.error("会员地址不存在");
|
||||
|
@ -135,12 +130,12 @@ public class ApiMemberAddressController extends BaseController {
|
|||
public AjaxResult delete(@PathVariable("id") Long id) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
UpdateWrapper<CuMemberReceiving> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq(SystemFieldConstants.PK_ID, id);
|
||||
updateWrapper.eq("PK_MEMBER", userId);
|
||||
updateWrapper.set(SystemFieldConstants.DEL_FLAG, EDelFlag.DELETE.getValue());
|
||||
updateWrapper.set(SystemFieldConstants.PK_MODIFIED, userId);
|
||||
updateWrapper.set(SystemFieldConstants.MODIFIED_TIME, new Date());
|
||||
LambdaUpdateWrapper<CuMemberReceiving> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(CuMemberReceiving::getPkId, id);
|
||||
updateWrapper.eq(CuMemberReceiving::getPkMember, userId);
|
||||
updateWrapper.set(CuMemberReceiving::getDelFlag, EDelFlag.DELETE.getValue());
|
||||
updateWrapper.set(CuMemberReceiving::getPkModified, userId);
|
||||
updateWrapper.set(CuMemberReceiving::getModifiedTime, new Date());
|
||||
|
||||
return toAjax(iCuMemberReceivingService.update(updateWrapper));
|
||||
}
|
||||
|
@ -154,9 +149,9 @@ public class ApiMemberAddressController extends BaseController {
|
|||
public AjaxResult setDefault(@PathVariable("id") Long id) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
QueryWrapper<CuMemberReceiving> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(SystemFieldConstants.PK_ID, id);
|
||||
queryWrapper.eq("PK_MEMBER", userId);
|
||||
LambdaQueryWrapper<CuMemberReceiving> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CuMemberReceiving::getPkId, id);
|
||||
queryWrapper.eq(CuMemberReceiving::getPkMember, userId);
|
||||
CuMemberReceiving cuMemberReceiving = iCuMemberReceivingService.getOne(queryWrapper);
|
||||
if (null == cuMemberReceiving) {
|
||||
return AjaxResult.success("会员地址不存在");
|
||||
|
|
|
@ -259,53 +259,6 @@ public class ApiMemberController extends BaseController {
|
|||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 更新邮箱
|
||||
// *
|
||||
// * @param param
|
||||
// * @return
|
||||
// */
|
||||
// @PutMapping("/update-email")
|
||||
// public AjaxResult updateEmail(@RequestBody MemberDataParam param) {
|
||||
// if (StringUtils.isEmpty(param.getEmail())) {
|
||||
// // 缺少参数
|
||||
// return AjaxResult.error("缺少参数");
|
||||
// }
|
||||
// if (StringUtils.isEmpty(param.getCode())) {
|
||||
// // 验证码不能为空
|
||||
// return AjaxResult.error(TransactionUtils.getContent(FinanceMsgConstants.VERIFICATION_CODE_CANNOT_EMPTY));
|
||||
// }
|
||||
//
|
||||
// Long memberId = SecurityUtils.getUserId();
|
||||
// CuMember member = iCuMemberService.getMemberById(memberId);
|
||||
// if (null == member) {
|
||||
// // 会员不存在
|
||||
// return AjaxResult.error(TransactionUtils.getContent(MemberMsgConstants.MEMBER_NOT_EXITS));
|
||||
// }
|
||||
//
|
||||
// // 短信校验码校验
|
||||
// String checkStr = iApiSmsService.checkSms(ESmsTemplate.VERIFICATION.getCache() + memberId, param.getCode());
|
||||
// if (null != checkStr) {
|
||||
// return AjaxResult.error(checkStr);
|
||||
// }
|
||||
//
|
||||
// // 会员修改信息
|
||||
// CuMember cuMember = new CuMember();
|
||||
// cuMember.setPkId(memberId);
|
||||
// cuMember.setEmail(param.getEmail());
|
||||
// cuMember.setPkModified(memberId);
|
||||
// cuMember.setModifiedTime(new Date());
|
||||
// // 会员修改记录信息
|
||||
// CuMemberChangeLog cuMemberChangeLog = CuMemberChangeLog.builder()
|
||||
// .pkMember(memberId)
|
||||
// .changeType(EMemberChangeType.EMAIL.getValue())
|
||||
// .changeFront(member.getEmail())
|
||||
// .changeAfter(param.getEmail())
|
||||
// .build();
|
||||
// iMemberInfoService.updateMemberInfo(cuMember, Collections.singletonList(cuMemberChangeLog));
|
||||
// return AjaxResult.success();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 忘记密码更新
|
||||
*
|
||||
|
@ -396,7 +349,7 @@ public class ApiMemberController extends BaseController {
|
|||
|
||||
// /**
|
||||
// * @param memberParam 订单参数
|
||||
// * @Description: 确认注册订单,生成待支付订单,只有注册订单有待支付订单
|
||||
// * 确认注册订单,生成待支付订单,只有注册订单有待支付订单
|
||||
// * @return: AjaxResult
|
||||
// * @Author: sui q
|
||||
// * @Date: 2022/8/27 16:47
|
||||
|
@ -490,10 +443,7 @@ public class ApiMemberController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* @Description: 确认注册订单,生成待支付订单,只有注册订单有待支付订单
|
||||
* @return: AjaxResult
|
||||
* @Author: sui q
|
||||
* @Date: 2022/8/27 16:47
|
||||
* 确认注册订单,生成待支付订单,只有注册订单有待支付订单
|
||||
*/
|
||||
@GetMapping("/validate-share-member/{memberCode}")
|
||||
public AjaxResult validateShareMemberCode(@PathVariable("memberCode") String memberCode) {
|
||||
|
@ -510,10 +460,7 @@ public class ApiMemberController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* @Description: 获得推荐人国家前缀
|
||||
* @return: AjaxResult
|
||||
* @Author: sui q
|
||||
* @Date: 2022/8/27 16:47
|
||||
* 获得推荐人国家前缀
|
||||
*/
|
||||
@GetMapping("/query-country-prefix/{pkParent}")
|
||||
public AjaxResult queryCountryPrefix(@PathVariable("pkParent") String pkParent) {
|
||||
|
@ -545,7 +492,7 @@ public class ApiMemberController extends BaseController {
|
|||
}
|
||||
CuMember cuMember = iCuMemberService.getMemberById(Long.parseLong(new String(Base64Decoder.decode(pkParent))));
|
||||
if (null != cuMember) {
|
||||
return AjaxResult.success(cuMember.getMemberCode());
|
||||
return AjaxResult.success("", cuMember.getMemberCode());
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
@ -673,11 +620,9 @@ public class ApiMemberController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 验证字段是否必输
|
||||
*
|
||||
* @param fieldList 需要验证的字段
|
||||
* @Description: 验证字段是否必输
|
||||
* @return: boolean
|
||||
* @Author: sui q
|
||||
* @Date: 2022/8/29 11:13
|
||||
*/
|
||||
private boolean validateFieldNotNull(MemberParam memberParam, List<String> fieldList) {
|
||||
return fieldList.stream().anyMatch(field -> {
|
||||
|
|
|
@ -324,6 +324,7 @@
|
|||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectPlaceSponsorOnUmbrella" resultMap="MemberResultMap">
|
||||
select t.pk_id, t.member_code, t.member_name, t.phone, t.pk_place_parent
|
||||
from cu_member t
|
||||
|
@ -338,6 +339,7 @@
|
|||
connect by t.pk_id = prior t.pk_place_parent
|
||||
order by level desc
|
||||
</select>
|
||||
|
||||
<select id="selectPlaceSponsorUnderUmbrella" resultMap="MemberResultMap">
|
||||
select t.pk_id,
|
||||
t.member_code,
|
||||
|
|
|
@ -127,8 +127,8 @@ public abstract class ParentOrderController extends BaseController {
|
|||
// 1.只能在同一个团队内 验证安置人及安置人伞上是否存在该手机号+姓名
|
||||
// 很多情况安置人跟伞下是一样的,从redis获取安置人,验证安置人手机号跟姓名是否一致
|
||||
CuMember placeParentCuMember = getCuMemberByCode(orderParam.getPlaceParent());
|
||||
if (!placeParentCuMember.getMemberName().equals(memberName) ||
|
||||
!placeParentCuMember.getPhone().equals(phone)) {
|
||||
if (!placeParentCuMember.getMemberName().equals(memberName)
|
||||
|| !placeParentCuMember.getPhone().equals(phone)) {
|
||||
// 寻找安置人伞上,验证安置伞上是否存在该手机姓名,如果伞上没有找到手机号,其他地方找到了,说明不在一个团队
|
||||
List<CuMemberExt> sponsorOnUmbrella = iSaOrderService.querySponsorOnUmbrella(placeParentCuMember.getPkId(), phone);
|
||||
CuMemberExt searchCuMember = null;
|
||||
|
|
|
@ -0,0 +1,217 @@
|
|||
package com.hzs.sale.order.controller.api;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.hzs.common.core.constant.CacheConstants;
|
||||
import com.hzs.common.core.enums.*;
|
||||
import com.hzs.common.core.utils.CommonUtil;
|
||||
import com.hzs.common.core.utils.StringUtils;
|
||||
import com.hzs.common.core.web.domain.AjaxResult;
|
||||
import com.hzs.common.domain.member.base.CuMemberShare;
|
||||
import com.hzs.common.domain.sale.ext.BdWaresSpecsSkuExt;
|
||||
import com.hzs.common.domain.sale.ext.SaOrderExt;
|
||||
import com.hzs.common.domain.sale.order.SaOrderShareTmp;
|
||||
import com.hzs.common.domain.sale.wares.BdWares;
|
||||
import com.hzs.common.security.utils.SecurityUtils;
|
||||
import com.hzs.member.base.IMemberServiceApi;
|
||||
import com.hzs.sale.order.controller.ParentOrderController;
|
||||
import com.hzs.sale.order.param.*;
|
||||
import com.hzs.sale.order.service.ISaOrderService;
|
||||
import com.hzs.sale.order.service.ISaOrderShareTmpService;
|
||||
import com.hzs.sale.order.vo.FansConfirmOrderVO;
|
||||
import com.hzs.sale.wares.service.IBdWaresService;
|
||||
import com.hzs.sale.wares.service.IBdWaresSpecsSkuService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 分享订单
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/order")
|
||||
@Slf4j
|
||||
public class ApiFanSaOrderController extends ParentOrderController {
|
||||
|
||||
@Autowired
|
||||
private IBdWaresService iBdWaresService;
|
||||
@Autowired
|
||||
private IBdWaresSpecsSkuService iBdWaresSpecsSkuService;
|
||||
@Autowired
|
||||
private ISaOrderShareTmpService iSaOrderShareTmpService;
|
||||
@Autowired
|
||||
private ISaOrderService iSaOrderService;
|
||||
|
||||
@DubboReference
|
||||
IMemberServiceApi iMemberServiceApi;
|
||||
|
||||
/**
|
||||
* 海粉确认订单
|
||||
*
|
||||
* @param param 确认订单入参
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/fans-confirm-order")
|
||||
public AjaxResult fansConfirmOrder(@RequestBody FansConfirmOrderParam param) {
|
||||
// 校验参数
|
||||
if (StringUtils.isAnyEmpty(param.getMemberName(), param.getPhone(), param.getRecName(), param.getRecPhone(), param.getRecAddress())
|
||||
|| null == param.getPkCountry() || null == param.getRecProvince() || null == param.getRecCity()
|
||||
|| CollectionUtil.isEmpty(param.getWaresList())
|
||||
) {
|
||||
// 缺少参数
|
||||
return AjaxResult.error("缺少参数");
|
||||
}
|
||||
// 校验商品数据
|
||||
for (FansConfirmOrderWaresParam waresParam : param.getWaresList()) {
|
||||
if (null == waresParam.getPkWares() || null == waresParam.getQuantity()
|
||||
|| CollectionUtil.isEmpty(waresParam.getSkuList())) {
|
||||
// 缺少参数
|
||||
return AjaxResult.error("缺少参数");
|
||||
}
|
||||
// 校验产品数据
|
||||
for (FansConfirmOrderSkuParam skuParam : waresParam.getSkuList()) {
|
||||
if (null == skuParam.getPkWaresSku() || null == skuParam.getQuantity()) {
|
||||
// 缺少参数
|
||||
return AjaxResult.error("缺少参数");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 会员ID
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
// 所属国家
|
||||
Integer pkCountry = SecurityUtils.getPkCountry();
|
||||
|
||||
// 查询临时会员
|
||||
CuMemberShare cuMemberShare = iMemberServiceApi.queryCuMemberShare(userId).getData();
|
||||
if (null == cuMemberShare) {
|
||||
// 会员不存在
|
||||
return AjaxResult.error("推荐人不存在");
|
||||
}
|
||||
|
||||
// 封装缓存数据
|
||||
OrderParam orderParam = OrderParam.builder()
|
||||
.memberName(param.getMemberName())
|
||||
.phone(param.getPhone())
|
||||
.centerCodeId(cuMemberShare.getPkParent())
|
||||
.pkParent(cuMemberShare.getPkParent())
|
||||
.pkMemberId(userId)
|
||||
.pkCountry(param.getPkCountry())
|
||||
.pkSettleCountry(pkCountry)
|
||||
.source(EDataSource.H5.getValue())
|
||||
.isHaiFun(true)
|
||||
.build();
|
||||
|
||||
// 手机号注册次数校验
|
||||
AjaxResult ajaxResult = super.validatePhone(orderParam);
|
||||
if (!ajaxResult.isSuccess()) {
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
// 订单金额
|
||||
BigDecimal orderAmount = BigDecimal.ZERO;
|
||||
|
||||
// 生成订单编号
|
||||
String orderCode = CommonUtil.createSerialNumber(EOrderPrefix.ORDER_CODE);
|
||||
|
||||
// 缓存数据
|
||||
List<OrderItemsParam> orderItemsParams = new ArrayList<>();
|
||||
// 遍历商品,封装订单明细
|
||||
for (FansConfirmOrderWaresParam waresParam : param.getWaresList()) {
|
||||
// 遍历sku
|
||||
// 产品价格等map
|
||||
Map<Long, BdWaresSpecsSkuExt> skuMap = iBdWaresSpecsSkuService.queryWaresSpecsSkuList(waresParam.getSkuList().stream().map(FansConfirmOrderSkuParam::getPkWaresSku).collect(Collectors.toList()));
|
||||
|
||||
// 查询商品
|
||||
BdWares bdWares = iBdWaresService.getWares(waresParam.getPkWares());
|
||||
|
||||
// 缓存数据
|
||||
List<WaresItemsParam> itemsParamList = new ArrayList<>(waresParam.getSkuList().size());
|
||||
// 遍历产品信息
|
||||
for (FansConfirmOrderSkuParam skuParam : waresParam.getSkuList()) {
|
||||
BdWaresSpecsSkuExt specsSku = skuMap.get(skuParam.getPkWaresSku());
|
||||
orderAmount = orderAmount.add(specsSku.getPrice().multiply(new BigDecimal(skuParam.getQuantity() * waresParam.getQuantity())));
|
||||
|
||||
itemsParamList.add(WaresItemsParam.builder()
|
||||
.pkWaresSpecsSku(skuParam.getPkWaresSku().intValue())
|
||||
.quantity(skuParam.getQuantity())
|
||||
.build());
|
||||
}
|
||||
orderItemsParams.add(OrderItemsParam.builder()
|
||||
.waresCode(bdWares.getWaresCode())
|
||||
.quantity(waresParam.getQuantity())
|
||||
.waresItemsParamList(itemsParamList)
|
||||
.build());
|
||||
}
|
||||
// 封装订单数据
|
||||
SaOrderExt saOrder = new SaOrderExt();
|
||||
saOrder.setOrderCode(orderCode);
|
||||
// 188注册订单实际按复购订单来片
|
||||
saOrder.setOrderType(EOrderType.REPURCHASE_ORDER.getValue());
|
||||
saOrder.setOrderTypeExtend(EOrderTypeExtend.REG_REP.getValue());
|
||||
saOrder.setOrderAmount(orderAmount);
|
||||
saOrder.setPostage(BigDecimal.ZERO);
|
||||
saOrder.setRecName(param.getRecName());
|
||||
saOrder.setRecPhone(param.getRecPhone());
|
||||
saOrder.setRecProvince(param.getRecProvince());
|
||||
saOrder.setRecCity(param.getRecCity());
|
||||
saOrder.setRecCounty(param.getRecCounty());
|
||||
saOrder.setRecAddress(param.getRecAddress());
|
||||
saOrder.setRemark(param.getRemark());
|
||||
saOrder.setPkMember(cuMemberShare.getPkId());
|
||||
saOrder.setPkReference(cuMemberShare.getPkParent());
|
||||
saOrder.setDeliveryWay(EDelivery.FAST_MAIL.getValue());
|
||||
saOrder.setTranType(ETransportType.LAND.getValue());
|
||||
saOrder.setPkCreator(cuMemberShare.getPkId());
|
||||
saOrder.setPkCountry(pkCountry);
|
||||
|
||||
orderParam.setOrderCode(orderCode);
|
||||
orderParam.setSpecialArea(saOrder.getOrderType());
|
||||
orderParam.setPostage(saOrder.getPostage());
|
||||
orderParam.setDeliveryWay(saOrder.getDeliveryWay());
|
||||
orderParam.setTransType(saOrder.getTranType());
|
||||
orderParam.setRecName(saOrder.getRecName());
|
||||
orderParam.setRecPhone(saOrder.getRecPhone());
|
||||
orderParam.setRecProvince(saOrder.getRecProvince());
|
||||
orderParam.setRecCity(saOrder.getRecCity());
|
||||
orderParam.setRecCounty(saOrder.getRecCounty());
|
||||
orderParam.setRecAddress(saOrder.getRecAddress());
|
||||
orderParam.setOrderItemsParams(orderItemsParams);
|
||||
|
||||
HashMap<String, Object> orderInfo = new HashMap<>();
|
||||
orderInfo.put("param", param);
|
||||
orderInfo.put("saOrder", saOrder);
|
||||
orderInfo.put("orderParam", orderParam);
|
||||
// 分享会员订单数据
|
||||
if (iSaOrderShareTmpService.save(SaOrderShareTmp.builder()
|
||||
.pkId(cuMemberShare.getPkId())
|
||||
.orderInfo(JSONUtil.toJsonStr(orderInfo))
|
||||
.build())) {
|
||||
|
||||
// 临时订单直接放入缓存(24小时有效)
|
||||
redisService.setCacheObject(CacheConstants.TEMP_ORDER + userId + orderCode, saOrder, 24L, TimeUnit.HOURS);
|
||||
// 临时会员直接放入缓存(24小时有效)
|
||||
redisService.setCacheObject(CacheConstants.TEMP_PARAM + userId + orderCode, orderParam, 24L, TimeUnit.HOURS);
|
||||
|
||||
return AjaxResult.success(FansConfirmOrderVO.builder()
|
||||
.orderCode(orderCode)
|
||||
.orderAmount(saOrder.getOrderAmount().add(saOrder.getPostage()))
|
||||
.payTime(iSaOrderService.getIsToBePayTime(pkCountry, saOrder.getOrderType()))
|
||||
.build());
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.hzs.sale.order.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 海粉确认订单入参
|
||||
*/
|
||||
@Data
|
||||
public class FansConfirmOrderParam {
|
||||
|
||||
/***
|
||||
* 自然国
|
||||
*/
|
||||
private Integer pkCountry;
|
||||
|
||||
/**
|
||||
* 会员姓名
|
||||
*/
|
||||
private String memberName;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 收货人
|
||||
*/
|
||||
private String recName;
|
||||
|
||||
/**
|
||||
* 收货电话
|
||||
*/
|
||||
private String recPhone;
|
||||
|
||||
/**
|
||||
* 收货省
|
||||
*/
|
||||
private Integer recProvince;
|
||||
|
||||
/**
|
||||
* 收货市
|
||||
*/
|
||||
private Integer recCity;
|
||||
|
||||
/**
|
||||
* 收货县
|
||||
*/
|
||||
private Integer recCounty;
|
||||
|
||||
/**
|
||||
* 收货地址
|
||||
*/
|
||||
private String recAddress;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
private List<FansConfirmOrderWaresParam> waresList;
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.hzs.sale.order.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 海粉确认订单产品入参
|
||||
*/
|
||||
@Data
|
||||
public class FansConfirmOrderSkuParam {
|
||||
|
||||
/**
|
||||
* SKU ID
|
||||
*/
|
||||
private Long pkWaresSku;
|
||||
|
||||
/**
|
||||
* 产品数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.hzs.sale.order.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 海粉确认订单商品入参
|
||||
*/
|
||||
@Data
|
||||
public class FansConfirmOrderWaresParam {
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Integer pkWares;
|
||||
|
||||
/**
|
||||
* 商品数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 产品列表
|
||||
*/
|
||||
private List<FansConfirmOrderSkuParam> skuList;
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.hzs.sale.order.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 海粉确认订单返回VO
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Data
|
||||
public class FansConfirmOrderVO {
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderCode;
|
||||
|
||||
/**
|
||||
* 待支付金额
|
||||
*/
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
/**
|
||||
* 订单支付剩余时间
|
||||
*/
|
||||
private Long payTime;
|
||||
|
||||
}
|
|
@ -113,4 +113,12 @@ public interface BdWaresSpecsSkuMapper extends BaseMapper<BdWaresSpecsSku> {
|
|||
*/
|
||||
List<BdWaresSpecsSkuExt> selectByMinWaresSpecsSkuByPkWaresList(@Param("pkWaresIds") List<Integer> pkWaresIds);
|
||||
|
||||
/**
|
||||
* 查询SKU价格等信息
|
||||
*
|
||||
* @param skuIdList skuID列表
|
||||
* @return
|
||||
*/
|
||||
List<BdWaresSpecsSkuExt> queryWaresSpecsSkuList(@Param("skuIdList") List<Long> skuIdList);
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import com.hzs.sale.wares.param.SpecsSkuParam;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 规格sku表 服务类
|
||||
|
@ -80,7 +79,7 @@ public interface IBdWaresSpecsSkuService extends IService<BdWaresSpecsSku> {
|
|||
List<WaresItemWaresInfo> selectByPkIds(List<Integer> pkWaresSpecsSku);
|
||||
|
||||
/*
|
||||
* @description: 查询商品封装为返回到会员端商品信息
|
||||
* 查询商品封装为返回到会员端商品信息
|
||||
**/
|
||||
WaresItemVo selectWaresItemsVO(Long pkMember, Integer pkCountry, Integer specialArea, String waresCode, List<ProductGroup> productGroup, Integer quantity);
|
||||
|
||||
|
@ -108,4 +107,12 @@ public interface IBdWaresSpecsSkuService extends IService<BdWaresSpecsSku> {
|
|||
*/
|
||||
BdWaresSpecsSkuExt selectByPkWaresSpecsSku(Integer pkWaresSpecsSku);
|
||||
|
||||
/**
|
||||
* 查询SKU价格等信息
|
||||
*
|
||||
* @param skuIdList skuID列表
|
||||
* @return
|
||||
*/
|
||||
Map<Long, BdWaresSpecsSkuExt> queryWaresSpecsSkuList(List<Long> skuIdList);
|
||||
|
||||
}
|
||||
|
|
|
@ -479,4 +479,16 @@ public class BdWaresSpecsSkuServiceImpl extends ServiceImpl<BdWaresSpecsSkuMappe
|
|||
return baseMapper.selectByPkWaresSpecsSku(pkWaresSpecsSku);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, BdWaresSpecsSkuExt> queryWaresSpecsSkuList(List<Long> skuIdList) {
|
||||
Map<Long, BdWaresSpecsSkuExt> resultMap = new HashMap<>();
|
||||
|
||||
List<BdWaresSpecsSkuExt> list = baseMapper.queryWaresSpecsSkuList(skuIdList);
|
||||
for (BdWaresSpecsSkuExt waresSpecsSku : list) {
|
||||
resultMap.put(waresSpecsSku.getPkId().longValue(), waresSpecsSku);
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -343,4 +343,23 @@
|
|||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- 查询SKU价格等信息 -->
|
||||
<select id="queryWaresSpecsSkuList" resultType="com.hzs.common.domain.sale.ext.BdWaresSpecsSkuExt">
|
||||
select bwss.pk_id,
|
||||
bwd.pk_product,
|
||||
bwss.pk_wares_detail,
|
||||
bwss.price,
|
||||
bwss.achieve,
|
||||
bwss.ass_achieve
|
||||
from bd_wares_specs_sku bwss
|
||||
left join BD_WARES_DETAIL bwd
|
||||
on bwd.del_flag = 0
|
||||
and bwd.pk_id = bwss.pk_wares_detail
|
||||
where bwss.del_flag = 0
|
||||
and bwss.pk_id in
|
||||
<foreach collection="skuIdList" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -5,7 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.hzs.common.core.enums.EYesNo;
|
||||
import com.hzs.common.core.web.domain.AjaxResult;
|
||||
import com.hzs.common.domain.system.base.BdArea;
|
||||
|
@ -23,19 +23,12 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: yuhui
|
||||
* @Time: 2023/1/30 16:26
|
||||
* @Classname: BdAreaController
|
||||
* @PackageName: com.hzs.system.base.controller.api
|
||||
*/
|
||||
@RestController("apiAreaController")
|
||||
@RequestMapping("/api/area")
|
||||
public class ApiAreaController {
|
||||
|
||||
@Autowired
|
||||
private IBdAreaService areaService;
|
||||
private IBdAreaService iBdAreaService;
|
||||
|
||||
/**
|
||||
* 查询树形图 省市区
|
||||
|
@ -47,7 +40,7 @@ public class ApiAreaController {
|
|||
if (pkCountry == null) {
|
||||
pkCountry = SecurityUtils.getPkCountry();
|
||||
}
|
||||
List<AreaCache> areaList = areaService.getAreaList(pkCountry);
|
||||
List<AreaCache> areaList = iBdAreaService.getAreaList(pkCountry);
|
||||
TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
|
||||
treeNodeConfig.setDeep(3);
|
||||
|
||||
|
@ -62,21 +55,11 @@ public class ApiAreaController {
|
|||
}
|
||||
|
||||
/**
|
||||
* @description: 查询所有省市区
|
||||
* @author: yh
|
||||
* @date: 2022/11/24 16:26
|
||||
* @param: []
|
||||
* @return: com.hz.common.core.domain.AjaxResult
|
||||
* 查询所有省市区
|
||||
**/
|
||||
@GetMapping("/provinceList")
|
||||
public AjaxResult provinceList(Integer pkCountry) {
|
||||
// Integer pkCountry = SecurityUtils.getPkCountry();
|
||||
// QueryWrapper<BdArea> qw = new QueryWrapper<BdArea>();
|
||||
// qw.eq("PARENT",0);
|
||||
// qw.eq("PK_COUNTRY",pkCountry);
|
||||
// // 查询第一层国家层
|
||||
// BdArea area = areaService.getOne(qw);
|
||||
List<AreaCache> list = areaService.getAreaList(pkCountry);
|
||||
List<AreaCache> list = iBdAreaService.getAreaList(pkCountry);
|
||||
List<AreaCache> provinceList = new ArrayList<>();
|
||||
List<AreaCache> cityList = new ArrayList<>();
|
||||
List<AreaCache> countyList = new ArrayList<>();
|
||||
|
@ -100,14 +83,6 @@ public class ApiAreaController {
|
|||
}
|
||||
}
|
||||
areaCache.setCityList(cityList);
|
||||
//县
|
||||
// for(AreaCache ac:cityList){
|
||||
// for(AreaCache co:list){
|
||||
// if(co.getParent().intValue()==ac.getPkId()){
|
||||
// countyList.add(co);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Set<Integer> idSet = new HashSet<>();
|
||||
for (AreaCache cache : cityList) {
|
||||
for (AreaCache ac : list) {
|
||||
|
@ -133,25 +108,20 @@ public class ApiAreaController {
|
|||
* @param parent
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("get-level-list")
|
||||
@GetMapping("/get-level-list")
|
||||
public AjaxResult getLevelList(Integer parent) {
|
||||
List<BdArea> list = new ArrayList<>();
|
||||
if (parent == null) {
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
QueryWrapper<BdArea> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("parent", parent);
|
||||
queryWrapper.eq("PK_COUNTRY", SecurityUtils.getPkCountry());
|
||||
queryWrapper.eq("enable_state", EYesNo.YES.getIntValue());
|
||||
list = areaService.list(queryWrapper);
|
||||
LambdaQueryWrapper<BdArea> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BdArea::getParent, parent);
|
||||
queryWrapper.eq(BdArea::getPkCountry, SecurityUtils.getPkCountry());
|
||||
queryWrapper.eq(BdArea::getEnableState, EYesNo.YES.getIntValue());
|
||||
list = iBdAreaService.list(queryWrapper);
|
||||
List<BdAreaVo> resultList = new ArrayList<>();
|
||||
for (BdArea bdArea : list) {
|
||||
BdAreaVo bdAreaVo = BeanUtil.copyProperties(bdArea, BdAreaVo.class);
|
||||
// QueryWrapper<BdArea> areaWrapper = new QueryWrapper<>();
|
||||
// areaWrapper.eq("parent", bdAreaVo.getPkId());
|
||||
// int count = areaService.count(areaWrapper);
|
||||
// bdAreaVo.setLevelCount(count);
|
||||
resultList.add(bdAreaVo);
|
||||
resultList.add(BeanUtil.copyProperties(bdArea, BdAreaVo.class));
|
||||
}
|
||||
return AjaxResult.success(resultList);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue