Merge branch 'cpupon-dev' of http://gitea.dctpay.com/hurui/puhui-go into cpupon-dev

cpupon-dev
袁野 1 month ago
commit e4c7af56fb
  1. 2
      bweb/src/main/java/com/bweb/config/AuthConfig.java
  2. 2
      bweb/src/main/java/com/bweb/controller/file/FileController.java
  3. 130
      bweb/src/main/java/com/bweb/controller/goods/GoodPresentController.java
  4. 3
      bweb/src/main/java/com/bweb/controller/goods/GoodsController.java
  5. 1
      cweb/src/main/java/com/cweb/config/AuthConfig.java
  6. 7
      cweb/src/main/java/com/cweb/controller/cms/CmsContentController.java
  7. 66
      cweb/src/main/java/com/cweb/controller/discount/DiscountController.java
  8. 37
      cweb/src/main/java/com/cweb/controller/goods/GoodsController.java
  9. 101
      cweb/src/main/java/com/cweb/controller/output/OutputController.java
  10. 4
      order/src/main/java/com/order/controller/business/BsOrderGoodsController.java
  11. 2
      service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java
  12. 1
      service/src/main/java/com/hfkj/dao/GoodsSpecsMapperExt.java
  13. 2
      service/src/main/java/com/hfkj/entity/GoodsVpd.java
  14. 21
      service/src/main/java/com/hfkj/haioil/HaiOilService.java
  15. 5
      service/src/main/java/com/hfkj/jd/Impl/JdServiceImpl.java
  16. 19
      service/src/main/java/com/hfkj/model/discount/CouponDiscountUserRelModel.java
  17. 10
      service/src/main/java/com/hfkj/service/discount/CouponDiscountPackageService.java
  18. 15
      service/src/main/java/com/hfkj/service/discount/impl/CouponDiscountPackageServiceImpl.java
  19. 1
      service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java
  20. 59
      service/src/main/java/com/hfkj/service/goods/GoodPresentService.java
  21. 9
      service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java
  22. 62
      service/src/main/java/com/hfkj/service/goods/impl/GoodPresentServiceImpl.java
  23. 7
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  24. 38
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  25. 28
      service/src/main/java/com/hfkj/service/order/impl/BsOrderAfterSalesApplyServiceImpl.java
  26. 8
      service/src/main/java/com/hfkj/sysenum/GoodsVpdSourceEnum.java

@ -1,4 +1,4 @@
package com.cweb.config;
package com.bweb.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;

@ -46,7 +46,7 @@ public class FileController {
@RequestMapping(value="/getFileRecordsList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询列表")
public ResponseData getFileRecordsList( HttpServletRequest request) {
public ResponseData getFileRecordsList(HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);

@ -0,0 +1,130 @@
package com.bweb.controller.goods;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.CouponDiscountPackage;
import com.hfkj.entity.GoodPresent;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsType;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.discount.CouponDiscountPackageService;
import com.hfkj.service.goods.GoodPresentService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.Map;
@Controller
@RequestMapping(value="/goodPresent")
@Api(value="商品赠送")
public class GoodPresentController {
private static final Logger log = LoggerFactory.getLogger(GoodPresentController.class);
@Resource
private GoodPresentService goodPresentService;
@Resource
private CouponDiscountPackageService discountPackageService;
@Resource
private UserCenter userCenter;
@RequestMapping(value="/createGoodPresent",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "创建商品赠送")
public ResponseData createGoodPresent(@RequestBody GoodPresent body, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
if (!userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
if (body == null
|| body.getKey() == null
|| body.getType() == null
|| body.getSpecsId() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
CouponDiscountPackage discountPackage = discountPackageService.findDiscountPackageByKey(body.getKey());
if (discountPackage == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券包不存在");
}
body.setCreateTime(new Date());
body.setUpdateTime(new Date());
body.setStatus(1);
body.setName(discountPackage.getTitle());
goodPresentService.create(body);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getListBrand",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询列表")
public ResponseData getListBrand(@RequestParam(value = "specsId" , required = false) Long specsId) {
try {
Map<String , Object> map = new HashMap<>();
map.put("specsId", specsId);
return ResponseMsgUtil.success(goodPresentService.getList(map));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/delete",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "删除")
public ResponseData delete(@RequestParam(value = "id" , required = false) Long id, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
if (!userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
goodPresentService.delete(id , false);
return ResponseMsgUtil.success("删除成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -133,6 +133,7 @@ public class GoodsController {
goodsMsg.setGoodsTypeParent(goodsType.getParentId());
goodsMsg.setGoodsTypeParentName(goodsTypeService.findGoodsType(goodsType.getParentId()));
goodsMsg.setType(body.getType());
goodsMsg.setShowType(body.getShowType());
goodsMsg.setGoodsBrand(body.getGoodsBrand());
goodsMsg.setStatus(body.getStatus());
goodsMsg.setTitle(body.getTitle());
@ -256,7 +257,6 @@ public class GoodsController {
// 判断必填项
if ( goodsSpecs.getId() == null
|| body.getValidDay() == null
|| body.getType() == null
|| body.getSource() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
@ -271,7 +271,6 @@ public class GoodsController {
goodsVpd.setSpecsId(goodsSpecs.getId());
goodsVpd.setValidDay(body.getValidDay());
goodsVpd.setType(body.getType());
goodsVpd.setJumpType(body.getJumpType());
goodsVpd.setJumpUrl(body.getJumpUrl());
goodsVpd.setAppid(body.getAppid());

@ -95,6 +95,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/starbucks/*")
.excludePathPatterns("/meiTuan/*")
.excludePathPatterns("/jd/*")
.excludePathPatterns("/output/*")
;
}

@ -69,20 +69,21 @@ public class CmsContentController {
Map<String , Object> goodsMap = new HashMap<>();
goodsMap.put("status" , 1);
goodsMap.put("showType" , 1);
List<GoodsMsg> goodsMsgs = new ArrayList<>();
if (cmsContent.getShowType() == 1) {
goodsMap.put("goodsType", cmsContent.getShowDataId());
goodsMsgs = goodsMsgService.getList(goodsMap).stream().limit(2).collect(Collectors.toList());
goodsMsgs = goodsMsgService.getListCrest(goodsMap).stream().limit(2).collect(Collectors.toList());
}
if (cmsContent.getShowType() == 2) {
goodsMap.put("goodsType", cmsContent.getShowDataId());
goodsMsgs = goodsMsgService.getList(goodsMap).stream().limit(4).collect(Collectors.toList());
goodsMsgs = goodsMsgService.getListCrest(goodsMap).stream().limit(4).collect(Collectors.toList());
}
if (cmsContent.getShowType() == 3) {
goodsMap.put("goodsType", cmsContent.getShowDataId());
goodsMsgs = goodsMsgService.getList(goodsMap).stream().limit(10).collect(Collectors.toList());
goodsMsgs = goodsMsgService.getListCrest(goodsMap).stream().limit(10).collect(Collectors.toList());
}
for (GoodsMsg goodsMsg : goodsMsgs) {

@ -1,5 +1,6 @@
package com.cweb.controller.discount;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -10,9 +11,11 @@ import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.*;
import com.hfkj.haioil.HaiOilService;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.UserSessionObject;
import com.hfkj.model.discount.CouponDiscountUserRelModel;
import com.hfkj.model.discount.DiscountGoodsModel;
import com.hfkj.service.CommonService;
import com.hfkj.service.SecDictionaryService;
@ -63,18 +66,71 @@ public class DiscountController {
@RequestMapping(value = "/getListUserDiscount", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取用户优惠券列表")
public ResponseData getListUserDiscount(@RequestParam(value = "status", required = true) Integer status) {
public ResponseData getListUserDiscount(
@RequestParam(value = "status", required = true) Integer status,
@RequestParam(value = "source", required = true) Integer source
) {
try {
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
Map<String, Object> map = new HashMap<>();
if (source == 1) {
Map<String, Object> map = new HashMap<>();
map.put("userId", userSession.getUser().getId());
map.put("status", status);
map.put("userId", userSession.getUser().getId());
map.put("status", status);
return ResponseMsgUtil.success(discountUserRelService.getList(map));
} else {
List<CouponDiscountUserRelModel> list = new ArrayList<>();
if (userSession.getUser().getPhone() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户未绑定手机号!");
}
Map<String , Object> map = new HashMap<>();
if (status == 0) {
status = 3;
}
map.put("status" , status);
map.put("phone" , userSession.getUser().getPhone());
JSONObject object = HaiOilService.queryListByPhone(map);
if (object.getString("return_code").equals("000000")) {
JSONArray array = object.getJSONObject("return_data").getJSONArray("dataList");
for (int i = 0; i < array.size(); i++) {
JSONObject jsonObject = array.getJSONObject(i);
CouponDiscountUserRelModel rel = new CouponDiscountUserRelModel();
rel.setSource(2);
rel.setUserId(userSession.getUser().getId());
rel.setDiscountName(jsonObject.getString("discountName"));
rel.setDiscountType(jsonObject.getInteger("discountType"));
rel.setDiscountNo(jsonObject.getString("discountNo"));
rel.setDiscountCondition(jsonObject.getBigDecimal("discountCondition"));
if (jsonObject.getInteger("discountType") == 3) {
rel.setDiscountPercentage(jsonObject.getBigDecimal("discountPrice"));
} else {
rel.setDiscountPrice(jsonObject.getBigDecimal("discountPrice"));
}
if (jsonObject.getInteger("status") == 3) {
rel.setStatus(0);
}else {
rel.setStatus(jsonObject.getInteger("status"));
}
rel.setCreateTime(jsonObject.getDate("createTime"));
rel.setUseTime(jsonObject.getDate("useTime"));
rel.setUseEndTime(jsonObject.getDate("expirationTime"));
list.add(rel);
}
return ResponseMsgUtil.success(list);
} else {
return ResponseMsgUtil.success(null);
}
}
return ResponseMsgUtil.success(discountUserRelService.getList(map));
} catch (Exception e) {
log.error("GoodsDetailController --> getListUser() error!", e);

@ -10,16 +10,14 @@ import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.PageUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsSpecs;
import com.hfkj.entity.GoodsType;
import com.hfkj.entity.GoodsVpd;
import com.hfkj.entity.*;
import com.hfkj.jd.JdService;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.goods.GoodsModel;
import com.hfkj.model.goods.GoodsModelSpecs;
import com.hfkj.model.goods.GoodsTypeModel;
import com.hfkj.service.discount.CouponDiscountService;
import com.hfkj.service.goods.*;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import io.swagger.annotations.Api;
@ -59,9 +57,10 @@ public class GoodsController {
@Resource
private GoodsVpdService goodsVpdService;
@Resource
private JdService jdService;
@Resource
private CouponDiscountService couponDiscountService;
@RequestMapping(value="/getListGoodsType",method = RequestMethod.GET)
@ -114,6 +113,8 @@ public class GoodsController {
@RequestParam(value = "title", required = false) String title,
@RequestParam(value = "goodsTypeParent", required = false) Long goodsTypeParent,
@RequestParam(value = "goodsType", required = false) Long goodsType,
@RequestParam(value = "showType", required = false) Integer showType,
@RequestParam(value = "discountId", required = false) Integer discountId,
@RequestParam(value = "goodsBrand", required = false) Long goodsBrand,
@RequestParam(value = "price", required = false) Integer price,
@RequestParam(value = "saleNum", required = false) Integer saleNum,
@ -129,6 +130,7 @@ public class GoodsController {
map.put("title", title);
map.put("goodsType", goodsType);
map.put("showType", showType);
map.put("goodsTypeParent", goodsTypeParent);
map.put("goodsBrand", goodsBrand);
map.put("saleNum", saleNum);
@ -141,6 +143,14 @@ public class GoodsController {
List<GoodsModel> goodsModels = new ArrayList<>();
// 查询优惠券可以用规格
Map<String, Object> mapSpecs = new HashMap<>();
mapSpecs.put("discountId", discountId);
// 查询规格可用优惠券
List<CouponDiscountGoodsRel> couponDiscountGoodsRel = couponDiscountService.getListGoodsRel(mapSpecs);
for (GoodsMsg goodsMsg : list) {
GoodsModel goodsModel = new GoodsModel();
@ -151,12 +161,29 @@ public class GoodsController {
BigDecimal minPrice = goodsSpecs.get(0).getSalePrice();
BigDecimal minOriginalPrice = goodsSpecs.get(0).getOriginalPrice();
for (GoodsSpecs specs : goodsSpecs) {
if (specs.getSalePrice().compareTo(minPrice) < 0) {
minPrice = specs.getSalePrice();
minOriginalPrice = specs.getOriginalPrice();
}
if (discountId != null) {
CouponDiscountGoodsRel discountGoodsRel = couponDiscountGoodsRel.stream().filter(s -> s.getSpecsId().equals(specs.getId())).findFirst().orElse(null);
if (discountGoodsRel == null) {
specs.setExt1("0");
}
}
}
// todo 删除没有绑定优惠券的
goodsSpecs = goodsSpecs.stream().filter(s-> !s.getExt1().equals("0")).collect(Collectors.toList());
if (goodsSpecs.isEmpty()) {
continue;
}
BeanUtils.copyProperties(goodsMsg, goodsModel);
goodsModel.setOriginalPrice(minOriginalPrice);
goodsModel.setPrice(minPrice);

@ -0,0 +1,101 @@
package com.cweb.controller.output;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.api.ApiMerService;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.common.utils.SignatureUtil;
import com.hfkj.entity.*;
import com.hfkj.model.ResponseData;
import com.hfkj.model.UserSessionObject;
import com.hfkj.service.SecDictionaryService;
import com.hfkj.service.discount.CouponDiscountPackageService;
import com.hfkj.service.discount.CouponDiscountService;
import com.hfkj.service.discount.CouponDiscountUserRelService;
import com.hfkj.service.user.BsUserService;
import com.hfkj.sysenum.UserLoginPlatform;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@Controller
@RequestMapping(value="/output")
@Api(value="输出外部接口")
public class OutputController {
private static final Logger log = LoggerFactory.getLogger(OutputController.class);
@Resource
private ApiMerService apiMerService;
@Resource
private CouponDiscountUserRelService discountUserRelService;
@Resource
private BsUserService bsUserService;
@RequestMapping(value = "/getListUserDiscount", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取用户优惠券列表")
public ResponseData getListUserDiscount(@RequestBody JSONObject body) {
try {
if (body == null
|| StringUtils.isBlank(body.getString("status"))
|| StringUtils.isBlank(body.getString("phone"))
|| StringUtils.isBlank(body.getString("sign"))
|| StringUtils.isBlank(body.getString("appid"))
) {
log.error("LoginController --> phone() error!", "请求参数校验失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询api商户信息
ApiMer apiMer = apiMerService.queryDetail(body.getString("appid"));
Map<String , Object> map = new HashMap<>();
map.put("appid" , body.getString("appid"));
map.put("phone" , body.getString("phone"));
map.put("status" , body.getString("status"));
String sign = SignatureUtil.createSign(map , apiMer.getAppSecret());
if (!body.getString("sign").equals(sign)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "签名校验失败!");
}
// 查询用户信息
BsUser user = bsUserService.getUser(body.getString("phone"));
if (user == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户不存在!");
}
Map<String, Object> mapPost = new HashMap<>();
mapPost.put("userId", user.getId());
mapPost.put("status", body.getInteger("status"));
return ResponseMsgUtil.success(discountUserRelService.getList(mapPost));
} catch (Exception e) {
log.error("GoodsDetailController --> getListUser() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -305,10 +305,6 @@ public class BsOrderGoodsController {
BsOrderGoods goodsOrder = bsOrderGoodsService.queryDetail(body.getId());
if (goodsOrder == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "信息错误!");
}

@ -42,7 +42,6 @@ public interface GoodsMsgMapperExt {
" SELECT" +
" id ," +
" title as title," +
" title as title," +
" list_img as listImg," +
" third_id as thirdId," +
" sale_num as saleNum" +
@ -51,6 +50,7 @@ public interface GoodsMsgMapperExt {
" <if test='param.goodsTypeParent != null'> and goods_type_parent = #{param.goodsTypeParent} </if>" +
" <if test='param.title != null'> and title like concat('%',#{param.title},'%') </if>" +
" <if test='param.goodsType != null'> and goods_type = #{param.goodsType} </if>" +
" <if test='param.showType != null'> and show_type = #{param.showType} </if>" +
" <if test='param.goodsBrand != null'> and goods_brand = #{param.goodsBrand} </if>" +
" <if test='param.time != 1'>ORDER BY update_time desc</if>" +
" <if test='param.time == 1'>ORDER BY create_time desc</if>" +

@ -17,6 +17,7 @@ public interface GoodsSpecsMapperExt {
@Select("<script>" +
" SELECT" +
" id as id ," +
" goods_id as goodsId ," +
" sale_price as salePrice," +
" original_price as originalPrice" +

@ -39,7 +39,7 @@ public class GoodsVpd implements Serializable {
private Integer type;
/**
* 产品来源1.内部虚拟商品 4.贵州中石化 5.重庆中石油 6.比邻星停车券 7.四川中石油 10.中油优途中石油
* 产品来源1.内部优惠券包 2娱尚虚拟商品 3:嗨加油优惠券包 4.贵州中石化 5.重庆中石油 6.比邻星停车券 7.四川中石油 10.中油优途中石油
*/
private Integer source;

@ -37,6 +37,27 @@ public class HaiOilService {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
}
}
/**
* @MethodName queryListByPhone
* @Description: 根据手机号查询优惠券包
* @param map
* @return: com.alibaba.fastjson.JSONObject
* @Author: Sum1Dream
* @Date: 2024/9/9 下午3:00
*/
public static JSONObject queryListByPhone(Map<String , Object> map) throws Exception {
JSONObject object = request("/openapi/discount/queryListByPhone" , map);
if (Objects.equals(object.getString("return_code"), "000000")) {
return object;
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
}
}
/**

@ -87,10 +87,13 @@ public class JdServiceImpl implements JdService {
public String getToken() throws Exception {
Object token = redisUtil.get("jd_access_token");
for (int i = 0; i < 10; i++) {
}
if (token == null) {
// 请求回调 会在回调存入参数
JdPostService.getAccessToken();
// getToken();
getToken();
}
return token.toString();
}

@ -0,0 +1,19 @@
package com.hfkj.model.discount;
import com.hfkj.entity.CouponDiscountUserRel;
import lombok.Data;
@Data
public class CouponDiscountUserRelModel extends CouponDiscountUserRel {
/**
* 优惠券来源
*/
private Integer source;
/**
* 优惠券编号
*/
private String discountNo;
}

@ -111,6 +111,16 @@ public interface CouponDiscountPackageService {
void deleteDetail(Integer id);
/**
* @MethodName findDiscountPackageByKey
* @Description: 根据key查询优惠券包
* @param key
* @return: com.hfkj.entity.CouponDiscountPackage
* @Author: Sum1Dream
* @Date: 2024/12/16 下午5:38
*/
CouponDiscountPackage findDiscountPackageByKey(String key);
/**
* @MethodName giveDiscountPackage
* @Description: 赠送优惠券包

@ -156,6 +156,21 @@ public class CouponDiscountPackageServiceImpl implements CouponDiscountPackageSe
couponDiscountPackageDetailsMapper.deleteByPrimaryKey(id);
}
@Override
public CouponDiscountPackage findDiscountPackageByKey(String key) {
CouponDiscountPackageExample example = new CouponDiscountPackageExample();
CouponDiscountPackageExample.Criteria criteria = example.createCriteria();
criteria.andKeyEqualTo(key);
List<CouponDiscountPackage> list = couponDiscountPackageMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public void giveDiscountPackage(Integer discountPackageId, String phone) {
CouponDiscountPackage discountPackage = queryDetail(Long.valueOf(discountPackageId));

@ -27,6 +27,7 @@ public interface BsOrderGoodsService {
* @return void
*/
void update(BsOrderGoods orderGoods);
void updateIsNull(BsOrderGoods orderGoods);
/**
* @Author Sum1Dream

@ -0,0 +1,59 @@
package com.hfkj.service.goods;
import com.hfkj.entity.GoodPresent;
import java.util.List;
import java.util.Map;
public interface GoodPresentService {
/**
* @Author Sum1Dream
* @Name create
* @Description // 创建
* @Date 15:12 2024/4/19
* @Param GoodsBrand
* @return void
*/
void create(GoodPresent goodPresent);
/**
* @MethodName update
* @Description: 更新
* @param goodPresent
* @Author: Sum1Dream
* @Date: 2024/12/18 下午3:39
*/
void update(GoodPresent goodPresent);
/**
* @MethodName findById
* @Description:
* @param id
* @return: com.hfkj.entity.GoodPresent
* @Author: Sum1Dream
* @Date: 2024/12/18 下午3:38
*/
GoodPresent findById(Long id);
/**
* @MethodName getList
* @Description: 查询列表
* @param map
* @return: java.util.List<com.hfkj.entity.GoodPresent>
* @Author: Sum1Dream
* @Date: 2024/12/18 下午3:39
*/
List<GoodPresent> getList(Map<String , Object> map);
/**
* @MethodName delete
* @Description: 删除
* @param id
* @param fullDelete
* @Author: Sum1Dream
* @Date: 2024/12/18 下午3:42
*/
void delete(Long id , Boolean fullDelete);
}

@ -53,6 +53,11 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
bsOrderGoodsMapper.updateByPrimaryKeySelective(orderGoods);
}
@Override
public void updateIsNull(BsOrderGoods orderGoods) {
bsOrderGoodsMapper.updateByPrimaryKey(orderGoods);
}
@Override
public void delete(Long id, Boolean fullDelete) {
if (fullDelete) {
@ -312,6 +317,7 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
@Override
public void confirmReceipt(Long orderGoodsId) {
BsOrderGoods orderGoods = queryDetail(orderGoodsId);
if (orderGoods == null ||
orderGoods.getStatus() == 1 ||
orderGoods.getStatus() == 5 ||
@ -321,6 +327,9 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前状态,不支持确认收货!");
}
if (orderGoods.getLogisticsNo() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前状态,不支持确认收货!");
}
// 子订单完成
orderService.childOrderComplete(orderGoods.getChildOrderNo());

@ -0,0 +1,62 @@
package com.hfkj.service.goods.impl;
import com.hfkj.dao.GoodPresentMapper;
import com.hfkj.entity.GoodPresent;
import com.hfkj.entity.GoodPresentExample;
import com.hfkj.entity.GoodsBrand;
import com.hfkj.service.goods.GoodPresentService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("goodPresentService")
public class GoodPresentServiceImpl implements GoodPresentService {
@Resource
private GoodPresentMapper goodPresentMapper;
@Override
public void create(GoodPresent goodPresent) {
goodPresentMapper.insert(goodPresent);
}
@Override
public void update(GoodPresent goodPresent) {
goodPresentMapper.updateByPrimaryKey(goodPresent);
}
@Override
public GoodPresent findById(Long id) {
return goodPresentMapper.selectByPrimaryKey(id);
}
@Override
public List<GoodPresent> getList(Map<String, Object> map) {
GoodPresentExample example = new GoodPresentExample();
GoodPresentExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "specsId") != null) {
criteria.andSpecsIdEqualTo(MapUtils.getLong(map, "specsId"));
}
return goodPresentMapper.selectByExample(example);
}
@Override
public void delete(Long id, Boolean fullDelete) {
if (fullDelete) {
goodPresentMapper.deleteByPrimaryKey(id);
} else {
GoodPresent goodPresent = findById(id);
goodPresent.setStatus(0);
goodPresent.setUpdateTime(new Date());
update(goodPresent);
}
}
}

@ -129,7 +129,11 @@ public class OrderCreateService {
orderChild.setBusiness(goodsVpd);
if (goodsVpd.getSource().equals(GoodsVpdSourceEnum.type2.getCode())) {
yuShang(order , orderChild , goodsVpd , goodsMsg , goodsSpecs , businessObj);
} else if (goodsVpd.getSource().equals(GoodsVpdSourceEnum.type4.getCode()) || goodsVpd.getSource().equals(GoodsVpdSourceEnum.type10.getCode())) {
} else if (
goodsVpd.getSource().equals(GoodsVpdSourceEnum.type1.getCode()) ||
goodsVpd.getSource().equals(GoodsVpdSourceEnum.type3.getCode()) ||
goodsVpd.getSource().equals(GoodsVpdSourceEnum.type4.getCode()) ||
goodsVpd.getSource().equals(GoodsVpdSourceEnum.type10.getCode())) {
couponHlt(order , orderChild , goodsVpd , goodsMsg , goodsSpecs , businessObj);
}
@ -219,6 +223,7 @@ public class OrderCreateService {
}
orderCouponNo.setChannelOrderNo(response.getJSONObject("data").getString("rechargeOrderId"));
}
orderCouponNoService.editData(orderCouponNo);
}
}

@ -9,6 +9,7 @@ import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.OrderUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.*;
import com.hfkj.haioil.HaiOilService;
import com.hfkj.jd.JdService;
import com.hfkj.meituan.MeiTuanService;
import com.hfkj.model.order.OrderModel;
@ -17,6 +18,7 @@ import com.hfkj.qianzhu.StarbucksService;
import com.hfkj.service.coupon.BsOrderCouponNoService;
import com.hfkj.service.coupon.BsOrderCouponService;
import com.hfkj.service.coupon.channel.*;
import com.hfkj.service.discount.CouponDiscountPackageService;
import com.hfkj.service.goods.*;
import com.hfkj.service.goods.impl.BsOrderStarbucksServiceImpl;
import com.hfkj.service.hlt.HuiLianTongUnionCardService;
@ -57,14 +59,15 @@ public class OrderPaySuccessService {
@Resource
private GoodsVpdService goodsVpdService;
@Resource
private BsOrderStarbucksService orderStarbucksService;
private CouponDiscountPackageService discountPackageService;
@Resource
private BsOrderCinemaService bsOrderCinemaService;
@Resource
private BsOrderStarbucksServiceImpl bsOrderStarbucksService;
@Resource
private BsOrderMeiTuanService bsOrderMeiTuanService;
@Resource
private CouponDiscountPackageService couponDiscountPackageService;
@Resource
private BsOrderMemberService bsOrderMemberService;
@Resource
@ -152,8 +155,37 @@ public class OrderPaySuccessService {
List<BsOrderCouponNo> couponNoList = orderCouponNoService.getListByCouponOrderId(orderCoupon.getId());
for (BsOrderCouponNo couponNo : couponNoList) {
try {
if (vpd.getSource() == GoodsVpdSourceEnum.type1.getCode()) {
// 查询优惠券包
CouponDiscountPackage couponDiscountPackage = discountPackageService.findDiscountPackageByKey(vpd.getKey());
if (couponDiscountPackage != null) {
couponDiscountPackageService.giveDiscountPackage(couponDiscountPackage.getId().intValue() , order.getUserPhone());
couponNo.setExpireTime(couponDiscountPackage.getEffectiveTime());
couponNo.setDeliverTime(new Date());
couponNo.setGoodsVpdSourceCouNo(couponDiscountPackage.getKey());
couponNo.setStatus(OrderCouponNoStatusEnum.status2.getCode());
orderCouponNoService.editData(couponNo);
}
} else if (vpd.getSource() == GoodsVpdSourceEnum.type3.getCode()) {
// 推送给嗨加油
Map<String , Object> map = new HashMap<>();
map.put("discountPkNo" , vpd.getKey());
map.put("number" , 1);
map.put("phone" , order.getUserPhone());
JSONObject returnParam = HaiOilService.pushPk(map);
if (returnParam.getString("return_code").equals("000000")) {
JSONArray dataArray = returnParam.getJSONObject("return_data").getJSONArray("codeList");
couponNo.setExpireTime(dataArray.getJSONObject(0).getDate("expirationDate"));
couponNo.setDeliverTime(new Date());
couponNo.setGoodsVpdSourceCouNo(vpd.getKey());
couponNo.setStatus(OrderCouponNoStatusEnum.status2.getCode());
orderCouponNoService.editData(couponNo);
}
if (vpd.getSource() == GoodsVpdSourceEnum.type4.getCode()) {
}else if (vpd.getSource() == GoodsVpdSourceEnum.type4.getCode()) {
// 推送给汇联通
JSONObject returnParam = HuiLianTongCouponService.costRechargeOrder(couponNo.getChannelOrderNo());
if (returnParam.getString("respCode").equals("0000")) {

@ -15,10 +15,7 @@ import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsMsgService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.service.order.*;
import com.hfkj.sysenum.order.OrderAfterSalesApplyStatusEnum;
import com.hfkj.sysenum.order.OrderAfterSalesApplyTypeEnum;
import com.hfkj.sysenum.order.OrderChildStatusEnum;
import com.hfkj.sysenum.order.OrderRefundStatusEnum;
import com.hfkj.sysenum.order.*;
import com.jd.open.api.sdk.response.vopsh.VopAfsCreateAfsApplyResponse;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -62,6 +59,7 @@ public class BsOrderAfterSalesApplyServiceImpl implements BsOrderAfterSalesApply
private GoodsMsgService goodsMsgService;
@Resource
private BsOrderAfterSalesAddressRecordService afterSalesAddressRecordService;
@Override
public void editData(BsOrderAfterSalesApply data) {
data.setUpdateTime(new Date());
@ -85,6 +83,7 @@ public class BsOrderAfterSalesApplyServiceImpl implements BsOrderAfterSalesApply
&& !orderChild.getStatus().equals(OrderChildStatusEnum.status3.getCode()) ) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误,无法提交");
}
// 查询订单
BsOrder order = orderService.getOrder(orderChild.getOrderNo());
if (order == null) {
@ -132,6 +131,16 @@ public class BsOrderAfterSalesApplyServiceImpl implements BsOrderAfterSalesApply
}
editData(apply);
// 实物商品状态修改为售后中
if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) {
BsOrderGoods goods = bsOrderGoodsService.findGoodsOrderByChild(orderChild.getChildOrderNo());
goods.setStatus(6);
goods.setLogisticsStatus("售后中");
goods.setLogisticsStatusDesc("售后中");
goods.setUpdateTime(new Date());
bsOrderGoodsService.update(goods);
}
// 操作记录
BsOrderAfterSalesOpRecord opRecord = new BsOrderAfterSalesOpRecord();
opRecord.setApplyNo(apply.getApplyNo());
@ -184,6 +193,15 @@ public class BsOrderAfterSalesApplyServiceImpl implements BsOrderAfterSalesApply
} else {
apply.setStatus(OrderAfterSalesApplyStatusEnum.type2.getCode());
BsOrderGoods bsOrderGoods = bsOrderGoodsService.findGoodsOrderByChild(apply.getChildOrderNo());
if (bsOrderGoods != null) {
bsOrderGoods.setStatus(2);
bsOrderGoods.setLogisticsStatus(null);
bsOrderGoods.setLogisticsStatusDesc(null);
bsOrderGoods.setUpdateTime(new Date());
bsOrderGoodsService.updateIsNull(bsOrderGoods);
}
}
// 操作记录
@ -308,7 +326,6 @@ public class BsOrderAfterSalesApplyServiceImpl implements BsOrderAfterSalesApply
if (response.getOpenRpcResult().getSuccess()) {
apply.setStatus(OrderAfterSalesApplyStatusEnum.type4.getCode());
editData(apply);
// 操作记录
BsOrderAfterSalesOpRecord opRecord = new BsOrderAfterSalesOpRecord();
opRecord.setApplyNo(apply.getApplyNo());
@ -322,7 +339,6 @@ public class BsOrderAfterSalesApplyServiceImpl implements BsOrderAfterSalesApply
apply.setAuditMsg(response.getOpenRpcResult().getResultMessage());
editData(apply);
}
}
@Override

@ -9,13 +9,17 @@ package com.hfkj.sysenum;
public enum GoodsVpdSourceEnum {
/**
* 内部虚拟商品
* 内部优惠券包
*/
type1(1, "内部虚拟商品"),
type1(1, "内部优惠券包"),
/**
* 娱尚虚拟商品
*/
type2(2, "娱尚虚拟商品"),
/**
* 娱尚虚拟商品
*/
type3(3, "嗨加油优惠券包"),
/**
* 贵州中石化
*/

Loading…
Cancel
Save