master
胡锐 3 months ago
commit 4d8f14656b
  1. 53
      bweb/src/main/java/com/bweb/controller/SecMenuController.java
  2. 75
      bweb/src/main/java/com/bweb/controller/TestController.java
  3. 106
      bweb/src/main/java/com/bweb/controller/file/FileController.java
  4. 1
      cweb/src/main/java/com/cweb/config/AuthConfig.java
  5. 20
      cweb/src/main/java/com/cweb/controller/CommonController.java
  6. 4
      cweb/src/main/java/com/cweb/controller/goods/DeliveryAddressController.java
  7. 49
      cweb/src/main/java/com/cweb/controller/qianZhu/CinemaController.java
  8. 18
      cweb/src/main/java/com/cweb/controller/qianZhu/StarbucksController.java
  9. 34
      order/src/main/java/com/order/controller/OrderController.java
  10. 11
      order/src/main/java/com/order/controller/business/BsOrderDownloadController.java
  11. 262
      order/src/main/java/com/order/controller/business/BsOrderGoodsController.java
  12. 7
      order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java
  13. 100
      schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java
  14. 3
      service/src/main/java/com/hfkj/common/utils/OrderUtil.java
  15. 83
      service/src/main/java/com/hfkj/common/utils/StarbucksUtil.java
  16. 142
      service/src/main/java/com/hfkj/dao/FileRecordsMapper.java
  17. 7
      service/src/main/java/com/hfkj/dao/FileRecordsMapperExt.java
  18. 388
      service/src/main/java/com/hfkj/dao/FileRecordsSqlProvider.java
  19. 2
      service/src/main/java/com/hfkj/entity/BsOrderGoods.java
  20. 305
      service/src/main/java/com/hfkj/entity/FileRecords.java
  21. 1263
      service/src/main/java/com/hfkj/entity/FileRecordsExample.java
  22. 2
      service/src/main/java/com/hfkj/model/order/OrderStarbucksModel.java
  23. 116
      service/src/main/java/com/hfkj/model/order/orderExport/OrderGoodsExportModel.java
  24. 17
      service/src/main/java/com/hfkj/qianzhu/channel/StarbucksService.java
  25. 2
      service/src/main/java/com/hfkj/service/cms/impl/CmsContentServiceImpl.java
  26. 83
      service/src/main/java/com/hfkj/service/file/FileRecordsService.java
  27. 71
      service/src/main/java/com/hfkj/service/file/impl/FileRecordsServiceImpl.java
  28. 13
      service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java
  29. 49
      service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java
  30. 10
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  31. 23
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  32. 15
      service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java
  33. 59
      service/src/main/java/com/hfkj/sysenum/fileRecords/FileRecordsEnum.java
  34. 32
      service/src/main/java/com/hfkj/sysenum/order/OrderLogisticsStatusEnum.java
  35. 9
      service/src/main/java/com/hfkj/sysenum/order/OrderStatusEnum.java
  36. 12
      service/src/main/resources/dev/commonConfig.properties

@ -1,17 +1,12 @@
package com.bweb.controller; package com.bweb.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.HttpUtils;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.SecMenu; import com.hfkj.entity.SecMenu;
import com.hfkj.entity.SecRoleMenuRel; import com.hfkj.entity.SecRoleMenuRel;
import com.hfkj.model.MenuTreeModel;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.service.SecMenuService; import com.hfkj.service.SecMenuService;
import com.hfkj.service.SecRoleMenuRelService; import com.hfkj.service.SecRoleMenuRelService;
@ -26,7 +21,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -174,39 +168,10 @@ public class SecMenuController {
try { try {
// 查询角色菜单权限 // 查询角色菜单权限
Map<Long, SecMenu> roleMenu = secMenuService.queryRoleMenu(roleId, SecMenuTypeEnum.type1).stream() List<SecRoleMenuRel> roleMenuList = secRoleMenuRelService.getRelListByRole(roleId);
.collect(Collectors.toMap(SecMenu::getId, Function.identity()));
// 系统菜单叶节点 return ResponseMsgUtil.success(roleMenuList.stream().map(SecRoleMenuRel::getMenuId).collect(Collectors.toList())
List<String> menuLeafList = new ArrayList<>(); .stream().map(Object::toString).collect(Collectors.toList()));
// 角色菜单叶节点
List<String> roleLeafList = new ArrayList<>();
// 获取全部菜单
List<SecMenu> menuList = secMenuService.getAllList();
// 获取最顶层菜单
List<SecMenu> topLevelMenuList = menuList.stream()
.filter(o -> o.getMenuPSid() == null)
.sorted(Comparator.comparing(SecMenu::getMenuSort))
.collect(Collectors.toList());
// 递归获取系统菜单叶子节点
for (SecMenu topLevelMenu : topLevelMenuList) {
if (topLevelMenu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) {
recursionMenu(menuList, topLevelMenu.getId(), menuLeafList);
}
}
// 筛选角色菜单叶节点
for (String leaf : menuLeafList) {
SecMenu menu = roleMenu.get(Long.parseLong(leaf));
if (menu != null) {
roleLeafList.add(""+menu.getId());
}
}
return ResponseMsgUtil.success(roleLeafList);
} catch (Exception e) { } catch (Exception e) {
log.error("error!",e); log.error("error!",e);
@ -247,11 +212,11 @@ public class SecMenuController {
for (SecMenu topLevelMenu : topLevelMenuList) { for (SecMenu topLevelMenu : topLevelMenuList) {
if (topLevelMenu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { if (topLevelMenu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) {
map = new LinkedHashMap<>(); map = new HashMap<>();
map.put("key", ""+topLevelMenu.getId()); map.put("key", ""+topLevelMenu.getId());
map.put("title", topLevelMenu.getMenuName()); map.put("title", topLevelMenu.getMenuName());
// 获取下级菜单 // 获取下级菜单
map.put("children", recursionMenu(menuList, topLevelMenu.getId(), new ArrayList<>())); map.put("children", recursionMenu(menuList, topLevelMenu.getId()));
mapList.add(map); mapList.add(map);
} }
} }
@ -270,7 +235,7 @@ public class SecMenuController {
* @param parentMenuId 父级菜单id * @param parentMenuId 父级菜单id
* @return * @return
*/ */
public List<Map<String,Object>> recursionMenu(List<SecMenu> dataSource, Long parentMenuId, List<String> leaf) { public List<Map<String,Object>> recursionMenu(List<SecMenu> dataSource, Long parentMenuId) {
List<Map<String,Object>> mapList = new ArrayList<>(); List<Map<String,Object>> mapList = new ArrayList<>();
Map<String,Object> map; Map<String,Object> map;
@ -280,13 +245,12 @@ public class SecMenuController {
.collect(Collectors.toList()); .collect(Collectors.toList());
for (SecMenu menu : collect) { for (SecMenu menu : collect) {
if (menu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { if (menu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) {
map = new LinkedHashMap<>(); map = new HashMap<>();
map.put("key", ""+menu.getId()); map.put("key", ""+menu.getId());
map.put("title", menu.getMenuName()); map.put("title", menu.getMenuName());
// 获取下级菜单 // 获取下级菜单
List<Map<String, Object>> recursioned = recursionMenu(dataSource, menu.getId(), leaf); List<Map<String, Object>> recursioned = recursionMenu(dataSource, menu.getId());
if (recursioned.isEmpty()) { if (recursioned.isEmpty()) {
leaf.add(""+menu.getId());
map.put("isLeaf", true); map.put("isLeaf", true);
} else { } else {
map.put("children", recursioned); map.put("children", recursioned);
@ -297,5 +261,4 @@ public class SecMenuController {
return mapList; return mapList;
} }
} }

@ -1,19 +1,22 @@
package com.bweb.controller; package com.bweb.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
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.entity.CouponDiscountGoodsRel; import com.hfkj.entity.*;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsSpecs;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.service.discount.CouponDiscountService; import com.hfkj.service.discount.CouponDiscountService;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsMsgService; import com.hfkj.service.goods.GoodsMsgService;
import com.hfkj.service.goods.GoodsSpecsService; import com.hfkj.service.goods.GoodsSpecsService;
import com.hfkj.service.hlt.HltCanteenService; import com.hfkj.service.hlt.HltCanteenService;
import com.hfkj.service.hlt.HuiLianTongUnionCardService; import com.hfkj.service.hlt.HuiLianTongUnionCardService;
import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.sysenum.order.OrderLogisticsStatusEnum;
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;
@ -44,6 +47,13 @@ public class TestController {
@Resource @Resource
private CouponDiscountService couponDiscountService; private CouponDiscountService couponDiscountService;
@Resource
private BsOrderChildService orderChildService;
@Resource
private BsOrderGoodsService orderGoodsService;
@Resource
private BsOrderGoodsService bsOrderGoodsService;
@RequestMapping(value="/canteenConsume",method = RequestMethod.GET) @RequestMapping(value="/canteenConsume",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "食堂消费") @ApiOperation(value = "食堂消费")
@ -100,4 +110,63 @@ public class TestController {
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }
} }
@RequestMapping(value="/orderGoodsUpdate",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "商品更新")
public ResponseData orderGoodsUpdate() {
try {
List<BsOrderGoods> orderGoodsList = orderGoodsService.getList();
for (BsOrderGoods goods : orderGoodsList) {
BsOrderChild child = orderChildService.getDetail(goods.getChildOrderNo());
goods.setStatus(child.getStatus());
goods.setUpdateTime(new Date());
orderGoodsService.update(goods);
}
return ResponseMsgUtil.success("成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/orderGoodsConfirmReceipt",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "商品确认收货")
public ResponseData orderGoodsConfirmReceipt() {
try {
Map<String , Object> map = new HashMap<>();
map.put("logisticsStatus" , "SIGN");
map.put("status" , 2);
List<BsOrderGoods> orderGoodsList = orderGoodsService.getList(map);
for (BsOrderGoods goods : orderGoodsList) {
// 判断时间是否是十天前
if (DateUtil.differentDays(goods.getCreateTime() , new Date()) > 9) {
bsOrderGoodsService.confirmReceipt(goods.getId());
goods.setStatus(3);
goods.setUpdateTime(new Date());
orderGoodsService.update(goods);
}
}
return ResponseMsgUtil.success("成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -0,0 +1,106 @@
package com.bweb.controller.file;
import com.bweb.controller.cms.CmsContentController;
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.FileRecords;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.file.FileRecordsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value="/file")
@Api(value="文件操作")
public class FileController {
Logger log = LoggerFactory.getLogger(CmsContentController.class);
@Resource
private FileRecordsService fileRecordsService;
@Resource
private UserCenter userCenter;
@RequestMapping(value="/getFileRecordsList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询列表")
public ResponseData getFileRecordsList( HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
Map<String, Object> map = new HashMap<>();
map.put("opId", userModel.getAccount().getId());
return ResponseMsgUtil.success(fileRecordsService.getList(map));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/findFileRecords",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询详情")
public ResponseData findFileRecords(
@RequestParam(value = "id" , required = true) Long id) {
try {
return ResponseMsgUtil.success(fileRecordsService.queryDetail(id));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getDownLoad",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "下载")
public ResponseData getDownLoad(
@RequestParam(value = "id" , required = true) Long id) {
try {
FileRecords fileRecords = fileRecordsService.queryDetail(id);
if (fileRecords.getStatus() != 1) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前状态错误!");
}
fileRecords.setStatus(1);
fileRecords.setUpdateTime(new Date());
fileRecords.setDownloadStatus(1);
fileRecords.setDownloadTime(new Date());
fileRecordsService.update(fileRecords);
return ResponseMsgUtil.success(fileRecords.getFileUrl());
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -93,6 +93,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/wxMsg/*") .excludePathPatterns("/wxMsg/*")
.excludePathPatterns("/cinema/*") .excludePathPatterns("/cinema/*")
.excludePathPatterns("/starbucks/*") .excludePathPatterns("/starbucks/*")
.excludePathPatterns("/c/*")
; ;
} }

@ -7,11 +7,14 @@ import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.RedisUtil; import com.hfkj.common.utils.RedisUtil;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsOrderGoods;
import com.hfkj.entity.GoodsLogistics; import com.hfkj.entity.GoodsLogistics;
import com.hfkj.entity.GoodsUserAddress;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.qianzhu.channel.QianZhuService; import com.hfkj.qianzhu.channel.QianZhuService;
import com.hfkj.service.CommonService; import com.hfkj.service.CommonService;
import com.hfkj.service.goods.BsOrderGoodsService; import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.service.hlt.HuiLianTongUnionCardService; import com.hfkj.service.hlt.HuiLianTongUnionCardService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -42,6 +45,9 @@ public class CommonController {
@Resource @Resource
private BsOrderGoodsService bsOrderGoodsService; private BsOrderGoodsService bsOrderGoodsService;
@Resource
private GoodsUserAddressService addressService;
@RequestMapping(value = "/test", method = RequestMethod.GET) @RequestMapping(value = "/test", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "test") @ApiOperation(value = "test")
@ -111,7 +117,19 @@ public class CommonController {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(logisticsNo); BsOrderGoods orderGoods = bsOrderGoodsService.findGoodsOrderLogisticsNo(logisticsNo);
if (orderGoods == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
GoodsUserAddress userAddress = addressService.queryDetail(orderGoods.getDeliveryAddressId());
if (userAddress == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(logisticsNo , userAddress.getPhone());
params.put("logistics", logistics); params.put("logistics", logistics);
JSONArray object = JSONArray.parseArray(logistics.getLogisticsTraceDetails()); JSONArray object = JSONArray.parseArray(logistics.getLogisticsTraceDetails());

@ -91,9 +91,7 @@ public class DeliveryAddressController {
deliveryAddress.setUpdateTime(new Date()); deliveryAddress.setUpdateTime(new Date());
deliveryAddressService.create(deliveryAddress); deliveryAddressService.create(deliveryAddress);
return ResponseMsgUtil.success(deliveryAddress);
return ResponseMsgUtil.success("新增成功");
} catch (Exception e) { } catch (Exception e) {
log.error("GoodsDetailController --> insertPrice() error!", e); log.error("GoodsDetailController --> insertPrice() error!", e);

@ -2,10 +2,16 @@ package com.cweb.controller.qianZhu;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
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.utils.DateUtil; import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.PageUtil;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsProductConfig; import com.hfkj.entity.BsProductConfig;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.model.goods.GoodsModel;
import com.hfkj.qianzhu.channel.CinemaService; import com.hfkj.qianzhu.channel.CinemaService;
import com.hfkj.service.BsProductConfigService; import com.hfkj.service.BsProductConfigService;
import com.hfkj.sysenum.order.OrderChildProductTypeEnum; import com.hfkj.sysenum.order.OrderChildProductTypeEnum;
@ -22,9 +28,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
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.Comparator; import java.util.*;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Controller @Controller
@ -41,6 +45,7 @@ public class CinemaController {
@ResponseBody @ResponseBody
@ApiOperation(value = "根据城市分页查询影片") @ApiOperation(value = "根据城市分页查询影片")
public ResponseData filmsPagedQuery(@RequestParam(value = "cityId", required = false) Integer cityId, public ResponseData filmsPagedQuery(@RequestParam(value = "cityId", required = false) Integer cityId,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "cityCode", required = false) String cityCode, @RequestParam(value = "cityCode", required = false) String cityCode,
@RequestParam(value = "cinemaId", required = false) String cinemaId, @RequestParam(value = "cinemaId", required = false) String cinemaId,
@RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageNum", required = true) Integer pageNum,
@ -58,10 +63,42 @@ public class CinemaController {
if (cinemaId != null) { if (cinemaId != null) {
params.put("cinemaId", cinemaId); params.put("cinemaId", cinemaId);
} }
params.put("pageIndex", pageNum); params.put("pageIndex", 1);
params.put("pageSize", pageSize); params.put("pageSize", 499);
JSONObject object = CinemaService.filmsPagedQuery(params);
JSONArray array = object.getJSONArray("data");
List<JSONObject> list = new ArrayList<>();
for (Object o : array) {
JSONObject item = (JSONObject) o;
list.add(item);
}
return ResponseMsgUtil.success(CinemaService.filmsPagedQuery(params)); if (list.isEmpty()) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无数据!");
}
if (name != null) {
list = list.stream()
.filter(s -> s.getString("name").contains(name)) // 使用contains方法进行模糊查询
.collect(Collectors.toList()); // 将结果收集到列表中
}
list = list.stream().sorted(
// 根据对象中的ID进行升序排序 小到大
Comparator.comparingLong(
e -> DateUtil.timesTamp(JSONObject.parseObject(e.toString()).getString("publishDate"))
)
// 放开下面的注释,使用reversed()方法,就是降序 大到小
.reversed()
).collect(Collectors.toList());
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, list.size(), pageSize, new PageInfo<>(list)));
} catch (Exception e) { } catch (Exception e) {
log.error("error!",e); log.error("error!",e);

@ -26,10 +26,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
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.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -84,7 +81,7 @@ public class StarbucksController {
// 查询产品 // 查询产品
Map<String , Object> map = new HashMap<>(); Map<String , Object> map = new HashMap<>();
map.put("pageIndex", 1); map.put("pageIndex", 1);
map.put("pageSize", 100000); map.put("pageSize", 200);
JSONObject object = StarbucksService.starbucksProducts(map); JSONObject object = StarbucksService.starbucksProducts(map);
if (object.getJSONObject("data") != null) { if (object.getJSONObject("data") != null) {
JSONArray jsonArray = object.getJSONObject("data").getJSONArray("items"); JSONArray jsonArray = object.getJSONObject("data").getJSONArray("items");
@ -96,29 +93,40 @@ public class StarbucksController {
// 中杯售卖价 // 中杯售卖价
BigDecimal tallPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesTallPrice")); BigDecimal tallPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesTallPrice"));
List<BigDecimal> priceList = new ArrayList<>();
// 判断如果卖家 大于 原价 展示原价 // 判断如果卖家 大于 原价 展示原价
if (tallPrice.compareTo(item.getBigDecimal("marketTallPrice")) > 0) { if (tallPrice.compareTo(item.getBigDecimal("marketTallPrice")) > 0) {
item.put("tallPrice" , item.getBigDecimal("marketTallPrice")); item.put("tallPrice" , item.getBigDecimal("marketTallPrice"));
priceList.add(item.getBigDecimal("marketTallPrice"));
} else { } else {
item.put("tallPrice" , tallPrice); item.put("tallPrice" , tallPrice);
priceList.add(tallPrice);
} }
// 大杯销售价 // 大杯销售价
BigDecimal grandePrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesGrandePrice")); BigDecimal grandePrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesGrandePrice"));
if (grandePrice.compareTo(item.getBigDecimal("marketGrandePrice")) > 0) { if (grandePrice.compareTo(item.getBigDecimal("marketGrandePrice")) > 0) {
item.put("grandePrice" , item.getBigDecimal("marketGrandePrice")); item.put("grandePrice" , item.getBigDecimal("marketGrandePrice"));
priceList.add(item.getBigDecimal("marketGrandePrice"));
} else { } else {
item.put("grandePrice" , grandePrice); item.put("grandePrice" , grandePrice);
priceList.add(grandePrice);
} }
// 超大杯销售价 // 超大杯销售价
BigDecimal ventiPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesVentiPrice")); BigDecimal ventiPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesVentiPrice"));
if (ventiPrice.compareTo(item.getBigDecimal("marketVentiPrice")) > 0) { if (ventiPrice.compareTo(item.getBigDecimal("marketVentiPrice")) > 0) {
item.put("ventiPrice" , item.getBigDecimal("marketVentiPrice")); item.put("ventiPrice" , item.getBigDecimal("marketVentiPrice"));
priceList.add(item.getBigDecimal("marketVentiPrice"));
} else { } else {
item.put("ventiPrice" , ventiPrice); item.put("ventiPrice" , ventiPrice);
priceList.add(ventiPrice);
} }
Collections.sort(priceList);
item.put("tallPrice" ,priceList.get(0));
List<JSONObject> dataList = new ArrayList<>(); List<JSONObject> dataList = new ArrayList<>();
JSONObject jsonObject ; JSONObject jsonObject ;

@ -35,6 +35,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @className: OrderController * @className: OrderController
@ -57,6 +58,7 @@ public class OrderController {
@ApiOperation(value = "创建订单") @ApiOperation(value = "创建订单")
public ResponseData create(@RequestBody OrderModel body) { public ResponseData create(@RequestBody OrderModel body) {
try { try {
System.out.println("body" + body.toString());
// 用户session // 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class); UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
if (userSession == null) { if (userSession == null) {
@ -202,5 +204,37 @@ public class OrderController {
} }
@RequestMapping(value="/orderNum",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "订单数量")
public ResponseData orderNum() {
try {
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
Map<String , Object> map = new HashMap<>();
map.put("userId" , userSession.getUser().getId());
List<BsOrder> bsOrder = orderService.getOrderList(map);
Map<Integer, List<BsOrder>> collect = bsOrder.stream().collect(Collectors.groupingBy(BsOrder::getOrderStatus));
List<JSONObject> countRecords = collect.keySet().stream().map(key -> {
JSONObject goodObject = new JSONObject(true);
goodObject.put("name", OrderStatusEnum.getData(key).getName());
goodObject.put("status", key);
goodObject.put("num",collect.get(key).size());
return goodObject;
}).collect(Collectors.toList());
return ResponseMsgUtil.success(countRecords);
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -0,0 +1,11 @@
package com.order.controller.business;
import io.swagger.annotations.Api;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping(value="/orderDownload")
@Api(value="订单下载管理")
public class BsOrderDownloadController {
}

@ -1,6 +1,8 @@
package com.order.controller.business; package com.order.controller.business;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -9,30 +11,41 @@ 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.OrderUtil; import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsOrderGoods; import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.GoodsLogistics; import com.hfkj.entity.*;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject; import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.UserSessionObject;
import com.hfkj.model.order.orderExport.OrderGoodsExportModel;
import com.hfkj.service.file.FileRecordsService;
import com.hfkj.service.goods.BsOrderGoodsService; import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.service.order.BsOrderService; import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.SecUserObjectTypeEnum; import com.hfkj.sysenum.SecUserObjectTypeEnum;
import com.hfkj.sysenum.order.OrderGoodsStatusEnum; import com.hfkj.sysenum.fileRecords.FileRecordsEnum;
import com.hfkj.sysenum.order.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; 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.util.Date; import java.io.File;
import java.util.HashMap; import java.math.BigDecimal;
import java.util.Map; import java.util.*;
import java.util.Objects; import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@Controller @Controller
@RequestMapping(value="/orderGoods") @RequestMapping(value="/orderGoods")
@ -50,6 +63,15 @@ public class BsOrderGoodsController {
@Resource @Resource
private BsOrderService orderService; private BsOrderService orderService;
@Resource
private FileRecordsService fileRecordsService;
@Resource
private GoodsUserAddressService addressService;
@Resource
private BsOrderGoodsService orderGoodsService;
@RequestMapping(value="/getListGoods",method = RequestMethod.GET) @RequestMapping(value="/getListGoods",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ -62,8 +84,10 @@ public class BsOrderGoodsController {
@RequestParam(value = "userPhone" , required = false) String userPhone, @RequestParam(value = "userPhone" , required = false) String userPhone,
@RequestParam(value = "goodsSpecsName" , required = false) String goodsSpecsName, @RequestParam(value = "goodsSpecsName" , required = false) String goodsSpecsName,
@RequestParam(value = "goodsName" , required = false) String goodsName, @RequestParam(value = "goodsName" , required = false) String goodsName,
@RequestParam(value = "logisticsStatus" , required = false) String logisticsStatus,
@RequestParam(value = "payType" , required = false) Integer payType, @RequestParam(value = "payType" , required = false) Integer payType,
@RequestParam(value = "status" , required = false) Integer status, @RequestParam(value = "status" , required = false) Integer status,
@RequestParam(value = "merId" , required = false) Long merId,
@RequestParam(value = "createTimeS" , required = false) Long createTimeS, @RequestParam(value = "createTimeS" , required = false) Long createTimeS,
@RequestParam(value = "createTimeE" , required = false) Long createTimeE, @RequestParam(value = "createTimeE" , required = false) Long createTimeE,
@RequestParam(value = "pageNum" , required = true) Integer pageNum, @RequestParam(value = "pageNum" , required = true) Integer pageNum,
@ -74,7 +98,9 @@ public class BsOrderGoodsController {
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject(); SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
Map<String , Object> map = new HashMap<>(); Map<String , Object> map = new HashMap<>();
if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
map.put("merId", merId);
}
if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) {
map.put("merId", userModel.getAccount().getObjectId()); map.put("merId", userModel.getAccount().getObjectId());
} }
@ -85,12 +111,12 @@ public class BsOrderGoodsController {
map.put("orderNo", orderNo); map.put("orderNo", orderNo);
map.put("childOrderNo", childOrderNo); map.put("childOrderNo", childOrderNo);
map.put("userPhone", userPhone); map.put("userPhone", userPhone);
map.put("logisticsStatus", logisticsStatus);
map.put("goodsSpecsName", goodsSpecsName); map.put("goodsSpecsName", goodsSpecsName);
map.put("goodsName", goodsName); map.put("goodsName", goodsName);
map.put("payType", payType); map.put("payType", payType);
map.put("createTimeS", createTimeS); map.put("createTimeS", createTimeS);
map.put("createTimeE", createTimeE); map.put("createTimeE", createTimeE);
map.put("status", status); map.put("status", status);
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
@ -102,6 +128,157 @@ public class BsOrderGoodsController {
} }
} }
@RequestMapping(value="/exportGoodsOrder",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "导出商品订单")
public ResponseData exportGoodsOrder(@RequestParam(value = "logisticsNo" , required = false) String logisticsNo,
@RequestParam(value = "goodsType" , required = false) Long goodsType,
@RequestParam(value = "goodsBrand" , required = false) Long goodsBrand,
@RequestParam(value = "orderNo" , required = false) String orderNo,
@RequestParam(value = "childOrderNo" , required = false) String childOrderNo,
@RequestParam(value = "userPhone" , required = false) String userPhone,
@RequestParam(value = "goodsSpecsName" , required = false) String goodsSpecsName,
@RequestParam(value = "goodsName" , required = false) String goodsName,
@RequestParam(value = "logisticsStatus" , required = false) String logisticsStatus,
@RequestParam(value = "payType" , required = false) Integer payType,
@RequestParam(value = "status" , required = false) Integer status,
@RequestParam(value = "merId" , required = false) Long merId,
@RequestParam(value = "createTimeS" , required = false) Long createTimeS,
@RequestParam(value = "createTimeE" , required = false) Long createTimeE, HttpServletRequest request) {
// 插入下载记录
FileRecords fileRecords = new FileRecords();
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
Map<String , Object> map = new HashMap<>();
if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
map.put("merId", merId);
}
if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) {
map.put("merId", userModel.getAccount().getObjectId());
}
map.put("logisticsNo", logisticsNo);
map.put("goodsType", goodsType);
map.put("goodsBrand", goodsBrand);
map.put("orderNo", orderNo);
map.put("childOrderNo", childOrderNo);
map.put("userPhone", userPhone);
map.put("logisticsStatus", logisticsStatus);
map.put("goodsSpecsName", goodsSpecsName);
map.put("goodsName", goodsName);
map.put("payType", payType);
map.put("createTimeS", createTimeS);
map.put("createTimeE", createTimeE);
map.put("status", status);
String dataSting = "";
if (createTimeE != null) {
dataSting = DateUtil.date2String(DateUtil.long2Date(createTimeS) , DateUtil.YMDHMS) + "-" + DateUtil.date2String(DateUtil.long2Date(createTimeE) , DateUtil.YMDHMS);
} else {
dataSting = DateUtil.date2String(new Date(), DateUtil.YMDHMS);
}
String fileUrl = CommonSysConst.getSysConfig().getFileUrl();
String filePath = "/temporary/" + userModel.getAccount().getId() + "/" ;
String pathName = filePath + FileRecordsEnum.status1.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.status1.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.status1.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<BsOrderGoods> list = bsOrderGoodsService.getList(map);
List<OrderGoodsExportModel> goodsExportModels = new ArrayList<>();
for (BsOrderGoods bsOrderGoods : list) {
OrderGoodsExportModel orderGoodsExportModel = new OrderGoodsExportModel();
BeanUtils.copyProperties(orderGoodsExportModel, bsOrderGoods);
if (bsOrderGoods.getIntegralDiscountPrice() != null) {
orderGoodsExportModel.setIntegralDiscountPrice(BigDecimal.valueOf(bsOrderGoods.getIntegralDiscountPrice()).divide(new BigDecimal(100)));
}
if (bsOrderGoods.getPayChannel() != null) {
orderGoodsExportModel.setPayChannel(OrderPayChannelEnum.getData(bsOrderGoods.getPayChannel()).getName());
}
if (bsOrderGoods.getPayType() != null) {
orderGoodsExportModel.setPayType(OrderPayTypeEnum.getData(bsOrderGoods.getPayType()).getName());
}
if (bsOrderGoods.getStatus() != null) {
orderGoodsExportModel.setTradeStatus(OrderChildStatusEnum.getData(bsOrderGoods.getStatus()).getName());
}
goodsExportModels.add(orderGoodsExportModel);
}
File file = new File(fileUrl + filePath);
if (!file.exists()) {
file.mkdirs();
}
EasyExcel.write(fileUrl+pathName)
.head(OrderGoodsExportModel.class)
.sheet(fileRecords.getTitle())
.doWrite(goodsExportModels);
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);
}
}
@RequestMapping(value="/updateLogisticsNo",method = RequestMethod.POST) @RequestMapping(value="/updateLogisticsNo",method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "更新物流订单号") @ApiOperation(value = "更新物流订单号")
@ -126,14 +303,12 @@ public class BsOrderGoodsController {
goodsOrder.setLogisticsNo(logisticsNo); goodsOrder.setLogisticsNo(logisticsNo);
goodsOrder.setUpdateTime(new Date()); goodsOrder.setUpdateTime(new Date());
if (goodsOrder.getStatus() == OrderGoodsStatusEnum.status1.getCode()) {
goodsOrder.setStatus(OrderGoodsStatusEnum.status2.getCode());
}
// 删除缓存 // 删除缓存
orderService.cacheDelete(goodsOrder.getOrderNo()); orderService.cacheDelete(goodsOrder.getOrderNo());
bsOrderGoodsService.cacheDelete(goodsOrder.getLogisticsNo()); bsOrderGoodsService.cacheDelete(goodsOrder.getLogisticsNo());
bsOrderGoodsService.update(goodsOrder); bsOrderGoodsService.update(goodsOrder);
getLogisticsMsg(goodsOrder.getId());
return ResponseMsgUtil.success("更新成功!"); return ResponseMsgUtil.success("更新成功!");
} catch (Exception e) { } catch (Exception e) {
@ -147,19 +322,31 @@ public class BsOrderGoodsController {
@ApiOperation(value = "查询物流") @ApiOperation(value = "查询物流")
public ResponseData getLogisticsMsg(@RequestParam(value = "id" , required = false) Long id) { public ResponseData getLogisticsMsg(@RequestParam(value = "id" , required = false) Long id) {
try { try {
Map<String , Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
BsOrderGoods orderGoods = bsOrderGoodsService.queryDetail(id); BsOrderGoods orderGoods = bsOrderGoodsService.queryDetail(id);
if (orderGoods == null || orderGoods.getLogisticsNo() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂未发货!"); if (orderGoods == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
} }
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(orderGoods.getLogisticsNo()); GoodsUserAddress userAddress = addressService.queryDetail(orderGoods.getDeliveryAddressId());
orderGoods.setLogisticsStatus(logistics.getLogisticsStatus()); if (userAddress == null) {
orderGoods.setLogisticsStatusDesc(logistics.getLogisticsStatusDesc()); throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
bsOrderGoodsService.update(orderGoods); }
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(orderGoods.getLogisticsNo() , userAddress.getPhone());
if (logistics.getLogisticsStatus() != null) {
orderGoods.setLogisticsStatus(logistics.getLogisticsStatus());
orderGoods.setLogisticsStatusDesc(logistics.getLogisticsStatusDesc());
} else {
orderGoods.setLogisticsStatus(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getCode());
orderGoods.setLogisticsStatusDesc(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getName());
}
bsOrderGoodsService.update(orderGoods);
map.put("logistics", logistics); map.put("logistics", logistics);
JSONArray object = JSONArray.parseArray(logistics.getLogisticsTraceDetails()); JSONArray object = JSONArray.parseArray(logistics.getLogisticsTraceDetails());
map.put("logisticsTraceDetails", object); map.put("logisticsTraceDetails", object);
@ -186,4 +373,39 @@ public class BsOrderGoodsController {
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }
} }
@RequestMapping(value="/updateShippingAddress",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "更新收货地址")
public ResponseData updateShippingAddress(@RequestParam(value = "orderNo" , required = true) String orderNo,
@RequestParam(value = "addressId" , required = true) Long addressId) {
try {
GoodsUserAddress deliveryAddress = addressService.queryDetail(addressId);
if (deliveryAddress == null) {
log.error("GoodsDetailController -> findGoodsDetailById() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相信息");
}
BsOrderGoods orderGoods = orderGoodsService.findGoodsOrder(orderNo);
if (orderGoods == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "未找到相信息");
}
orderGoods.setDeliveryAddressId(deliveryAddress.getId());
orderGoods.setUpdateTime(new Date());
orderGoods.setDeliveryAddress(deliveryAddress.getAddress());
orderGoodsService.update(orderGoods);
return ResponseMsgUtil.success("成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -1,18 +1,15 @@
package com.order.controller.business; package com.order.controller.business;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.PageUtil; import com.hfkj.common.utils.PageUtil;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsOrderChild; import com.hfkj.entity.BsOrderChild;
import com.hfkj.entity.BsOrderStarbucks; import com.hfkj.entity.BsOrderStarbucks;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.order.OrderStarbucksModel; import com.hfkj.model.order.OrderStarbucksModel;
import com.hfkj.service.goods.BsOrderStarbucksService; import com.hfkj.service.goods.BsOrderStarbucksService;
import com.hfkj.service.order.BsOrderChildService; import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
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;
@ -89,7 +86,7 @@ public class BsOrderStarbucksController {
starbucksModel.setStoreAddress(starbucks.get(0).getStoreAddress()); starbucksModel.setStoreAddress(starbucks.get(0).getStoreAddress());
starbucksModel.setStoreName(starbucks.get(0).getStoreName()); starbucksModel.setStoreName(starbucks.get(0).getStoreName());
starbucksModel.setUserPhone(starbucks.get(0).getUserPhone()); starbucksModel.setUserPhone(starbucks.get(0).getUserPhone());
starbucksModel.setPayType(starbucks.get(0).getPayType());
starbucksModelList.add(starbucksModel); starbucksModelList.add(starbucksModel);
} }

@ -0,0 +1,100 @@
package com.hfkj.schedule;
import com.alibaba.fastjson.JSONArray;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.entity.BsOrderGoods;
import com.hfkj.entity.GoodsLogistics;
import com.hfkj.entity.GoodsUserAddress;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.sysenum.order.OrderLogisticsStatusEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName OrderGoodsSchedule
* @Author Sum1Dream
* @Description 实物订单定时任务
* @Date 2024/8/12 下午3:00
**/
@Configuration
public class OrderGoodsSchedule {
private static Logger log = LoggerFactory.getLogger(OrderGoodsSchedule.class);
@Resource
private BsOrderGoodsService orderGoodsService;
@Resource
private BsOrderGoodsService bsOrderGoodsService;
@Resource
private GoodsUserAddressService addressService;
//每日凌晨12点5秒执行一次
@Scheduled(cron = "5 0 0 * * ?")
public void orderGoodsConfirmReceipt() {
Map<String , Object> map = new HashMap<>();
map.put("logisticsStatus" , "SIGN");
map.put("status" , 2);
List<BsOrderGoods> orderGoodsList = orderGoodsService.getList(map);
for (BsOrderGoods goods : orderGoodsList) {
// 判断时间是否是十天前
if (DateUtil.differentDays(goods.getCreateTime() , new Date()) > 10) {
bsOrderGoodsService.confirmReceipt(goods.getId());
}
}
}
@Scheduled(cron = "30 0 0 * * ?")
public void getLogisticsMsg() {
Map<String , Object> objectMap = new HashMap<>();
objectMap.put("status" , 2);
List<BsOrderGoods> orderGoodsList = orderGoodsService.getList(objectMap);
for (BsOrderGoods goods : orderGoodsList) {
if (goods == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
GoodsUserAddress userAddress = addressService.queryDetail(goods.getDeliveryAddressId());
if (userAddress == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(goods.getLogisticsNo() , userAddress.getPhone());
if (logistics.getLogisticsStatus() != null) {
goods.setLogisticsStatus(logistics.getLogisticsStatus());
goods.setLogisticsStatusDesc(logistics.getLogisticsStatusDesc());
} else {
goods.setLogisticsStatus(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getCode());
goods.setLogisticsStatusDesc(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getName());
}
goods.setUpdateTime(new Date());
bsOrderGoodsService.update(goods);
}
}
}

@ -71,13 +71,14 @@ public class OrderUtil {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public static JSONObject getLogisticsMsg(String num) { public static JSONObject getLogisticsMsg(String num , String mobile) {
String appcode = "f9ace4c915054ca697a76fb9a4e1e8c0"; String appcode = "f9ace4c915054ca697a76fb9a4e1e8c0";
Map<String, String> headers = new HashMap<>(); Map<String, String> headers = new HashMap<>();
headers.put("Authorization", "APPCODE " + appcode); headers.put("Authorization", "APPCODE " + appcode);
Map<String, String> querys = new HashMap<>(); Map<String, String> querys = new HashMap<>();
querys.put("number", num); querys.put("number", num);
querys.put("mobile", mobile);
return HttpsUtils.doGet("https://express3.market.alicloudapi.com/express3" , querys ,headers); return HttpsUtils.doGet("https://express3.market.alicloudapi.com/express3" , querys ,headers);
} }

@ -36,36 +36,61 @@ public class StarbucksUtil {
for (String cup : cpuS) { for (String cup : cpuS) {
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
switch (cup) { if (cup.equals("中杯") && tallPrice.compareTo(new BigDecimal(1000)) < 0) {
case "中杯": obj.put("cpu" , "中杯");
obj.put("cpu", "中杯"); obj.put("notSelect" , tall);
obj.put("notSelect", tall); obj.put("select" , tallSelect);
obj.put("select", tallSelect); obj.put("volume" , "355ml");
obj.put("volume", "355ml"); obj.put("price", tallPrice);
obj.put("price", tallPrice); } else if (cup.equals("大杯") && grandePrice.compareTo(new BigDecimal(1000)) < 0) {
break; obj.put("cpu" , "大杯");
case "大杯": obj.put("notSelect" , grande);
obj.put("cpu", "大杯"); obj.put("select" , grandeSelect);
obj.put("notSelect", grande); obj.put("volume" , "473ml");
obj.put("select", grandeSelect); obj.put("price", grandePrice);
obj.put("volume", "473ml"); } else if (cup.equals("超大杯") && ventiPrice.compareTo(new BigDecimal(1000)) < 0) {
obj.put("price", grandePrice); obj.put("cpu" , "超大杯");
break; obj.put("notSelect" , venti);
case "超大杯": obj.put("select" , ventiSelect);
obj.put("cpu", "超大杯"); obj.put("volume" , "592ml");
obj.put("notSelect", venti); obj.put("price", ventiPrice);
obj.put("select", ventiSelect); } else {
obj.put("volume", "473ml"); obj.put("cpu" , "特殊杯");
obj.put("price", ventiPrice); obj.put("notSelect" , venti);
break; obj.put("select" , ventiSelect);
default: obj.put("volume" , "∞ml");
obj.put("cpu", "特殊杯"); obj.put("price", ventiPrice);
obj.put("notSelect", venti);
obj.put("select", ventiSelect);
obj.put("volume", "∞ml");
obj.put("price", ventiPrice);
break;
} }
// switch (cup) {
// case "中杯":
// obj.put("cpu", "中杯");
// obj.put("notSelect", tall);
// obj.put("select", tallSelect);
// obj.put("volume", "355ml");
// obj.put("price", tallPrice);
// break;
// case "大杯":
// obj.put("cpu", "大杯");
// obj.put("notSelect", grande);
// obj.put("select", grandeSelect);
// obj.put("volume", "473ml");
// obj.put("price", grandePrice);
// break;
// case "超大杯":
// obj.put("cpu", "超大杯");
// obj.put("notSelect", venti);
// obj.put("select", ventiSelect);
// obj.put("volume", "592ml");
// obj.put("price", ventiPrice);
// break;
// default:
// obj.put("cpu", "特殊杯");
// obj.put("notSelect", venti);
// obj.put("select", ventiSelect);
// obj.put("volume", "∞ml");
// obj.put("price", ventiPrice);
// break;
// }
list.add(obj); list.add(obj);
} }

@ -0,0 +1,142 @@
package com.hfkj.dao;
import com.hfkj.entity.FileRecords;
import com.hfkj.entity.FileRecordsExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface FileRecordsMapper extends FileRecordsMapperExt {
@SelectProvider(type=FileRecordsSqlProvider.class, method="countByExample")
long countByExample(FileRecordsExample example);
@DeleteProvider(type=FileRecordsSqlProvider.class, method="deleteByExample")
int deleteByExample(FileRecordsExample example);
@Delete({
"delete from file_records",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into file_records (title, `type`, ",
"download_conditions, file_url, ",
"business_type, create_time, ",
"update_time, download_time, ",
"download_status, `status`, ",
"op_id, op_name, ext_1, ",
"ext_2, ext_3)",
"values (#{title,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, ",
"#{downloadConditions,jdbcType=VARCHAR}, #{fileUrl,jdbcType=VARCHAR}, ",
"#{businessType,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{downloadTime,jdbcType=TIMESTAMP}, ",
"#{downloadStatus,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, ",
"#{opId,jdbcType=BIGINT}, #{opName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(FileRecords record);
@InsertProvider(type=FileRecordsSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(FileRecords record);
@SelectProvider(type=FileRecordsSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
@Result(column="type", property="type", jdbcType=JdbcType.VARCHAR),
@Result(column="download_conditions", property="downloadConditions", jdbcType=JdbcType.VARCHAR),
@Result(column="file_url", property="fileUrl", jdbcType=JdbcType.VARCHAR),
@Result(column="business_type", property="businessType", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="download_time", property="downloadTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="download_status", property="downloadStatus", jdbcType=JdbcType.INTEGER),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT),
@Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<FileRecords> selectByExample(FileRecordsExample example);
@Select({
"select",
"id, title, `type`, download_conditions, file_url, business_type, create_time, ",
"update_time, download_time, download_status, `status`, op_id, op_name, ext_1, ",
"ext_2, ext_3",
"from file_records",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
@Result(column="type", property="type", jdbcType=JdbcType.VARCHAR),
@Result(column="download_conditions", property="downloadConditions", jdbcType=JdbcType.VARCHAR),
@Result(column="file_url", property="fileUrl", jdbcType=JdbcType.VARCHAR),
@Result(column="business_type", property="businessType", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="download_time", property="downloadTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="download_status", property="downloadStatus", jdbcType=JdbcType.INTEGER),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT),
@Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
FileRecords selectByPrimaryKey(Long id);
@UpdateProvider(type=FileRecordsSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") FileRecords record, @Param("example") FileRecordsExample example);
@UpdateProvider(type=FileRecordsSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") FileRecords record, @Param("example") FileRecordsExample example);
@UpdateProvider(type=FileRecordsSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(FileRecords record);
@Update({
"update file_records",
"set title = #{title,jdbcType=VARCHAR},",
"`type` = #{type,jdbcType=VARCHAR},",
"download_conditions = #{downloadConditions,jdbcType=VARCHAR},",
"file_url = #{fileUrl,jdbcType=VARCHAR},",
"business_type = #{businessType,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"download_time = #{downloadTime,jdbcType=TIMESTAMP},",
"download_status = #{downloadStatus,jdbcType=INTEGER},",
"`status` = #{status,jdbcType=INTEGER},",
"op_id = #{opId,jdbcType=BIGINT},",
"op_name = #{opName,jdbcType=VARCHAR},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(FileRecords record);
}

@ -0,0 +1,7 @@
package com.hfkj.dao;
/**
* mapper扩展类
*/
public interface FileRecordsMapperExt {
}

@ -0,0 +1,388 @@
package com.hfkj.dao;
import com.hfkj.entity.FileRecords;
import com.hfkj.entity.FileRecordsExample.Criteria;
import com.hfkj.entity.FileRecordsExample.Criterion;
import com.hfkj.entity.FileRecordsExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class FileRecordsSqlProvider {
public String countByExample(FileRecordsExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("file_records");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(FileRecordsExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("file_records");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(FileRecords record) {
SQL sql = new SQL();
sql.INSERT_INTO("file_records");
if (record.getTitle() != null) {
sql.VALUES("title", "#{title,jdbcType=VARCHAR}");
}
if (record.getType() != null) {
sql.VALUES("`type`", "#{type,jdbcType=VARCHAR}");
}
if (record.getDownloadConditions() != null) {
sql.VALUES("download_conditions", "#{downloadConditions,jdbcType=VARCHAR}");
}
if (record.getFileUrl() != null) {
sql.VALUES("file_url", "#{fileUrl,jdbcType=VARCHAR}");
}
if (record.getBusinessType() != null) {
sql.VALUES("business_type", "#{businessType,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getDownloadTime() != null) {
sql.VALUES("download_time", "#{downloadTime,jdbcType=TIMESTAMP}");
}
if (record.getDownloadStatus() != null) {
sql.VALUES("download_status", "#{downloadStatus,jdbcType=INTEGER}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getOpId() != null) {
sql.VALUES("op_id", "#{opId,jdbcType=BIGINT}");
}
if (record.getOpName() != null) {
sql.VALUES("op_name", "#{opName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(FileRecordsExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("title");
sql.SELECT("`type`");
sql.SELECT("download_conditions");
sql.SELECT("file_url");
sql.SELECT("business_type");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("download_time");
sql.SELECT("download_status");
sql.SELECT("`status`");
sql.SELECT("op_id");
sql.SELECT("op_name");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("file_records");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
FileRecords record = (FileRecords) parameter.get("record");
FileRecordsExample example = (FileRecordsExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("file_records");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getTitle() != null) {
sql.SET("title = #{record.title,jdbcType=VARCHAR}");
}
if (record.getType() != null) {
sql.SET("`type` = #{record.type,jdbcType=VARCHAR}");
}
if (record.getDownloadConditions() != null) {
sql.SET("download_conditions = #{record.downloadConditions,jdbcType=VARCHAR}");
}
if (record.getFileUrl() != null) {
sql.SET("file_url = #{record.fileUrl,jdbcType=VARCHAR}");
}
if (record.getBusinessType() != null) {
sql.SET("business_type = #{record.businessType,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getDownloadTime() != null) {
sql.SET("download_time = #{record.downloadTime,jdbcType=TIMESTAMP}");
}
if (record.getDownloadStatus() != null) {
sql.SET("download_status = #{record.downloadStatus,jdbcType=INTEGER}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getOpId() != null) {
sql.SET("op_id = #{record.opId,jdbcType=BIGINT}");
}
if (record.getOpName() != null) {
sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("file_records");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("title = #{record.title,jdbcType=VARCHAR}");
sql.SET("`type` = #{record.type,jdbcType=VARCHAR}");
sql.SET("download_conditions = #{record.downloadConditions,jdbcType=VARCHAR}");
sql.SET("file_url = #{record.fileUrl,jdbcType=VARCHAR}");
sql.SET("business_type = #{record.businessType,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("download_time = #{record.downloadTime,jdbcType=TIMESTAMP}");
sql.SET("download_status = #{record.downloadStatus,jdbcType=INTEGER}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("op_id = #{record.opId,jdbcType=BIGINT}");
sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
FileRecordsExample example = (FileRecordsExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(FileRecords record) {
SQL sql = new SQL();
sql.UPDATE("file_records");
if (record.getTitle() != null) {
sql.SET("title = #{title,jdbcType=VARCHAR}");
}
if (record.getType() != null) {
sql.SET("`type` = #{type,jdbcType=VARCHAR}");
}
if (record.getDownloadConditions() != null) {
sql.SET("download_conditions = #{downloadConditions,jdbcType=VARCHAR}");
}
if (record.getFileUrl() != null) {
sql.SET("file_url = #{fileUrl,jdbcType=VARCHAR}");
}
if (record.getBusinessType() != null) {
sql.SET("business_type = #{businessType,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getDownloadTime() != null) {
sql.SET("download_time = #{downloadTime,jdbcType=TIMESTAMP}");
}
if (record.getDownloadStatus() != null) {
sql.SET("download_status = #{downloadStatus,jdbcType=INTEGER}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getOpId() != null) {
sql.SET("op_id = #{opId,jdbcType=BIGINT}");
}
if (record.getOpName() != null) {
sql.SET("op_name = #{opName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, FileRecordsExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -165,7 +165,7 @@ public class BsOrderGoods implements Serializable {
private Integer payType; private Integer payType;
/** /**
* 1:待发货 2:已发货 3配送中 4已送达 5已取消 6退货中 7已退货 8待支付 0:删除 * bs_order_child订单表同步
*/ */
private Integer status; private Integer status;

@ -0,0 +1,305 @@
package com.hfkj.entity;
import java.io.Serializable;
import java.util.Date;
/**
* file_records
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class FileRecords implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 标题
*/
private String title;
/**
* 1:上传2:下载
*/
private String type;
/**
* 下载条件
*/
private String downloadConditions;
/**
* 文件地址
*/
private String fileUrl;
/**
* 业务类型1:实物产品 2:虚拟产品 3:肯德基 4:星巴克 5:支付订单 6:物流上传订单 7: 物流下载订单
*/
private Integer businessType;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 下载时间
*/
private Date downloadTime;
/**
* 是否下载 1 已下载 2未下载 0:下载失败
*/
private Integer downloadStatus;
/**
* 状态1 成功 2:导出中 3:失败
*/
private Integer status;
/**
* 操作人
*/
private Long opId;
/**
* 操作人名称
*/
private String opName;
/**
* ext_1
*/
private String ext1;
/**
* ext_2
*/
private String ext2;
/**
* ext_3
*/
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDownloadConditions() {
return downloadConditions;
}
public void setDownloadConditions(String downloadConditions) {
this.downloadConditions = downloadConditions;
}
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
public Integer getBusinessType() {
return businessType;
}
public void setBusinessType(Integer businessType) {
this.businessType = businessType;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Date getDownloadTime() {
return downloadTime;
}
public void setDownloadTime(Date downloadTime) {
this.downloadTime = downloadTime;
}
public Integer getDownloadStatus() {
return downloadStatus;
}
public void setDownloadStatus(Integer downloadStatus) {
this.downloadStatus = downloadStatus;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Long getOpId() {
return opId;
}
public void setOpId(Long opId) {
this.opId = opId;
}
public String getOpName() {
return opName;
}
public void setOpName(String opName) {
this.opName = opName;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
FileRecords other = (FileRecords) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getDownloadConditions() == null ? other.getDownloadConditions() == null : this.getDownloadConditions().equals(other.getDownloadConditions()))
&& (this.getFileUrl() == null ? other.getFileUrl() == null : this.getFileUrl().equals(other.getFileUrl()))
&& (this.getBusinessType() == null ? other.getBusinessType() == null : this.getBusinessType().equals(other.getBusinessType()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getDownloadTime() == null ? other.getDownloadTime() == null : this.getDownloadTime().equals(other.getDownloadTime()))
&& (this.getDownloadStatus() == null ? other.getDownloadStatus() == null : this.getDownloadStatus().equals(other.getDownloadStatus()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getOpId() == null ? other.getOpId() == null : this.getOpId().equals(other.getOpId()))
&& (this.getOpName() == null ? other.getOpName() == null : this.getOpName().equals(other.getOpName()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getDownloadConditions() == null) ? 0 : getDownloadConditions().hashCode());
result = prime * result + ((getFileUrl() == null) ? 0 : getFileUrl().hashCode());
result = prime * result + ((getBusinessType() == null) ? 0 : getBusinessType().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getDownloadTime() == null) ? 0 : getDownloadTime().hashCode());
result = prime * result + ((getDownloadStatus() == null) ? 0 : getDownloadStatus().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getOpId() == null) ? 0 : getOpId().hashCode());
result = prime * result + ((getOpName() == null) ? 0 : getOpName().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", title=").append(title);
sb.append(", type=").append(type);
sb.append(", downloadConditions=").append(downloadConditions);
sb.append(", fileUrl=").append(fileUrl);
sb.append(", businessType=").append(businessType);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", downloadTime=").append(downloadTime);
sb.append(", downloadStatus=").append(downloadStatus);
sb.append(", status=").append(status);
sb.append(", opId=").append(opId);
sb.append(", opName=").append(opName);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -17,4 +17,6 @@ public class OrderStarbucksModel extends BsOrderChild{
private String storeName; private String storeName;
private String userPhone; private String userPhone;
private Integer payType;
} }

@ -0,0 +1,116 @@
package com.hfkj.model.order.orderExport;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @ClassName OrderGoodsExportModel
* @Author Sum1Dream
* @Description 实物订单导出
* @Date 2024/8/12 下午5:07
**/
@Data
public class OrderGoodsExportModel {
@ColumnWidth(50)
@ExcelProperty("商品名称")
public String goodsName;
@ColumnWidth(20)
@ExcelProperty("商户名称")
public String merName;
@ColumnWidth(20)
@ExcelProperty("类型名称")
public String goodsTypeName;
@ColumnWidth(20)
@ExcelProperty("品牌名称")
public String goodsBrandName;
@ColumnWidth(20)
@ExcelProperty("用户手机号")
public String userPhone;
@ColumnWidth(40)
@ExcelProperty("订单号")
public String orderNo;
@ColumnWidth(15)
@ExcelProperty("子订单号")
public String childOrderNo;
@ColumnWidth(20)
@ExcelProperty("物流单号")
public String logisticsNo;
@ColumnWidth(30)
@ExcelProperty("商品规格")
public String goodsSpecsName;
@ColumnWidth(20)
@ExcelProperty("商品价格")
public BigDecimal goodsPrice;
@ColumnWidth(20)
@ExcelProperty("购买数量")
public Integer goodsCount;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "订单金额"})
public BigDecimal totalPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "总优惠"})
public BigDecimal totalDeductionPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "优惠券优惠"})
public BigDecimal couponDiscountPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "积分抵扣"})
public BigDecimal integralDiscountPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "实付金额"})
public BigDecimal payRealPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "支付渠道"})
public String payChannel;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "支付方式"})
public String payType;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "支付单号"})
public String paySerialNo;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "交易状态"})
public String tradeStatus;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "创建时间"})
public Date createTime;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "支付时间"})
public Date payTime;
@ColumnWidth(20)
@ExcelProperty("物流状态")
public String logisticsStatusDesc;
@ColumnWidth(20)
@ExcelProperty("完成时间")
public Date finishTime;
}

@ -103,14 +103,17 @@ public class StarbucksService {
* @Author: Sum1Dream * @Author: Sum1Dream
* @Date: 2024/8/1 下午2:21 * @Date: 2024/8/1 下午2:21
*/ */
public static JSONObject starbucksOrdersPay(Map<String , Object> map) throws Exception { public static JSONObject starbucksOrdersPay(Map<String , Object> map) {
try {
JSONObject object = QianZhuService.requestH5("starbucksOrders.pay" , map); JSONObject object = QianZhuService.requestH5("starbucksOrders.pay" , map);
if (object.getBoolean("success")) { if (object.getBoolean("success")) {
return object; return object;
} else { } else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询失败!"); return null;
}
} catch (Exception e) {
return null;
} }
} }

@ -63,7 +63,7 @@ public class CmsContentServiceImpl implements CmsContentService {
if (StringUtils.isNotBlank(MapUtils.getString(map, "platformCode"))) { if (StringUtils.isNotBlank(MapUtils.getString(map, "platformCode"))) {
criteria.andPlatformCodeEqualTo(MapUtils.getString(map, "platformCode")); criteria.andPlatformCodeEqualTo(MapUtils.getString(map, "platformCode"));
} }
example.setOrderByClause("create_time desc");
return cmsContentMapper.selectByExample(example); return cmsContentMapper.selectByExample(example);
} }
} }

@ -0,0 +1,83 @@
package com.hfkj.service.file;
import com.hfkj.entity.FileRecords;
import java.util.List;
import java.util.Map;
/**
* @ClassName FileRecordsService
* @Author Sum1Dream
* @Description 文件记录
* @Date 2024/8/12 下午2:04
**/
public interface FileRecordsService {
/**
* @MethodName create
* @Description: 创建
* @param fileRecords
* @Author: Sum1Dream
* @Date: 2024/8/12 下午2:06
*/
void create(FileRecords fileRecords);
/**
* @MethodName update
* @Description: 更新
* @param fileRecords
* @Author: Sum1Dream
* @Date: 2024/8/12 下午2:06
*/
void update(FileRecords fileRecords);
/**
* @MethodName delete
* @Description: 删除
* @param id
* @param fullDelete
* @Author: Sum1Dream
* @Date: 2024/8/12 下午2:06
*/
void delete(Long id , Boolean fullDelete);
/**
* @MethodName queryDetail
* @Description: 查询详情
* @param id
* @return: com.hfkj.entity.FileRecords
* @Author: Sum1Dream
* @Date: 2024/8/12 下午2:07
*/
FileRecords queryDetail(Long id);
/**
* @MethodName queryDetailByMap
* @Description: 查询
* @param map
* @return: com.hfkj.entity.FileRecords
* @Author: Sum1Dream
* @Date: 2024/8/12 下午2:07
*/
FileRecords queryDetailByMap(Map<String , Object> map);
/**
* @MethodName getList
* @Description: 查询列表
* @param map
* @return: java.util.List<com.hfkj.entity.FileRecords>
* @Author: Sum1Dream
* @Date: 2024/8/12 下午2:07
*/
List<FileRecords> getList(Map<String , Object> map);
/**
* @MethodName findExported
* @Description: 是否可以导出
* @param content
* @return: java.lang.Boolean
* @Author: Sum1Dream
* @Date: 2024/8/14 下午5:03
*/
Boolean findExported(String content , Long opId);
}

@ -0,0 +1,71 @@
package com.hfkj.service.file.impl;
import com.hfkj.dao.FileRecordsMapper;
import com.hfkj.entity.FileRecords;
import com.hfkj.entity.FileRecordsExample;
import com.hfkj.service.file.FileRecordsService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@Service("fileRecordsService")
public class FileRecordsServiceImpl implements FileRecordsService {
@Resource
private FileRecordsMapper fileRecordsMapper;
@Override
public void create(FileRecords fileRecords) {
fileRecordsMapper.insert(fileRecords);
}
@Override
public void update(FileRecords fileRecords) {
fileRecordsMapper.updateByPrimaryKeySelective(fileRecords);
}
@Override
public void delete(Long id, Boolean fullDelete) {
fileRecordsMapper.deleteByPrimaryKey(id);
}
@Override
public FileRecords queryDetail(Long id) {
return fileRecordsMapper.selectByPrimaryKey(id);
}
@Override
public FileRecords queryDetailByMap(Map<String, Object> map) {
return null;
}
@Override
public List<FileRecords> getList(Map<String, Object> map) {
FileRecordsExample example = new FileRecordsExample();
FileRecordsExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "opId") != null) {
criteria.andOpIdEqualTo(MapUtils.getLong(map, "opId"));
}
example.setOrderByClause("create_time desc");
return fileRecordsMapper.selectByExample(example);
}
@Override
public Boolean findExported(String content , Long opId) {
FileRecordsExample example = new FileRecordsExample();
FileRecordsExample.Criteria criteria = example.createCriteria();
criteria.andDownloadConditionsEqualTo(content).andOpIdEqualTo(opId).andStatusEqualTo(2);
List<FileRecords> list = fileRecordsMapper.selectByExample(example);
return !list.isEmpty();
}
}

@ -58,6 +58,16 @@ public interface BsOrderGoodsService {
*/ */
BsOrderGoods findGoodsOrder(String orderNo); BsOrderGoods findGoodsOrder(String orderNo);
/**
* @MethodName findGoodsOrderLogisticsNo
* @Description: 根据物流单好查询
* @param logisticsNo
* @return: com.hfkj.entity.BsOrderGoods
* @Author: Sum1Dream
* @Date: 2024/8/13 上午9:50
*/
BsOrderGoods findGoodsOrderLogisticsNo(String logisticsNo);
/** /**
* @MethodName findGoodsOrderByChild * @MethodName findGoodsOrderByChild
* @Description: * @Description:
@ -87,6 +97,7 @@ public interface BsOrderGoodsService {
* @return java.util.List<com.hfkj.entity.GoodsBrand> * @return java.util.List<com.hfkj.entity.GoodsBrand>
*/ */
List<BsOrderGoods> getList(Map<String , Object> map); List<BsOrderGoods> getList(Map<String , Object> map);
List<BsOrderGoods> getList();
/** /**
* @Author Sum1Dream * @Author Sum1Dream
@ -126,7 +137,7 @@ public interface BsOrderGoodsService {
* @Param [num] * @Param [num]
* @Return com.alibaba.fastjson.JSONObject * @Return com.alibaba.fastjson.JSONObject
*/ */
Object getLogisticsMsg(String logisticsNo); Object getLogisticsMsg(String logisticsNo , String mobile);
/** /**
* 更新缓存 * 更新缓存

@ -15,15 +15,13 @@ import com.hfkj.entity.GoodsLogisticsExample;
import com.hfkj.model.order.OrderModel; import com.hfkj.model.order.OrderModel;
import com.hfkj.service.goods.BsOrderGoodsService; import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.order.BsOrderService; import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.order.OrderChildStatusEnum;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Service("bsOrderGoodsService") @Service("bsOrderGoodsService")
public class BsOrderGoodsServiceImpl implements BsOrderGoodsService { public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
@ -31,7 +29,7 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
// 缓存前缀KEY // 缓存前缀KEY
public final static String CACHE_KEY = "LOGISTICS:"; public final static String CACHE_KEY = "LOGISTICS:";
// 订单缓存时间 7天 // 订单缓存时间 7天
public final static Integer CACHE_TIME = 60*60*6; public final static Integer CACHE_TIME = 60*30;
@Resource @Resource
private BsOrderGoodsMapper bsOrderGoodsMapper; private BsOrderGoodsMapper bsOrderGoodsMapper;
@ -70,7 +68,21 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
@Override @Override
public BsOrderGoods findGoodsOrder(String orderNo) { public BsOrderGoods findGoodsOrder(String orderNo) {
BsOrderGoodsExample example = new BsOrderGoodsExample(); BsOrderGoodsExample example = new BsOrderGoodsExample();
example.createCriteria().andStatusNotEqualTo(0).andOrderNoEqualTo(orderNo); example.createCriteria().andOrderNoEqualTo(orderNo);
List<BsOrderGoods> list = bsOrderGoodsMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public BsOrderGoods findGoodsOrderLogisticsNo(String logisticsNo) {
BsOrderGoodsExample example = new BsOrderGoodsExample();
example.createCriteria().andStatusNotEqualTo(0).andLogisticsNoEqualTo(logisticsNo);
List<BsOrderGoods> list = bsOrderGoodsMapper.selectByExample(example); List<BsOrderGoods> list = bsOrderGoodsMapper.selectByExample(example);
@ -84,7 +96,7 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
@Override @Override
public BsOrderGoods findGoodsOrderByChild(String orderChildNo) { public BsOrderGoods findGoodsOrderByChild(String orderChildNo) {
BsOrderGoodsExample example = new BsOrderGoodsExample(); BsOrderGoodsExample example = new BsOrderGoodsExample();
example.createCriteria().andStatusNotEqualTo(0).andChildOrderNoEqualTo(orderChildNo); example.createCriteria().andChildOrderNoEqualTo(orderChildNo);
List<BsOrderGoods> list = bsOrderGoodsMapper.selectByExample(example); List<BsOrderGoods> list = bsOrderGoodsMapper.selectByExample(example);
@ -125,6 +137,14 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
if (StringUtils.isNotBlank(MapUtils.getString(map, "userPhone"))) { if (StringUtils.isNotBlank(MapUtils.getString(map, "userPhone"))) {
criteria.andUserPhoneEqualTo(MapUtils.getString(map, "userPhone")); criteria.andUserPhoneEqualTo(MapUtils.getString(map, "userPhone"));
} }
if (StringUtils.isNotBlank(MapUtils.getString(map, "logisticsStatus"))) {
if (MapUtils.getString(map , "logisticsStatus").equals("待发货")) {
criteria.andLogisticsStatusIsNull();
} else {
criteria.andLogisticsStatusEqualTo(MapUtils.getString(map, "logisticsStatus"));
}
}
if (MapUtils.getLong(map, "goodsType") != null) { if (MapUtils.getLong(map, "goodsType") != null) {
criteria.andGoodsTypeIdEqualTo(MapUtils.getLong(map, "goodsType")); criteria.andGoodsTypeIdEqualTo(MapUtils.getLong(map, "goodsType"));
} }
@ -160,6 +180,13 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
return bsOrderGoodsMapper.selectByExample(example); return bsOrderGoodsMapper.selectByExample(example);
} }
@Override
public List<BsOrderGoods> getList() {
BsOrderGoodsExample example = new BsOrderGoodsExample();
return bsOrderGoodsMapper.selectByExample(example);
}
@Override @Override
public GoodsLogistics findGoodsLogistics(Long orderGoodsId) { public GoodsLogistics findGoodsLogistics(Long orderGoodsId) {
GoodsLogisticsExample example = new GoodsLogisticsExample(); GoodsLogisticsExample example = new GoodsLogisticsExample();
@ -227,10 +254,10 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
} }
@Override @Override
public Object getLogisticsMsg(String logisticsNo) { public Object getLogisticsMsg(String logisticsNo , String mobile) {
Object data = redisUtil.get(CACHE_KEY + logisticsNo); Object data = redisUtil.get(CACHE_KEY + logisticsNo);
if (data == null) { if (data == null) {
JSONObject jsonObjects = OrderUtil.getLogisticsMsg(logisticsNo); JSONObject jsonObjects = OrderUtil.getLogisticsMsg(logisticsNo , mobile);
if (jsonObjects == null) { if (jsonObjects == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂未发货!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂未发货!");
} }
@ -270,9 +297,11 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前状态,不支持确认收货!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前状态,不支持确认收货!");
} }
orderGoods.setStatus(9);
// 子订单完成 // 子订单完成
orderService.childOrderComplete(orderGoods.getChildOrderNo()); orderService.childOrderComplete(orderGoods.getChildOrderNo());
orderGoods.setStatus(OrderChildStatusEnum.status3.getCode());
orderGoods.setUpdateTime(new Date());
update(orderGoods); update(orderGoods);
// 删除缓存 // 删除缓存
orderService.cacheDelete(orderGoods.getOrderNo()); orderService.cacheDelete(orderGoods.getOrderNo());

@ -239,7 +239,7 @@ public class OrderCreateService {
orderGoods.setGoodsSpecsName(goodsSpecs.getName()); orderGoods.setGoodsSpecsName(goodsSpecs.getName());
orderGoods.setGoodsSpecsOriginalPrice(goodsSpecs.getOriginalPrice()); orderGoods.setGoodsSpecsOriginalPrice(goodsSpecs.getOriginalPrice());
orderGoods.setGoodsCount(orderChild.getProductCount()); orderGoods.setGoodsCount(orderChild.getProductCount());
orderGoods.setStatus(OrderGoodsStatusEnum.status8.getCode()); orderGoods.setStatus(orderChild.getStatus());
orderGoods.setDeliveryAddress(address.getAddress()); orderGoods.setDeliveryAddress(address.getAddress());
orderGoods.setDeliveryAddressId(address.getId()); orderGoods.setDeliveryAddressId(address.getId());
orderGoods.setCreateTime(new Date()); orderGoods.setCreateTime(new Date());
@ -361,7 +361,7 @@ public class OrderCreateService {
// 查询星巴克产品 // 查询星巴克产品
Map<String , Object> map = new HashMap<>(); Map<String , Object> map = new HashMap<>();
map.put("pageIndex", 1); map.put("pageIndex", 1);
map.put("pageSize", 100000); map.put("pageSize", 200);
JSONObject jsonObject = StarbucksService.starbucksProducts(map); JSONObject jsonObject = StarbucksService.starbucksProducts(map);
if (jsonObject.getJSONObject("data") == null) { if (jsonObject.getJSONObject("data") == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.REQ_PARAMS_ERROR ); throw ErrorHelp.genException(SysCode.System , ErrorCode.REQ_PARAMS_ERROR );
@ -445,16 +445,16 @@ public class OrderCreateService {
orderChild.setMerId(productConfig.getMerId()); orderChild.setMerId(productConfig.getMerId());
orderChild.setProductName("星巴克"); orderChild.setProductName("星巴克");
orderChild.setProductCount(1); orderChild.setProductCount(1);
orderChild.setProductSpecName(String.valueOf(productSpecName.toString())); orderChild.setProductSpecName(productSpecName.toString());
// 星巴克创建订单 // 星巴克创建订单
// 获取token // 获取token
Map<String , Object> mapToken = new HashMap<>(); Map<String , Object> mapToken = new HashMap<>();
mapToken.put("platformUniqueId" , order.getOrderNo()); mapToken.put("platformUniqueId" , order.getOrderNo());
mapToken.put("nickname" , order.getUserName()); mapToken.put("nickname" , order.getUserName());
mapToken.put("mobile" , order.getUserPhone()); mapToken.put("mobile" , object.getString("phone"));
StarbucksService.getTokenV2(mapToken); StarbucksService.getTokenV2(mapToken);
// 查询产品 // 预下单
Map<String , Object> mapOrder = new HashMap<>(); Map<String , Object> mapOrder = new HashMap<>();
mapOrder.put("storeCode", object.getString("storeCode")); mapOrder.put("storeCode", object.getString("storeCode"));
mapOrder.put("customerMobile", object.getString("phone")); mapOrder.put("customerMobile", object.getString("phone"));

@ -76,7 +76,7 @@ public class OrderPaySuccessService {
} else if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type3.getCode())) { } else if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type3.getCode())) {
cinema(order, childOrder); cinema(order, childOrder);
} else if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type4.getCode())) { } else if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type4.getCode())) {
starbucks(childOrder); starbucks(order , childOrder);
} }
} catch (Exception e) { } catch (Exception e) {
@ -224,14 +224,16 @@ public class OrderPaySuccessService {
goodsOrder.setPaySerialNo(order.getPaySerialNo()); goodsOrder.setPaySerialNo(order.getPaySerialNo());
goodsOrder.setPayTime(order.getPayTime()); goodsOrder.setPayTime(order.getPayTime());
goodsOrder.setUpdateTime(new Date()); goodsOrder.setUpdateTime(new Date());
goodsOrder.setStatus(1); goodsOrder.setStatus(childOrder.getStatus());
bsOrderGoodsService.update(goodsOrder);
} catch (Exception e) { } catch (Exception e) {
goodsOrder.setExceptionStatus(true); if (goodsOrder == null) {
goodsOrder = new BsOrderGoods();
}
goodsOrder.setExceptionMsg(e.getMessage()); goodsOrder.setExceptionMsg(e.getMessage());
bsOrderGoodsService.update(goodsOrder);
} }
bsOrderGoodsService.update(goodsOrder);
} }
public void cinema(OrderModel order,BsOrderChild childOrder) { public void cinema(OrderModel order,BsOrderChild childOrder) {
@ -288,12 +290,21 @@ public class OrderPaySuccessService {
} }
public void starbucks(BsOrderChild childOrder) throws Exception { public void starbucks(OrderModel order,BsOrderChild childOrder) {
// 推送订单 // 推送订单
// 查询星巴克订单 // 查询星巴克订单
Map<String , Object> map = new HashMap<>(); Map<String , Object> map = new HashMap<>();
map.put("orderNo", childOrder.getChannelOrderNo()); map.put("orderNo", childOrder.getChannelOrderNo());
StarbucksService.starbucksOrdersPay(map); StarbucksService.starbucksOrdersPay(map);
Map<String, Object> params = new HashMap<>();
params.put("orderNo", childOrder.getOrderNo());
List<BsOrderStarbucks> orderStarbucks = bsOrderStarbucksService.getList(params);
for (BsOrderStarbucks bsOrderStarbucks : orderStarbucks) {
bsOrderStarbucks.setPayType(order.getPayType());
bsOrderStarbucksService.update(bsOrderStarbucks);
}
} }

@ -12,8 +12,10 @@ import com.hfkj.service.BsProductConfigService;
import com.hfkj.service.goods.*; import com.hfkj.service.goods.*;
import com.hfkj.service.goods.impl.BsOrderStarbucksServiceImpl; import com.hfkj.service.goods.impl.BsOrderStarbucksServiceImpl;
import com.hfkj.service.order.BsOrderChildService; import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.order.OrderChildProductTypeEnum; import com.hfkj.sysenum.order.OrderChildProductTypeEnum;
import com.hfkj.sysenum.order.OrderChildStatusEnum; import com.hfkj.sysenum.order.OrderChildStatusEnum;
import com.hfkj.sysenum.order.OrderLogisticsStatusEnum;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -48,6 +50,9 @@ public class BsOrderChildServiceImpl implements BsOrderChildService {
@Resource @Resource
private BsProductConfigService bsProductConfigService; private BsProductConfigService bsProductConfigService;
@Resource
private BsOrderService orderService;
@Override @Override
public void editData(BsOrderChild data) { public void editData(BsOrderChild data) {
data.setUpdateTime(new Date()); data.setUpdateTime(new Date());
@ -113,6 +118,16 @@ public class BsOrderChildServiceImpl implements BsOrderChildService {
object.put("orderGoodsId", orderGoods.getId()); object.put("orderGoodsId", orderGoods.getId());
childModel.setBusiness(object); childModel.setBusiness(object);
if (orderGoods.getLogisticsStatus() != null && orderGoods.getLogisticsStatus().equals(OrderLogisticsStatusEnum.statusSIGN.getCode())) {
// 子订单完成
orderService.childOrderComplete(orderGoods.getChildOrderNo());
orderGoods.setStatus(OrderChildStatusEnum.status3.getCode());
orderGoods.setUpdateTime(new Date());
orderGoodsService.update(orderGoods);
// 删除缓存
orderService.cacheDelete(orderGoods.getOrderNo());
}
} }
} else if (childModel.getProductType().equals(OrderChildProductTypeEnum.type2.getCode())) { } else if (childModel.getProductType().equals(OrderChildProductTypeEnum.type2.getCode())) {
childModel.setBusiness(goodsVpdService.queryDetailBySpecsId(childModel.getProductSpecId())); childModel.setBusiness(goodsVpdService.queryDetailBySpecsId(childModel.getProductSpecId()));

@ -0,0 +1,59 @@
package com.hfkj.sysenum.fileRecords;
import lombok.Getter;
import java.util.Objects;
@Getter
public enum FileRecordsEnum {
/**
* 实物订单
*/
status1(1, "实物订单"),
/**
* 虚拟订单
*/
status2(2, "虚拟订单"),
/**
* 肯德基订单
*/
status3(3, "肯德基订单"),
/**
* 星巴克订单
*/
status4(4, "星巴克订单"),
/**
* 财务对账订单
*/
status5(5, "财务对账订单"),
/**
* 物流订单上传订单
*/
status6(6, "物流订单上传订单"),
status7(7, "物流订单下载订单"),
;
private final int code;
private final String name;
FileRecordsEnum(int code, String name) {
this.code = code;
this.name = name;
}
public static FileRecordsEnum getData(Integer type) {
for (FileRecordsEnum ele : values()) {
if (Objects.equals(type,ele.getCode())) return ele;
}
return null;
}
}

@ -0,0 +1,32 @@
package com.hfkj.sysenum.order;
import lombok.Getter;
@Getter
public enum OrderLogisticsStatusEnum {
statusDELIVERING("派件中" , "DELIVERING"),
statusTRANSPORT("运输中", "TRANSPORT"),
statusAGENT_SIGN("已代签收", "AGENT_SIGN"),
statusSIGN("已签收", "SIGN"),
statusACCEPT("已揽收", "ACCEPT"),
statusFAILED("包裹异常", "FAILED"),
statusWAIT_ACCEPT("待揽收", "WAIT_ACCEPT"),
;
private final String code;
private final String name;
OrderLogisticsStatusEnum(String name, String code) {
this.code = code;
this.name = name;
}
}

@ -2,6 +2,8 @@ package com.hfkj.sysenum.order;
import lombok.Getter; import lombok.Getter;
import java.util.Objects;
/** /**
* 交易订单状态 * 交易订单状态
* @className: OrderChildProductType * @className: OrderChildProductType
@ -45,4 +47,11 @@ public enum OrderStatusEnum {
this.code = code; this.code = code;
this.name = name; this.name = name;
} }
public static OrderStatusEnum getData(Integer type) {
for (OrderStatusEnum ele : values()) {
if (Objects.equals(type,ele.getCode())) return ele;
}
return null;
}
} }

@ -58,12 +58,12 @@ huiftShopCode=50041b27-f985-dcb0-1cc0-f106b09bf1fe
huiftSignSecret=DB4D8069A9AC6DDF9D75667EE5CF182A huiftSignSecret=DB4D8069A9AC6DDF9D75667EE5CF182A
#QIANZHU #QIANZHU
qianZhuUrl=https://live-test.qianzhu8.com qianZhuUrl=https://live.qianzhu8.com
qianzhuH5url=https://nf-test.qianzhu8.com/gateway qianzhuH5url=https://nf.qianzhu8.com/gateway
qinzhuUrlToken=https://live-test.qianzhu8.com/gateway qinzhuUrlToken=https://live.qianzhu8.com/gateway
qianZhuPlatformId=10376 qianZhuPlatformId=10710
qianZhuSecret=ktxb49sh2jfhgn8g qianZhuSecret=pgmh5j1cbq2brm08
qianZhuCinemaNotify=https://phgcs.dctpay.com/order/cinemaNotify/notify qianZhuCinemaNotify=https://phg.dctpay.com/order/cinemaNotify/notify
#CT #CT
ctNotifyUrl = 1 ctNotifyUrl = 1

Loading…
Cancel
Save