袁野 5 days ago
parent c0a396a84b
commit d57eef3c6e
  1. 12
      bweb/src/main/java/com/bweb/controller/TestController.java
  2. 157
      bweb/src/main/java/com/bweb/controller/goods/GoodsController.java
  3. 17
      cweb/src/main/java/com/cweb/controller/cms/CmsContentController.java
  4. 3
      cweb/src/main/java/com/cweb/controller/goods/DeliveryAddressController.java
  5. 22
      cweb/src/main/java/com/cweb/controller/goods/GoodsController.java
  6. 22
      cweb/src/main/java/com/cweb/controller/goods/ShoppingCartController.java
  7. 2
      order/src/main/java/com/order/controller/notify/JdNotify.java
  8. 1
      service/src/main/java/com/hfkj/common/exception/ErrorCode.java
  9. 55
      service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java
  10. 20
      service/src/main/java/com/hfkj/dao/GoodsSpecsMapperExt.java
  11. 81
      service/src/main/java/com/hfkj/jd/Impl/JdServiceImpl.java
  12. 4
      service/src/main/java/com/hfkj/jd/JdPostService.java
  13. 58
      service/src/main/java/com/hfkj/model/goods/JdGoodsModel.java
  14. 13
      service/src/main/java/com/hfkj/service/goods/GoodsMsgService.java
  15. 3
      service/src/main/java/com/hfkj/service/goods/GoodsSpecsService.java
  16. 11
      service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java
  17. 6
      service/src/main/java/com/hfkj/service/goods/impl/GoodsSpecsServiceImpl.java
  18. 18
      service/src/main/java/com/hfkj/service/goods/impl/GoodsUserAddressServiceImpl.java
  19. 4
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  20. 4
      service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java
  21. 1
      service/src/main/java/com/hfkj/sysenum/fileRecords/FileRecordsEnum.java
  22. 10
      service/src/main/resources/prod/commonConfig.properties
  23. 85
      user/src/main/java/com/user/controller/BsUserController.java

@ -143,19 +143,7 @@ public class TestController {
} }
} }
@RequestMapping(value="/querySkuByPage",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "querySkuByPage")
public ResponseData querySkuByPage() {
try {
return ResponseMsgUtil.success(JdPostService.querySkuByPage(jdService.getToken() , "7028" , 0).getOpenRpcResult().getResult().getSkus());
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getSkuDetailInfo",method = RequestMethod.GET) @RequestMapping(value="/getSkuDetailInfo",method = RequestMethod.GET)
@ResponseBody @ResponseBody

@ -1,5 +1,6 @@
package com.bweb.controller.goods; package com.bweb.controller.goods;
import com.alibaba.excel.EasyExcel;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorCode;
@ -7,15 +8,24 @@ import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.SessionObject; import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter; import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.OrderUtil; import com.hfkj.common.utils.OrderUtil;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.*; import com.hfkj.entity.*;
import com.hfkj.model.goods.GoodsModelSpecs; import com.hfkj.model.goods.GoodsModelSpecs;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject; import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.goods.JdGoodsModel;
import com.hfkj.model.order.orderExport.OrderGoodsExportModel;
import com.hfkj.service.audit.AuditMsgService; import com.hfkj.service.audit.AuditMsgService;
import com.hfkj.service.file.FileRecordsService;
import com.hfkj.service.goods.*; import com.hfkj.service.goods.*;
import com.hfkj.sysenum.SecUserObjectTypeEnum; import com.hfkj.sysenum.SecUserObjectTypeEnum;
import com.hfkj.sysenum.fileRecords.FileRecordsEnum;
import com.hfkj.sysenum.order.OrderChildStatusEnum;
import com.hfkj.sysenum.order.OrderPayChannelEnum;
import com.hfkj.sysenum.order.OrderPayTypeEnum;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -27,7 +37,12 @@ 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.io.File;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@Controller @Controller
@RequestMapping(value="/goods") @RequestMapping(value="/goods")
@ -63,6 +78,10 @@ public class GoodsController {
@Resource @Resource
private GoodsJumpService goodsJumpService; private GoodsJumpService goodsJumpService;
@Resource
private FileRecordsService fileRecordsService;
@RequestMapping(value="/editGoodsMsg",method = RequestMethod.POST) @RequestMapping(value="/editGoodsMsg",method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "编辑商品信息") @ApiOperation(value = "编辑商品信息")
@ -500,5 +519,143 @@ public class GoodsController {
} }
} }
@RequestMapping(value="/getJdGoodsList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询京东商品")
public ResponseData getJdGoodsList(@RequestParam(value = "title" , required = false) String title,
@RequestParam(value = "goodsType" , required = false) Long goodsType,
@RequestParam(value = "goodsBrand" , required = false) Integer goodsBrand,
@RequestParam(value = "salePriceS" , required = false) BigDecimal salePriceS,
@RequestParam(value = "salePriceE" , required = false) BigDecimal salePriceE,
@RequestParam(value = "pageNum" , required = true) Integer pageNum,
@RequestParam(value = "pageSize" , required = true) Integer pageSize) {
try {
Map<String,Object> param = new HashMap<>();
if (goodsType != null) {
GoodsType goodsType1 = goodsTypeService.queryDetail(goodsType);
if (goodsType1.getParentId() == null) {
param.put("goodsTypeParent", goodsType);
} else {
param.put("goodsType", goodsType);
}
}
param.put("title", title);
param.put("goodsBrand", goodsBrand);
param.put("salePriceS", salePriceS);
param.put("salePriceE", salePriceE);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(goodsMsgService.getJdGoodsList(param)));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/exportJdGoods",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "导出京东商品")
public ResponseData exportJdGoods(@RequestParam(value = "title" , required = false) String title,
@RequestParam(value = "goodsType" , required = false) Long goodsType,
@RequestParam(value = "goodsBrand" , required = false) Integer goodsBrand,
@RequestParam(value = "salePriceS" , required = false) BigDecimal salePriceS,
@RequestParam(value = "salePriceE" , required = false) BigDecimal salePriceE, HttpServletRequest request) {
// 插入下载记录
FileRecords fileRecords = new FileRecords();
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
Map<String,Object> map = new HashMap<>();
if (goodsType != null) {
GoodsType goodsType1 = goodsTypeService.queryDetail(goodsType);
if (goodsType1.getParentId() == null) {
map.put("goodsTypeParent", goodsType);
} else {
map.put("goodsType", goodsType);
}
}
map.put("title", title);
map.put("goodsBrand", goodsBrand);
map.put("salePriceS", salePriceS);
map.put("salePriceE", salePriceE);
String dataSting = "";
dataSting = DateUtil.date2String(new Date(), DateUtil.YMDHMS);
String fileUrl = CommonSysConst.getSysConfig().getFileUrl();
String filePath = "/temporary/" + userModel.getAccount().getId() + "/" ;
String pathName = filePath + FileRecordsEnum.status13.getName() + "导出" + dataSting +".xlsx";
if (fileRecordsService.findExported(map.toString() , userModel.getAccount().getId())) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "相同导出内容请勿重复点击!");
}
fileRecords.setCreateTime(new Date());
fileRecords.setBusinessType(FileRecordsEnum.status13.getCode());
fileRecords.setDownloadConditions(map.toString());
fileRecords.setOpId(userModel.getAccount().getId());
fileRecords.setOpName(userModel.getAccount().getUserName());
fileRecords.setStatus(2);
fileRecords.setDownloadStatus(2);
fileRecords.setFileUrl(CommonSysConst.getSysConfig().getDomainName() + "/filesystem" + pathName);
fileRecords.setType("2");
fileRecords.setTitle(FileRecordsEnum.status13.getName() + "导出" + dataSting + ".xls");
fileRecordsService.create(fileRecords);
// 创建线程
ThreadPoolExecutor executor = new ThreadPoolExecutor(
2, // 核心线程数
5, // 最大线程数
1, // 线程空闲时间
TimeUnit.MINUTES, // 时间单位
new ArrayBlockingQueue<>(5), // 任务队列
new ThreadPoolExecutor.CallerRunsPolicy() // 拒绝策略
);
// 提交任务给线程池
executor.execute(() -> {
try {
List<JdGoodsModel> jdGoodsModels = goodsMsgService.getJdGoodsList(map);
File file = new File(fileUrl + filePath);
if (!file.exists()) {
file.mkdirs();
}
EasyExcel.write(fileUrl+pathName)
.head(JdGoodsModel.class)
.sheet(fileRecords.getTitle())
.doWrite(jdGoodsModels);
fileRecords.setStatus(1);
fileRecords.setUpdateTime(new Date());
fileRecordsService.update(fileRecords);
} catch (Exception e) {
fileRecords.setStatus(3);
fileRecords.setUpdateTime(new Date());
fileRecords.setExt1(e.toString());
fileRecordsService.update(fileRecords);
log.error("error!",e);
}
});
// 关闭线程池
executor.shutdown();
return ResponseMsgUtil.success(fileRecords);
} catch (Exception e) {
fileRecords.setStatus(3);
fileRecords.setUpdateTime(new Date());
fileRecordsService.update(fileRecords);
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -60,8 +60,6 @@ public class CmsContentController {
map.put("status", 1); map.put("status", 1);
map.put("platformCode", platformCode); map.put("platformCode", platformCode);
List<CmsContent> list = cmsContentService.getList(map); List<CmsContent> list = cmsContentService.getList(map);
List<GoodsMsg> goodsMsgList = goodsMsgService.getList(new HashMap<>());
List<GoodsSpecs> specsList = goodsSpecsService.getList(new HashMap<>());
List<CmsContentModel> cmsContents = new ArrayList<>(); List<CmsContentModel> cmsContents = new ArrayList<>();
@ -69,23 +67,30 @@ public class CmsContentController {
List<GoodsModel> goodsModels = new ArrayList<>(); List<GoodsModel> goodsModels = new ArrayList<>();
if (cmsContent.getShowType() != null) { if (cmsContent.getShowType() != null) {
Map<String , Object> goodsMap = new HashMap<>();
List<GoodsMsg> goodsMsgs = new ArrayList<>(); List<GoodsMsg> goodsMsgs = new ArrayList<>();
if (cmsContent.getShowType() == 1) { if (cmsContent.getShowType() == 1) {
goodsMsgs = goodsMsgList.stream().filter(s -> s.getGoodsType().equals(cmsContent.getShowDataId().longValue())).limit(2).collect(Collectors.toList()); goodsMap.put("goodsType", cmsContent.getShowDataId());
goodsMsgs = goodsMsgService.getList(goodsMap).stream().limit(2).collect(Collectors.toList());
} }
if (cmsContent.getShowType() == 2) { if (cmsContent.getShowType() == 2) {
goodsMsgs = goodsMsgList.stream().filter(s -> s.getGoodsType().equals(cmsContent.getShowDataId().longValue())).limit(4).collect(Collectors.toList()); goodsMap.put("goodsType", cmsContent.getShowDataId());
goodsMsgs = goodsMsgService.getList(goodsMap).stream().limit(4).collect(Collectors.toList());
} }
if (cmsContent.getShowType() == 3) { if (cmsContent.getShowType() == 3) {
goodsMsgs = goodsMsgList.stream().filter(s -> s.getGoodsType().equals(cmsContent.getShowDataId().longValue())).limit(10).collect(Collectors.toList()); goodsMap.put("goodsType", cmsContent.getShowDataId());
goodsMsgs = goodsMsgService.getList(goodsMap).stream().limit(10).collect(Collectors.toList());
} }
for (GoodsMsg goodsMsg : goodsMsgs) { for (GoodsMsg goodsMsg : goodsMsgs) {
GoodsModel goodsModel = new GoodsModel(); GoodsModel goodsModel = new GoodsModel();
List<GoodsSpecs> goodsSpecs = specsList.stream().filter(s -> s.getGoodsId().equals(goodsMsg.getId())).collect(Collectors.toList()); Map<String , Object> specMap = new HashMap<>();
specMap.put("goodsId", goodsMsg.getId());
List<GoodsSpecs> goodsSpecs = goodsSpecsService.getList(specMap);
if (!goodsSpecs.isEmpty()) { if (!goodsSpecs.isEmpty()) {
BigDecimal minPrice = goodsSpecs.get(0).getSalePrice(); BigDecimal minPrice = goodsSpecs.get(0).getSalePrice();

@ -53,6 +53,7 @@ public class DeliveryAddressController {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("userId", userSession.getUser().getId()); map.put("userId", userSession.getUser().getId());
map.put("status", 1);
return ResponseMsgUtil.success(deliveryAddressService.getList(map)); return ResponseMsgUtil.success(deliveryAddressService.getList(map));
@ -75,6 +76,7 @@ public class DeliveryAddressController {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("userId", userSession.getUser().getId()); map.put("userId", userSession.getUser().getId());
map.put("status", 1);
List<GoodsUserAddress> list = deliveryAddressService.getList(map); List<GoodsUserAddress> list = deliveryAddressService.getList(map);
if (list.isEmpty()) { if (list.isEmpty()) {
@ -238,6 +240,7 @@ public class DeliveryAddressController {
Map<String , Object> map = new HashMap<>(); Map<String , Object> map = new HashMap<>();
map.put("userId" , userSession.getUser().getId()); map.put("userId" , userSession.getUser().getId());
map.put("status", 1);
map.put("whetherDefault" , true); map.put("whetherDefault" , true);
GoodsUserAddress userAddress = goodsUserAddressService.queryDetailByMap(map); GoodsUserAddress userAddress = goodsUserAddressService.queryDetailByMap(map);

@ -14,6 +14,7 @@ import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsSpecs; import com.hfkj.entity.GoodsSpecs;
import com.hfkj.entity.GoodsType; import com.hfkj.entity.GoodsType;
import com.hfkj.entity.GoodsVpd; import com.hfkj.entity.GoodsVpd;
import com.hfkj.jd.JdService;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject; import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.goods.GoodsModel; import com.hfkj.model.goods.GoodsModel;
@ -59,6 +60,10 @@ public class GoodsController {
private GoodsVpdService goodsVpdService; private GoodsVpdService goodsVpdService;
@Resource
private JdService jdService;
@RequestMapping(value="/getListGoodsType",method = RequestMethod.GET) @RequestMapping(value="/getListGoodsType",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询商品分类列表") @ApiOperation(value = "查询商品分类列表")
@ -112,6 +117,7 @@ public class GoodsController {
@RequestParam(value = "goodsBrand", required = false) Long goodsBrand, @RequestParam(value = "goodsBrand", required = false) Long goodsBrand,
@RequestParam(value = "price", required = false) Integer price, @RequestParam(value = "price", required = false) Integer price,
@RequestParam(value = "saleNum", required = false) Integer saleNum, @RequestParam(value = "saleNum", required = false) Integer saleNum,
@RequestParam(value = "limit", required = false) Integer limit,
@RequestParam(value = "time", required = false) Integer time, @RequestParam(value = "time", required = false) Integer time,
@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
@ -126,11 +132,12 @@ public class GoodsController {
map.put("goodsTypeParent", goodsTypeParent); map.put("goodsTypeParent", goodsTypeParent);
map.put("goodsBrand", goodsBrand); map.put("goodsBrand", goodsBrand);
map.put("saleNum", saleNum); map.put("saleNum", saleNum);
map.put("limit", limit);
map.put("time", time); map.put("time", time);
map.put("status", 1); map.put("status", 1);
List<GoodsMsg> list = goodsMsgService.getList(map); List<GoodsMsg> list = goodsMsgService.getListCrest(map);
List<GoodsSpecs> specsList = goodsSpecsService.getList(new HashMap<>()); List<GoodsSpecs> specsList = goodsSpecsService.getGoodsSpecsCrest();
List<GoodsModel> goodsModels = new ArrayList<>(); List<GoodsModel> goodsModels = new ArrayList<>();
@ -153,9 +160,7 @@ public class GoodsController {
BeanUtils.copyProperties(goodsMsg, goodsModel); BeanUtils.copyProperties(goodsMsg, goodsModel);
goodsModel.setOriginalPrice(minOriginalPrice); goodsModel.setOriginalPrice(minOriginalPrice);
goodsModel.setPrice(minPrice); goodsModel.setPrice(minPrice);
goodsModels.add(goodsModel); goodsModels.add(goodsModel);
} }
} }
@ -186,7 +191,11 @@ public class GoodsController {
GoodsMsg goodsMsg = goodsMsgService.queryDetail(id); GoodsMsg goodsMsg = goodsMsgService.queryDetail(id);
if (goodsMsg != null && goodsMsg.getThirdId() != null) {
if (jdService.checkSkuSale(goodsMsg)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.SOLD_OUT, "");
}
}
GoodsModel goodsModel = new GoodsModel(); GoodsModel goodsModel = new GoodsModel();
@ -204,9 +213,6 @@ public class GoodsController {
BeanUtils.copyProperties(goodsSpec, goodsModelSpec); BeanUtils.copyProperties(goodsSpec, goodsModelSpec);
GoodsVpd goodsVpd = goodsVpdService.queryDetailBySpecsId(goodsSpec.getId()); GoodsVpd goodsVpd = goodsVpdService.queryDetailBySpecsId(goodsSpec.getId());
if (goodsVpd != null) { if (goodsVpd != null) {
BeanUtils.copyProperties(goodsVpd, goodsModelSpec); BeanUtils.copyProperties(goodsVpd, goodsModelSpec);
} }
goodsModelSpec.setSpecsId(goodsSpec.getId()); goodsModelSpec.setSpecsId(goodsSpec.getId());

@ -9,6 +9,7 @@ import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.GoodsMsg; import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsShoppingCart; import com.hfkj.entity.GoodsShoppingCart;
import com.hfkj.entity.GoodsSpecs; import com.hfkj.entity.GoodsSpecs;
import com.hfkj.jd.JdService;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.model.UserSessionObject; import com.hfkj.model.UserSessionObject;
import com.hfkj.service.goods.GoodsMsgService; import com.hfkj.service.goods.GoodsMsgService;
@ -45,6 +46,9 @@ public class ShoppingCartController {
@Resource @Resource
private GoodsShoppingCartService shoppingCartService; private GoodsShoppingCartService shoppingCartService;
@Resource
private JdService jdService;
@RequestMapping(value = "/getShoppingCartList", method = RequestMethod.GET) @RequestMapping(value = "/getShoppingCartList", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询购物车列表") @ApiOperation(value = "查询购物车列表")
@ -60,6 +64,24 @@ public class ShoppingCartController {
List<GoodsShoppingCart> list = shoppingCartService.getList(map); List<GoodsShoppingCart> list = shoppingCartService.getList(map);
for (GoodsShoppingCart shoppingCart : list) {
GoodsMsg goodsMsg = goodsMsgService.queryDetail(shoppingCart.getGoodsId());
GoodsSpecs goodsSpecs = goodsSpecsService.queryDetailByGoodsId(shoppingCart.getSpecsId());
if (goodsMsg.getStatus().equals(0)) {
shoppingCart.setLoseEfficacy(true);
}
if (goodsSpecs.getStatus().equals(0)) {
shoppingCart.setLoseEfficacy(true);
}
if (jdService.checkSkuSale(goodsMsg)) {
shoppingCart.setLoseEfficacy(true);
}
shoppingCart.setUpdateTime(new Date());
shoppingCartService.update(shoppingCart);
}
Map<String, List<GoodsShoppingCart>> collect = list.stream().collect(Collectors.groupingBy(GoodsShoppingCart::getMerName)); Map<String, List<GoodsShoppingCart>> collect = list.stream().collect(Collectors.groupingBy(GoodsShoppingCart::getMerName));
List<JSONObject> countRecords = collect.keySet().stream().map(key -> { List<JSONObject> countRecords = collect.keySet().stream().map(key -> {

@ -43,7 +43,7 @@ public class JdNotify {
JSONObject jsonObject = HttpsUtils.doGet("https://open-oauth.jd.com/oauth2/access_token", object); JSONObject jsonObject = HttpsUtils.doGet("https://open-oauth.jd.com/oauth2/access_token", object);
log.info("token回调 jsonObject-回调参数: " + jsonObject); log.info("token回调 jsonObject-回调参数: " + jsonObject);
log.info("token回调 access_token-回调参数: " + jsonObject.getString("access_token")); log.info("token回调 access_token-回调参数: " + jsonObject.getString("access_token"));
redisUtil.set("access_token", jsonObject.getString("access_token") , jsonObject.getInteger("expires_in") - 10000); redisUtil.set("jd_access_token", jsonObject.getString("access_token") , jsonObject.getInteger("expires_in") - 10000);
log.info("============token回调任务End============="); log.info("============token回调任务End=============");
} catch (Exception e) { } catch (Exception e) {

@ -31,6 +31,7 @@ public enum ErrorCode {
REQUEST_TIMED_OUT("2006","请求超时,请稍后重试"), REQUEST_TIMED_OUT("2006","请求超时,请稍后重试"),
UNKNOW_ERROR("999999","未知异常"), UNKNOW_ERROR("999999","未知异常"),
EXCEL_ERROR("80000","Excel处理异常"), EXCEL_ERROR("80000","Excel处理异常"),
SOLD_OUT("3000","商品已售空,请购买其他商品!"),
;//注意:上面为逗号,此次为分号 ;//注意:上面为逗号,此次为分号

@ -1,7 +1,62 @@
package com.hfkj.dao; package com.hfkj.dao;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.model.goods.JdGoodsModel;
import com.hfkj.model.order.OrderCouponModel;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/** /**
* mapper扩展类 * mapper扩展类
*/ */
public interface GoodsMsgMapperExt { public interface GoodsMsgMapperExt {
@Select("<script>" +
" SELECT" +
" a.goods_type_parent_name as goodsTypeParentName," +
" a.goods_type_name as goodsTypeName," +
" a.goods_brand_name as goodsBrandName," +
" a.title as title," +
" a.list_img as listImg," +
" b.sale_price as salePrice, " +
" b.third_price as thirdPrice," +
" b.original_price as originalPrice," +
" a.third_id as thirdId" +
" FROM" +
" goods_msg a join goods_specs b on a.id = b.goods_id where a.type = 1 and a.child_type=1 and a.status = 1" +
" <if test='param.goodsTypeParent != null'> and a.goods_type_parent = #{param.goodsTypeParent} </if>" +
" <if test='param.title != null'> and b.title like concat('%',#{param.title},'%') </if>" +
" <if test='param.goodsType != null'> and a.goods_type = #{param.goodsType} </if>" +
" <if test='param.goodsBrand != null'> and a.goods_brand = #{param.goodsBrand} </if>" +
" <if test='param.salePriceS != null'><![CDATA[ and b.sale_price >= #{param.salePriceS} ]]></if>" +
" <if test='param.salePriceE != null'><![CDATA[ and b.sale_price <= #{param.salePriceE} ]]></if>" +
" ORDER BY b.sale_price asc" +
"</script>")
List<JdGoodsModel> getJdGoodsList(@Param("param") Map<String,Object> param);
@Select("<script>" +
" SELECT" +
" id ," +
" title as title," +
" title as title," +
" list_img as listImg," +
" third_id as thirdId," +
" sale_num as saleNum" +
" FROM" +
" goods_msg where status = 1 " +
" <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.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>" +
" <if test='param.saleNum == 2'>, sale_num desc</if>" +
" <if test='param.limit != null'>limit #{param.limit}</if>" +
"</script>")
List<GoodsMsg> getGoodsListCrest(@Param("param") Map<String,Object> param);
} }

@ -1,7 +1,27 @@
package com.hfkj.dao; package com.hfkj.dao;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsSpecs;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/** /**
* mapper扩展类 * mapper扩展类
*/ */
public interface GoodsSpecsMapperExt { public interface GoodsSpecsMapperExt {
@Select("<script>" +
" SELECT" +
" goods_id as goodsId ," +
" sale_price as salePrice," +
" original_price as originalPrice" +
" FROM" +
" goods_specs where status = 1 " +
"</script>")
List<GoodsSpecs> getGoodsSpecsCrest();
} }

@ -1,6 +1,7 @@
package com.hfkj.jd.Impl; package com.hfkj.jd.Impl;
import com.hfkj.common.utils.RedisUtil; import com.hfkj.common.utils.RedisUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.*; import com.hfkj.entity.*;
import com.hfkj.jd.JdPostService; import com.hfkj.jd.JdPostService;
import com.hfkj.jd.JdService; import com.hfkj.jd.JdService;
@ -14,6 +15,7 @@ import com.jd.open.api.sdk.domain.vopsp.SkuInfoGoodsProvider.response.getSkuDeta
import com.jd.open.api.sdk.domain.vopsp.SkuInfoGoodsProvider.response.getSkuImageList.GetSkuImageGoodsResp; import com.jd.open.api.sdk.domain.vopsp.SkuInfoGoodsProvider.response.getSkuImageList.GetSkuImageGoodsResp;
import com.jd.open.api.sdk.domain.vopsp.SkuInfoGoodsProvider.response.getSkuImageList.SkuImageItemGoodsResp; import com.jd.open.api.sdk.domain.vopsp.SkuInfoGoodsProvider.response.getSkuImageList.SkuImageItemGoodsResp;
import com.jd.open.api.sdk.domain.vopsp.SkuPoolGoodsProvider.response.getSkuPoolInfo.GetSkuPoolInfoItemGoodsResp; import com.jd.open.api.sdk.domain.vopsp.SkuPoolGoodsProvider.response.getSkuPoolInfo.GetSkuPoolInfoItemGoodsResp;
import com.jd.open.api.sdk.domain.vopsp.SkuPoolGoodsProvider.response.querySkuByPage.OpenPagingResult;
import com.jd.open.api.sdk.response.vopsp.VopGoodsGetSkuDetailInfoResponse; import com.jd.open.api.sdk.response.vopsp.VopGoodsGetSkuDetailInfoResponse;
import com.jd.open.api.sdk.response.vopsp.VopGoodsGetSkuImageListResponse; import com.jd.open.api.sdk.response.vopsp.VopGoodsGetSkuImageListResponse;
import com.jd.open.api.sdk.response.vopsp.VopGoodsGetSkuPoolInfoResponse; import com.jd.open.api.sdk.response.vopsp.VopGoodsGetSkuPoolInfoResponse;
@ -24,10 +26,11 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.Date; import java.util.*;
import java.util.HashMap; import java.util.concurrent.ArrayBlockingQueue;
import java.util.List; import java.util.concurrent.ThreadPoolExecutor;
import java.util.Map; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Service("jdService") @Service("jdService")
@ -54,9 +57,11 @@ public class JdServiceImpl implements JdService {
@Resource @Resource
private GoodsSpecsService goodsSpecsService; private GoodsSpecsService goodsSpecsService;
private List<Long> skuList = new ArrayList<>();
@Override @Override
public String getToken() throws Exception { public String getToken() throws Exception {
Object token = redisUtil.get("access_token"); Object token = redisUtil.get("jd_access_token");
if (token == null) { if (token == null) {
// 请求回调 会在回调存入参数 // 请求回调 会在回调存入参数
@ -68,10 +73,16 @@ public class JdServiceImpl implements JdService {
@Override @Override
public void getGoodsJd() throws Exception { public void getGoodsJd() throws Exception {
String token = getToken();
// 获取京东商品池 // 获取京东商品池
VopGoodsGetSkuPoolInfoResponse sku = JdPostService.getSkuPoolInfo(getToken()); VopGoodsGetSkuPoolInfoResponse sku = JdPostService.getSkuPoolInfo(token);
// 获取sku列表 // 获取sku列表
List<GetSkuPoolInfoItemGoodsResp> skuList = sku.getOpenRpcResult().getResult().getSkuPoolList(); List<GetSkuPoolInfoItemGoodsResp> skuList = sku.getOpenRpcResult().getResult().getSkuPoolList();
// List<Long> skuIdList;
// for (GetSkuPoolInfoItemGoodsResp skuPoolInfoItemGoodsResp : skuList) {
// skuIdList = getSkuList(token , skuPoolInfoItemGoodsResp.getBizPoolId() , 0L);
// }
// BsMer bsMer = bsMerService.getDetail("166241009282");
// 初始化商品信息 // 初始化商品信息
GoodsMsg goodsMsg; GoodsMsg goodsMsg;
@ -88,33 +99,33 @@ public class JdServiceImpl implements JdService {
List<GoodsMsg> goodsMsgs = goodsMsgService.getList(goodsMap); List<GoodsMsg> goodsMsgs = goodsMsgService.getList(goodsMap);
List<GoodsSpecs> goodsSpecsList = goodsSpecsService.getList(new HashMap<>()); List<GoodsSpecs> goodsSpecsList = goodsSpecsService.getList(new HashMap<>());
BsProductConfig productConfig = productConfigService.queryDetail(OrderChildProductTypeEnum.type6.getCode()); BsProductConfig productConfig = productConfigService.queryDetail(OrderChildProductTypeEnum.type6.getCode());
List<Long> skuIdList;
for (GetSkuPoolInfoItemGoodsResp skuPoolInfoItemGoodsResp : skuList) { for (GetSkuPoolInfoItemGoodsResp skuPoolInfoItemGoodsResp : skuList) {
// 根据sku查询商品 skuIdList = getSkuList(token , skuPoolInfoItemGoodsResp.getBizPoolId() , 0L);
List<Long> skuIdList = JdPostService.querySkuByPage(getToken(), skuPoolInfoItemGoodsResp.getBizPoolId(), 0).getOpenRpcResult().getResult().getSkus();
for (Long aLong : skuIdList) { for (Long aLong : skuIdList) {
// 根据skuId 查询商品详情 // 根据skuId 查询商品详情
VopGoodsGetSkuDetailInfoResponse skuDetail = JdPostService.getSkuDetailInfo(getToken(), aLong); VopGoodsGetSkuDetailInfoResponse skuDetail = JdPostService.getSkuDetailInfo(token, aLong);
GetSkuPoolInfoGoodsResp detail = skuDetail.getOpenRpcResult().getResult(); GetSkuPoolInfoGoodsResp detail = skuDetail.getOpenRpcResult().getResult();
if (detail != null) { if (detail != null) {
// 根据skuId 查询商品售价 // 根据skuId 查询商品售价
OpenRpcResult priceResponse = JdPostService.getSellPrice(getToken(), String.valueOf(aLong)).getOpenRpcResult(); OpenRpcResult priceResponse = JdPostService.getSellPrice(token, String.valueOf(aLong)).getOpenRpcResult();
if (priceResponse.getSuccess()) { if (priceResponse.getSuccess()) {
GetSellPriceGoodsResp price = priceResponse.getResult().get(0); GetSellPriceGoodsResp price = priceResponse.getResult().get(0);
// 根据skuId 查询商品图片 // 根据skuId 查询商品图片
com.jd.open.api.sdk.domain.vopsp.SkuInfoGoodsProvider.response.getSkuImageList.OpenRpcResult imageListResponse = JdPostService.getSkuImageList(getToken(), String.valueOf(aLong)).getOpenRpcResult(); com.jd.open.api.sdk.domain.vopsp.SkuInfoGoodsProvider.response.getSkuImageList.OpenRpcResult imageListResponse = JdPostService.getSkuImageList(token, String.valueOf(aLong)).getOpenRpcResult();
if (imageListResponse.getSuccess()) { if (imageListResponse.getSuccess()) {
GetSkuImageGoodsResp img = imageListResponse.getResult().get(0); GetSkuImageGoodsResp img = imageListResponse.getResult().get(0);
// 查询分类 // 查询分类
String[] categoryS = detail.getCategory().split(";"); String[] categoryS = detail.getCategory().split(";");
// 查询一级分类 // 查询一级分类
String category1 = JdPostService.getCategoryInfoList(getToken(), categoryS[0]).getOpenRpcResult().getResult().get(0).getCategoryName(); String category1 = JdPostService.getCategoryInfoList(token, categoryS[0]).getOpenRpcResult().getResult().get(0).getCategoryName();
// 查询二级分类 // 查询二级分类
String category2 = JdPostService.getCategoryInfoList(getToken(), categoryS[1]).getOpenRpcResult().getResult().get(0).getCategoryName(); String category2 = JdPostService.getCategoryInfoList(token, categoryS[1]).getOpenRpcResult().getResult().get(0).getCategoryName();
GoodsType goodsType1 = goodsType.stream().filter(s -> s.getTitle().equals(category1)).findFirst().orElse(null); GoodsType goodsType1 = goodsType.stream().filter(s -> s.getTitle().equals(category1)).findFirst().orElse(null);
GoodsType goodsType2 = goodsType.stream().filter(s -> s.getTitle().equals(category2)).findFirst().orElse(null); GoodsType goodsType2 = goodsType.stream().filter(s -> s.getTitle().equals(category2)).findFirst().orElse(null);
@ -266,9 +277,12 @@ public class JdServiceImpl implements JdService {
goodsSpecs.setSalePrice(profitPrice.add(price.getSalePrice())); goodsSpecs.setSalePrice(profitPrice.add(price.getSalePrice()));
// 设置原价 // 设置原价
goodsSpecs.setOriginalPrice(price.getMarketPrice()); goodsSpecs.setOriginalPrice(price.getMarketPrice());
goodsSpecs.setThirdPrice(price.getJdPrice());
// 设置展示图片 // 设置展示图片
goodsSpecs.setShowImg(goodsMsg.getListImg()); goodsSpecs.setShowImg(goodsMsg.getListImg());
goodsSpecsList = goodsSpecsList.stream().filter(s-> s.getThirdId() != null).collect(Collectors.toList());
GoodsSpecs specs = goodsSpecsList.stream().filter(s -> s.getThirdId().equals(aLong.toString())).findFirst().orElse(null); GoodsSpecs specs = goodsSpecsList.stream().filter(s -> s.getThirdId().equals(aLong.toString())).findFirst().orElse(null);
if (specs != null) { if (specs != null) {
@ -291,6 +305,14 @@ public class JdServiceImpl implements JdService {
} }
} }
private List<Long> getSkuList(String token , String bizPoolId , Long offset) throws Exception {
OpenPagingResult result = JdPostService.querySkuByPage(token, bizPoolId, offset).getOpenRpcResult().getResult();
skuList.addAll(result.getSkus());
if (result.getRemainPage() > 0) {
getSkuList(token, bizPoolId, result.getOffset());
}
return skuList;
}
@Override @Override
public Boolean checkSkuSale(GoodsMsg goodsMsg) throws Exception { public Boolean checkSkuSale(GoodsMsg goodsMsg) throws Exception {
@ -299,8 +321,25 @@ public class JdServiceImpl implements JdService {
VopGoodsGetSkuStateListResponse skuStateListResponse = JdPostService.getSkuState(getToken(), goodsMsg.getThirdId()); VopGoodsGetSkuStateListResponse skuStateListResponse = JdPostService.getSkuState(getToken(), goodsMsg.getThirdId());
if (skuStateListResponse.getOpenRpcResult().getResult().get(0).getSkuState() == 0) { if (skuStateListResponse.getOpenRpcResult().getResult().get(0).getSkuState() == 0) {
// 创建线程
ThreadPoolExecutor executor = new ThreadPoolExecutor(
2, // 核心线程数
5, // 最大线程数
1, // 线程空闲时间
TimeUnit.MINUTES, // 时间单位
new ArrayBlockingQueue<>(5), // 任务队列
new ThreadPoolExecutor.CallerRunsPolicy() // 拒绝策略
);
// 提交任务给线程池
executor.execute(() -> {
goodsMsg.setStatus(0);
goodsMsgService.update(goodsMsg);
});
// 关闭线程池
executor.shutdown();
return true; return true;
} }
BsProductConfig productConfig = productConfigService.queryDetail(OrderChildProductTypeEnum.type6.getCode());
// 查询规格 // 查询规格
GoodsSpecs specs = goodsSpecsService.queryDetailByThirdId(goodsMsg.getThirdId()); GoodsSpecs specs = goodsSpecsService.queryDetailByThirdId(goodsMsg.getThirdId());
@ -310,6 +349,18 @@ public class JdServiceImpl implements JdService {
GetSkuPoolInfoGoodsResp detail = skuDetail.getOpenRpcResult().getResult(); GetSkuPoolInfoGoodsResp detail = skuDetail.getOpenRpcResult().getResult();
// 根据skuId 查询商品售价 // 根据skuId 查询商品售价
OpenRpcResult priceResponse = JdPostService.getSellPrice(getToken(), String.valueOf(goodsMsg.getThirdId())).getOpenRpcResult(); OpenRpcResult priceResponse = JdPostService.getSellPrice(getToken(), String.valueOf(goodsMsg.getThirdId())).getOpenRpcResult();
return null; GetSellPriceGoodsResp price = priceResponse.getResult().get(0);
// 设置商品名称
specs.setName(detail.getSpuName());
BigDecimal profitPrice = price.getSalePrice().multiply(productConfig.getDiscount().divide(new BigDecimal(100) , 2, RoundingMode.HALF_UP));
// 设置销售价格
specs.setSalePrice(profitPrice.add(price.getSalePrice()));
// 设置原价
specs.setOriginalPrice(price.getMarketPrice());
specs.setThirdPrice(price.getJdPrice());
// 设置展示图片
specs.setShowImg(goodsMsg.getListImg());
goodsSpecsService.update(specs);
return false;
} }
} }

@ -122,12 +122,12 @@ public class JdPostService {
} }
// 根据商品池获取所有商品信息 // 根据商品池获取所有商品信息
public static VopGoodsQuerySkuByPageResponse querySkuByPage(String token , String bizPoolId , Integer offset) throws Exception { public static VopGoodsQuerySkuByPageResponse querySkuByPage(String token , String bizPoolId , Long offset) throws Exception {
JdClient client=new DefaultJdClient(SERVER_URL,token,CommonSysConst.getSysConfig().getJDAppKey(),CommonSysConst.getSysConfig().getJDAppSecret()); JdClient client=new DefaultJdClient(SERVER_URL,token,CommonSysConst.getSysConfig().getJDAppKey(),CommonSysConst.getSysConfig().getJDAppSecret());
VopGoodsQuerySkuByPageRequest request=new VopGoodsQuerySkuByPageRequest(); VopGoodsQuerySkuByPageRequest request=new VopGoodsQuerySkuByPageRequest();
request.setBizPoolId(bizPoolId); request.setBizPoolId(bizPoolId);
request.setOffset(offset); request.setOffset(offset);
request.setPageSize(10); request.setPageSize(1000);
return client.execute(request); return client.execute(request);
} }

@ -0,0 +1,58 @@
package com.hfkj.model.goods;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import java.math.BigDecimal;
/**
* @ClassName JdGoodsModel
* @Author Sum1Dream
* @Description 京东商品
* @Date 2024/9/29 上午10:50
**/
@Data
public class JdGoodsModel {
@ColumnWidth(50)
@ExcelProperty("一级分类")
public String goodsTypeParentName;
@ColumnWidth(20)
@ExcelProperty("二级分类")
public String goodsTypeName;
@ColumnWidth(20)
@ExcelProperty("品牌名称")
public String goodsBrandName;
@ColumnWidth(20)
@ExcelProperty("商品名称")
public String title;
@ColumnWidth(40)
@ExcelProperty("列表图")
public String listImg;
@ColumnWidth(15)
@ExcelProperty("售卖价格")
public BigDecimal salePrice;
@ColumnWidth(20)
@ExcelProperty("京东价")
public BigDecimal thirdPrice;
@ColumnWidth(20)
@ExcelProperty({"原价"})
public BigDecimal originalPrice;
@ColumnWidth(20)
@ExcelProperty({"sku编码"})
public String thirdId;
@ColumnWidth(20)
@ExcelProperty({"销量"})
public String saleNum;
}

@ -3,6 +3,8 @@ package com.hfkj.service.goods;
import com.hfkj.entity.GoodsMsg; import com.hfkj.entity.GoodsMsg;
import com.hfkj.model.goods.JdGoodsModel;
import com.hfkj.model.order.OrderCouponModel;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -75,6 +77,17 @@ public interface GoodsMsgService {
*/ */
List<GoodsMsg> getList(Map<String , Object> map); List<GoodsMsg> getList(Map<String , Object> map);
/**
* @MethodName getListCrest
* @Description: c端查询
* @param map
* @return: java.util.List<com.hfkj.entity.GoodsMsg>
* @Author: Sum1Dream
* @Date: 2024/11/26 上午10:49
*/
List<GoodsMsg> getListCrest(Map<String , Object> map);
List<JdGoodsModel> getJdGoodsList(Map<String,Object> param);
/** /**
* 编辑商品库存 * 编辑商品库存

@ -86,6 +86,9 @@ public interface GoodsSpecsService {
*/ */
List<GoodsSpecs> getList(Map<String , Object> map); List<GoodsSpecs> getList(Map<String , Object> map);
List<GoodsSpecs> getGoodsSpecsCrest();
/** /**
* @Author Sum1Dream * @Author Sum1Dream
* @Name decreaseStockNum * @Name decreaseStockNum

@ -7,6 +7,7 @@ import com.hfkj.dao.GoodsMsgMapper;
import com.hfkj.entity.GoodsBrand; import com.hfkj.entity.GoodsBrand;
import com.hfkj.entity.GoodsMsg; import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsMsgExample; import com.hfkj.entity.GoodsMsgExample;
import com.hfkj.model.goods.JdGoodsModel;
import com.hfkj.service.goods.GoodsMsgService; import com.hfkj.service.goods.GoodsMsgService;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -129,6 +130,16 @@ public class GoodsMsgServiceImpl implements GoodsMsgService {
return goodsMsgMapper.selectByExample(example); return goodsMsgMapper.selectByExample(example);
} }
@Override
public List<GoodsMsg> getListCrest(Map<String, Object> map) {
return goodsMsgMapper.getGoodsListCrest(map);
}
@Override
public List<JdGoodsModel> getJdGoodsList(Map<String, Object> param) {
return goodsMsgMapper.getJdGoodsList(param);
}
@Override @Override
public void editSaleNum(Long goodsId, Integer num , Integer type) { public void editSaleNum(Long goodsId, Integer num , Integer type) {

@ -104,6 +104,12 @@ public class GoodsSpecsServiceImpl implements GoodsSpecsService {
return goodsSpecsMapper.selectByExample(goodsSpecsExample); return goodsSpecsMapper.selectByExample(goodsSpecsExample);
} }
@Override
public List<GoodsSpecs> getGoodsSpecsCrest() {
return goodsSpecsMapper.getGoodsSpecsCrest();
}
@Override @Override
public void editStockNum(Long specsId, Integer num , Integer type) { public void editStockNum(Long specsId, Integer num , Integer type) {
String key = "GOODS_STOCK_NUM"; String key = "GOODS_STOCK_NUM";

@ -1,6 +1,7 @@
package com.hfkj.service.goods.impl; package com.hfkj.service.goods.impl;
import com.hfkj.dao.GoodsUserAddressMapper; import com.hfkj.dao.GoodsUserAddressMapper;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsUserAddress; import com.hfkj.entity.GoodsUserAddress;
import com.hfkj.entity.GoodsUserAddressExample; import com.hfkj.entity.GoodsUserAddressExample;
import com.hfkj.service.goods.GoodsUserAddressService; import com.hfkj.service.goods.GoodsUserAddressService;
@ -8,10 +9,7 @@ import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("goodsUserAddressService") @Service("goodsUserAddressService")
public class GoodsUserAddressServiceImpl implements GoodsUserAddressService { public class GoodsUserAddressServiceImpl implements GoodsUserAddressService {
@ -31,7 +29,10 @@ public class GoodsUserAddressServiceImpl implements GoodsUserAddressService {
@Override @Override
public void delete(Long id) { public void delete(Long id) {
goodsUserAddressMapper.deleteByPrimaryKey(id); GoodsUserAddress goodsUserAddress = queryDetail(id);
goodsUserAddress.setStatus(0);
goodsUserAddress.setUpdateTime(new Date());
update(goodsUserAddress);
} }
@Override @Override
@ -50,7 +51,9 @@ public class GoodsUserAddressServiceImpl implements GoodsUserAddressService {
if (MapUtils.getBoolean(map, "whetherDefault") != null) { if (MapUtils.getBoolean(map, "whetherDefault") != null) {
criteria.andWhetherDefaultEqualTo(MapUtils.getBoolean(map, "whetherDefault")); criteria.andWhetherDefaultEqualTo(MapUtils.getBoolean(map, "whetherDefault"));
} }
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
}
List<GoodsUserAddress> list = goodsUserAddressMapper.selectByExample(example); List<GoodsUserAddress> list = goodsUserAddressMapper.selectByExample(example);
if (!list.isEmpty()) { if (!list.isEmpty()) {
@ -68,6 +71,9 @@ public class GoodsUserAddressServiceImpl implements GoodsUserAddressService {
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.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
}
return goodsUserAddressMapper.selectByExample(example); return goodsUserAddressMapper.selectByExample(example);
} }

@ -614,6 +614,10 @@ public class OrderCreateService {
// 查询库存 // 查询库存
VopGoodsGetNewStockByIdResponse stockResponse = JdPostService.getNewStockById(jdService.getToken() , Long.valueOf(skuId), address.getProvinceId() , address.getCityId() , address.getCountyId() , address.getTownId()); VopGoodsGetNewStockByIdResponse stockResponse = JdPostService.getNewStockById(jdService.getToken() , Long.valueOf(skuId), address.getProvinceId() , address.getCityId() , address.getCountyId() , address.getTownId());
if (stockResponse != null && !stockResponse.getOpenRpcResult().getSuccess()) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "商品已售罄!" );
}
if (!checkStock(stockResponse.getOpenRpcResult().getResult().get(0).getStockStateType())) { if (!checkStock(stockResponse.getOpenRpcResult().getResult().get(0).getStockStateType())) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "商品已售罄!" ); throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "商品已售罄!" );
} }

@ -182,7 +182,9 @@ public class BsUserServiceImpl implements BsUserService {
BsUser user = getUser(phone); BsUser user = getUser(phone);
if (user == null) { if (user == null) {
// 查询用户 // 查询用户
user = getUserByMaOpenId(other.get("maOpenId").toString()); if (other.get("maOpenId") != null) {
user = getUserByMaOpenId(other.get("maOpenId").toString());
}
if (user == null) { if (user == null) {
user = register(phone, password, other); user = register(phone, password, other);
} }

@ -63,6 +63,7 @@ public enum FileRecordsEnum {
* 导出结算总和 * 导出结算总和
*/ */
status12(12, "结算总和"), status12(12, "结算总和"),
status13(13, "京东商品"),
; ;
private final int code; private final int code;

@ -27,7 +27,7 @@ pcytCnpcSecret=xstEWAhjw74GzMkXcPr2Cf7z00aYXaSy
# BiLingXing # BiLingXing
blxPostUrl=https://zhctapplet.gyzhtc.com/gateway blxPostUrl=https://zhctapplet.gyzhtc.com/gateway
huiliantongUrl=https://gzapi.deepermobile.com.cn huiliantongUrl=http://hltgz.com:4010/api/v2/execute.json
huiliantongAppNo=guizhouhuilt huiliantongAppNo=guizhouhuilt
huiliantongAppkey=e0ja2Ex%2BmQ2hIPF6x%2BHA%3D huiliantongAppkey=e0ja2Ex%2BmQ2hIPF6x%2BHA%3D
huiliantongAppsecret=52662415DDCE55C7BA34223BCF53877A huiliantongAppsecret=52662415DDCE55C7BA34223BCF53877A
@ -86,6 +86,12 @@ haiOilPostUrl = https://oil.dctpay.com
haiOilAppid = hf166f4b2ed75e71 haiOilAppid = hf166f4b2ed75e71
haiOilAppSecret = 5a11778cfdd4962282a359397bf4f86b haiOilAppSecret = 5a11778cfdd4962282a359397bf4f86b
jDPostUrl = https://test-oil.dctpay.com
jDAppKey = C4FF710550C43FE76D4114E1C9C6A0C9
jDAppSecret = 873bcbc1d8d64f36832270c2ff59c194
ytAccessKey=9326673207264334 ytAccessKey=9326673207264334
ytSecretKey=VCLXFV09BNZNMERR9F21KI3LC7L101YY ytSecretKey=VCLXFV09BNZNMERR9F21KI3LC7L101YY
ytPostUrl= https://sichuan.95504.net/v4 ytPostUrl= https://sichuan.95504.net/v4

@ -156,49 +156,48 @@ public class BsUserController {
} }
} }
@RequestMapping(value = "/phoneNotVerify", method = RequestMethod.POST) // @RequestMapping(value = "/phoneNotVerify", method = RequestMethod.POST)
@ResponseBody // @ResponseBody
@ApiOperation(value = "H5手机号不校验登陆") // @ApiOperation(value = "H5手机号不校验登陆")
public ResponseData phoneNotVerify(@RequestBody JSONObject body) { // public ResponseData phoneNotVerify(@RequestBody JSONObject body) {
try { // try {
if (body == null // if (body == null
|| StringUtils.isBlank(body.getString("platform")) // || StringUtils.isBlank(body.getString("platform"))
|| StringUtils.isBlank(body.getString("type")) // || StringUtils.isBlank(body.getString("type"))
|| StringUtils.isBlank(body.getString("phone")) // || StringUtils.isBlank(body.getString("phone"))
) { // ) {
log.error("LoginController --> phone() error!", "请求参数校验失败"); // log.error("LoginController --> phone() error!", "请求参数校验失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); // throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} // }
String phone = body.getString("phone"); // String phone = body.getString("phone");
String password = body.getString("password"); // String password = body.getString("password");
//
// 客户端 // // 客户端
UserLoginPlatform platform = UserLoginPlatform.getDataByType(body.getString("platform")); // UserLoginPlatform platform = UserLoginPlatform.getDataByType(body.getString("platform"));
if (platform == null) { // if (platform == null) {
log.error("LoginController --> phone() error!", "未知客户端"); // log.error("LoginController --> phone() error!", "未知客户端");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知客户端"); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知客户端");
} // }
// 校验手机号格式 // // 校验手机号格式
if (!MemberValidateUtil.validatePhone(phone)) { // if (!MemberValidateUtil.validatePhone(phone)) {
log.error("LoginController --> phone() error!", "请输入正确的手机号"); // log.error("LoginController --> phone() error!", "请输入正确的手机号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号"); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号");
} // }
// 登录类型 // // 登录类型
UserLoginType loginType = UserLoginType.getDataByType(body.getString("type")); // UserLoginType loginType = UserLoginType.getDataByType(body.getString("type"));
if (loginType == null) { // if (loginType == null) {
log.error("LoginController --> phone() error!", "未知登录类型;" + body.getString("type")); // log.error("LoginController --> phone() error!", "未知登录类型;" + body.getString("type"));
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知登录类型"); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知登录类型");
} // }
//
Map<String, Object> other = new HashMap<>(); // Map<String, Object> other = new HashMap<>();
/*other.put("maOpenId", "maOpenId");*/ // return ResponseMsgUtil.success(userService.login(platform, loginType, phone, password, other));
return ResponseMsgUtil.success(userService.login(platform, loginType, phone, password, other)); //
// } catch (Exception e) {
} catch (Exception e) { // log.error("LoginController --> phone() error!", e);
log.error("LoginController --> phone() error!", e); // return ResponseMsgUtil.exception(e);
return ResponseMsgUtil.exception(e); // }
} // }
}
@RequestMapping(value = "/phoneTest", method = RequestMethod.POST) @RequestMapping(value = "/phoneTest", method = RequestMethod.POST)
@ResponseBody @ResponseBody

Loading…
Cancel
Save