提交实物代码

new-dev
袁野 2 years ago
parent 4f91ebe5cd
commit 8984ba7fde
  1. 179
      hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsPresentController.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  3. 55
      hai-cweb/src/main/java/com/cweb/controller/Goods/DeliveryAddressController.java
  4. 47
      hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java
  5. 21
      hai-cweb/src/main/java/com/cweb/controller/Goods/ShoppingCartController.java
  6. 10
      hai-order/src/main/java/com/web/controller/OrderController.java
  7. 1
      hai-service/src/main/java/com/hai/common/utils/PageUtil.java
  8. 3
      hai-service/src/main/java/com/hai/goods/model/GoodsModel.java
  9. 68
      hai-service/src/main/java/com/hai/goods/service/GoodsPresentService.java
  10. 3
      hai-service/src/main/java/com/hai/goods/service/impl/DeliveryAddressServiceImpl.java
  11. 4
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsDetailServiceImpl.java
  12. 53
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsPresentServiceImpl.java
  13. 69
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsRegionFreightServiceImpl.java
  14. 17
      hai-service/src/main/java/com/hai/order/model/CreateOrderChildModel.java
  15. 5
      hai-service/src/main/java/com/hai/order/model/CreateOrderModel.java
  16. 1
      hai-service/src/main/java/com/hai/order/type/OrderChildGoodsType.java

@ -0,0 +1,179 @@
package com.bweb.controller.Goods;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.GoodsPresent;
import com.hai.goods.service.GoodsPresentService;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping(value = "/goodsPresent")
@Api(value = "商品赠送")
public class GoodsPresentController {
Logger log = LoggerFactory.getLogger(GoodsPresentController.class);
@Resource
private GoodsPresentService presentService;
@Autowired
private UserCenter userCenter;
@RequestMapping(value = "/getListPresent", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询列表")
public ResponseData getListPresent(
@RequestParam(value = "goodsId", required = false) Long goodsId
) {
try {
Map<String, Object> map = new HashMap<>();
map.put("goodsId", goodsId);
return ResponseMsgUtil.success(presentService.getPresentList(map));
} catch (Exception e) {
log.error("GoodsDetailController --> getListUser() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/insertPresent", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "新增赠送内容")
public ResponseData insertPresent(@RequestBody GoodsPresent present, HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (present == null ||
present.getGoodsId() == null ||
present.getNum() == null ||
present.getSourceId() == null ||
present.getSourceName() == null ||
present.getType() == null
) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
present.setOpId(userInfoModel.getSecUser().getId());
present.setOpName(userInfoModel.getSecUser().getLoginName());
present.setCreateTime(new Date());
present.setUpdateTime(new Date());
present.setStatus(String.valueOf(1));
presentService.insertPresent(present);
return ResponseMsgUtil.success("新增成功");
} catch (Exception e) {
log.error("GoodsDetailController --> insertPrice() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/updatePresent", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "更新赠送内容")
public ResponseData updatePresent(@RequestBody GoodsPresent present, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (present == null ||
present.getId() == null ||
present.getGoodsId() == null ||
present.getNum() == null ||
present.getSourceId() == null ||
present.getSourceName() == null ||
present.getType() == null
) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
GoodsPresent goodsPresent = presentService.findPresentById(present.getId());
if (goodsPresent == null) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关信息!");
}
present.setOpId(userInfoModel.getSecUser().getId());
present.setOpName(userInfoModel.getSecUser().getLoginName());
present.setStatus(present.getStatus());
present.setUpdateTime(new Date());
presentService.insertPresent(present);
return ResponseMsgUtil.success("新增成功");
} catch (Exception e) {
log.error("GoodsDetailController --> insertPrice() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/deletePresent", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "删除")
public ResponseData deletePresent(
@RequestParam(value = "id", required = true) Long id
, HttpServletRequest request
) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
GoodsPresent goodsPresent = presentService.findPresentById(id);
if (goodsPresent == null) {
log.error("GoodsDetailController -> findGoodsDetailById() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关信息");
}
goodsPresent.setStatus(String.valueOf(0));
goodsPresent.setUpdateTime(new Date());
goodsPresent.setOpId(userInfoModel.getSecUser().getId());
goodsPresent.setOpName(userInfoModel.getSecUser().getLoginName());
presentService.updatePresent(goodsPresent);
return ResponseMsgUtil.success("删除成功!");
} catch (Exception e) {
log.error("GoodsDetailController --> findGoodsDetailById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

File diff suppressed because one or more lines are too long

@ -1,5 +1,6 @@
package com.cweb.controller.Goods; package com.cweb.controller.Goods;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
@ -13,6 +14,7 @@ import com.hai.entity.GoodsShoppingCart;
import com.hai.entity.GoodsSku; import com.hai.entity.GoodsSku;
import com.hai.goods.model.ShoppingCartModel; import com.hai.goods.model.ShoppingCartModel;
import com.hai.goods.service.DeliveryAddressService; import com.hai.goods.service.DeliveryAddressService;
import com.hai.goods.service.GoodsRegionFreightService;
import com.hai.model.HighUserModel; import com.hai.model.HighUserModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -39,6 +41,9 @@ public class DeliveryAddressController {
@Autowired @Autowired
private UserCenter userCenter; private UserCenter userCenter;
@Resource
private GoodsRegionFreightService goodsRegionFreightService;
@RequestMapping(value = "/getDeliveryAddressList", method = RequestMethod.GET) @RequestMapping(value = "/getDeliveryAddressList", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询收货地址列表") @ApiOperation(value = "查询收货地址列表")
@ -74,6 +79,15 @@ public class DeliveryAddressController {
SessionObject sessionObject = userCenter.getSessionObject(request); SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
Map<String, Object> map = new HashMap<>();
map.put("userId", userInfoModel.getHighUser().getId());
List<GoodsDeliveryAddress> list = deliveryAddressService.getDeliveryAddressList(map);
if (list.size() == 0) {
deliveryAddress.setWhetherDefault(true);
}
if (deliveryAddress == null || if (deliveryAddress == null ||
deliveryAddress.getAddress() == null || deliveryAddress.getAddress() == null ||
deliveryAddress.getWhetherDefault() == null || deliveryAddress.getWhetherDefault() == null ||
@ -91,6 +105,8 @@ public class DeliveryAddressController {
deliveryAddress.setUpdateTime(new Date()); deliveryAddress.setUpdateTime(new Date());
deliveryAddressService.insertDeliveryAddress(deliveryAddress); deliveryAddressService.insertDeliveryAddress(deliveryAddress);
return ResponseMsgUtil.success("新增成功"); return ResponseMsgUtil.success("新增成功");
} catch (Exception e) { } catch (Exception e) {
@ -169,10 +185,10 @@ public class DeliveryAddressController {
} }
} }
@RequestMapping(value = "/deleteShoppingCart", method = RequestMethod.GET) @RequestMapping(value = "/deleteDeliveryAddress", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "删除购物车信息") @ApiOperation(value = "删除删除收货地址")
public ResponseData deleteShoppingCart( public ResponseData deleteDeliveryAddress(
@RequestParam(value = "id", required = true) Long id, HttpServletRequest request @RequestParam(value = "id", required = true) Long id, HttpServletRequest request
) { ) {
try { try {
@ -203,4 +219,37 @@ public class DeliveryAddressController {
} }
} }
@RequestMapping(value = "/getAddressPrice", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询收货地址包邮金额和运费金额")
public ResponseData getAddressPrice( HttpServletRequest request
) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
Map<String, Object> map = new HashMap<>();
map.put("userId", userInfoModel.getHighUser().getId());
map.put("whetherDefault", true);
List<GoodsDeliveryAddress> list = deliveryAddressService.getDeliveryAddressList(map);
if (list.size() == 0) {
log.error("GoodsDetailController -> findGoodsDetailById() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关信息");
}
JSONObject object = goodsRegionFreightService.getRegionFreight(list.get(0).getRegionId());
object.put("deliveryAddress" , list.get(0));
return ResponseMsgUtil.success(object);
} catch (Exception e) {
log.error("GoodsDetailController --> findGoodsDetailById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -8,16 +8,16 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject; import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.common.utils.PageUtil;
import com.hai.common.utils.RedisUtil; import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonConfig; import com.hai.config.CommonConfig;
import com.hai.entity.GoodsDetail; import com.hai.entity.*;
import com.hai.entity.GoodsLogistics;
import com.hai.entity.GoodsSku;
import com.hai.goods.model.GoodsModel; import com.hai.goods.model.GoodsModel;
import com.hai.goods.service.GoodsDetailService; import com.hai.goods.service.GoodsDetailService;
import com.hai.goods.service.GoodsLogisticsService; import com.hai.goods.service.GoodsLogisticsService;
import com.hai.goods.service.GoodsSkuService; import com.hai.goods.service.GoodsSkuService;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
import com.hai.service.HighGoodsTypeService; import com.hai.service.HighGoodsTypeService;
@ -34,6 +34,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Controller @Controller
@RequestMapping(value = "/goods") @RequestMapping(value = "/goods")
@ -47,9 +48,6 @@ public class GoodsController {
@Autowired @Autowired
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Autowired
private UserCenter userCenter;
@Resource @Resource
private GoodsLogisticsService logisticsService; private GoodsLogisticsService logisticsService;
@ -65,6 +63,7 @@ public class GoodsController {
public ResponseData getListGoodsDetail( public ResponseData getListGoodsDetail(
@RequestParam(value = "title", required = false) String title, @RequestParam(value = "title", required = false) String title,
@RequestParam(value = "goodsType", required = false) Long goodsType, @RequestParam(value = "goodsType", required = false) Long goodsType,
@RequestParam(value = "price", required = false) Integer price,
@RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize @RequestParam(name = "pageSize", required = true) Integer pageSize
) { ) {
@ -77,7 +76,6 @@ public class GoodsController {
map.put("goodsType", goodsType); map.put("goodsType", goodsType);
map.put("status", 1); map.put("status", 1);
PageHelper.startPage(pageNum,pageSize);
List<GoodsDetail> list = goodsDetailService.getGoodsDetailList(map); List<GoodsDetail> list = goodsDetailService.getGoodsDetailList(map);
@ -108,7 +106,15 @@ public class GoodsController {
} }
} }
return ResponseMsgUtil.success(new PageInfo<>(goodsModels)); if (price == 1) {
goodsModels = goodsModels.stream().sorted(Comparator.comparing(GoodsModel::getPrice)).collect(Collectors.toList());
}
if (price == 2) {
goodsModels = goodsModels.stream().sorted(Comparator.comparing(GoodsModel::getPrice).reversed()).collect(Collectors.toList());
}
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, goodsModels.size(), pageSize, new PageInfo<>(goodsModels)));
} catch (Exception e) { } catch (Exception e) {
log.error("GoodsDetailController --> getListUser() error!", e); log.error("GoodsDetailController --> getListUser() error!", e);
@ -132,7 +138,27 @@ public class GoodsController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关商品信息"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关商品信息");
} }
return ResponseMsgUtil.success(goodsDetail); GoodsModel goodsModel = new GoodsModel();
List<GoodsSku> goodsSku = goodsSkuService.getGoodsSkuList(goodsDetail.getId());
if (goodsSku.size() > 0) {
BigDecimal minPrice = goodsSku.get(0).getPrice();
BigDecimal minOriginalPrice = goodsSku.get(0).getOriginalPrice();
for (GoodsSku sku : goodsSku) {
if (sku.getPrice().compareTo(minPrice) < 0) {
minPrice = sku.getPrice();
minOriginalPrice = sku.getOriginalPrice();
}
}
BeanUtils.copyProperties(goodsDetail, goodsModel);
goodsModel.setOriginalPrice(minOriginalPrice);
goodsModel.setPrice(minPrice);
goodsModel.setWhetherMultiple(goodsSku.size() != 1);
}
return ResponseMsgUtil.success(goodsModel);
} catch (Exception e) { } catch (Exception e) {
log.error("GoodsDetailController --> findGoodsDetailById() error!", e); log.error("GoodsDetailController --> findGoodsDetailById() error!", e);
@ -210,5 +236,8 @@ public class GoodsController {
} }
} }
} }

@ -1,7 +1,5 @@
package com.cweb.controller.Goods; package com.cweb.controller.Goods;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
@ -10,16 +8,13 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.GoodsDetail; import com.hai.entity.GoodsDetail;
import com.hai.entity.GoodsShoppingCart; import com.hai.entity.GoodsShoppingCart;
import com.hai.entity.GoodsShoppingCartExample;
import com.hai.entity.GoodsSku; import com.hai.entity.GoodsSku;
import com.hai.goods.model.GoodsModel;
import com.hai.goods.model.ShoppingCartModel; import com.hai.goods.model.ShoppingCartModel;
import com.hai.goods.service.GoodsDetailService; import com.hai.goods.service.GoodsDetailService;
import com.hai.goods.service.GoodsSkuService; import com.hai.goods.service.GoodsSkuService;
import com.hai.goods.service.ShoppingCartService; import com.hai.goods.service.ShoppingCartService;
import com.hai.model.HighUserModel; import com.hai.model.HighUserModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -31,7 +26,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
@Controller @Controller
@ -180,11 +174,13 @@ public class ShoppingCartController {
} }
} }
@RequestMapping(value = "/goodsAddNum", method = RequestMethod.GET) @RequestMapping(value = "/goodsEditNum", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "商品增加数量") @ApiOperation(value = "商品编辑数量")
public ResponseData goodsAddNum( public ResponseData goodsEditNum(
@RequestParam(value = "id", required = true) Long id, HttpServletRequest request @RequestParam(value = "id", required = true) Long id,
@RequestParam(value = "num", required = true) String num
, HttpServletRequest request
) { ) {
try { try {
@ -206,10 +202,11 @@ public class ShoppingCartController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户信息错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户信息错误");
} }
shoppingCart.setNum(num);
shoppingCart.setNum(String.valueOf(Integer.parseInt(shoppingCart.getNum())+1));
shoppingCart.setUpdateTime(new Date()); shoppingCart.setUpdateTime(new Date());
shoppingCartService.updateShoppingCart(shoppingCart);
return ResponseMsgUtil.success("增加成功"); return ResponseMsgUtil.success("增加成功");
} catch (Exception e) { } catch (Exception e) {

@ -113,6 +113,16 @@ public class OrderController {
log.error("OrderController -> create() error!",""); log.error("OrderController -> create() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入下单手机号!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入下单手机号!");
} }
} else if (childModel.getGoodsType().equals(OrderChildGoodsType.TYPE11.getNumber())) {
if (childModel.getSkuId() == null) {
log.error("OrderController -> create() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请选择规格!");
}
if (body.getDeliveryAddressId() == null) {
log.error("OrderController -> create() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请选择收货地址!");
}
} }
} }

@ -51,6 +51,7 @@ public class PageUtil {
pageInfo.setNextPage(currentPage < ((total + pageSize - 1) / pageSize) ? currentPage + 1 : currentPage); pageInfo.setNextPage(currentPage < ((total + pageSize - 1) / pageSize) ? currentPage + 1 : currentPage);
pageInfo.setTotal(total); pageInfo.setTotal(total);
pageInfo.setPageNum(currentPage); pageInfo.setPageNum(currentPage);
pageInfo.setPageSize(pageSize);
pageInfo.setPages((total + pageSize - 1) / pageSize); pageInfo.setPages((total + pageSize - 1) / pageSize);
pageInfo.setNavigateLastPage((total + pageSize - 1) / pageSize); pageInfo.setNavigateLastPage((total + pageSize - 1) / pageSize);
pageInfo.setPrePage(currentPage > 1 ? currentPage - 1 : currentPage); pageInfo.setPrePage(currentPage > 1 ? currentPage - 1 : currentPage);

@ -2,6 +2,7 @@ package com.hai.goods.model;
import com.hai.entity.GoodsDetail; import com.hai.entity.GoodsDetail;
import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
public class GoodsModel extends GoodsDetail { public class GoodsModel extends GoodsDetail {
@ -10,8 +11,10 @@ public class GoodsModel extends GoodsDetail {
private BigDecimal originalPrice; private BigDecimal originalPrice;
private Boolean whetherMultiple; private Boolean whetherMultiple;
public BigDecimal getPrice() { public BigDecimal getPrice() {
return price; return price;
} }

@ -0,0 +1,68 @@
package com.hai.goods.service;
import com.hai.entity.GoodsPresent;
import java.util.List;
import java.util.Map;
/**
* @serviceName GoodsPresentService.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 商品赠送业务
* @createTime 14:17 2023/4/17
**/
public interface GoodsPresentService {
/**
* @Author Sum1Dream
* @Name insertGoodsPresent
* @Description // 新增
* @Date 15:08 2023/4/11
* @Param [GoodsPresent]
* @Return void
*/
void insertPresent(GoodsPresent present);
/**
* @Author Sum1Dream
* @Name updateGoodsPresent
* @Description // 更新
* @Date 15:14 2023/4/11
* @Param [GoodsPresent]
* @Return void
*/
void updatePresent(GoodsPresent present);
/**
* @Author Sum1Dream
* @Name getGoodsPresentList
* @Description // 查询
* @Date 15:17 2023/4/11
* @Param [map]
* @Return java.util.List<com.hai.entity.GoodsPresent>
*/
List<GoodsPresent> getPresentList(Map<String , Object> map);
/**
* @Author Sum1Dream
* @Name findGoodsPresentById
* @Description // 根据id查询详情
* @Date 16:19 2023/4/11
* @Param [id]
* @Return com.hai.entity.GoodsPresent
*/
GoodsPresent findPresentById(Long id);
/**
* @Author Sum1Dream
* @Name deletePresent
* @Description // 删除
* @Date 17:37 2023/4/13
* @Param [id]
* @Return void
*/
void deletePresent(Long id);
}

@ -37,6 +37,9 @@ public class DeliveryAddressServiceImpl implements DeliveryAddressService {
if (MapUtils.getLong(map, "userId") != null) { if (MapUtils.getLong(map, "userId") != null) {
criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId")); criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId"));
} }
if (MapUtils.getBoolean(map, "whetherDefault") != null) {
criteria.andWhetherDefaultEqualTo(MapUtils.getBoolean(map, "whetherDefault"));
}
return deliveryAddressMapper.selectByExample(example); return deliveryAddressMapper.selectByExample(example);
} }

@ -40,8 +40,8 @@ public class GoodsDetailServiceImpl implements GoodsDetailService {
GoodsDetailExample example = new GoodsDetailExample(); GoodsDetailExample example = new GoodsDetailExample();
GoodsDetailExample.Criteria criteria = example.createCriteria(); GoodsDetailExample.Criteria criteria = example.createCriteria();
if (MapUtils.getString(map, "name") != null) { if (MapUtils.getString(map, "title") != null) {
criteria.andNameLike("%" + MapUtils.getString(map, "name") + "%"); criteria.andNameLike("%" + MapUtils.getString(map, "title") + "%");
} }
if (MapUtils.getLong(map, "goodsType") != null) { if (MapUtils.getLong(map, "goodsType") != null) {
criteria.andGoodsTypeEqualTo(MapUtils.getLong(map, "goodsType") ); criteria.andGoodsTypeEqualTo(MapUtils.getLong(map, "goodsType") );

@ -0,0 +1,53 @@
package com.hai.goods.service.impl;
import com.hai.dao.GoodsPresentMapper;
import com.hai.entity.GoodsPresent;
import com.hai.entity.GoodsPresentExample;
import com.hai.entity.GoodsRegionFreight;
import com.hai.goods.service.GoodsPresentService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service("goodsPresentService")
public class GoodsPresentServiceImpl implements GoodsPresentService {
@Resource
private GoodsPresentMapper goodsPresentMapper;
@Override
public void insertPresent(GoodsPresent present) {
goodsPresentMapper.insert(present);
}
@Override
public void updatePresent(GoodsPresent present) {
goodsPresentMapper.updateByPrimaryKey(present);
}
@Override
public List<GoodsPresent> getPresentList(Map<String, Object> map) {
GoodsPresentExample example = new GoodsPresentExample();
GoodsPresentExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "goodsId") != null) {
criteria.andGoodsIdEqualTo(MapUtils.getLong(map, "goodsId"));
}
criteria.andStatusNotEqualTo(String.valueOf(0));
return goodsPresentMapper.selectByExample(example);
}
@Override
public GoodsPresent findPresentById(Long id) {
return goodsPresentMapper.selectByPrimaryKey(id);
}
@Override
public void deletePresent(Long id) {
goodsPresentMapper.deleteByPrimaryKey(id);
}
}

@ -113,74 +113,7 @@ public class GoodsRegionFreightServiceImpl implements GoodsRegionFreightService
return jsonObject; return jsonObject;
} }
getRegionFreight(region.getParentId().toString()); return getRegionFreight(region.getParentId().toString());
return jsonObject;
} }
// @Override
// public JSONObject getRegionFreight(String regionId) throws Exception {
//
// // 获取默认包邮价格 , 运费
// BigDecimal freePostPrice = new BigDecimal(secConfigService.findByCodeType("FREE_POST_PRICE").getCodeValue());
// BigDecimal freightPrice = new BigDecimal(secConfigService.findByCodeType("FREIGHT_PRICE").getCodeValue());
//
// JSONObject jsonObject = new JSONObject();
//
// // 查询当前登记
// GoodsRegionFreight goodsRegionFreight = findRegionFreightByRegionId(regionId);
//
// SecRegion region = commonService.getRegionsById(Long.parseLong(regionId));
//
// if (region == null) {
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无效区域编码!");
// }
//
// if (goodsRegionFreight != null) {
// jsonObject.put("freePostPrice" , goodsRegionFreight.getFreePostPrice());
// jsonObject.put("freightPrice" , goodsRegionFreight.getFreightPrice());
// return jsonObject;
// }
//
// if (region.getParentId() == null) {
// jsonObject.put("freePostPrice" , freePostPrice);
// jsonObject.put("freightPrice" , freightPrice);
// return jsonObject;
// }
//
// GoodsRegionFreight goodsRegionFreight1 = findRegionFreightByRegionId(region.getParentId().toString());
// SecRegion region1 = commonService.getRegionsById(region.getParentId());
//
// if (goodsRegionFreight1 != null) {
// jsonObject.put("freePostPrice" , goodsRegionFreight1.getFreePostPrice());
// jsonObject.put("freightPrice" , goodsRegionFreight1.getFreightPrice());
// return jsonObject;
// }
//
// if (region1.getParentId() == null) {
// jsonObject.put("freePostPrice" , freePostPrice);
// jsonObject.put("freightPrice" , freightPrice);
// return jsonObject;
// }
//
// GoodsRegionFreight goodsRegionFreight2 = findRegionFreightByRegionId(region1.getParentId().toString());
// SecRegion region2 = commonService.getRegionsById(region1.getParentId());
//
// if (goodsRegionFreight2 != null) {
// jsonObject.put("freePostPrice" , goodsRegionFreight2.getFreePostPrice());
// jsonObject.put("freightPrice" , goodsRegionFreight2.getFreightPrice());
// return jsonObject;
// }
//
// if (region2.getParentId() == null) {
// jsonObject.put("freePostPrice" , freePostPrice);
// jsonObject.put("freightPrice" , freightPrice);
// return jsonObject;
// }
//
// jsonObject.put("freePostPrice" , freePostPrice);
// jsonObject.put("freightPrice" , freightPrice);
//
// return jsonObject;
// }
} }

@ -36,6 +36,17 @@ public class CreateOrderChildModel {
/** /**
* 产品类型 * 产品类型
* 1. 卡卷
* 2. 积分充值
* 3. 加油订单
* 4. KFC
* 5. 电影票
* 6. 话费充值
* 7. 优惠卷包
* 8. 汇联通充值
* 9. 星巴克
* 10. 第三方充值
* 11. 实物商品购买
*/ */
private Integer goodsType; private Integer goodsType;
@ -101,5 +112,11 @@ public class CreateOrderChildModel {
// 充值内容 // 充值内容
private String rechargeContent; private String rechargeContent;
/** ======================= 话费充值所需参数 end ======================== **/ /** ======================= 话费充值所需参数 end ======================== **/
/** ======================= 实物商品所需参数 start ======================== **/
// 规格编码
private Long skuId;
// 商品内容
private Long shopCartId;
/** ======================= 实物商品所需参数 end ======================== **/
} }

@ -64,6 +64,11 @@ public class CreateOrderModel {
*/ */
private String remarks; private String remarks;
/**
* 收货地址
*/
private Long deliveryAddressId;
/** /**
* 子订单参数模型 * 子订单参数模型
*/ */

@ -19,6 +19,7 @@ public enum OrderChildGoodsType {
TYPE8(8, "贵州汇联通工会卡充值"), TYPE8(8, "贵州汇联通工会卡充值"),
TYPE9(9, "星巴克"), TYPE9(9, "星巴克"),
TYPE10(10, "第三方充值"), TYPE10(10, "第三方充值"),
TYPE11(11, "实物商品购买"),
; ;
private Integer number; private Integer number;

Loading…
Cancel
Save