springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/ShopFlowerApi.java
@@ -176,7 +176,15 @@ @GetMapping("orderDetail") @ApiImplicitParam(name = "orderId", value = "订单id", required = true) public R orderDetail(@RequestParam("orderId") Long orderId) { return communityService.orderDetailFlower(orderId); return communityService.orderDetailFlower(orderId,null); } @ApiOperation(value = "自提点查询订单详情", response = ComShopFlowerOrderPageVO.class) @GetMapping("pointOrderDetail") @ApiImplicitParam(name = "orderId", value = "订单id", required = true) public R pointOrderDetail(@RequestParam("orderId") Long orderId) { String phone = this.getLoginUserInfo().getPhone(); return communityService.orderDetailFlower(orderId,phone); } @ApiOperation(value = "取消订单") @@ -534,6 +542,7 @@ @PostMapping("/shipOrderFlower") @ApiOperation(value = "订单发货") public R shipOrderFlower(@RequestBody ComShopOrderShipDTO orderShipDTO) { orderShipDTO.setOperUserAccount(this.getLoginUserInfo().getAccount()); return communityService.shipOrderFlower(orderShipDTO); } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/shop/PageComShopFlowerGoodsDTO.java
@@ -28,4 +28,6 @@ @ApiModelProperty(value = "分页-每页记录数", example = "10") private Long pageSize; @ApiModelProperty(value = "用户id",hidden = true) private Long userId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/shop/AddShopFlowerGoodsVO.java
@@ -46,6 +46,9 @@ @ApiModelProperty("商品详情") private String details; @ApiModelProperty("商品详情()富文本") private String goodsDescribe; /** * 配送方式(1.商家配送 2.快递物流) */ springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/shop/ComShopFlowerOrderPageVO.java
@@ -68,10 +68,6 @@ @ApiModelProperty(value = "支付单号") private String payNo; @ApiModelProperty(value = "发货时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date deliveryTime; @ApiModelProperty(value = "收货时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date receivingTime; @@ -121,4 +117,16 @@ @ApiModelProperty(value = "商品规格图") private String goodsAttrPic; @ApiModelProperty(value = "取消时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date cancelTime; @ApiModelProperty(value = "配送时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date deliveryTime; @ApiModelProperty(value = "送达时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date serviceTime; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -10803,7 +10803,7 @@ * @return 订单详情 */ @GetMapping("/shopFlower/orderDetail") R orderDetailFlower(@RequestParam("orderId") Long orderId); R orderDetailFlower(@RequestParam("orderId") Long orderId,@RequestParam(value = "phone",required = false) String phone); /** * 根据订单id取消订单 @@ -11103,4 +11103,12 @@ * @return */ @GetMapping("/shopFlower/selectOrderLineChart") R selectOrderLineChart(@RequestParam("storeId") Long storeId,@RequestParam("type") Integer type,@RequestParam("tab") Integer tab); /** * 统计上架的上下架商品数量 * @param userId * @return */ @GetMapping("/shopFlower/countSaleByUserId") R countSaleByUserId(@RequestParam("userId") Long userId); } springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ShopFlowerApi.java
@@ -58,6 +58,7 @@ @ApiOperation(value = "分页查询商品", response = PageShopGoodsVO.class) @PostMapping("/goods/page") public R pageGoodsList(@RequestBody PageComShopFlowerGoodsDTO pageComShopGoodsDTO) { pageComShopGoodsDTO.setUserId(this.getUserId()); return communityService.pageFlowerGoodsList(pageComShopGoodsDTO); } @@ -119,7 +120,7 @@ @ApiOperation(value = "订单_详细", response = ComShopFlowerOrderPageVO.class) @GetMapping("/order/detail") public R detail(@RequestParam("orderId") Long orderId) { return communityService.orderDetailFlower(orderId); return communityService.orderDetailFlower(orderId,null); } /** @@ -183,4 +184,14 @@ return communityService.selectOrderLineChart(storeId,type,tab); } /** * 统计上架的上下架商品数量 * @return */ @ApiOperation(value = "商家后台-上下架商品数量") @GetMapping("/countSale") public R countSale(){ return communityService.countSaleByUserId(this.getUserId()); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ShopFlowerApi.java
@@ -198,8 +198,8 @@ * @return 订单详情 */ @GetMapping("orderDetail") public R orderDetailFlower(@RequestParam("orderId") Long orderId) { return comShopFlowerOrderService.orderDetail(orderId); public R orderDetailFlower(@RequestParam("orderId") Long orderId,@RequestParam(value = "phone",required = false) String phone) { return comShopFlowerOrderService.orderDetail(orderId,phone); } /** @@ -567,5 +567,14 @@ return comShopFlowerOrderService.pageOrderByDeliveryNo(pageComFlowerOrderListDTO); } /** * 统计上架的上下架商品数量 * @param userId * @return */ @GetMapping("/countSaleByUserId") R countSaleByUserId(@RequestParam("userId") Long userId){ return comShopFlowerGoodsService.countSaleByUserId(userId); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComShopFlowerGoodsDAO.java
@@ -7,10 +7,13 @@ import com.panzhihua.common.model.dtos.shop.PageComShopFlowerGoodsDTO; import com.panzhihua.common.model.dtos.shop.PageComShopFlowerStoreDTO; import com.panzhihua.common.model.vos.shop.ComShopFlowerGoodsVO; import com.panzhihua.common.model.vos.shop.ComShopOrderStoreIdCountVO; import com.panzhihua.common.model.vos.shop.PageShopFlowerGoodsVO; import com.panzhihua.service_community.model.dos.ComShopFlowerGoodsDO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; /** * @auther yh @@ -42,8 +45,11 @@ /** * 商店内在售商品 * * @param storeId * @return */ Integer selectCountSaleByStoreId(@Param("storeId") Long storeId); List<ComShopOrderStoreIdCountVO> countSaleByUserId(@Param("userId") Long userId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComShopFlowerGoodsService.java
@@ -87,4 +87,11 @@ */ R incrGoodsView(Long goodsId); /** * 统计上架的上下架商品数量 * @param userId * @return */ R countSaleByUserId(Long userId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComShopFlowerOrderService.java
@@ -56,7 +56,7 @@ * 订单id * @return 订单详情 */ R orderDetail(Long orderId); R orderDetail(Long orderId,String phone); /** * 根据订单id取消订单 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopFlowerGoodsServiceImpl.java
@@ -30,6 +30,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import static java.util.Objects.isNull; @@ -341,4 +342,11 @@ } return R.ok(); } @Override public R countSaleByUserId(Long userId){ List<ComShopOrderStoreIdCountVO> comShopOrderStoreIdCountVOS = this.baseMapper.countSaleByUserId(userId); Map<String, Integer> collect = comShopOrderStoreIdCountVOS.stream().collect(Collectors.toMap(ComShopOrderStoreIdCountVO::getCountName, ComShopOrderStoreIdCountVO::getCountNum)); return R.ok(collect); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopFlowerOrderServiceImpl.java
@@ -1,6 +1,7 @@ package com.panzhihua.service_community.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -31,6 +32,7 @@ import java.util.*; import java.util.stream.Collectors; import static java.util.Objects.isNull; import static java.util.Objects.nonNull; /** @@ -365,13 +367,13 @@ BeanUtils.copyProperties(convenientMerchantDO, shopStoreVO); } orderVo.setConvenientMerchantVO(shopStoreVO); //已完成、已退款才有评论 TODO // if (ComShopFlowerOrderDO.status.ywc == shopOrderDO.getStatus() || ComShopFlowerOrderDO.status.ytk == shopOrderDO.getStatus()) { //已完成、已退款才有评论 if (ComShopFlowerOrderDO.status.ywc == orderVo.getStatus() || ComShopFlowerOrderDO.status.ytk == orderVo.getStatus()) { ComShopFlowerEvaluateVO comShopFlowerEvaluateVO = comShopFlowerEvaluateDAO.selectByOrderNo(orderVo.getOrderNo()); if (nonNull(comShopFlowerEvaluateVO)) { orderVo.setComShopFlowerEvaluateVO(comShopFlowerEvaluateVO); } // } } }); } return R.ok(orderPageVOIPage); @@ -384,11 +386,23 @@ * @return 订单详情 */ @Override public R orderDetail(Long orderId) { public R orderDetail(Long orderId, String phone) { ComShopFlowerOrderPageVO orderVO = new ComShopFlowerOrderPageVO(); ComShopFlowerOrderDO shopOrderDO = null; if (StrUtil.isEmpty(phone)) { // 查询订单信息 ComShopFlowerOrderDO shopOrderDO = this.baseMapper.selectById(orderId); shopOrderDO = this.baseMapper.selectById(orderId); } else { //查询自提点信息 ConvenientElevatingPointDO convenientElevatingPointDO = convenientElevatingPointDAO.selectOne(new LambdaQueryWrapper<ConvenientElevatingPointDO>().eq(ConvenientElevatingPointDO::getWechatAccount, phone)); if (isNull(convenientElevatingPointDO)) { return R.fail("自提点不存在"); } Long pointDOId = convenientElevatingPointDO.getId(); shopOrderDO = this.baseMapper.selectOne(new LambdaQueryWrapper<ComShopFlowerOrderDO>().eq(ComShopFlowerOrderDO::getId, orderId).eq(ComShopFlowerOrderDO::getPointId, pointDOId)); } if (shopOrderDO == null) { return R.fail("未查询到订单"); } @@ -464,17 +478,22 @@ BeanUtils.copyProperties(convenientElevatingPointDO, convenientElevatingPointVO); orderVO.setConvenientElevatingPointVO(convenientElevatingPointVO); } //已完成、已退款才有评论 TODO // if (ComShopFlowerOrderDO.status.ywc == shopOrderDO.getStatus() || ComShopFlowerOrderDO.status.ytk == shopOrderDO.getStatus()) { //已完成、已退款才有评论 if (ComShopFlowerOrderDO.status.ywc == shopOrderDO.getStatus() || ComShopFlowerOrderDO.status.ytk == shopOrderDO.getStatus()) { ComShopFlowerEvaluateVO comShopFlowerEvaluateVO = comShopFlowerEvaluateDAO.selectByOrderNo(shopOrderDO.getOrderNo()); if (nonNull(comShopFlowerEvaluateVO)) { orderVO.setComShopFlowerEvaluateVO(comShopFlowerEvaluateVO); } // } } //设置退款金额 ComShopFlowerRefundOrderDO comShopFlowerRefundOrderDO = comShopFlowerRefundOrderDAO.selectOne(new LambdaQueryWrapper<ComShopFlowerRefundOrderDO>().eq(ComShopFlowerRefundOrderDO::getOrderId, shopOrderDO.getOrderNo())); if (nonNull(comShopFlowerRefundOrderDO)){ orderVO.setRefundAmount(comShopFlowerRefundOrderDO.getRefundAmount()); } //如果状态时取消状态,更新时间为去取消时间 if (shopOrderDO.getStatus() == ComShopFlowerOrderDO.status.yqx) { orderVO.setCancelTime(shopOrderDO.getUpdateAt()); } return R.ok(orderVO); @@ -494,9 +513,7 @@ if (shopOrderDO == null) { return R.fail("未查询到订单"); } if (!shopOrderDO.getStatus().equals(ComShopFlowerOrderDO.status.ddps)) { return R.fail("已配送订单不可取消"); } if (shopOrderDO.getStatus().equals(ComShopFlowerOrderDO.status.ddps)||shopOrderDO.getStatus().equals(ComShopFlowerOrderDO.status.dfh)) { // 取消订单 shopOrderDO.setStatus(ComShopFlowerOrderDO.status.yqx); //退款 @@ -557,6 +574,10 @@ } else { return R.fail("取消订单失败"); } }else { return R.fail("该订单不可取消"); } } @@ -641,7 +662,7 @@ if (comShopOrderDO == null) { return R.fail("订单不存在"); } if (!(comShopOrderDO.getStatus() == 1) || !(comShopOrderDO.getDeliveryStatus() == 1)) { if (!(comShopOrderDO.getStatus() == ComShopFlowerOrderDO.status.dfh) || (comShopOrderDO.getDeliveryStatus() == ComShopFlowerOrderDO.deliveryStatus.yes)) { return R.fail("订单发货失败,订单状态不允许发货"); } @@ -662,13 +683,9 @@ orderOperateDO.setOrderNo(comShopOrderDO.getOrderNo()); orderOperateDO.setOperationType(ComShopFlowerOrderOperateDO.operationType.deliver); orderOperateDO.setOperationTime(new Date()); if (orderShipDTO.getIsAdmin()) { orderOperateDO.setOperationContent(orderShipDTO.getOperUserAccount() + "已发货"); orderOperateDO.setOperationBy(orderShipDTO.getOperUserAccount()); } else { orderOperateDO.setOperationContent(orderShipDTO.getOperUserAccount() + "已发货"); orderOperateDO.setOperationBy(orderShipDTO.getOperUserAccount()); } int inserted = comShopFlowerOrderOperateDAO.insert(orderOperateDO); if (inserted != 1) { log.error("订单发货日志保存错误"); @@ -922,8 +939,8 @@ @Override public R selectCountByDeliveryType(Integer deliveryType, Long userId) { //1.等待配送 2.配送中 3.待收货 4.待评价 5.已完成 6.已取消 7.已退款 8.总订单 String[] statusStr = {"ddps", "psz", "dsh", "dpj", "ywc", "yqx", "ytk"}; //1.等待配送 2.配送中 3.待收货 4.待评价 5.已完成 6.已取消 7.已退款 8.待发货 String[] statusStr = {"ddps", "psz", "dsh", "dpj", "ywc", "yqx", "ytk", "dfh"}; ConvenientMerchantVO convenientMerchantVO = convenientMerchantDAO.selectMerchantByUserId(userId); List<ComShopOrderCountVO> comShopOrderCountVOS = this.baseMapper.selectCountByDeliveryType(deliveryType, convenientMerchantVO.getId()); Map<Integer, Integer> collect = comShopOrderCountVOS.stream().collect(Collectors.toMap(ComShopOrderCountVO::getStatus, ComShopOrderCountVO::getAmount)); springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientElevatingPointServiceImpl.java
@@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; import static java.util.Objects.isNull; import static java.util.Objects.nonNull; @@ -67,6 +68,10 @@ @Override @Transactional(rollbackFor = Exception.class) public R addPoint(ConvenientElevatingPointDTO convenientElevatingPointDTO) { ConvenientElevatingPointDO convenientElevatingPointDODB = this.baseMapper.selectOne(new LambdaQueryWrapper<ConvenientElevatingPointDO>().eq(ConvenientElevatingPointDO::getWechatAccount, convenientElevatingPointDTO.getWechatAccount())); if (!Objects.isNull(convenientElevatingPointDODB)){ return R.fail("该微信手机号已使用,请更换"); } ConvenientElevatingPointDO convenientElevatingPointDO = new ConvenientElevatingPointDO(); BeanUtils.copyProperties(convenientElevatingPointDTO, convenientElevatingPointDO); String communityId = convenientElevatingPointDTO.getCommunityId(); @@ -89,11 +94,16 @@ @Override @Transactional(rollbackFor = Exception.class) public R putPoint(ConvenientElevatingPointDTO convenientElevatingPointDTO) { ConvenientElevatingPointDO convenientElevatingPointDODB = this.baseMapper.selectOne(new LambdaQueryWrapper<ConvenientElevatingPointDO>().eq(ConvenientElevatingPointDO::getWechatAccount, convenientElevatingPointDTO.getWechatAccount())); Long id = convenientElevatingPointDTO.getId(); ConvenientElevatingPointDO convenientElevatingPointDO = this.baseMapper.selectById(id); if (isNull(convenientElevatingPointDO)) { return R.fail("自提点不存在"); } if (nonNull(convenientElevatingPointDODB) && !convenientElevatingPointDODB.getId().equals(convenientElevatingPointDO.getId())) { R.fail("该微信手机号:" + convenientElevatingPointDTO.getWechatAccount() + "已被使用!请更换"); } String communityId = convenientElevatingPointDTO.getCommunityId(); if (nonNull(communityId)) { ComActDO comActDO = comActDAO.selectById(Long.parseLong(communityId.substring(communityId.lastIndexOf(",") + 1))); springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComShopFlowerGoodsMapper.xml
@@ -49,6 +49,9 @@ <if test='pageComShopFlowerGoodsDTO.status != null'> and c.status like concat('%',#{pageComShopFlowerGoodsDTO.status},'%') </if> <if test='pageComShopFlowerGoodsDTO.userId != null'> and ccm.user_id = #{pageComShopFlowerGoodsDTO.userId} </if> order by c.create_at desc </select> @@ -60,8 +63,9 @@ </select> <select id="pageShopGoodByApps" resultType="com.panzhihua.common.model.vos.shop.ComShopFlowerGoodsVO"> select csg.id,csg.`name`,csg.store_id,csg.goods_pic,csg.images,csg.`status`,csg.sale,csg.original_price ,csg.price,csg.unit,csg.`order`,csg.stock,csg.details,csg.delivery_type, csg.create_at, (SELECT count(fog.id) FROM com_shop_flower_order_goods as fog WHERE fog.goods_id = 1) as order_num ,csg.price,csg.unit,csg.`order`,csg.details,csg.delivery_type, csg.create_at, (SELECT count(fog.id) FROM com_shop_flower_order_goods as fog WHERE fog.goods_id = csg.id) as order_num, (SELECT ifnull(sum(ga.stock),0) from com_shop_flower_goods_attr ga where ga.goods_id = csg.id ) as stock from com_shop_flower_goods as csg left join com_convenient_merchants as css on css.id = csg.store_id left join com_convenient_goods_scope as cgs on cgs.goods_id = csg.id @@ -81,4 +85,10 @@ </select> <select id="countSaleByUserId" resultType="com.panzhihua.common.model.vos.shop.ComShopOrderStoreIdCountVO"> SELECT count(1) AS count_num, 'sale' AS count_name FROM com_shop_flower_goods g LEFT JOIN com_convenient_merchants m on g.store_id = m.id WHERE g.delete_status = 1 and m.user_id = #{userId} and g.`status` = 1 union all SELECT count(1) AS count_num, 'noSale' AS count_name FROM com_shop_flower_goods g LEFT JOIN com_convenient_merchants m on g.store_id = m.id WHERE g.delete_status = 1 and m.user_id = #{userId} and g.`status` = 2 </select> </mapper>