From c21d2ac4393fba16ec4acd9ba637282073075294 Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Thu, 12 Sep 2024 11:20:32 +0800 Subject: [PATCH] /1 --- .../com/bweb/controller/TestController.java | 314 +----------------- .../controller/goods/GoodsController.java | 2 + .../com/order/controller/OrderController.java | 2 +- .../business/BsOrderGoodsController.java | 15 + .../com/hfkj/schedule/OrderGoodsSchedule.java | 43 ++- .../order/OrderRefundSuccessService.java | 5 +- .../order/impl/BsOrderServiceImpl.java | 37 ++- .../com/user/controller/BsUserController.java | 44 +++ 8 files changed, 138 insertions(+), 324 deletions(-) diff --git a/bweb/src/main/java/com/bweb/controller/TestController.java b/bweb/src/main/java/com/bweb/controller/TestController.java index 639d012..f75a5e5 100644 --- a/bweb/src/main/java/com/bweb/controller/TestController.java +++ b/bweb/src/main/java/com/bweb/controller/TestController.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,205 +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 map = new HashMap<>(); - map.put("goodsType" , goodsType); - List goodsMsg = goodsMsgService.getList(map); - List specsList = goodsSpecsService.getList(map); - - List goodsRelList = new ArrayList<>(); - for (GoodsMsg goods : goodsMsg) { - List 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 map = new HashMap<>(); - - map.put("status", 1); - - List list = goodsMsgService.getList(map); - - List specsList = goodsSpecsService.getList(new HashMap<>()); - - - for (GoodsMsg goodsMsg : list) { - List 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); + if (body == null|| StringUtils.isBlank(body.getString("phone"))) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } - 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 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 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); - } - } - - @RequestMapping(value="/getLogisticsMsg",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "查询物流") - public ResponseData getLogisticsMsg() { - try { - Map objectMap = new HashMap<>(); - - objectMap.put("status" , 2); - - List 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"); + return ResponseMsgUtil.success(map); } catch (Exception e) { log.error("error!",e); @@ -250,89 +51,4 @@ public class TestController { } } - - @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 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 map = new HashMap<>(); - Map 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); - } - } - - } diff --git a/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java b/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java index d89c2c2..0573255 100644 --- a/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java +++ b/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java @@ -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); diff --git a/order/src/main/java/com/order/controller/OrderController.java b/order/src/main/java/com/order/controller/OrderController.java index 2a8f010..fce04dc 100644 --- a/order/src/main/java/com/order/controller/OrderController.java +++ b/order/src/main/java/com/order/controller/OrderController.java @@ -326,7 +326,7 @@ public class OrderController { } Map 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())); diff --git a/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java b/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java index 3a56f61..5888da5 100644 --- a/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java +++ b/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java @@ -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); diff --git a/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java b/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java index 3b68208..89ec8ed 100644 --- a/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java +++ b/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java @@ -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 objectMap = new HashMap<>(); + + objectMap.put("status" , 15); + + List orderStarbucks = orderStarbucksService.getList(objectMap); + + for (BsOrderStarbucks starbucks : orderStarbucks) { + + if (starbucks != null) { + // 查询星巴克订单详情 + BsOrderChild child = orderChildService.getDetail(starbucks.getChildOrderNo()); + Map orderMap = new HashMap<>(); + orderMap.put("orderNo" , child.getChannelOrderNo()); + + // 子订单完成 + orderService.childOrderComplete(starbucks.getChildOrderNo()); + + } + + + } + } } diff --git a/service/src/main/java/com/hfkj/service/order/OrderRefundSuccessService.java b/service/src/main/java/com/hfkj/service/order/OrderRefundSuccessService.java index 37a628a..ecae015 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderRefundSuccessService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderRefundSuccessService.java @@ -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 map = new HashMap<>(); - map.put("orderNo", childOrder.getOrderNo()); - CinemaService.refundMovieOrder(map); orderGoods.setStatus(OrderChildStatusEnum.status4.getCode()); orderGoods.setLogisticsStatusDesc(null); orderGoods.setLogisticsNo(null); diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java index fe1f729..3b92d76 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java @@ -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; @@ -522,28 +523,30 @@ public class BsOrderServiceImpl implements BsOrderService { orderModel.setBusiness(orderChild.getBusiness()); } - if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type3.getCode())) { + if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type3.getCode())) { - BsOrderCinema bsOrderCinema = bsOrderCinemaService.findGoodsOrder(orderNo); + BsOrderCinema bsOrderCinema = bsOrderCinemaService.findGoodsOrder(orderNo); - Map map = new HashMap<>(); - map.put("orderNo" , bsOrderCinema.getChannelOrderNo()); - JSONObject object = CinemaService.getByOrderNo(map); - if (object != null && object.getJSONObject("data") != null) { - orderModel.setBusiness(object.getJSONObject("data")); - bsOrderCinema.setUpdateTime(new Date()); - bsOrderCinema.setStatus(object.getJSONObject("data").getInteger("status")); - } + Map map = new HashMap<>(); + map.put("orderNo" , bsOrderCinema.getChannelOrderNo()); + JSONObject object = CinemaService.getByOrderNo(map); + if (object != null && object.getJSONObject("data") != null) { + orderModel.setBusiness(object.getJSONObject("data")); + bsOrderCinema.setUpdateTime(new Date()); + bsOrderCinema.setStatus(object.getJSONObject("data").getInteger("status")); + } + + orderModel.setBusinessOrder(bsOrderCinema); + + bsOrderCinemaService.update(bsOrderCinema); - orderModel.setBusinessOrder(bsOrderCinema); + if (bsOrderCinema.getStatus() == 10) { + // 子订单完成 + childOrderComplete(orderChild.getChildOrderNo()); + } + } - bsOrderCinemaService.update(bsOrderCinema); - if (bsOrderCinema.getStatus() == 10) { - // 子订单完成 - childOrderComplete(orderChild.getChildOrderNo()); - } - } } return orderModel; diff --git a/user/src/main/java/com/user/controller/BsUserController.java b/user/src/main/java/com/user/controller/BsUserController.java index 1fcfe56..a2a54a6 100644 --- a/user/src/main/java/com/user/controller/BsUserController.java +++ b/user/src/main/java/com/user/controller/BsUserController.java @@ -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 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 = "手机号登录")