diff --git a/bweb/src/main/java/com/bweb/config/AuthConfig.java b/bweb/src/main/java/com/bweb/config/AuthConfig.java index 1a5fcba..48cc9e7 100644 --- a/bweb/src/main/java/com/bweb/config/AuthConfig.java +++ b/bweb/src/main/java/com/bweb/config/AuthConfig.java @@ -88,7 +88,12 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/**/swagger-ui.html") .excludePathPatterns("/fileUpload/*") .excludePathPatterns("/common/*") + .excludePathPatterns("/test/*") .excludePathPatterns("/secMenu/queryMenuList") + .excludePathPatterns("/user/phgDataUser") + .excludePathPatterns("/user/phgDataUserDetail") + .excludePathPatterns("/user/phgDataUserOrder") + .excludePathPatterns("/user/downloadImage") ; } diff --git a/bweb/src/main/java/com/bweb/controller/BsUserController.java b/bweb/src/main/java/com/bweb/controller/BsUserController.java index 4bf1d7c..83333f8 100644 --- a/bweb/src/main/java/com/bweb/controller/BsUserController.java +++ b/bweb/src/main/java/com/bweb/controller/BsUserController.java @@ -6,25 +6,48 @@ 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.OrderUtil; import com.hfkj.common.utils.ResponseMsgUtil; -import com.hfkj.entity.BsUser; -import com.hfkj.entity.BsUserComplaint; +import com.hfkj.entity.*; import com.hfkj.model.ResponseData; +import com.hfkj.service.CommonService; +import com.hfkj.service.card.BsUserCardService; +import com.hfkj.service.coupon.BsOrderCouponNoService; +import com.hfkj.service.coupon.BsOrderCouponService; +import com.hfkj.service.goods.BsOrderGoodsService; +import com.hfkj.service.goods.GoodsSpecsService; +import com.hfkj.service.goods.GoodsUserAddressService; +import com.hfkj.service.goods.GoodsVpdService; +import com.hfkj.service.order.BsOrderChildService; +import com.hfkj.service.order.BsOrderDeductionService; +import com.hfkj.service.order.BsOrderService; import com.hfkj.service.user.BsUserComplaintService; import com.hfkj.service.user.BsUserService; +import com.hfkj.service.user.PhgDataUserService; import com.hfkj.service.user.impl.BsUserServiceImpl; import com.hfkj.sysenum.SecUserStatusEnum; import com.hfkj.sysenum.UserStatusEnum; +import com.hfkj.sysenum.order.OrderChildStatusEnum; +import com.hfkj.sysenum.order.OrderStatusEnum; +import com.mysql.jdbc.StringUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.commons.collections4.ListUtils; +import org.mvel2.util.Make; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import java.util.HashMap; -import java.util.Map; +import java.math.BigDecimal; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; /** * @className: BsUserController @@ -42,6 +65,23 @@ public class BsUserController { @Resource private BsUserComplaintService userComplaintService; + @Resource + private PhgDataUserService phgDataUserService; + + @Resource + private BsUserCardService userCardService; + + @Resource + private CommonService commonService; + + @Resource + private GoodsUserAddressService goodsUserAddressService; + + @Resource + private GoodsSpecsService goodsSpecsService; + @Resource + private GoodsVpdService goodsVpdService; + @RequestMapping(value="/restore",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "恢复") @@ -137,4 +177,432 @@ public class BsUserController { return ResponseMsgUtil.exception(e); } } + +// @RequestMapping(value="/phgDataUser",method = RequestMethod.GET) +// @ResponseBody +// @ApiOperation(value = "普惠GO用户数据迁移") +// public ResponseData phgDataUser() { +// try { +// // 查询普惠GO老用户数据 +// Map param = new HashMap<>(); +// param.put("type" , 1); +// List list = phgDataUserService.getList(param); +// +// Map cyymallUserMap = list.stream().collect(Collectors.toMap(CyymallUser:: getWechatOpenId , Function.identity() , (cyymallUser, cyymallUser2) -> cyymallUser)); +// List cyymallUserList = new ArrayList<>(cyymallUserMap.values()); +// +// // 查询新普惠GO用户数据 +// List bsUserList = userService.getList(new HashMap<>()); +// +// // 定义用户 工会卡 新增用户列表 新增用户工会卡列表 更新用户列表 更新用户工会卡列表 +// BsUser sysUser; +// List listUserInsert = new ArrayList<>(); +// List listUserUpdate = new ArrayList<>(); +// +// // 循环老用户数据 组装新数据 +// for (CyymallUser user : cyymallUserList) { +// sysUser = new BsUser(); +// if (user.getBinding() != null) { +// //判断新老用户数据是否有相同数据 根据手机号 +// List bsUsers = bsUserList.stream() +// .filter(bsUser -> Objects.equals(bsUser.getPhone(), user.getBinding())) +// .collect(Collectors.toList()); +// List bsUsersOpenId = bsUserList.stream() +// .filter(bsUser -> Objects.equals(bsUser.getWxMaOpenid(), user.getWechatOpenId())) +// .collect(Collectors.toList()); +// if (!bsUsers.isEmpty() || !bsUsersOpenId.isEmpty()) { +// sysUser = bsUsers.get(0); +// } else { +// sysUser = new BsUser(); +// } +// } +// +// // 组装用户数据 +// sysUser.setHeadImg(user.getAvatarUrl()); +// sysUser.setStatus(UserStatusEnum.status1.getCode()); +// sysUser.setPhone(user.getBinding()); +// sysUser.setWxMaOpenid(user.getWechatOpenId()); +// sysUser.setIntegral(0L); +// sysUser.setUpdateTime(new Date()); +// sysUser.setExt1(String.valueOf(user.getId())); +// sysUser.setExt2(user.getGhCardNo()); +// if (sysUser.getId() == null) { +// sysUser.setName(user.getNickname()); +// sysUser.setCreateTime(new Date()); +// listUserInsert.add(sysUser); +// }else { +// listUserUpdate.add(sysUser); +// } +// } +// +// if (!listUserInsert.isEmpty()) { +// userService.insertUserBatch(listUserInsert); +// } +// if (!listUserUpdate.isEmpty()) { +// userService.updateUserBatch(listUserUpdate); +// } +// +// return ResponseMsgUtil.success("成功"); +// +// } catch (Exception e) { +// log.error("error!",e); +// return ResponseMsgUtil.exception(e); +// } +// } +// +// +// +// @RequestMapping(value="/phgDataUserDetail",method = RequestMethod.GET) +// @ResponseBody +// @ApiOperation(value = "普惠GO用户详细数据迁移") +// public ResponseData phgDataUserDetail() { +// try { +// +// // 查询新用户数据 查询新工会卡数据 查询 老收货地址数据 查询新城市数据 +// List bsUserList = userService.getList(new HashMap<>()); +// List cyymallAddresses = phgDataUserService.getAddressList(); +// List cityList = commonService.getCityListAll(); +// +// +// // 定义用户 工会卡 收货地址数据 更新用户工会卡列表 新增收货地址列表 +// BsUserCard sysUserCard; +// GoodsUserAddress userAddress; +// List listCardUpdate = new ArrayList<>(); +// List userAddresses = new ArrayList<>(); +// +// // 循环新用户数据 组装逐句 +// for (BsUser bsUser : bsUserList) { +// // 根据工会卡数据 匹配用户数据中的老数据 更新用户ID +// if (!StringUtils.isNullOrEmpty(bsUser.getExt2())) { +// sysUserCard = new BsUserCard(); +// sysUserCard.setCardNo(bsUser.getExt2()); +// sysUserCard.setType(1); +// sysUserCard.setStatus(1); +// sysUserCard.setUserId(bsUser.getId()); +// sysUserCard.setCreateTime(new Date()); +// sysUserCard.setUpdateTime(new Date()); +// listCardUpdate.add(sysUserCard); +// } +// +// // 匹配收货地址数据 新增新收货地址 +// List cyymallAddressList = cyymallAddresses.stream() +// .filter(cyymallAddress -> Objects.equals(cyymallAddress.getUserId().toString() , bsUser.getExt1())) +// .collect(Collectors.toList()); +// if (!cyymallAddressList.isEmpty()) { +// for (CyymallAddress address : cyymallAddressList) { +// List bsCities = cityList.stream().filter(city -> Objects.equals(city.getRegionName() , address.getDistrict())).collect(Collectors.toList()); +// if (!bsCities.isEmpty()) { +// userAddress = new GoodsUserAddress(); +// userAddress.setRegionId(String.valueOf(bsCities.get(0).getRegionId())); +// userAddress.setRegionName(address.getProvince() + "," + address.getCity() + "," + address.getDistrict()); +// userAddress.setAddress(address.getDetail()); +// userAddress.setUserId(bsUser.getId()); +// userAddress.setCreateTime(new Date()); +// userAddress.setUpdateTime(new Date()); +// userAddress.setPhone(address.getMobile()); +// userAddress.setConsignee(address.getName()); +// userAddress.setWhetherDefault(address.getIsDefault() == 1); +// userAddresses.add(userAddress); +// } +// +// } +// +// } +// +// } +// +// if (!listCardUpdate.isEmpty()) { +// userCardService.insertUserCardBatch(listCardUpdate); +// } +// +// if (!userAddresses.isEmpty()) { +// goodsUserAddressService.insertUserAddressBatch(userAddresses); +// } +// +// return ResponseMsgUtil.success("成功"); +// +// } catch (Exception e) { +// log.error("error!",e); +// return ResponseMsgUtil.exception(e); +// } +// } +// +// +// @RequestMapping(value="/phgDataUserOrder",method = RequestMethod.GET) +// @ResponseBody +// @ApiOperation(value = "普惠GO用户订单数据迁移") +// public ResponseData phgDataUserOrder() { +// try { +// +// Map map = new HashMap<>(); +// map.put("isPay" , 1); +// map.put("applyDelete" , 0); +// // 查询新用户数据 查询老用户订单列表 老收货订单详情 查询老商品列表 虚拟产品配置列表 +// List bsUserList = userService.getList(new HashMap<>()); +// List cyymallOrderList = phgDataUserService.getListOrder(map); +// List orderDetailList = phgDataUserService.getListOrderDetail(); +// List goodsList = phgDataUserService.getListGoods(); +// +// BsOrder order; +// BsOrderChild orderChild; +// BsOrderCoupon orderCoupon; +// BsOrderCouponNo orderCouponNo; +// BsOrderGoods orderGoods; +// BsOrderDeduction orderDeduction; +// +// List addOrderList = new ArrayList<>(); +// List addOrderChildList = new ArrayList<>(); +// List addOrderCouponList = new ArrayList<>(); +// List addOrderCouponNoList = new ArrayList<>(); +// List addOrderGoodsList = new ArrayList<>(); +// List addOrderDeductionList = new ArrayList<>(); +// BigDecimal price = new BigDecimal(0); +// +// for (CyymallOrder cyymallOrder : cyymallOrderList) { +// // 查询相关订单详情内容 +// List orderDetail = orderDetailList.stream().filter(detail -> Objects.equals(detail.getOrderId() , cyymallOrder.getId())) +// .collect(Collectors.toList()); +// // 查询用户信息 +// List userList = bsUserList.stream().filter(user -> Objects.equals(user.getExt1() , cyymallOrder.getUserId().toString())).collect(Collectors.toList()); +// // 判断用户是否存在 +// if (!userList.isEmpty()) { +// BsUser user = userList.get(0); +// // 判断是否存在订单详情 不存在不添加 +// if (!orderDetail.isEmpty()) { +// CyymallOrderDetail cyymallOrderDetail = orderDetail.get(0); +// // 查询产品 +// List goods = goodsList.stream().filter(cyymallGoods -> Objects.equals(cyymallGoods.getId() , cyymallOrderDetail.getGoodsId())) +// .collect(Collectors.toList()); +// // 判断产品不为空 +// if (!goods.isEmpty()) { +// CyymallGoods cyymallGoods = goods.get(0); +// +// +// // 公用订单数据 +// order = new BsOrder(); +// orderChild = new BsOrderChild(); +// orderCoupon = new BsOrderCoupon(); +// orderCouponNo = new BsOrderCouponNo(); +// orderDeduction = new BsOrderDeduction(); +// orderGoods = new BsOrderGoods(); +// // 定义订单内容 +// order.setOrderNo(cyymallOrder.getOrderNo()); +// Long createTime = (long) (cyymallOrder.getAddtime() )* 1000; +// Long payTime = (long) (cyymallOrder.getPayTime() )* 1000; +// order.setCreateTime(DateUtil.long2Date(createTime)); +// order.setUpdateTime(new Date()); +// order.setOrderStatus(OrderStatusEnum.status3.getCode()); +// order.setFinishTime(new Date()); +// order.setPayTime(DateUtil.long2Date(payTime)); +// order.setUserId(user.getId()); +// order.setUserName(user.getName()); +// order.setPayChannel(4); +// order.setUserPhone(user.getPhone()); +// +// // 订单金额 +// order.setPayRealPrice(cyymallOrder.getPayPrice()); +// order.setTotalPrice(cyymallOrder.getTotalPrice()); +// order.setProductTotalPrice(cyymallOrder.getTotalPrice()); +// order.setPayType(4); +// order.setExt3("迁移数据"); +// +// +// // 定义子订单 +// orderChild.setChildOrderNo(OrderUtil.generateChildOrderNo()); +// orderChild.setOrderNo(order.getOrderNo()); +// orderChild.setCreateTime(order.getCreateTime()); +// orderChild.setUpdateTime(order.getUpdateTime()); +// orderChild.setFinishTime(order.getFinishTime()); +// // 优惠金额 +// orderChild.setProductActualPrice(order.getPayRealPrice()); +// orderChild.setIntegralDiscountPrice(0L); +// orderChild.setCouponDiscountPrice(price); +// orderChild.setProductTotalPrice(order.getProductTotalPrice()); +// orderChild.setProductPrice(cyymallGoods.getPrice()); +// orderChild.setSurplusRefundPrice(price); +// orderChild.setTotalDeductionPrice(price); +// orderChild.setSurplusRefundPrice(price); +// orderChild.setSurplusRefundCount(0); +// orderChild.setSurplusRefundIntegral(0L); +// +// // 产品数据 +// orderChild.setProductCount(cyymallOrderDetail.getNum()); +// orderChild.setProductName(cyymallGoods.getName()); +// orderChild.setStatus(OrderChildStatusEnum.status3.getCode()); +// +// +// // 优惠订单数据 +// orderDeduction.setOrderNo(order.getOrderNo()); +// orderDeduction.setIntegralDiscountPrice(0L); +// orderDeduction.setCouponDiscountPrice(price); +// orderDeduction.setCouponDiscountActualPrice(price); +// orderDeduction.setTotalDeductionPrice(price); +// +// // 判断实物产品 +// if (!StringUtils.isNullOrEmpty(cyymallGoods.getOilCoutypecode())) { +// orderChild.setProductType(2); +// orderChild.setProductId(999999L); +// // todo 图片查询 +// orderChild.setProductImg(cyymallOrderDetail.getPic()); +// orderChild.setProductSpecId(999999L); +// orderChild.setProductSpecName(cyymallOrder.getName()); +// // 定义卡券订单内容 +// orderCoupon.setChildOrderNo(orderChild.getChildOrderNo()); +// orderCoupon.setCreateTime(orderChild.getCreateTime()); +// orderCoupon.setUpdateTime(orderChild.getUpdateTime()); +// orderCoupon.setFinishTime(orderChild.getFinishTime()); +// orderCoupon.setPayTime(order.getPayTime()); +// orderCoupon.setOrderNo(orderChild.getOrderNo()); +// // 优惠金额 +// orderCoupon.setIntegralDiscountPrice(0L); +// orderCoupon.setCouponDiscountPrice(price); +// orderCoupon.setTotalDeductionPrice(price); +// orderCoupon.setPayRealPrice(order.getPayRealPrice()); +// orderCoupon.setTotalPrice(order.getTotalPrice()); +// orderCoupon.setPayType(order.getPayType()); +// // todo 定义死数据 +// orderCoupon.setGoodsBrandId(999999L); +// orderCoupon.setGoodsBrandName("贵州卡券"); +// orderCoupon.setGoodsId(orderChild.getProductId()); +// orderCoupon.setGoodsName("工会加油权益"); +// orderCoupon.setGoodsCount(orderChild.getProductCount()); +// orderCoupon.setGoodsSpescOriginalPrice(cyymallGoods.getOriginalPrice()); +// orderCoupon.setGoodsVpdId(9L); +// orderCoupon.setGoodsVpdKey(cyymallGoods.getOilCoutypecode()); +// orderCoupon.setGoodsSpecsId(257L); +// orderCoupon.setGoodsTypeId(999999L); +// orderCoupon.setGoodsTypeName("贵州卡券"); +// orderCoupon.setGoodsSpecsName(cyymallGoods.getName()); +// orderCoupon.setUserId(user.getId()); +// orderCoupon.setUserPhone(user.getPhone()); +// orderCoupon.setGoodsVpdSource(4); +// orderCoupon.setStatus(orderChild.getStatus()); +// addOrderCouponList.add(orderCoupon); +// // 定义订单卡券号 +// orderCouponNo.setGoodsVpdSource(orderCoupon.getGoodsVpdSource()); +// orderCouponNo.setCreateTime(orderChild.getCreateTime()); +// orderCouponNo.setUpdateTime(orderChild.getUpdateTime()); +// orderCouponNo.setFinishTime(orderChild.getFinishTime()); +// orderCouponNo.setDeliverTime(orderChild.getCreateTime()); +// orderCouponNo.setExceptionStatus(false); +// orderCouponNo.setGoodsVpdKey(orderCoupon.getGoodsVpdKey()); +// orderCouponNo.setGoodsVpdSourceCouNo(cyymallOrder.getCouponRecordId()); +// orderCouponNo.setExt1(order.getOrderNo()); +// orderCouponNo.setStatus(3); +// addOrderCouponNoList.add(orderCouponNo); +// +// }else { +// // 实物商品数据 +// orderChild.setProductType(1); +// orderChild.setProductId(999999L); +// orderChild.setProductSpecId(999999L); +// orderChild.setProductSpecName(cyymallGoods.getName()); +// orderGoods.setChildOrderNo(orderChild.getChildOrderNo()); +// orderGoods.setCreateTime(orderChild.getCreateTime()); +// orderGoods.setUpdateTime(orderChild.getUpdateTime()); +// orderGoods.setFinishTime(orderChild.getFinishTime()); +// orderGoods.setOrderNo(orderChild.getOrderNo()); +// orderGoods.setGoodsId(999999L); +// orderGoods.setGoodsName(cyymallGoods.getName()); +// orderGoods.setGoodsCount(orderChild.getProductCount()); +// orderGoods.setGoodsSpecsId(999999L); +// orderGoods.setGoodsSpecsName(cyymallGoods.getName()); +// orderGoods.setGoodsCount(orderChild.getProductCount()); +// orderGoods.setGoodsSpecsId(999999L); +// orderGoods.setUserId(user.getId()); +// orderGoods.setUserPhone(user.getPhone()); +// orderGoods.setIntegralDiscountPrice(0L); +// orderGoods.setCouponDiscountPrice(price); +// orderGoods.setTotalDeductionPrice(price); +// orderGoods.setPayRealPrice(order.getPayRealPrice()); +// orderGoods.setTotalPrice(order.getTotalPrice()); +// orderGoods.setPayType(order.getPayType()); +// orderGoods.setStatus(4); +// // todo 定义死数据 +// orderGoods.setGoodsBrandId(99L); +// orderGoods.setGoodsBrandName("其他"); +// // todo 图片 +// orderChild.setProductImg(cyymallOrderDetail.getPic()); +// orderGoods.setImg(cyymallOrderDetail.getPic()); +// // 收货信息 +// orderGoods.setDeliveryAddress(cyymallOrder.getAddress()); +// orderGoods.setLogisticsStatusDesc("已完成"); +// orderGoods.setLogisticsStatus("4"); +// addOrderGoodsList.add(orderGoods); +// } +// +// // 插入订单 +// addOrderList.add(order); +// addOrderChildList.add(orderChild); +// addOrderDeductionList.add(orderDeduction); +// } +// } +// } +// +// } +// if (!addOrderList.isEmpty()) { +// +// List> partition = ListUtils.partition(addOrderList, 5000); +// +// for (List orderList : partition) { +// phgDataUserService.insertOrderBatch(orderList); +// } +// +// } +// if (!addOrderChildList.isEmpty()) { +// List> partitionChild = ListUtils.partition(addOrderChildList, 5000); +// +// for (List orderChildList : partitionChild) { +// phgDataUserService.insertOrderChildBatch(orderChildList); +// } +// +// } +// if (!addOrderCouponList.isEmpty()) { +// List> couponList = ListUtils.partition(addOrderCouponList, 5000); +// +// for (List orderCouponList : couponList) { +// phgDataUserService.insertOrderCouponBatch(orderCouponList); +// } +// } +// if (!addOrderCouponNoList.isEmpty()) { +// List> couponNoList = ListUtils.partition(addOrderCouponNoList, 5000); +// for (List orderCouponNoList : couponNoList) { +// phgDataUserService.insertOrderCouponNoBatch(orderCouponNoList); +// } +// } +// if (!addOrderDeductionList.isEmpty()) { +// List> deductionList = ListUtils.partition(addOrderDeductionList, 5000); +// for (List orderDeductionList : deductionList) { +// phgDataUserService.insertOrderDeductionBatch(orderDeductionList); +// } +// } +// if (!addOrderGoodsList.isEmpty()) { +// List> orderGoodsList = ListUtils.partition(addOrderGoodsList, 5000); +// for (List orderGoodsList1 : orderGoodsList) { +// phgDataUserService.insertOrderGoodsBatch(orderGoodsList1); +// } +// } +// +// return ResponseMsgUtil.success("成功"); +// +// } catch (Exception e) { +// log.error("error!",e); +// return ResponseMsgUtil.exception(e); +// } +// } +// +// +// @RequestMapping(value="/downloadImage",method = RequestMethod.GET) +// @ResponseBody +// @ApiOperation(value = "图片下载") +// public ResponseData downloadImage(@RequestParam(value = "imageUrl" , required = false) String imageUrl) { +// try { +// +// return ResponseMsgUtil.success(phgDataUserService.downloadImage(imageUrl)); +// +// } catch (Exception e) { +// log.error("error!",e); +// return ResponseMsgUtil.exception(e); +// } +// } } diff --git a/bweb/src/main/java/com/bweb/controller/FileUploadController.java b/bweb/src/main/java/com/bweb/controller/FileUploadController.java index 07ba0cb..eaf109d 100644 --- a/bweb/src/main/java/com/bweb/controller/FileUploadController.java +++ b/bweb/src/main/java/com/bweb/controller/FileUploadController.java @@ -27,6 +27,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; +import java.net.URL; import java.util.*; @RestController diff --git a/bweb/src/main/java/com/bweb/controller/TestController.java b/bweb/src/main/java/com/bweb/controller/TestController.java new file mode 100644 index 0000000..2f64fd3 --- /dev/null +++ b/bweb/src/main/java/com/bweb/controller/TestController.java @@ -0,0 +1,52 @@ +package com.bweb.controller; + +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.OrderUtil; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.model.ResponseData; +import com.hfkj.service.hlt.HltCanteenService; +import com.hfkj.service.hlt.HuiLianTongUnionCardService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + + +@Controller +@RequestMapping(value="/test") +@Api(value="测试") +public class TestController { + private static Logger log = LoggerFactory.getLogger(TestController.class); + + @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); + } + } +} diff --git a/bweb/src/main/java/com/bweb/controller/goods/GoodsController.java b/bweb/src/main/java/com/bweb/controller/goods/GoodsController.java index d6b462e..584f6b8 100644 --- a/bweb/src/main/java/com/bweb/controller/goods/GoodsController.java +++ b/bweb/src/main/java/com/bweb/controller/goods/GoodsController.java @@ -147,9 +147,9 @@ public class GoodsController { SessionObject sessionObject = userCenter.getSessionObject(request); SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject(); - if (userModel.getAccount().getObjectType() != SecUserObjectTypeEnum.type2.getCode()) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); - } +// if (userModel.getAccount().getObjectType() != SecUserObjectTypeEnum.type2.getCode()) { +// throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); +// } if (body == null || body.getGoodsId() == null diff --git a/bweb/src/main/resources/pre/application.yml b/bweb/src/main/resources/pre/application.yml index 874093a..23f62ce 100644 --- a/bweb/src/main/resources/pre/application.yml +++ b/bweb/src/main/resources/pre/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.9.154.68:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/phg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/bweb/src/main/resources/pre/config.properties b/bweb/src/main/resources/pre/config.properties index 44ea8fc..9176532 100644 --- a/bweb/src/main/resources/pre/config.properties +++ b/bweb/src/main/resources/pre/config.properties @@ -1,2 +1,2 @@ -fileUrl=/home/project/hsg/filesystem -cmsPath=/home/project/hsg/filesystem/cmsPath +fileUrl=/home/project/phg/filesystem +cmsPath=/home/project/phg/filesystem/cmsPath diff --git a/cweb/src/main/java/com/cweb/controller/hlt/HltCanteenController.java b/cweb/src/main/java/com/cweb/controller/hlt/HltCanteenController.java new file mode 100644 index 0000000..06dfa50 --- /dev/null +++ b/cweb/src/main/java/com/cweb/controller/hlt/HltCanteenController.java @@ -0,0 +1,76 @@ +package com.cweb.controller.hlt; + +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.OrderUtil; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.model.ResponseData; +import com.hfkj.service.cms.CmsContentService; +import com.hfkj.service.hlt.HltCanteenService; +import com.hfkj.service.hlt.HuiLianTongUnionCardService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.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 java.util.HashMap; +import java.util.Map; + +@Controller +@RequestMapping(value="/hltCanteen") +@Api(value="汇联通食堂接口") +public class HltCanteenController { + + Logger log = LoggerFactory.getLogger(HltCanteenController.class); + + + @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 info = HltCanteenService.canteenConsume(orderNo , cardNo , instCode , canteenId); + if (StringUtils.isBlank(info.getString("data"))) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败"); + } + return ResponseMsgUtil.success(HuiLianTongUnionCardService.resolveResponse(info.getString("data"))); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/queryCanteenOrder",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "食堂消费记录") + public ResponseData queryCanteenOrder(@RequestParam(value = "cardNo" , required = false) String cardNo) { + try { + + JSONObject info = HltCanteenService.queryCanteenOrder(cardNo); + if (StringUtils.isBlank(info.getString("data"))) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败"); + } + return ResponseMsgUtil.success(HuiLianTongUnionCardService.resolveResponse(info.getString("data"))); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/cweb/src/main/resources/pre/application.yml b/cweb/src/main/resources/pre/application.yml index 874093a..23f62ce 100644 --- a/cweb/src/main/resources/pre/application.yml +++ b/cweb/src/main/resources/pre/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.9.154.68:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/phg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/cweb/src/main/resources/pre/config.properties b/cweb/src/main/resources/pre/config.properties index d26a02e..2bb287c 100644 --- a/cweb/src/main/resources/pre/config.properties +++ b/cweb/src/main/resources/pre/config.properties @@ -1 +1 @@ -fileUrl=/home/project/hsg/filesystem +fileUrl=/home/project/phg/filesystem diff --git a/openapi/src/main/resources/dev/config.properties b/openapi/src/main/resources/dev/config.properties index 44ea8fc..9176532 100644 --- a/openapi/src/main/resources/dev/config.properties +++ b/openapi/src/main/resources/dev/config.properties @@ -1,2 +1,2 @@ -fileUrl=/home/project/hsg/filesystem -cmsPath=/home/project/hsg/filesystem/cmsPath +fileUrl=/home/project/phg/filesystem +cmsPath=/home/project/phg/filesystem/cmsPath diff --git a/openapi/src/main/resources/pre/application.yml b/openapi/src/main/resources/pre/application.yml index 874093a..23f62ce 100644 --- a/openapi/src/main/resources/pre/application.yml +++ b/openapi/src/main/resources/pre/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.9.154.68:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/phg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/openapi/src/main/resources/pre/config.properties b/openapi/src/main/resources/pre/config.properties index 44ea8fc..9176532 100644 --- a/openapi/src/main/resources/pre/config.properties +++ b/openapi/src/main/resources/pre/config.properties @@ -1,2 +1,2 @@ -fileUrl=/home/project/hsg/filesystem -cmsPath=/home/project/hsg/filesystem/cmsPath +fileUrl=/home/project/phg/filesystem +cmsPath=/home/project/phg/filesystem/cmsPath diff --git a/openapi/src/main/resources/prod/application.yml b/openapi/src/main/resources/prod/application.yml index f3e38c7..300889c 100644 --- a/openapi/src/main/resources/prod/application.yml +++ b/openapi/src/main/resources/prod/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://127.0.0.1:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 + url: jdbc:mysql://127.0.0.1:3306/phg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/openapi/src/main/resources/prod/config.properties b/openapi/src/main/resources/prod/config.properties index 44ea8fc..9176532 100644 --- a/openapi/src/main/resources/prod/config.properties +++ b/openapi/src/main/resources/prod/config.properties @@ -1,2 +1,2 @@ -fileUrl=/home/project/hsg/filesystem -cmsPath=/home/project/hsg/filesystem/cmsPath +fileUrl=/home/project/phg/filesystem +cmsPath=/home/project/phg/filesystem/cmsPath diff --git a/order/src/main/java/com/order/config/AuthConfig.java b/order/src/main/java/com/order/config/AuthConfig.java index 8c71d98..584e91c 100644 --- a/order/src/main/java/com/order/config/AuthConfig.java +++ b/order/src/main/java/com/order/config/AuthConfig.java @@ -1,4 +1,4 @@ -package com.cweb.config; +package com.order.config; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.module.SimpleModule; @@ -88,6 +88,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/**/swagger-ui.html") .excludePathPatterns("/notify/*") .excludePathPatterns("/cqNotify/*") + .excludePathPatterns("/orderCinema/queryOrder") ; } diff --git a/order/src/main/java/com/order/controller/business/BsOrderCinemaController.java b/order/src/main/java/com/order/controller/business/BsOrderCinemaController.java index 56a478f..323af35 100644 --- a/order/src/main/java/com/order/controller/business/BsOrderCinemaController.java +++ b/order/src/main/java/com/order/controller/business/BsOrderCinemaController.java @@ -104,7 +104,6 @@ public class BsOrderCinemaController { bsOrderCinemaService.update(bsOrderCinema); } - return ResponseMsgUtil.success(object); } catch (Exception e) { diff --git a/order/src/main/java/com/order/controller/notify/EtcNotify.java b/order/src/main/java/com/order/controller/notify/EtcNotify.java new file mode 100644 index 0000000..1967020 --- /dev/null +++ b/order/src/main/java/com/order/controller/notify/EtcNotify.java @@ -0,0 +1,47 @@ +package com.order.controller.notify; + +import com.alibaba.fastjson.JSONObject; +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.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; + +@Controller +@RequestMapping(value = "/etcNotify") +@Api(value = "etc通知") +public class EtcNotify { + private static final Logger log = LoggerFactory.getLogger(QzCinemaNotify.class); + + @RequestMapping(value = "/notify", method = RequestMethod.POST) + @ApiOperation(value = "回调") + @ResponseBody + public void notify(@RequestBody String reqBodyStr, HttpServletRequest request, HttpServletResponse response) { + try { + + JSONObject dataObject = JSONObject.parseObject(reqBodyStr, JSONObject.class); + + log.info("============回调任务Start============="); + log.info("尖椒订单充值-回调参数: " + dataObject); + log.info("============回调任务End============="); + + + response.setCharacterEncoding("UTF-8"); + response.setContentType("text/html;charset=utf-8"); + PrintWriter writer= response.getWriter(); + writer.write("SUCCESS"); + + + } catch (Exception e) { + log.error("WechatPayController --> wechatNotify() error!", e); + } + } +} diff --git a/order/src/main/resources/pre/application.yml b/order/src/main/resources/pre/application.yml index 874093a..23f62ce 100644 --- a/order/src/main/resources/pre/application.yml +++ b/order/src/main/resources/pre/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.9.154.68:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/phg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/order/src/main/resources/pre/config.properties b/order/src/main/resources/pre/config.properties index 44ea8fc..9176532 100644 --- a/order/src/main/resources/pre/config.properties +++ b/order/src/main/resources/pre/config.properties @@ -1,2 +1,2 @@ -fileUrl=/home/project/hsg/filesystem -cmsPath=/home/project/hsg/filesystem/cmsPath +fileUrl=/home/project/phg/filesystem +cmsPath=/home/project/phg/filesystem/cmsPath diff --git a/schedule/src/main/resources/pre/application.yml b/schedule/src/main/resources/pre/application.yml index db63258..7082821 100644 --- a/schedule/src/main/resources/pre/application.yml +++ b/schedule/src/main/resources/pre/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.9.154.68:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 + url: jdbc:mysql://139.9.154.68:3306/phg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/service/src/main/java/com/hfkj/common/utils/DesUtil.java b/service/src/main/java/com/hfkj/common/utils/DesUtil.java index 384e7c3..bd17045 100644 --- a/service/src/main/java/com/hfkj/common/utils/DesUtil.java +++ b/service/src/main/java/com/hfkj/common/utils/DesUtil.java @@ -246,7 +246,7 @@ public class DesUtil { /*String s = encode("中国", Charset.forName("UTF-8"),"12345678"); System.out.println(s);*/ //String data = "T3xbPEKEXV9+CbBw8D1B+N2jk8xwa55s0Bde48c49YDwYfnUdBVz6Kj4HS2oCA1TTiqJkCUIYa5ckMhJeByBCAMsqu21LmFjb/hdW0y1Tt0Wk5PqmO8FAg=="; - String data = "T3xbPEKEXV9+CbBw8D1B+N2jk8xwa55s0Bde48c49YDMmj1rv5nOrkawWt8fskSihNw0wugKUT1xWjHhIN8af7NylRVfhJvbeja2Zjjxnwk3FEKgyvIvJnk3QgiY4aghqQcGKxDOlAxT/kjrkDd2ESu1IWkpi+0HGnG3rKSL6+a1Nu7aW+rPHwXUOmHSgWFZFb9HhlfKI/jml3GhMZBWsZFirayyMMi8UKrdYN7ANPEB/6uV9iVtpLF5Kz8M2+GpI0EqRhPFAH2u3Q/RSgW8ei2ZbOY9NnbkdwuOjU93wgJxdY1Y93hvLYNe1i9QkSM1"; + String data = "T3xbPEKEXV9+CbBw8D1B+N2jk8xwa55s0Bde48c49YDMmj1rv5nOrkawWt8fskSihNw0wugKUT1xWjHhIN8af7NylRVfhJvbeja2Zjjxnwk3FEKgyvIvJnk3QgiY4aghqQcGKxDOlAxT/kjrkDd2ESu1IWkpi+0HGnG3rKSL6+a1Nu7aW+rPHwXUOmphgWFZFb9HhlfKI/jml3GhMZBWsZFirayyMMi8UKrdYN7ANPEB/6uV9iVtpLF5Kz8M2+GpI0EqRhPFAH2u3Q/RSgW8ei2ZbOY9NnbkdwuOjU93wgJxdY1Y93hvLYNe1i9QkSM1"; String data1 = "T3xbPEKEXV9+CbBw8D1B+N2jk8xwa55s0Bde48c49YBr4/b4yBwN2FIVZZn+Xg9KQTDoTCLu3YtByaWh7zPmdcpBr9FGARduhPrwSnYTFJ0VVVSK/UzPWdHN2YYd4yHGQRJ2HEr/1egt2JUHpWr0JA=="; /* { "success": true, diff --git a/service/src/main/java/com/hfkj/config/CommonSysConfig.java b/service/src/main/java/com/hfkj/config/CommonSysConfig.java index ba56f09..ec29b42 100644 --- a/service/src/main/java/com/hfkj/config/CommonSysConfig.java +++ b/service/src/main/java/com/hfkj/config/CommonSysConfig.java @@ -11,6 +11,10 @@ import org.springframework.stereotype.Component; @Data public class CommonSysConfig { + /** + * 图片地址 + */ + private String fileUrl; /** * 普惠GO域名地址 */ diff --git a/service/src/main/java/com/hfkj/dao/BsOrderMapperExt.java b/service/src/main/java/com/hfkj/dao/BsOrderMapperExt.java index 08c462e..d03de78 100644 --- a/service/src/main/java/com/hfkj/dao/BsOrderMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsOrderMapperExt.java @@ -1,7 +1,299 @@ package com.hfkj.dao; +import com.hfkj.entity.*; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + /** * mapper扩展类 */ public interface BsOrderMapperExt { + @Insert({ + "" + }) + void insertOrderBatch(@Param(value = "list") List list); + + @Insert({ + "" + }) + void insertOrderChildBatch(@Param(value = "list") List list); + + @Insert({ + "" + }) + void insertOrderCouponBatch(@Param(value = "list") List list); + + @Insert({ + "" + }) + void insertOrderCouponNoBatch(@Param(value = "list") List list); + + @Insert({ + "" + }) + void insertOrderGoodsBatch(@Param(value = "list") List list); + + @Insert({ + "" + }) + void insertOrderDeductionBatch(@Param(value = "list") List list); } \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserCardMapperExt.java b/service/src/main/java/com/hfkj/dao/BsUserCardMapperExt.java index 920112d..3cd3ebb 100644 --- a/service/src/main/java/com/hfkj/dao/BsUserCardMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsUserCardMapperExt.java @@ -1,7 +1,56 @@ package com.hfkj.dao; +import com.hfkj.entity.BsUser; +import com.hfkj.entity.BsUserCard; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; + +import java.util.List; + /** * mapper扩展类 */ public interface BsUserCardMapperExt { + + @Insert({ + "" + }) + void insertUserCardList(@Param(value = "list") List list); + + @Update({ + "" + }) + void updateUserCardList(@Param(value = "list") List list); } \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java b/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java index 4078eb8..d591a57 100644 --- a/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java @@ -1,7 +1,71 @@ package com.hfkj.dao; + +import com.hfkj.entity.BsUser; +import com.hfkj.entity.BsUserCard; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; + +import java.util.List; + /** * mapper扩展类 */ public interface BsUserMapperExt { + + @Insert({ + "" + }) + void insertUserList(@Param(value = "list") List list); + + + @Update({ + "" + }) + void updateUserList(@Param(value = "list") List list); + } \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/GoodsUserAddressMapper.java b/service/src/main/java/com/hfkj/dao/GoodsUserAddressMapper.java index 4c6266f..6c1001d 100644 --- a/service/src/main/java/com/hfkj/dao/GoodsUserAddressMapper.java +++ b/service/src/main/java/com/hfkj/dao/GoodsUserAddressMapper.java @@ -46,7 +46,8 @@ public interface GoodsUserAddressMapper extends GoodsUserAddressMapperExt { "update_time, op_id, ", "op_name, ext_1, ext_2, ", "ext_3)", - "values (#{userId,jdbcType=BIGINT}, #{consignee,jdbcType=VARCHAR}, ", + "values " + + "(#{userId,jdbcType=BIGINT}, #{consignee,jdbcType=VARCHAR}, ", "#{phone,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, ", "#{regionId,jdbcType=VARCHAR}, #{regionName,jdbcType=VARCHAR}, ", "#{whetherDefault,jdbcType=BIT}, #{createTime,jdbcType=TIMESTAMP}, ", diff --git a/service/src/main/java/com/hfkj/dao/GoodsUserAddressMapperExt.java b/service/src/main/java/com/hfkj/dao/GoodsUserAddressMapperExt.java index be57214..7a174ef 100644 --- a/service/src/main/java/com/hfkj/dao/GoodsUserAddressMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/GoodsUserAddressMapperExt.java @@ -1,7 +1,45 @@ package com.hfkj.dao; +import com.hfkj.entity.BsUser; +import com.hfkj.entity.GoodsUserAddress; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + /** * mapper扩展类 */ public interface GoodsUserAddressMapperExt { + + + @Insert({ + "" + }) + void insertAddressList(@Param(value = "list") List list); } \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/service/CommonService.java b/service/src/main/java/com/hfkj/service/CommonService.java index 8bcca8b..94ae27a 100644 --- a/service/src/main/java/com/hfkj/service/CommonService.java +++ b/service/src/main/java/com/hfkj/service/CommonService.java @@ -17,6 +17,16 @@ public interface CommonService { */ List getCityList(Long parentId); + /** + * @MethodName getCityListAll + * @Description: 查询所有城市 + * @param + * @return: java.util.List + * @Author: Sum1Dream + * @Date: 2024/7/25 下午3:29 + */ + List getCityListAll(); + /** * @Author Sum1Dream diff --git a/service/src/main/java/com/hfkj/service/card/BsUserCardService.java b/service/src/main/java/com/hfkj/service/card/BsUserCardService.java index 6387806..5bb7ee5 100644 --- a/service/src/main/java/com/hfkj/service/card/BsUserCardService.java +++ b/service/src/main/java/com/hfkj/service/card/BsUserCardService.java @@ -1,10 +1,12 @@ package com.hfkj.service.card; +import com.hfkj.entity.BsUser; import com.hfkj.entity.BsUserCard; import com.hfkj.sysenum.UserCardStatusEnum; import com.hfkj.sysenum.UserCardTypeEnum; import java.util.List; +import java.util.Map; /** * @className: BsUserCardService @@ -26,6 +28,24 @@ public interface BsUserCardService { */ BsUserCard getCard(String cardNo); + /** + * @MethodName insertUserCardBatch + * @Description: 批量插入工会卡 + * @param data + * @Author: Sum1Dream + * @Date: 2024/7/25 上午9:58 + */ + void insertUserCardBatch(List data); + + /** + * @MethodName updateUserCardBatch + * @Description:批量更新工会卡 + * @param data + * @Author: Sum1Dream + * @Date: 2024/7/25 上午9:58 + */ + void updateUserCardBatch(List data); + /** * 查询卡 * @param userId @@ -41,6 +61,9 @@ public interface BsUserCardService { */ List getCardList(Long userId, UserCardTypeEnum type); + + List getCardList(Map map); + /** * 绑定卡号 * @param type diff --git a/service/src/main/java/com/hfkj/service/card/impl/BsUserCardServiceImpl.java b/service/src/main/java/com/hfkj/service/card/impl/BsUserCardServiceImpl.java index 1b20b4b..91b1e4d 100644 --- a/service/src/main/java/com/hfkj/service/card/impl/BsUserCardServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/card/impl/BsUserCardServiceImpl.java @@ -16,8 +16,10 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Collections; import java.util.Date; import java.util.List; +import java.util.Map; /** * @className: BsUserCardServiceImpl @@ -36,6 +38,7 @@ public class BsUserCardServiceImpl implements BsUserCardService { if (data.getId() == null) { data.setCreateTime(new Date()); userCardMapper.insert(data); + } else { userCardMapper.updateByPrimaryKeySelective(data); } @@ -52,6 +55,16 @@ public class BsUserCardServiceImpl implements BsUserCardService { return null; } + @Override + public void insertUserCardBatch(List data) { + userCardMapper.insertUserCardList(data); + } + + @Override + public void updateUserCardBatch(List data) { + userCardMapper.updateUserCardList(data); + } + @Override public BsUserCard getCard(Long userId, String cardNo) { BsUserCardExample example = new BsUserCardExample(); @@ -79,6 +92,13 @@ public class BsUserCardServiceImpl implements BsUserCardService { return userCardMapper.selectByExample(example); } + @Override + public List getCardList(Map map) { + BsUserCardExample example = new BsUserCardExample(); + BsUserCardExample.Criteria criteria = example.createCriteria(); + return userCardMapper.selectByExample(example); + } + @Override public void bindCard(UserCardTypeEnum type, Long userId, String cardNo) throws Exception { if (UserCardTypeEnum.type1.getCode() == type.getCode()) { diff --git a/service/src/main/java/com/hfkj/service/coupon/BsOrderCouponNoService.java b/service/src/main/java/com/hfkj/service/coupon/BsOrderCouponNoService.java index 26de9b3..c74b7fd 100644 --- a/service/src/main/java/com/hfkj/service/coupon/BsOrderCouponNoService.java +++ b/service/src/main/java/com/hfkj/service/coupon/BsOrderCouponNoService.java @@ -31,6 +31,15 @@ public interface BsOrderCouponNoService { * @return */ List getListByCouponOrderId(Long couponOrderId); + /** + * @MethodName getListByOrderNo + * @Description: + * @param orderNo + * @return: com.hfkj.entity.BsOrderCouponNo + * @Author: Sum1Dream + * @Date: 2024/7/30 下午2:39 + */ + BsOrderCouponNo getListByOrderNo(String orderNo); /** * 查询列表 diff --git a/service/src/main/java/com/hfkj/service/coupon/impl/BsOrderCouponNoServiceImpl.java b/service/src/main/java/com/hfkj/service/coupon/impl/BsOrderCouponNoServiceImpl.java index 0182f93..f1e64f0 100644 --- a/service/src/main/java/com/hfkj/service/coupon/impl/BsOrderCouponNoServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/coupon/impl/BsOrderCouponNoServiceImpl.java @@ -8,6 +8,7 @@ import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map; @@ -51,6 +52,18 @@ public class BsOrderCouponNoServiceImpl implements BsOrderCouponNoService { return orderCouponNoMapper.selectByExample(example); } + @Override + public BsOrderCouponNo getListByOrderNo(String orderNo) { + BsOrderCouponNoExample example = new BsOrderCouponNoExample(); + example.createCriteria().andExt1EqualTo(orderNo); + example.setOrderByClause("create_time desc"); + List list = orderCouponNoMapper.selectByExample(example); + if (!list.isEmpty()) { + return list.get(0); + } + return null; + } + @Override public List getList(Map param) { BsOrderCouponNoExample example = new BsOrderCouponNoExample(); diff --git a/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java b/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java index fce3b82..0e600a0 100644 --- a/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java +++ b/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java @@ -58,6 +58,16 @@ public interface BsOrderGoodsService { */ BsOrderGoods findGoodsOrder(String orderNo); + /** + * @MethodName findGoodsOrderByChild + * @Description: + * @param orderChildNo + * @return: com.hfkj.entity.BsOrderGoods + * @Author: Sum1Dream + * @Date: 2024/7/31 上午10:37 + */ + BsOrderGoods findGoodsOrderByChild(String orderChildNo); + /** * @Author Sum1Dream * @Name queryDetailByMap diff --git a/service/src/main/java/com/hfkj/service/goods/GoodsUserAddressService.java b/service/src/main/java/com/hfkj/service/goods/GoodsUserAddressService.java index 3ffa7f1..88ed86c 100644 --- a/service/src/main/java/com/hfkj/service/goods/GoodsUserAddressService.java +++ b/service/src/main/java/com/hfkj/service/goods/GoodsUserAddressService.java @@ -74,4 +74,13 @@ public interface GoodsUserAddressService { * @Return void */ void cleanDeliveryAddressDefault(Long userId); + + /** + * @MethodName insertUserAddressBatch + * @Description: 批量新增 + * @param list + * @Author: Sum1Dream + * @Date: 2024/7/25 下午3:11 + */ + void insertUserAddressBatch(List list); } diff --git a/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java b/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java index 4ef4f62..d565c88 100644 --- a/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java @@ -81,6 +81,20 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService { return null; } + @Override + public BsOrderGoods findGoodsOrderByChild(String orderChildNo) { + BsOrderGoodsExample example = new BsOrderGoodsExample(); + example.createCriteria().andStatusNotEqualTo(0).andChildOrderNoEqualTo(orderChildNo); + + List list = bsOrderGoodsMapper.selectByExample(example); + + if (!list.isEmpty()) { + return list.get(0); + } + + return null; + } + @Override public BsOrderGoods queryDetail(Long id) { return bsOrderGoodsMapper.selectByPrimaryKey(id); diff --git a/service/src/main/java/com/hfkj/service/goods/impl/GoodsUserAddressServiceImpl.java b/service/src/main/java/com/hfkj/service/goods/impl/GoodsUserAddressServiceImpl.java index fe526f1..874b6f8 100644 --- a/service/src/main/java/com/hfkj/service/goods/impl/GoodsUserAddressServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/goods/impl/GoodsUserAddressServiceImpl.java @@ -84,4 +84,9 @@ public class GoodsUserAddressServiceImpl implements GoodsUserAddressService { } } } + + @Override + public void insertUserAddressBatch(List list) { + goodsUserAddressMapper.insertAddressList(list); + } } diff --git a/service/src/main/java/com/hfkj/service/goods/impl/GoodsVpdServiceImpl.java b/service/src/main/java/com/hfkj/service/goods/impl/GoodsVpdServiceImpl.java index 2dd9955..c207701 100644 --- a/service/src/main/java/com/hfkj/service/goods/impl/GoodsVpdServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/goods/impl/GoodsVpdServiceImpl.java @@ -69,6 +69,6 @@ public class GoodsVpdServiceImpl implements GoodsVpdService { @Override public List getList(Map map) { - return Collections.emptyList(); + return goodsVpdMapper.selectByExample(new GoodsVpdExample()); } } diff --git a/service/src/main/java/com/hfkj/service/hlt/HltCanteenService.java b/service/src/main/java/com/hfkj/service/hlt/HltCanteenService.java new file mode 100644 index 0000000..00a2e23 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/hlt/HltCanteenService.java @@ -0,0 +1,52 @@ +package com.hfkj.service.hlt; + +import com.alibaba.fastjson.JSONObject; +import java.util.HashMap; +import java.util.Map; + +/** + * @ClassName HltCanteenService + * @Author Sum1Dream + * @Description 汇联通食堂功能 + * @Date 2024/7/30 下午5:31 + **/ +public class HltCanteenService { + + /** + * @MethodName canteenConsume + * @Description: 食堂消费 + * @param orderNo + * @param cardNo + * @param instCode + * @param canteenId + * @return: com.alibaba.fastjson.JSONObject + * @Author: Sum1Dream + * @Date: 2024/7/30 下午5:36 + */ + public static JSONObject canteenConsume(String orderNo , String cardNo , String instCode , String canteenId) throws Exception { + Map dataMap = new HashMap<>(); + dataMap.put("orderNo", orderNo); + dataMap.put("consumeType", 3); + dataMap.put("cardNo", cardNo); + dataMap.put("instCode", instCode); + dataMap.put("canteenId", canteenId); + return HuiLianTongUnionCardService.request("canteen/canteenConsume", dataMap); + } + + /** + * @MethodName queryCanteenOrder + * @Description:查询食堂消费记录 + * @param cardNo + * @return: com.alibaba.fastjson.JSONObject + * @Author: Sum1Dream + * @Date: 2024/7/30 下午5:38 + */ + public static JSONObject queryCanteenOrder(String cardNo) throws Exception { + Map dataMap = new HashMap<>(); + dataMap.put("cardNo", cardNo); + dataMap.put("page", 1); + dataMap.put("pageSize", 100000); + return HuiLianTongUnionCardService.request("canteen/queryCanteenOrder", dataMap); + } + +} diff --git a/service/src/main/java/com/hfkj/service/impl/CommonServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/CommonServiceImpl.java index 47008c5..7ae33d4 100644 --- a/service/src/main/java/com/hfkj/service/impl/CommonServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/CommonServiceImpl.java @@ -33,6 +33,16 @@ public class CommonServiceImpl implements CommonService { return bsCityMapper.selectByExample(example); } + @Override + public List getCityListAll() { + BsCityExample example = new BsCityExample(); + BsCityExample.Criteria criteria = example.createCriteria(); + + criteria.andStatusEqualTo(1); + + return bsCityMapper.selectByExample(example); + } + @Override public List getCity(String code, String name, String child) { diff --git a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java index db80d25..e47df9d 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java @@ -11,6 +11,7 @@ import com.hfkj.entity.*; import com.hfkj.model.order.OrderChildModel; import com.hfkj.model.order.OrderModel; import com.hfkj.qianzhu.channel.CinemaService; +import com.hfkj.service.BsMerService; import com.hfkj.service.BsProductConfigService; import com.hfkj.service.coupon.BsOrderCouponNoService; import com.hfkj.service.coupon.BsOrderCouponService; @@ -207,6 +208,8 @@ public class OrderCreateService { jsonObject = new JSONObject((Map) orderChild.getBusiness()); } + + jsonObject.put("address", address); // 创建实物订单 @@ -214,6 +217,7 @@ public class OrderCreateService { orderGoods.setOrderNo(orderChild.getOrderNo()); orderGoods.setChildOrderNo(orderChild.getChildOrderNo()); orderGoods.setMerId(orderChild.getMerId()); + orderGoods.setMerName(goodsMsg.getMerName()); orderGoods.setUserId(order.getUserId()); orderGoods.setUserPhone(order.getUserPhone()); orderGoods.setGoodsId(goodsMsg.getId()); diff --git a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java index d65f357..f938a79 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java @@ -196,13 +196,14 @@ public class OrderPaySuccessService { * @param order */ public void goods(OrderModel order, BsOrderChild childOrder) { - BsOrderGoods goodsOrder = bsOrderGoodsService.findGoodsOrder(order.getOrderNo()); + BsOrderGoods goodsOrder = bsOrderGoodsService.findGoodsOrderByChild(childOrder.getChildOrderNo()); try { if (goodsOrder == null) { throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "未查询到相关内容"); } + goodsMsgService.editSaleNum(goodsOrder.getGoodsId() , goodsOrder.getGoodsCount() , 1); goodsOrder.setTotalPrice(childOrder.getProductTotalPrice()); @@ -266,6 +267,7 @@ public class OrderPaySuccessService { orderCinema.setPayTime(order.getPayTime()); orderCinema.setUpdateTime(new Date()); orderCinema.setStatus(OrderCinemaStatusEnum.status5.getCode()); + bsOrderCinemaService.update(orderCinema); } catch (Exception e) { if (orderCinema == null) { @@ -273,7 +275,6 @@ public class OrderPaySuccessService { } orderCinema.setExceptionStatus(true); orderCinema.setExceptionMsg(e.getMessage()); - } finally { bsOrderCinemaService.update(orderCinema); } diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java index f73ba07..e3c194c 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java @@ -18,10 +18,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @className: BsOrderChildServiceImpl @@ -82,7 +79,15 @@ public class BsOrderChildServiceImpl implements BsOrderChildService { if (childModel.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) { BsOrderGoods orderGoods = orderGoodsService.findGoodsOrder(orderNo); if (orderGoods != null) { - GoodsUserAddress address = goodsUserAddressService.queryDetail(orderGoods.getDeliveryAddressId()); + GoodsUserAddress address; + if (orderGoods.getDeliveryAddressId() != null) { + address = goodsUserAddressService.queryDetail(orderGoods.getDeliveryAddressId()); + } else { + Map map = new HashMap<>(); + map.put("userId" , orderGoods.getUserId()); + address = goodsUserAddressService.queryDetailByMap(map); + } + JSONObject object; if (childModel.getBusiness() == null) { object = new JSONObject(); 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 09880fe..46fbe52 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 @@ -16,11 +16,15 @@ import com.hfkj.model.order.OrderModel; import com.hfkj.mqtopic.OrderTopic; import com.hfkj.qianzhu.channel.CinemaService; import com.hfkj.service.BsProductConfigService; +import com.hfkj.service.coupon.BsOrderCouponNoService; +import com.hfkj.service.coupon.BsOrderCouponService; import com.hfkj.service.discount.CouponDiscountService; import com.hfkj.service.discount.CouponDiscountUserRelService; import com.hfkj.service.goods.BsOrderCinemaService; +import com.hfkj.service.goods.BsOrderGoodsService; import com.hfkj.service.order.*; import com.hfkj.service.user.UserIntegralService; +import com.hfkj.service.user.impl.PhgDataUserServiceImpl; import com.hfkj.sysenum.UserIntegralRecordOpUserTypeEnum; import com.hfkj.sysenum.UserIntegralRecordSourceTypeEnum; import com.hfkj.sysenum.order.OrderChildProductTypeEnum; @@ -87,7 +91,14 @@ public class BsOrderServiceImpl implements BsOrderService { private BsOrderCinemaService bsOrderCinemaService; @Resource private BsProductConfigService productConfigService; - + @Resource + private PhgDataUserServiceImpl phgDataUserService; + @Resource + private BsOrderGoodsService bsOrderGoodsService; + @Resource + private BsOrderCouponService bsOrderCouponService; + @Resource + private BsOrderCouponNoService bsOrderCouponNoService; @Override @@ -261,9 +272,9 @@ public class BsOrderServiceImpl implements BsOrderService { } // TODO 临时多商户支付功能限制 - if (order.getOrderChildList().stream().collect(Collectors.groupingBy(BsOrderChild::getMerId, Collectors.toList())).size() > 1) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂不支持多商户商品下单"); - } +// if (order.getOrderChildList().stream().collect(Collectors.groupingBy(BsOrderChild::getMerId, Collectors.toList())).size() > 1) { +// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂不支持多商户商品下单"); +// } if (order.getPayRealPrice().compareTo(new BigDecimal("0")) <= 0) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前不支持0元购买"); @@ -481,7 +492,7 @@ public class BsOrderServiceImpl implements BsOrderService { } @Override - public OrderModel getDetail(String orderNo){ + public OrderModel getDetail(String orderNo){ OrderModel orderModel = new OrderModel(); BeanUtils.copyProperties(getOrder(orderNo), orderModel); @@ -493,9 +504,11 @@ public class BsOrderServiceImpl implements BsOrderService { // todo 1.0阶段暂时需要返回收货地址使用 for (OrderChildModel orderChild : orderModel.getOrderChildList()) { - if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) { - orderModel.setBusiness(orderChild.getBusiness()); - } + if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) { + orderModel.setBusiness(orderChild.getBusiness()); + } + + if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type3.getCode())) { BsOrderCinema bsOrderCinema = bsOrderCinemaService.findGoodsOrder(orderNo); diff --git a/service/src/main/java/com/hfkj/service/user/BsUserService.java b/service/src/main/java/com/hfkj/service/user/BsUserService.java index cb4c156..8156d14 100644 --- a/service/src/main/java/com/hfkj/service/user/BsUserService.java +++ b/service/src/main/java/com/hfkj/service/user/BsUserService.java @@ -21,6 +21,24 @@ public interface BsUserService { */ void editData(BsUser data); + /** + * @MethodName insertUserBatch + * @Description: 批量插入 + * @param data + * @Author: Sum1Dream + * @Date: 2024/7/24 下午5:38 + */ + void insertUserBatch(List data); + + /** + * @MethodName updateUserBatch + * @Description: 批量更新 + * @param data + * @Author: Sum1Dream + * @Date: 2024/7/24 下午5:38 + */ + void updateUserBatch(List data); + /** * 获取用户 * @param userId 用户id @@ -35,6 +53,9 @@ public interface BsUserService { */ BsUser getUser(String phone); + + BsUser getUserByMaOpenId(String maOpenId); + /** * 获取用户 * @param vFamilyOpenid 手机号 diff --git a/service/src/main/java/com/hfkj/service/user/PhgDataUserService.java b/service/src/main/java/com/hfkj/service/user/PhgDataUserService.java new file mode 100644 index 0000000..36f80d3 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/PhgDataUserService.java @@ -0,0 +1,42 @@ +package com.hfkj.service.user; + +import com.hfkj.entity.*; + +import java.util.List; +import java.util.Map; + +public interface PhgDataUserService { + + /** + * @MethodName queryDetail + * @Description: + * @param id + * @return: com.hfkj.entity.CyymallUser + * @Author: Sum1Dream + * @Date: 2024/7/22 下午3:29 + */ + CyymallUser queryDetail(Integer id); + + + List getList(Map map); + + List getListOrder(Map map); + + List getListOrderDetail(); + + CyymallOrderDetail getDetail(Integer id); + + List getAddressList(); + + CyymallGoods findGoods(Integer id); + List getListGoods(); + + void insertOrderBatch(List list); + void insertOrderChildBatch(List list); + void insertOrderCouponBatch(List list); + void insertOrderCouponNoBatch(List list); + void insertOrderGoodsBatch(List list); + void insertOrderDeductionBatch(List list); + + String downloadImage(String imageUrl); +} diff --git a/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java index 595a08b..1a667d8 100644 --- a/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java @@ -60,6 +60,16 @@ public class BsUserServiceImpl implements BsUserService { } } + @Override + public void insertUserBatch(List data) { + userMapper.insertUserList(data); + } + + @Override + public void updateUserBatch(List data) { + userMapper.updateUserList(data); + } + @Override public BsUser getUser(Long userId) { return userMapper.selectByPrimaryKey(userId); @@ -78,6 +88,19 @@ public class BsUserServiceImpl implements BsUserService { return null; } + @Override + public BsUser getUserByMaOpenId(String maOpenId) { + BsUserExample example = new BsUserExample(); + example.createCriteria() + .andWxMaOpenidEqualTo(maOpenId) + .andStatusNotEqualTo(UserStatusEnum.status0.getCode()); + List list = userMapper.selectByExample(example); + if (!list.isEmpty()) { + return list.get(0); + } + return null; + } + @Override public BsUser getUserByOutsideOpenid(String outsideOpenid) { BsUserExample example = new BsUserExample(); @@ -158,7 +181,13 @@ public class BsUserServiceImpl implements BsUserService { // 查询用户 BsUser user = getUser(phone); if (user == null) { - user = register(phone, password, other); + // 查询用户 + user = getUserByMaOpenId(other.get("maOpenId").toString()); + if (user == null) { + user = register(phone, password, other); + } + user.setPhone(phone); + editData(user); } // 缓存 diff --git a/service/src/main/java/com/hfkj/service/user/impl/PhgDataUserServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/PhgDataUserServiceImpl.java new file mode 100644 index 0000000..d692d32 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/impl/PhgDataUserServiceImpl.java @@ -0,0 +1,182 @@ +package com.hfkj.service.user.impl; + +import com.hfkj.common.obs.HuaWeiYunObs; +import com.hfkj.common.utils.DateUtil; +import com.hfkj.config.CommonSysConst; +import com.hfkj.dao.*; +import com.hfkj.entity.*; +import com.hfkj.service.user.PhgDataUserService; +import org.apache.commons.collections4.MapUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.io.*; +import java.net.URL; +import java.net.URLConnection; +import java.util.*; + +@Service("phgDataUserService") +public class PhgDataUserServiceImpl implements PhgDataUserService { + + @Resource + private CyymallUserMapper cyymallUserMapper; + + @Resource + private CyymallOrderMapper cyymallOrderMapper; + + @Resource + private CyymallOrderDetailMapper cyymallOrderDetailMapper; + + @Resource + private CyymallAddressMapper cyymallAddressMapper; + + @Resource + private CyymallGoodsMapper cyymallGoodsMapper; + + @Resource + private BsOrderMapper orderMapper; + @Qualifier("bsOrderMapperExt") + + @Resource + private BsOrderMapperExt bsOrderMapperExt; + + @Override + public CyymallUser queryDetail(Integer id) { + return cyymallUserMapper.selectByPrimaryKey(id); + } + + @Override + public List getList(Map map) { + + CyymallUserExample example = new CyymallUserExample(); + CyymallUserExample.Criteria criteria = example.createCriteria(); + + + if (MapUtils.getShort(map, "type") != null) { + criteria.andTypeEqualTo(MapUtils.getShort(map, "type")); + } + return cyymallUserMapper.selectByExample(example); + } + + @Override + public List getListOrder(Map map) { + + CyymallOrderExample example = new CyymallOrderExample(); + CyymallOrderExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getLong(map, "userId") != null) { + criteria.andUserIdEqualTo(MapUtils.getInteger(map, "type")); + } + if (MapUtils.getShort(map, "isPay") != null) { + criteria.andIsPayEqualTo(MapUtils.getShort(map, "isPay")); + } + if (MapUtils.getShort(map, "applyDelete") != null) { + criteria.andApplyDeleteEqualTo(MapUtils.getShort(map, "applyDelete")); + } + return cyymallOrderMapper.selectByExample(example); + } + + @Override + public List getListOrderDetail() { + return cyymallOrderDetailMapper.selectByExample(new CyymallOrderDetailExample()); + } + + @Override + public CyymallOrderDetail getDetail(Integer id) { + return cyymallOrderDetailMapper.selectByPrimaryKey(id); + } + + @Override + public List getAddressList() { + CyymallAddressExample example = new CyymallAddressExample(); + CyymallAddressExample.Criteria criteria = example.createCriteria(); + + return cyymallAddressMapper.selectByExample(example); + } + + + @Override + public CyymallGoods findGoods(Integer id) { + return cyymallGoodsMapper.selectByPrimaryKey(id); + } + + + @Override + public List getListGoods() { + return cyymallGoodsMapper.selectByExample(new CyymallGoodsExample()); + } + + + @Override + public void insertOrderBatch(List list) { + bsOrderMapperExt.insertOrderBatch(list); + } + + @Override + public void insertOrderChildBatch(List list) { + bsOrderMapperExt.insertOrderChildBatch(list); + } + + @Override + public void insertOrderCouponBatch(List list) { + bsOrderMapperExt.insertOrderCouponBatch(list); + } + + @Override + public void insertOrderCouponNoBatch(List list) { + bsOrderMapperExt.insertOrderCouponNoBatch(list); + } + + @Override + public void insertOrderGoodsBatch(List list) { + bsOrderMapperExt.insertOrderGoodsBatch(list); + } + + @Override + public void insertOrderDeductionBatch(List list) { + bsOrderMapperExt.insertOrderDeductionBatch(list); + } + + @Override + public String downloadImage(String imageUrl) { + try { + URL url = new URL(imageUrl); + URLConnection connection = url.openConnection(); + InputStream inputStream = connection.getInputStream(); + BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); + + + // 创建图片路径 + String fileName = System.currentTimeMillis() + ".png"; + String childPath = DateUtil.date2String(new Date(), "yyyyMM"); + String destDirName = CommonSysConst.getSysConfig().getFileUrl() + File.separator + childPath; + // 创建文件夹 + File dir = new File(destDirName); + if (!dir.exists()) { + dir.mkdirs(); + } + + FileOutputStream fileOutputStream = new FileOutputStream(destDirName + File.separator + fileName); + + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = bufferedInputStream.read(buffer)) != -1) { + fileOutputStream.write(buffer, 0, bytesRead); + fileOutputStream.flush(); + } + HuaWeiYunObs.putObject(CommonSysConst.getSysConfig().getObsBucketName(), + childPath + "/" + fileName, new File(destDirName + "/" + fileName)); + fileOutputStream.close(); + bufferedInputStream.close(); + inputStream.close(); + + return childPath + "/" + fileName; + } catch (IOException ioException) { + ioException.printStackTrace(); + } + return null; + + } +} diff --git a/service/src/main/resources/dev/commonConfig.properties b/service/src/main/resources/dev/commonConfig.properties index 86d85bc..fcd1078 100644 --- a/service/src/main/resources/dev/commonConfig.properties +++ b/service/src/main/resources/dev/commonConfig.properties @@ -1,11 +1,11 @@ - +fileUrl=/Users/chenyao/Desktop/img domainName=https://phgcs.dctpay.com wechatMpAppid=wxa075e8509802f826 -wechatMpSecret=0e606fc1378d35e359fcf3f15570b2c5 +wechatMpSecret=0e606fc1378d35e359fcf3f15570b2c51 -wechatMaAppid=wx8d49e2f83025229d -wechatMaSecret=d8d6dcaef77d3b659258a01b5ddba5df +wechatMaAppid=wx785ac6bc8daa0f88 +wechatMaSecret=81c5f13b7c5372b31e04814c86ae97d8 obsBucketName=phg-test obsEndPoint=https://obs.cn-southwest-2.myhuaweicloud.com @@ -58,11 +58,11 @@ huiftShopCode=50041b27-f985-dcb0-1cc0-f106b09bf1fe huiftSignSecret=DB4D8069A9AC6DDF9D75667EE5CF182A #QIANZHU -qianZhuUrl=https://live-test.qianzhu8.com -qianzhuH5url=https://nf-test.qianzhu8.com/gateway -qianZhuPlatformId=10376 -qianZhuSecret=ktxb49sh2jfhgn8g -qianZhuCinemaNotify=https://phgcs.dctpay.com/order/cinemaNotify/notify +qianZhuUrl=https://live.qianzhu8.com +qianzhuH5url=https://nf.qianzhu8.com/gateway +qianZhuPlatformId=10710 +qianZhuSecret=pgmh5j1cbq2brm08 +qianZhuCinemaNotify=https://phg.dctpay.com/order/cinemaNotify/notify #CT ctNotifyUrl = 1 diff --git a/service/src/main/resources/prod/commonConfig.properties b/service/src/main/resources/prod/commonConfig.properties index 4bc3974..3af1cb1 100644 --- a/service/src/main/resources/prod/commonConfig.properties +++ b/service/src/main/resources/prod/commonConfig.properties @@ -1,11 +1,11 @@ - +fileUrl=/home/project/phg/filesystem domainName=https://phg.dctpay.com wechatMpAppid=wxa075e8509802f826 wechatMpSecret=0e606fc1378d35e359fcf3f15570b2c5 -wechatMaAppid=wx8d49e2f83025229d -wechatMaSecret=d8d6dcaef77d3b659258a01b5ddba5df +wechatMaAppid=wx785ac6bc8daa0f88 +wechatMaSecret=81c5f13b7c5372b31e04814c86ae97d8 obsBucketName=phg obsEndPoint=https://obs.cn-southwest-2.myhuaweicloud.com diff --git a/user/src/main/java/com/user/controller/BsUserController.java b/user/src/main/java/com/user/controller/BsUserController.java index 2266847..1fcfe56 100644 --- a/user/src/main/java/com/user/controller/BsUserController.java +++ b/user/src/main/java/com/user/controller/BsUserController.java @@ -14,7 +14,6 @@ import com.hfkj.entity.BsUserComplaint; import com.hfkj.model.ResponseData; import com.hfkj.model.SecUserSessionObject; import com.hfkj.model.UserSessionObject; -import com.hfkj.service.SecUserService; import com.hfkj.service.user.BsUserComplaintService; import com.hfkj.service.user.BsUserService; import com.hfkj.service.user.impl.BsUserServiceImpl; @@ -23,17 +22,14 @@ import com.hfkj.sysenum.UserLoginPlatform; import com.hfkj.sysenum.UserLoginType; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.apache.catalina.User; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.Description; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -122,7 +118,6 @@ public class BsUserController { } } - @RequestMapping(value = "/outsideOpenid", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "外部openid登录") @@ -144,7 +139,7 @@ public class BsUserController { 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")); @@ -277,11 +272,12 @@ public class BsUserController { BsUser bsUser = userSession.getUser(); bsUser.setHeadImg(body.getHeadImg()); + bsUser.setName(body.getName()); bsUser.setPhone(body.getPhone()); userService.editData(bsUser); - - return ResponseMsgUtil.success("修改成功"); + // 更新登录信息 + return ResponseMsgUtil.success(userService.updateSession(bsUser.getId())); } catch (Exception e) { log.error("LoginController --> wechatMaPhone() error!", e); diff --git a/user/src/main/resources/pre/application.yml b/user/src/main/resources/pre/application.yml index 874093a..23f62ce 100644 --- a/user/src/main/resources/pre/application.yml +++ b/user/src/main/resources/pre/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.9.154.68:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/phg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/user/src/main/resources/pre/config.properties b/user/src/main/resources/pre/config.properties index 44ea8fc..9176532 100644 --- a/user/src/main/resources/pre/config.properties +++ b/user/src/main/resources/pre/config.properties @@ -1,2 +1,2 @@ -fileUrl=/home/project/hsg/filesystem -cmsPath=/home/project/hsg/filesystem/cmsPath +fileUrl=/home/project/phg/filesystem +cmsPath=/home/project/phg/filesystem/cmsPath