袁野 2 months ago
parent 05b91a28c9
commit c21d2ac439
  1. 314
      bweb/src/main/java/com/bweb/controller/TestController.java
  2. 2
      cweb/src/main/java/com/cweb/controller/goods/GoodsController.java
  3. 2
      order/src/main/java/com/order/controller/OrderController.java
  4. 15
      order/src/main/java/com/order/controller/business/BsOrderGoodsController.java
  5. 43
      schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java
  6. 5
      service/src/main/java/com/hfkj/service/order/OrderRefundSuccessService.java
  7. 3
      service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java
  8. 44
      user/src/main/java/com/user/controller/BsUserController.java

@ -1,42 +1,24 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONArray;
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.*;
import com.hfkj.entity.*;
import com.hfkj.meituan.MeiTuanService;
import com.hfkj.config.CommonSysConst;
import com.hfkj.model.ResponseData;
import com.hfkj.model.goods.GoodsModel;
import com.hfkj.service.discount.CouponDiscountService;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsMsgService;
import com.hfkj.service.goods.GoodsSpecsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.service.hlt.HltCanteenService;
import com.hfkj.service.hlt.HuiLianTongUnionCardService;
import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.service.pay.huift.TradeService;
import com.hfkj.service.pay.huift.config.HuiftConfig;
import com.hfkj.sysenum.order.OrderLogisticsStatusEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
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 org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@Controller
@RequestMapping(value="/test")
@ -44,157 +26,24 @@ import java.util.stream.Collectors;
public class TestController {
private static Logger log = LoggerFactory.getLogger(TestController.class);
@Resource
private GoodsMsgService goodsMsgService;
@Resource
private GoodsSpecsService goodsSpecsService;
@Resource
private CouponDiscountService couponDiscountService;
@Resource
private BsOrderChildService orderChildService;
@Resource
private BsOrderGoodsService orderGoodsService;
@Resource
private BsOrderGoodsService bsOrderGoodsService;
@Resource
private GoodsUserAddressService addressService;
@Resource
private TradeService huiftTradeService;
@RequestMapping(value="/thirdPayResult",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询V家园订单交易状态")
public ResponseData thirdPayResult(@RequestParam(value = "preOrderNo" , required = true) String preOrderNo,
@RequestParam(value = "shopCode" , required = true) String shopCode,
@RequestParam(value = "signSecret" , required = true) String signSecret) {
try {
return ResponseMsgUtil.success(huiftTradeService.thirdPayResult(preOrderNo,shopCode,signSecret));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/canteenConsume",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "食堂消费")
public ResponseData canteenConsume(@RequestParam(value = "cardNo" , required = false) String cardNo,
@RequestParam(value = "instCode" , required = false) String instCode,
@RequestParam(value = "canteenId" , required = false) String canteenId) {
try {
String orderNo = OrderUtil.generateOrderNo();
JSONObject cardInfo = HltCanteenService.canteenConsume(orderNo , cardNo , instCode , canteenId);
if (StringUtils.isBlank(cardInfo.getString("data"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败");
}
return ResponseMsgUtil.success(HuiLianTongUnionCardService.resolveResponse(cardInfo.getString("data")));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/bindDiscountSpecs",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据类型绑定")
public ResponseData bindDiscountSpecs(@RequestParam(value = "goodsType" , required = false) Integer goodsType ,
@RequestParam(value = "discountId" , required = false) Long discountId) {
try {
Map<String , Object> map = new HashMap<>();
map.put("goodsType" , goodsType);
List<GoodsMsg> goodsMsg = goodsMsgService.getList(map);
List<GoodsSpecs> specsList = goodsSpecsService.getList(map);
List<CouponDiscountGoodsRel> goodsRelList = new ArrayList<>();
for (GoodsMsg goods : goodsMsg) {
List<GoodsSpecs> list = specsList.stream().filter(specs -> specs.getGoodsId().equals(goods.getId())).
collect(Collectors.toList());
for (GoodsSpecs goodsSpecs : list) {
CouponDiscountGoodsRel goodsRel = new CouponDiscountGoodsRel();
goodsRel.setDiscountId(discountId);
goodsRel.setSpecsId(goodsSpecs.getId());
goodsRel.setCreateTime(new Date());
goodsRel.setStatus(1);
goodsRelList.add(goodsRel);
}
}
couponDiscountService.insertGoodsRelBatch(goodsRelList);
return ResponseMsgUtil.success("成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/orderGoodsUpdate",method = RequestMethod.GET)
@RequestMapping(value="/haiOilLogin",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "商品更新")
public ResponseData orderMsgUpdate() {
@ApiOperation(value = "嗨加油登陆参数")
public ResponseData haiOilLogin(@RequestBody JSONObject body) {
try {
Map<String, Object> map = new HashMap<>();
map.put("status", 1);
List<GoodsMsg> list = goodsMsgService.getList(map);
List<GoodsSpecs> specsList = goodsSpecsService.getList(new HashMap<>());
for (GoodsMsg goodsMsg : list) {
List<GoodsSpecs> goodsSpecsList = specsList.stream().filter(s -> s.getGoodsId().equals(goodsMsg.getId())).collect(Collectors.toList());
if (!goodsSpecsList.isEmpty()) {
goodsMsg.setSaleNum(CommonUtil.saleNumRandom(goodsSpecsList.get(0).getSalePrice()));
}
goodsMsgService.update(goodsMsg);
}
return ResponseMsgUtil.success("成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
if (body == null|| StringUtils.isBlank(body.getString("phone"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
@RequestMapping(value="/orderGoodsConfirmReceipt",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "商品确认收货")
public ResponseData orderGoodsConfirmReceipt() {
try {
Map<String , Object> map = new HashMap<>();
map.put("appid" , CommonSysConst.getSysConfig().getHaiOilAppid());
map.put("phone" , body.getString("phone"));
map.put("sign" , SignatureUtil.createSign(map , CommonSysConst.getSysConfig().getHaiOilAppSecret()));
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("成功");
return ResponseMsgUtil.success(map);
} catch (Exception e) {
log.error("error!",e);
@ -202,137 +51,4 @@ public class TestController {
}
}
@RequestMapping(value="/getLogisticsMsg",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询物流")
public ResponseData getLogisticsMsg() {
try {
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 , "暂无物流信息!");
}
if (goods.getLogisticsNo() != null) {
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);
}
}
return ResponseMsgUtil.success("map");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询汇联通工会卡消费记录")
public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType,
@RequestParam(name = "cardNo", required = true) String cardNo) {
try {
JSONObject consumptionRecord = HuiLianTongUnionCardService.queryConsumptionRecordByBusiness(businessType, cardNo, 1661498490000L, 1882423290000L, 1, 10000);
if (StringUtils.isBlank(consumptionRecord.getString("data"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "");
}
JSONArray array = HuiLianTongUnionCardService.resolveResponse(consumptionRecord.getString("data")).getJSONArray(
"records");
return ResponseMsgUtil.success(array);
} catch (Exception e) {
log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/queryTransJournal", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询汇联通工会卡消费记录")
public ResponseData queryTransJournal(@RequestParam(name = "tranType", required = true) String tranType,
@RequestParam(name = "cardNo", required = true) String cardNo,
@RequestParam(value = "pageNum" , required = true) Integer pageNum,
@RequestParam(value = "pageSize" , required = true) Integer pageSize) {
try {
JSONObject consumptionRecord = HuiLianTongUnionCardService.queryTransJournal(cardNo , tranType);
if (StringUtils.isBlank(consumptionRecord.getString("data"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "");
}
JSONArray array = HuiLianTongUnionCardService.resolveResponse(consumptionRecord.getString("data")).getJSONArray(
"journals");
List<JSONObject> list = new ArrayList<>();
for (Object object : array) {
JSONObject journal = (JSONObject) object;
journal.put("tranAmount", journal.getBigDecimal("tranAmount").divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP));
list.add(journal);
}
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, list.size(), pageSize, new PageInfo<>(list)));
} catch (Exception e) {
log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/loginFree", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "H5免登接口")
public ResponseData loginFree(@RequestParam(name = "staffPhone", required = true) String staffPhone,
@RequestParam(name = "productType", required = true) String productType) {
try {
Map<String , Object> map = new HashMap<>();
Map<String , Object> staffInfo = new HashMap<>();
staffInfo.put("staffPhone", staffPhone);
map.put("staffInfo", staffInfo);
map.put("ts", new Date().getTime());
map.put("entId", 104310L);
map.put("productType", productType);
map.put("nonce" , RandomStringGeneratorUtil.generateRandomString(36));
return ResponseMsgUtil.success(MeiTuanService.loginFree(map));
} catch (Exception e) {
log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -208,6 +208,8 @@ public class GoodsController {
goodsModelSpecs.add(goodsModelSpec);
}
goodsModelSpecs = goodsModelSpecs.stream().sorted(Comparator.comparing(GoodsModelSpecs::getSalePrice)).collect(Collectors.toList());
goodsModel.setGoodsModelSpecs(goodsModelSpecs);
return ResponseMsgUtil.success(goodsModel);

@ -326,7 +326,7 @@ public class OrderController {
}
Map<String , Object> map = new HashMap<>();
map.put("appId" , CommonSysConst.getSysConfig().getHaiOilAppid());
map.put("appid" , CommonSysConst.getSysConfig().getHaiOilAppid());
map.put("phone" , body.getString("phone"));
map.put("sign" , SignatureUtil.createSign(map , CommonSysConst.getSysConfig().getHaiOilAppSecret()));

@ -20,6 +20,7 @@ import com.hfkj.model.order.orderExport.OrderGoodsExportModel;
import com.hfkj.service.file.FileRecordsService;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.service.order.BsOrderAfterSalesApplyService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import com.hfkj.sysenum.fileRecords.FileRecordsEnum;
@ -68,6 +69,9 @@ public class BsOrderGoodsController {
@Resource
private BsOrderGoodsService orderGoodsService;
@Resource
private BsOrderAfterSalesApplyService bsOrderAfterSalesApplyService;
@RequestMapping(value="/getListGoods",method = RequestMethod.GET)
@ResponseBody
@ -296,10 +300,21 @@ public class BsOrderGoodsController {
BsOrderGoods goodsOrder = bsOrderGoodsService.queryDetail(body.getId());
if (goodsOrder == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "信息错误!");
}
// 查询是否存在退货申请
BsOrderAfterSalesApply afterSalesApply = bsOrderAfterSalesApplyService.getDetailByChildOrderNo(goodsOrder.getChildOrderNo());
if (afterSalesApply != null && afterSalesApply.getStatus().equals(OrderAfterSalesApplyStatusEnum.type1.getCode())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前订单存在退货申请,不可录入!");
}
String logisticsNo = body.getLogisticsNo().replaceAll("\\s+", "");
goodsOrder.setLogisticsNo(logisticsNo);

@ -1,15 +1,18 @@
package com.hfkj.schedule;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.entity.*;
import com.hfkj.qianzhu.StarbucksService;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.BsOrderStarbucksService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.order.OrderLogisticsStatusEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -41,6 +44,15 @@ public class OrderGoodsSchedule {
@Resource
private GoodsUserAddressService addressService;
@Resource
private BsOrderStarbucksService orderStarbucksService;
@Resource
private BsOrderChildService orderChildService;
@Resource
private BsOrderService orderService;
//每日凌晨12点5秒执行一次
@Scheduled(cron = "5 0 0 * * ?")
public void orderGoodsConfirmReceipt() {
@ -98,4 +110,29 @@ public class OrderGoodsSchedule {
}
}
@Scheduled(cron = "5 0 0 * * ?")
public void getStarbucks() {
Map<String , Object> objectMap = new HashMap<>();
objectMap.put("status" , 15);
List<BsOrderStarbucks> orderStarbucks = orderStarbucksService.getList(objectMap);
for (BsOrderStarbucks starbucks : orderStarbucks) {
if (starbucks != null) {
// 查询星巴克订单详情
BsOrderChild child = orderChildService.getDetail(starbucks.getChildOrderNo());
Map<String , Object> orderMap = new HashMap<>();
orderMap.put("orderNo" , child.getChannelOrderNo());
// 子订单完成
orderService.childOrderComplete(starbucks.getChildOrderNo());
}
}
}
}

@ -61,14 +61,11 @@ public class OrderRefundSuccessService {
public void goods(BsOrderChild childOrder) {
// 查询实物订单
BsOrderGoods orderGoods = bsOrderGoodsService.findGoodsOrderByChild(childOrder.getOrderNo());
BsOrderGoods orderGoods = bsOrderGoodsService.findGoodsOrderByChild(childOrder.getChildOrderNo());
try {
if (orderGoods != null) {
Map<String , Object> map = new HashMap<>();
map.put("orderNo", childOrder.getOrderNo());
CinemaService.refundMovieOrder(map);
orderGoods.setStatus(OrderChildStatusEnum.status4.getCode());
orderGoods.setLogisticsStatusDesc(null);
orderGoods.setLogisticsNo(null);

@ -15,6 +15,7 @@ import com.hfkj.model.order.OrderChildModel;
import com.hfkj.model.order.OrderModel;
import com.hfkj.mqtopic.OrderTopic;
import com.hfkj.qianzhu.CinemaService;
import com.hfkj.qianzhu.StarbucksService;
import com.hfkj.service.BsProductConfigService;
import com.hfkj.service.discount.CouponDiscountService;
import com.hfkj.service.discount.CouponDiscountUserRelService;
@ -544,6 +545,8 @@ public class BsOrderServiceImpl implements BsOrderService {
childOrderComplete(orderChild.getChildOrderNo());
}
}
}
return orderModel;

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

Loading…
Cancel
Save