新增门店核销与充值功能完善等

This commit is contained in:
hupeng
2020-03-06 11:36:27 +08:00
parent e44cde1bff
commit 4739c5ea01
32 changed files with 749 additions and 89 deletions

View File

@ -1 +1 @@
nohup java -jar yshop-api-1.9.jar --spring.profiles.active=prod &
nohup java -jar yshop-api-2.0.jar --spring.profiles.active=prod &

View File

@ -1,4 +1,4 @@
PID=$(ps -ef | grep yshop-api-1.9.jar | grep -v grep | awk '{ print $2 }')
PID=$(ps -ef | grep yshop-api-2.0.jar | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ];then
echo Application is already stopped
else

View File

@ -273,7 +273,7 @@ public class StoreBargainController extends BaseController {
return ApiResult.fail("未配置h5地址");
}
String apiUrl = systemConfigService.getData("api_url");
if(StrUtil.isEmpty(siteUrl)){
if(StrUtil.isEmpty(apiUrl)){
return ApiResult.fail("未配置api地址");
}
int uid = SecurityUtils.getUserId().intValue();

View File

@ -48,11 +48,9 @@ import co.yixiang.modules.shop.entity.YxStoreCart;
import co.yixiang.modules.shop.entity.YxStoreCouponUser;
import co.yixiang.modules.shop.mapper.YxStoreCartMapper;
import co.yixiang.modules.shop.mapper.YxStoreCouponUserMapper;
import co.yixiang.modules.shop.service.YxStoreCouponUserService;
import co.yixiang.modules.shop.service.YxStoreProductReplyService;
import co.yixiang.modules.shop.service.YxStoreProductService;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.modules.shop.service.*;
import co.yixiang.modules.shop.web.vo.YxStoreCartQueryVo;
import co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo;
import co.yixiang.modules.user.entity.YxUser;
import co.yixiang.modules.user.entity.YxUserBill;
import co.yixiang.modules.user.entity.YxWechatUser;
@ -148,6 +146,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
private YxExpressService expressService;
@Autowired
private AlipayService alipayService;
@Autowired
private YxSystemStoreService systemStoreService;
@Autowired
private OrderMap orderMap;
@ -872,8 +872,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
statusDTO.set_type("-2");
statusDTO.set_title("已退款");
}else if(order.getStatus() == 0){
//todo 拼团
//todo 店铺核销
// 拼团
if(order.getPinkId() > 0){
if(pinkService.pinkIngCount(order.getPinkId()) > 0){
statusDTO.set_class("state-nfh");
@ -887,10 +886,17 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
statusDTO.set_title("未发货");
}
}else{
statusDTO.set_class("state-nfh");
statusDTO.set_msg("商家未发货,请耐心等待");
statusDTO.set_type("1");
statusDTO.set_title("未发货");
if(OrderInfoEnum.SHIPPIING_TYPE_1.getValue().equals(order.getShippingType())){
statusDTO.set_class("state-nfh");
statusDTO.set_msg("商家未发货,请耐心等待");
statusDTO.set_type("1");
statusDTO.set_title("未发货");
}else{
statusDTO.set_class("state-nfh");
statusDTO.set_msg("待核销,请到核销点进行核销");
statusDTO.set_type("1");
statusDTO.set_title("待核销");
}
}
}else if(order.getStatus() == 1){
@ -1136,10 +1142,21 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
Double payPostage = cacheDTO.getPriceGroup().getStorePostage();
OtherDTO other = cacheDTO.getOther();
YxUserAddressQueryVo userAddress = null;
if(param.getShippingType() == 1){
if(OrderInfoEnum.SHIPPIING_TYPE_1.getValue().equals(param.getShippingType())){
if(StrUtil.isEmpty(param.getAddressId())) throw new ErrorRequestException("请选择收货地址");
userAddress = userAddressService.getYxUserAddressById(param.getAddressId());
if(ObjectUtil.isNull(userAddress)) throw new ErrorRequestException("地址选择有误");
}else{ //门店
if(StrUtil.isBlank(param.getRealName()) || StrUtil.isBlank(param.getPhone())) {
throw new ErrorRequestException("请填写姓名和电话");
}
userAddress = new YxUserAddressQueryVo();
userAddress.setRealName(param.getRealName());
userAddress.setPhone(param.getPhone());
userAddress.setProvince("");
userAddress.setCity("");
userAddress.setDistrict("");
userAddress.setDetail("");
}
Integer totalNum = 0;
@ -1168,10 +1185,12 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
}
//todo 门店等二期
//门店
if(param.getShippingType() == 1){
if(OrderInfoEnum.SHIPPIING_TYPE_1.getValue().equals(param.getShippingType())){
payPrice = NumberUtil.add(payPrice,payPostage);
}else{
payPostage = 0d;
}
//优惠券
@ -1281,6 +1300,13 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
storeOrder.setAddTime(OrderUtil.getSecondTimestampTwo());
storeOrder.setUnique(key);
storeOrder.setShippingType(param.getShippingType());
//处理门店
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().equals(param.getShippingType())){
YxSystemStoreQueryVo systemStoreQueryVo = systemStoreService.getStoreInfo();
if(systemStoreQueryVo == null ) throw new ErrorRequestException("暂无门店无法选择门店自提");
storeOrder.setVerifyCode(StrUtil.sub(orderSn,orderSn.length(),-12));
storeOrder.setStoreId(systemStoreQueryVo.getId());
}
boolean res = save(storeOrder);
if(!res) throw new ErrorRequestException("订单生成失败");
@ -1352,8 +1378,11 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
Double payPrice = cacheDTO.getPriceGroup().getTotalPrice();
Double payPostage = cacheDTO.getPriceGroup().getStorePostage();
//1-配送 2-到店
if(shippingType == 1){
payPrice = NumberUtil.add(payPrice,payPostage);
}else{
payPostage = 0d;
}
boolean deduction = false;//拼团秒杀砍价等

View File

@ -8,18 +8,23 @@
*/
package co.yixiang.modules.order.web.controller;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import co.yixiang.aop.log.Log;
import co.yixiang.common.api.ApiResult;
import co.yixiang.common.web.controller.BaseController;
import co.yixiang.enums.AppFromEnum;
import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.exception.BadRequestException;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.express.ExpressService;
import co.yixiang.express.dao.ExpressInfo;
import co.yixiang.modules.activity.entity.YxStoreBargainUser;
import co.yixiang.modules.activity.service.YxStoreBargainUserService;
import co.yixiang.modules.activity.service.YxStorePinkService;
import co.yixiang.modules.activity.web.vo.YxStorePinkQueryVo;
import co.yixiang.modules.order.entity.YxStoreOrder;
import co.yixiang.modules.order.entity.YxStoreOrderCartInfo;
import co.yixiang.modules.order.service.YxStoreOrderCartInfoService;
@ -29,17 +34,18 @@ import co.yixiang.modules.order.web.dto.*;
import co.yixiang.modules.order.web.param.*;
import co.yixiang.modules.order.web.vo.YxStoreOrderQueryVo;
import co.yixiang.modules.shop.entity.YxStoreProductReply;
import co.yixiang.modules.shop.service.YxStoreCartService;
import co.yixiang.modules.shop.service.YxStoreCouponUserService;
import co.yixiang.modules.shop.service.YxStoreProductReplyService;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.modules.shop.service.*;
import co.yixiang.modules.shop.web.vo.YxStoreCartQueryVo;
import co.yixiang.modules.user.entity.YxSystemAttachment;
import co.yixiang.modules.user.service.YxSystemAttachmentService;
import co.yixiang.modules.user.service.YxUserAddressService;
import co.yixiang.modules.user.service.YxUserService;
import co.yixiang.utils.OrderUtil;
import co.yixiang.utils.RedisUtil;
import co.yixiang.utils.SecurityUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
import com.github.binarywang.wxpay.bean.order.WxPayMwebOrderResult;
import com.github.binarywang.wxpay.exception.WxPayException;
@ -48,9 +54,11 @@ import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.io.File;
import java.util.*;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@ -81,9 +89,14 @@ public class StoreOrderController extends BaseController {
private final YxStorePinkService storePinkService;
private final ExpressService expressService;
private final YxStoreBargainUserService storeBargainUserService;
private final YxSystemStoreService systemStoreService;
private final YxSystemAttachmentService systemAttachmentService;
private static Lock lock = new ReentrantLock(false);
@Value("${file.path}")
private String path;
/**
* 订单确认
@ -158,6 +171,9 @@ public class StoreOrderController extends BaseController {
confirmOrderDTO.setUserInfo(userService.getYxUserById(uid));
//门店
confirmOrderDTO.setSystemStore(systemStoreService.getStoreInfo());
return ApiResult.ok(confirmOrderDTO);
}
@ -413,7 +429,34 @@ public class StoreOrderController extends BaseController {
if(ObjectUtil.isNull(storeOrder)){
return ApiResult.fail("订单不存在");
}
//todo 门店核销
String mapKey = RedisUtil.get("tengxun_map_key");
if(StrUtil.isBlank(mapKey)) return ApiResult.fail("请配置腾讯地图key");
//门店
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().equals(storeOrder.getShippingType())){
String apiUrl = systemConfigService.getData("api_url");
if(StrUtil.isEmpty(apiUrl)){
return ApiResult.fail("未配置api地址");
}
//生成二维码
String name = storeOrder.getVerifyCode()+"_yshop.jpg";
YxSystemAttachment attachment = systemAttachmentService.getInfo(name);
String fileDir = path+"qrcode"+ File.separator;
String qrcodeUrl = "";
if(ObjectUtil.isNull(attachment)){
//生成二维码
File file = FileUtil.mkdir(new File(fileDir));
QrCodeUtil.generate(storeOrder.getVerifyCode(), 180, 180,
FileUtil.file(fileDir+name));
systemAttachmentService.attachmentAdd(name,String.valueOf(FileUtil.size(file)),
fileDir+name,"qrcode/"+name);
qrcodeUrl = apiUrl + "/api/file/qrcode/"+name;
}else{
qrcodeUrl = apiUrl + "/api/file/" + attachment.getSattDir();
}
storeOrder.setCode(qrcodeUrl);
storeOrder.setMapKey(mapKey);
storeOrder.setSystemStore(systemStoreService.getStoreInfo());
}
return ApiResult.ok(storeOrderService.handleOrder(storeOrder));
}
@ -609,7 +652,7 @@ public class StoreOrderController extends BaseController {
ArrayList<String> list = new ArrayList<>();
list.add("收货地址填错了");
list.add("与描述不符");
list.add("息填错,重新拍\\");
list.add("信息填错,重新拍");
list.add("收到商品损坏了");
list.add("未按预定时间发货");
list.add("其它原因");
@ -659,6 +702,40 @@ public class StoreOrderController extends BaseController {
return ApiResult.ok(expressInfo);
}
/**
* 订单核销
*/
@PostMapping("/order/order_verific")
@ApiOperation(value = "订单核销",notes = "订单核销")
public ApiResult<Object> orderVerify( @RequestBody OrderVerifyParam param){
YxStoreOrder storeOrder = new YxStoreOrder();
storeOrder.setVerifyCode(param.getVerifyCode());
storeOrder.setIsDel(OrderInfoEnum.CANCEL_STATUS_0.getValue());
storeOrder.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue());
storeOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue());
YxStoreOrder order = storeOrderService.getOne(Wrappers.query(storeOrder));
if(order == null) return ApiResult.fail("核销的订单不存在或未支付或已退款");
if(order.getStatus() > 0) return ApiResult.fail("订单已经核销");
if(order.getCombinationId() > 0 && order.getPinkId() > 0){
YxStorePinkQueryVo storePink = storePinkService.getYxStorePinkById(order.getPinkId());
if(!OrderInfoEnum.PINK_STATUS_2.getValue().equals(storePink.getStatus())){
return ApiResult.fail("拼团订单暂未成功无法核销");
}
}
if(OrderInfoEnum.CONFIRM_STATUS_0.getValue().equals(param.getIsConfirm())){
return ApiResult.ok(order);
}
order.setStatus(OrderInfoEnum.STATUS_2.getValue());
storeOrderService.updateById(order);
return ApiResult.ok("核销成功");
}
}

View File

@ -2,6 +2,7 @@ package co.yixiang.modules.order.web.dto;
import co.yixiang.modules.shop.entity.YxStoreCouponUser;
import co.yixiang.modules.shop.web.vo.YxStoreCartQueryVo;
import co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo;
import co.yixiang.modules.user.entity.YxUserAddress;
import co.yixiang.modules.user.web.vo.YxUserQueryVo;
import lombok.Data;
@ -46,7 +47,8 @@ public class ConfirmOrderDTO implements Serializable {
private Integer storeSelfMention = 1;
//店铺信息
private List systemStore;
private YxSystemStoreQueryVo systemStore;
private YxStoreCouponUser usableCoupon;

View File

@ -0,0 +1,20 @@
package co.yixiang.modules.order.web.param;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @ClassName OrderVerifyParam
* @Author hupeng <610796224@qq.com>
* @Date 2020/03/05
**/
@Data
public class OrderVerifyParam implements Serializable {
private Integer isConfirm;
@NotBlank(message = "缺少核销码")
private String verifyCode;
}

View File

@ -2,6 +2,7 @@ package co.yixiang.modules.order.web.vo;
import co.yixiang.modules.order.web.dto.StatusDTO;
import co.yixiang.modules.shop.web.vo.YxStoreCartQueryVo;
import co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -182,4 +183,10 @@ public class YxStoreOrderQueryVo implements Serializable {
private Integer isSystemDel;
private String code;
private String mapKey;
private YxSystemStoreQueryVo systemStore;
}

View File

@ -0,0 +1,81 @@
package co.yixiang.modules.shop.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import co.yixiang.common.entity.BaseEntity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* <p>
* 门店自提
* </p>
*
* @author hupeng
* @since 2020-03-04
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "YxSystemStore对象", description = "门店自提")
public class YxSystemStore extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "门店名称")
private String name;
@ApiModelProperty(value = "简介")
private String introduction;
@ApiModelProperty(value = "手机号码")
private String phone;
@ApiModelProperty(value = "省市区")
private String address;
@ApiModelProperty(value = "详细地址")
private String detailedAddress;
@ApiModelProperty(value = "门店logo")
private String image;
@ApiModelProperty(value = "纬度")
private String latitude;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "核销有效日期")
private String validTime;
@ApiModelProperty(value = "每日营业开关时间")
private String dayTime;
@ApiModelProperty(value = "添加时间")
private Integer addTime;
@ApiModelProperty(value = "是否显示")
private Integer isShow;
@ApiModelProperty(value = "是否删除")
private Integer isDel;
private Date dayTimeEnd;
private Date dayTimeStart;
private Date validTimeEnd;
private Date validTimeStart;
}

View File

@ -0,0 +1,40 @@
package co.yixiang.modules.shop.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import co.yixiang.modules.shop.entity.YxSystemStore;
import co.yixiang.modules.shop.web.param.YxSystemStoreQueryParam;
import co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.io.Serializable;
/**
* <p>
* 门店自提 Mapper 接口
* </p>
*
* @author hupeng
* @since 2020-03-04
*/
@Repository
public interface YxSystemStoreMapper extends BaseMapper<YxSystemStore> {
/**
* 根据ID获取查询对象
* @param id
* @return
*/
YxSystemStoreQueryVo getYxSystemStoreById(Serializable id);
/**
* 获取分页对象
* @param page
* @param yxSystemStoreQueryParam
* @return
*/
IPage<YxSystemStoreQueryVo> getYxSystemStorePageList(@Param("page") Page page, @Param("param") YxSystemStoreQueryParam yxSystemStoreQueryParam);
}

View File

@ -0,0 +1,17 @@
package co.yixiang.modules.shop.mapping;
import co.yixiang.mapper.EntityMapper;
import co.yixiang.modules.shop.entity.YxSystemStore;
import co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author hupeng
* @date 2020-03-04
*/
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SystemStoreMap extends EntityMapper<YxSystemStoreQueryVo, YxSystemStore> {
}

View File

@ -0,0 +1,37 @@
package co.yixiang.modules.shop.service;
import co.yixiang.modules.shop.entity.YxSystemStore;
import co.yixiang.common.service.BaseService;
import co.yixiang.modules.shop.web.param.YxSystemStoreQueryParam;
import co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo;
import co.yixiang.common.web.vo.Paging;
import java.io.Serializable;
/**
* <p>
* 门店自提 服务类
* </p>
*
* @author hupeng
* @since 2020-03-04
*/
public interface YxSystemStoreService extends BaseService<YxSystemStore> {
YxSystemStoreQueryVo getStoreInfo();
/**
* 根据ID获取查询对象
* @param id
* @return
*/
YxSystemStoreQueryVo getYxSystemStoreById(Serializable id) throws Exception;
/**
* 获取分页对象
* @param yxSystemStoreQueryParam
* @return
*/
Paging<YxSystemStoreQueryVo> getYxSystemStorePageList(YxSystemStoreQueryParam yxSystemStoreQueryParam) throws Exception;
}

View File

@ -18,15 +18,13 @@ import co.yixiang.modules.shop.entity.YxStoreProductAttrValue;
import co.yixiang.modules.shop.mapper.YxStoreProductAttrValueMapper;
import co.yixiang.modules.shop.mapper.YxStoreProductMapper;
import co.yixiang.modules.shop.mapping.YxStoreProductMap;
import co.yixiang.modules.shop.service.YxStoreProductAttrService;
import co.yixiang.modules.shop.service.YxStoreProductRelationService;
import co.yixiang.modules.shop.service.YxStoreProductReplyService;
import co.yixiang.modules.shop.service.YxStoreProductService;
import co.yixiang.modules.shop.service.*;
import co.yixiang.modules.shop.web.dto.ProductDTO;
import co.yixiang.modules.shop.web.param.YxStoreProductQueryParam;
import co.yixiang.modules.shop.web.vo.YxStoreProductAttrQueryVo;
import co.yixiang.modules.shop.web.vo.YxStoreProductQueryVo;
import co.yixiang.modules.user.service.YxUserService;
import co.yixiang.utils.RedisUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
@ -63,6 +61,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<YxStoreProductMap
private final YxStoreProductRelationService relationService;
private final YxStoreProductReplyService replyService;
private final YxUserService userService;
private final YxSystemStoreService systemStoreService;
private final YxStoreProductMap storeProductMap;
@ -147,6 +146,10 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<YxStoreProductMap
productDTO.setReplyCount(replyCount);
productDTO.setReplyChance(replyService.doReply(id,replyCount));//百分比
//门店
productDTO.setSystemStore(systemStoreService.getStoreInfo());
productDTO.setMapKey(RedisUtil.get("store_self_mention"));
return productDTO;
}

View File

@ -0,0 +1,66 @@
package co.yixiang.modules.shop.service.impl;
import co.yixiang.modules.shop.entity.YxSystemStore;
import co.yixiang.modules.shop.mapper.YxSystemStoreMapper;
import co.yixiang.modules.shop.mapping.SystemStoreMap;
import co.yixiang.modules.shop.service.YxSystemStoreService;
import co.yixiang.modules.shop.web.param.YxSystemStoreQueryParam;
import co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.utils.RedisUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.io.Serializable;
/**
* <p>
* 门店自提 服务实现类
* </p>
*
* @author hupeng
* @since 2020-03-04
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class YxSystemStoreServiceImpl extends BaseServiceImpl<YxSystemStoreMapper, YxSystemStore> implements YxSystemStoreService {
@Autowired
private YxSystemStoreMapper yxSystemStoreMapper;
@Autowired
private SystemStoreMap storeMap;
@Override
public YxSystemStoreQueryVo getStoreInfo() {
YxSystemStore systemStore = new YxSystemStore();
systemStore.setIsDel(0);
YxSystemStore yxSystemStore = yxSystemStoreMapper.selectOne(Wrappers.query(systemStore));
if(yxSystemStore == null) return null;
String mention = RedisUtil.get("store_self_mention");
if(mention == null || Integer.valueOf(mention) == 2) return null;
return storeMap.toDto(yxSystemStore);
}
@Override
public YxSystemStoreQueryVo getYxSystemStoreById(Serializable id) throws Exception{
return yxSystemStoreMapper.getYxSystemStoreById(id);
}
@Override
public Paging<YxSystemStoreQueryVo> getYxSystemStorePageList(YxSystemStoreQueryParam yxSystemStoreQueryParam) throws Exception{
Page page = setPageParam(yxSystemStoreQueryParam,OrderItem.desc("create_time"));
IPage<YxSystemStoreQueryVo> iPage = yxSystemStoreMapper.getYxSystemStorePageList(page,yxSystemStoreQueryParam);
return new Paging(iPage);
}
}

View File

@ -0,0 +1,91 @@
package co.yixiang.modules.shop.web.controller;
import co.yixiang.modules.shop.entity.YxSystemStore;
import co.yixiang.modules.shop.service.YxSystemStoreService;
import co.yixiang.modules.shop.web.param.YxSystemStoreQueryParam;
import co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo;
import co.yixiang.common.web.controller.BaseController;
import co.yixiang.common.api.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.common.web.param.IdParam;
/**
* <p>
* 门店自提 前端控制器
* </p>
*
* @author hupeng
* @since 2020-03-04
*/
@Slf4j
@RestController
@RequestMapping("/yxSystemStore")
@Api("门店自提 API")
public class YxSystemStoreController extends BaseController {
@Autowired
private YxSystemStoreService yxSystemStoreService;
/**
* 添加门店自提
*/
@PostMapping("/add")
@ApiOperation(value = "添加YxSystemStore对象",notes = "添加门店自提",response = ApiResult.class)
public ApiResult<Boolean> addYxSystemStore(@Valid @RequestBody YxSystemStore yxSystemStore) throws Exception{
boolean flag = yxSystemStoreService.save(yxSystemStore);
return ApiResult.result(flag);
}
/**
* 修改门店自提
*/
@PostMapping("/update")
@ApiOperation(value = "修改YxSystemStore对象",notes = "修改门店自提",response = ApiResult.class)
public ApiResult<Boolean> updateYxSystemStore(@Valid @RequestBody YxSystemStore yxSystemStore) throws Exception{
boolean flag = yxSystemStoreService.updateById(yxSystemStore);
return ApiResult.result(flag);
}
/**
* 删除门店自提
*/
@PostMapping("/delete")
@ApiOperation(value = "删除YxSystemStore对象",notes = "删除门店自提",response = ApiResult.class)
public ApiResult<Boolean> deleteYxSystemStore(@Valid @RequestBody IdParam idParam) throws Exception{
boolean flag = yxSystemStoreService.removeById(idParam.getId());
return ApiResult.result(flag);
}
/**
* 获取门店自提
*/
@PostMapping("/info")
@ApiOperation(value = "获取YxSystemStore对象详情",notes = "查看门店自提",response = YxSystemStoreQueryVo.class)
public ApiResult<YxSystemStoreQueryVo> getYxSystemStore(@Valid @RequestBody IdParam idParam) throws Exception{
YxSystemStoreQueryVo yxSystemStoreQueryVo = yxSystemStoreService.getYxSystemStoreById(idParam.getId());
return ApiResult.ok(yxSystemStoreQueryVo);
}
/**
* 门店自提分页列表
*/
@PostMapping("/getPageList")
@ApiOperation(value = "获取YxSystemStore分页列表",notes = "门店自提分页列表",response = YxSystemStoreQueryVo.class)
public ApiResult<Paging<YxSystemStoreQueryVo>> getYxSystemStorePageList(@Valid @RequestBody(required = false) YxSystemStoreQueryParam yxSystemStoreQueryParam) throws Exception{
Paging<YxSystemStoreQueryVo> paging = yxSystemStoreService.getYxSystemStorePageList(yxSystemStoreQueryParam);
return ApiResult.ok(paging);
}
}

View File

@ -5,6 +5,7 @@ import co.yixiang.modules.shop.entity.YxStoreProductAttrValue;
import co.yixiang.modules.shop.web.vo.YxStoreProductAttrQueryVo;
import co.yixiang.modules.shop.web.vo.YxStoreProductQueryVo;
import co.yixiang.modules.shop.web.vo.YxStoreProductReplyQueryVo;
import co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -30,8 +31,6 @@ public class ProductDTO extends QueryParam {
//todo
private List<YxStoreProductQueryVo> goodList = new ArrayList();
//todo
private String mapKay = "";
//todo
private Integer merId = 0;
@ -53,8 +52,10 @@ public class ProductDTO extends QueryParam {
private YxStoreProductQueryVo storeInfo;
//todo
private Map system_store = new LinkedHashMap<>();
private String mapKey;
//门店
private YxSystemStoreQueryVo systemStore;
private Integer uid = 0;

View File

@ -0,0 +1,22 @@
package co.yixiang.modules.shop.web.param;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import co.yixiang.common.web.param.QueryParam;
/**
* <p>
* 门店自提 查询参数对象
* </p>
*
* @author hupeng
* @date 2020-03-04
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="YxSystemStoreQueryParam对象", description="门店自提查询参数")
public class YxSystemStoreQueryParam extends QueryParam {
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,73 @@
package co.yixiang.modules.shop.web.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 门店自提 查询结果对象
* </p>
*
* @author hupeng
* @date 2020-03-04
*/
@Data
@ApiModel(value = "YxSystemStoreQueryVo对象", description = "门店自提查询参数")
public class YxSystemStoreQueryVo implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
@ApiModelProperty(value = "门店名称")
private String name;
@ApiModelProperty(value = "简介")
private String introduction;
@ApiModelProperty(value = "手机号码")
private String phone;
@ApiModelProperty(value = "省市区")
private String address;
@ApiModelProperty(value = "详细地址")
private String detailedAddress;
@ApiModelProperty(value = "门店logo")
private String image;
@ApiModelProperty(value = "纬度")
private String latitude;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "核销有效日期")
private String validTime;
private String latlng;
public String getLatlng(){
return latitude+","+longitude;
}
@ApiModelProperty(value = "每日营业开关时间")
private String dayTime;
@ApiModelProperty(value = "添加时间")
private Integer addTime;
private Date dayTimeEnd;
private Date dayTimeStart;
private Date validTimeEnd;
private Date validTimeStart;
}

View File

@ -9,12 +9,11 @@
package co.yixiang.modules.user.service.impl;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.enums.AppFromEnum;
import co.yixiang.enums.BillEnum;
import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.enums.PayTypeEnum;
import co.yixiang.enums.*;
import co.yixiang.modules.user.entity.YxUser;
import co.yixiang.modules.user.entity.YxUserBill;
import co.yixiang.modules.user.entity.YxUserRecharge;
@ -22,9 +21,12 @@ import co.yixiang.modules.user.mapper.YxUserMapper;
import co.yixiang.modules.user.mapper.YxUserRechargeMapper;
import co.yixiang.modules.user.service.YxUserBillService;
import co.yixiang.modules.user.service.YxUserRechargeService;
import co.yixiang.modules.user.service.YxWechatUserService;
import co.yixiang.modules.user.web.param.RechargeParam;
import co.yixiang.modules.user.web.param.YxUserRechargeQueryParam;
import co.yixiang.modules.user.web.vo.YxUserRechargeQueryVo;
import co.yixiang.modules.user.web.vo.YxWechatUserQueryVo;
import co.yixiang.mp.service.YxTemplateService;
import co.yixiang.utils.OrderUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
@ -32,6 +34,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -56,6 +59,8 @@ public class YxUserRechargeServiceImpl extends BaseServiceImpl<YxUserRechargeMap
private final YxUserRechargeMapper yxUserRechargeMapper;
private final YxUserBillService billService;
private final YxUserMapper yxUserMapper;
private final YxWechatUserService wechatUserService;
private final YxTemplateService templateService;
@Override
public void updateRecharge(YxUserRecharge userRecharge) {
@ -64,7 +69,6 @@ public class YxUserRechargeServiceImpl extends BaseServiceImpl<YxUserRechargeMap
//修改状态
userRecharge.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue());
userRecharge.setPayTime(OrderUtil.getSecondTimestampTwo());
userRecharge.setNickname(user.getNickname());
yxUserRechargeMapper.updateById(userRecharge);
//增加流水
@ -72,8 +76,8 @@ public class YxUserRechargeServiceImpl extends BaseServiceImpl<YxUserRechargeMap
userBill.setUid(userRecharge.getUid());
userBill.setTitle("用户余额充值");
userBill.setLinkId(userRecharge.getId().toString());
userBill.setCategory("now_money");
userBill.setType("recharge");
userBill.setCategory(BillDetailEnum.CATEGORY_1.getValue());
userBill.setType(BillDetailEnum.TYPE_1.getValue());
userBill.setNumber(userRecharge.getPrice());
userBill.setBalance(NumberUtil.add(userRecharge.getPrice(),user.getNowMoney()));
userBill.setMark("成功充值余额"+userRecharge.getPrice());
@ -85,6 +89,19 @@ public class YxUserRechargeServiceImpl extends BaseServiceImpl<YxUserRechargeMap
//update 余额
user.setNowMoney(NumberUtil.add(userRecharge.getPrice(),user.getNowMoney()));
yxUserMapper.updateById(user);
//模板消息推送
YxWechatUserQueryVo wechatUser = wechatUserService.getYxWechatUserById(userRecharge.getUid());
if(ObjectUtil.isNotNull(wechatUser)){
//公众号模板通知
if(StrUtil.isNotBlank(wechatUser.getOpenid())){
templateService.rechargeSuccessNotice(OrderUtil.stampToDate(userRecharge.getPayTime().toString()),
userRecharge.getPrice().toString(),wechatUser.getOpenid());
}else if(StrUtil.isNotBlank(wechatUser.getRoutineOpenid())){
//todo 小程序模板通知
}
}
}
@Override
@ -103,6 +120,9 @@ public class YxUserRechargeServiceImpl extends BaseServiceImpl<YxUserRechargeMap
public void addRecharge(RechargeParam param,int uid) {
YxUserRecharge yxUserRecharge = new YxUserRecharge();
YxUser user = yxUserMapper.selectById(uid);
yxUserRecharge.setNickname(user.getNickname());
yxUserRecharge.setOrderId(param.getOrderSn());
yxUserRecharge.setUid(uid);
yxUserRecharge.setPrice(BigDecimal.valueOf(param.getPrice()));

View File

@ -72,7 +72,6 @@ public class UserController extends BaseController {
public ApiResult<Object> userInfo(){
int uid = SecurityUtils.getUserId().intValue();
System.out.println("aa:"+uid);
//update count
yxUserService.setUserSpreadCount(uid);
return ApiResult.ok(yxUserService.getYxUserById(uid));

View File

@ -97,7 +97,7 @@ public class UserRechargeController extends BaseController {
"公众号充值", price,BillDetailEnum.TYPE_1.getValue());
Map<String,String> jsConfig = new HashMap<>();
jsConfig.put("appId",result.getAppId());
jsConfig.put("timeStamp",result.getTimeStamp());
jsConfig.put("timestamp",result.getTimeStamp());
jsConfig.put("nonceStr",result.getNonceStr());
jsConfig.put("package",result.getPackageValue());
jsConfig.put("signType",result.getSignType());

View File

@ -32,6 +32,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.bean.WxJsapiSignature;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
@ -87,42 +88,25 @@ public class WechatController extends BaseController {
@ApiOperation(value = "jssdk配置",notes = "jssdk配置")
public ApiResult<Object> jsConfig(@RequestParam(value = "url") String url) throws WxErrorException {
WxMpService wxService = WxMpConfiguration.getWxMpService();
return ApiResult.ok(wxService.createJsapiSignature(url));
WxJsapiSignature jsapiSignature = wxService.createJsapiSignature(url);
Map<String,Object> map = new LinkedHashMap<>();
map.put("appId",jsapiSignature.getAppId());
map.put("jsApiList",new String[]{"updateAppMessageShareData","openLocation","scanQRCode","chooseWXPay"});
map.put("nonceStr",jsapiSignature.getNonceStr());
map.put("signature",jsapiSignature.getSignature());
map.put("timestamp",jsapiSignature.getTimestamp());
map.put("url",jsapiSignature.getUrl());
return ApiResult.ok(map);
}
/**
* 微信支付回调
* 微信支付/充值回调
*/
@AnonymousAccess
@PostMapping("/wechat/notify")
@ApiOperation(value = "微信支付回调",notes = "微信支付回调")
public String notify(@RequestBody String xmlData) {
try {
WxPayService wxPayService = WxPayConfiguration.getPayService();
WxPayOrderNotifyResult notifyResult = wxPayService.parseOrderNotifyResult(xmlData);
String orderId = notifyResult.getOutTradeNo();
YxStoreOrderQueryVo orderInfo = orderService.getOrderInfo(orderId,0);
if(orderInfo.getPaid() == 1){
return WxPayNotifyResponse.success("处理成功!");
}
orderService.paySuccess(orderInfo.getOrderId(),"weixin");
return WxPayNotifyResponse.success("处理成功!");
} catch (WxPayException e) {
log.error(e.getMessage());
return WxPayNotifyResponse.fail(e.getMessage());
}
}
/**
* 微信支付充值回调
*/
@AnonymousAccess
@PostMapping("/wechat/renotify")
@ApiOperation(value = "微信支付充值回调",notes = "微信支付充值回调")
public String renotify(@RequestBody String xmlData) {
try {

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="co.yixiang.modules.shop.mapper.YxSystemStoreMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, name, introduction, phone, address, detailed_address, image, latitude, longitude, valid_time, day_time, add_time, is_show, is_del, day_time_end, day_time_start, valid_time_end, valid_time_start
</sql>
<select id="getYxSystemStoreById" resultType="co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo">
select <include refid="Base_Column_List"/> from yx_system_store where id = #{id}
</select>
<select id="getYxSystemStorePageList" resultType="co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo">
select <include refid="Base_Column_List"/> from yx_system_store
</select>
</mapper>

View File

@ -43,11 +43,11 @@ public class CodeGenerator {
// ############################ 配置部分 start ############################
// 模块名称
private static final String MODULE_NAME = "activity";
private static final String MODULE_NAME = "shop";
// 作者
private static final String AUTHOR = "hupeng";
// 生成的表名称
private static final String TABLE_NAME = "yx_store_bargain_user_help"; // 主键数据库列名称
private static final String TABLE_NAME = "yx_system_store"; // 主键数据库列名称
private static final String PK_ID_COLUMN_NAME = "id";
// 代码生成策略 trueAll/false:SIMPLE
private static final boolean GENERATOR_STRATEGY = true;

View File

@ -20,7 +20,7 @@ public enum OrderInfoEnum {
PAY_STATUS_0(0,"未支付"),
PAY_STATUS_1(1,"已支付"),
REFUND_STATUS_0(0,"未支付"),
REFUND_STATUS_0(0,"正常"),
REFUND_STATUS_1(1,"退款中"),
REFUND_STATUS_2(2,"已退款"),
@ -28,8 +28,19 @@ public enum OrderInfoEnum {
BARGAIN_STATUS_2(2,"参与失败"),
BARGAIN_STATUS_3(3,"参与成功"),
PINK_STATUS_1(1,"进行中"),
PINK_STATUS_2(2,"已完成"),
PINK_STATUS_3(3,"未完成"),
CANCEL_STATUS_0(0,"正常"),
CANCEL_STATUS_1(1,"已取消");
CANCEL_STATUS_1(1,"已取消"),
CONFIRM_STATUS_0(0,"正常"),
CONFIRM_STATUS_1(1,"确认"),
SHIPPIING_TYPE_1(1,"快递"),
SHIPPIING_TYPE_2(2,"门店自提");

View File

@ -18,12 +18,35 @@ public class YxTemplateService {
private final String PAY_SUCCESS_KEY = "OPENTM207791277"; //pay
private final String DELIVERY_SUCCESS_KEY = "OPENTM200565259"; //Delivery
private final String REFUND_SUCCESS_KEY = "OPENTM410119152"; //Refund
private final String RECHARGE_SUCCESS_KEY = "OPENTM405847076"; //Recharge
@Autowired
private YxWechatTemplateService templateService;
@Autowired
private WxMpTemplateMessageService templateMessageService;
/**
* 支付成功通知
* @param time
* @param price
* @param openid
*/
public void rechargeSuccessNotice(String time,String price,String openid){
String siteUrl = RedisUtil.get("site_url");
YxWechatTemplate WechatTemplate = templateService.findByTempkey(RECHARGE_SUCCESS_KEY);
Map<String,String> map = new HashMap<>();
map.put("first","您的账户金币发生变动,详情如下:");
map.put("keyword1","充值");
map.put("keyword2",time);
map.put("keyword3",price);
map.put("remark","yshop电商系统为你服务");
templateMessageService.sendWxMpTemplateMessage( openid
,WechatTemplate.getTempid(),
siteUrl+"/user/account",map);
}
/**
* 支付成功通知
* @param orderId

View File

@ -7,23 +7,24 @@ import cn.hutool.core.util.StrUtil;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.aop.log.Log;
import co.yixiang.constant.ShopConstants;
import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.exception.BadRequestException;
import co.yixiang.modules.activity.service.YxStorePinkService;
import co.yixiang.modules.activity.service.dto.YxStorePinkDTO;
import co.yixiang.modules.shop.domain.YxStoreOrder;
import co.yixiang.modules.shop.domain.YxStoreOrderStatus;
import co.yixiang.modules.shop.service.YxExpressService;
import co.yixiang.modules.shop.service.YxStoreOrderService;
import co.yixiang.modules.shop.service.YxStoreOrderStatusService;
import co.yixiang.modules.shop.service.YxWechatUserService;
import co.yixiang.modules.shop.service.dto.YxExpressDTO;
import co.yixiang.modules.shop.service.dto.YxStoreOrderDTO;
import co.yixiang.modules.shop.service.dto.YxStoreOrderQueryCriteria;
import co.yixiang.modules.shop.service.YxWechatUserService;
import co.yixiang.modules.shop.service.dto.YxWechatUserDTO;
import co.yixiang.mp.domain.YxWechatTemplate;
import co.yixiang.mp.service.WxMpTemplateMessageService;
import co.yixiang.mp.service.YxTemplateService;
import co.yixiang.mp.service.YxWechatTemplateService;
import co.yixiang.utils.OrderUtil;
import co.yixiang.utils.RedisUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -35,8 +36,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
@ -54,24 +53,21 @@ public class StoreOrderController {
private final YxStoreOrderStatusService yxStoreOrderStatusService;
private final YxExpressService yxExpressService;
private final YxWechatUserService wechatUserService;
private final WxMpTemplateMessageService templateMessageService;
private final YxWechatTemplateService yxWechatTemplateService;
private final RedisTemplate<String, String> redisTemplate;
private YxTemplateService templateService;
private final YxTemplateService templateService;
private final YxStorePinkService storePinkService;
public StoreOrderController(YxStoreOrderService yxStoreOrderService, YxStoreOrderStatusService yxStoreOrderStatusService,
YxExpressService yxExpressService, YxWechatUserService wechatUserService, WxMpTemplateMessageService templateMessageService,
YxWechatTemplateService yxWechatTemplateService,
YxExpressService yxExpressService, YxWechatUserService wechatUserService,
RedisTemplate<String, String> redisTemplate,
YxTemplateService templateService) {
YxTemplateService templateService,YxStorePinkService storePinkService) {
this.yxStoreOrderService = yxStoreOrderService;
this.yxStoreOrderStatusService = yxStoreOrderStatusService;
this.yxExpressService = yxExpressService;
this.wechatUserService = wechatUserService;
this.templateMessageService = templateMessageService;
this.yxWechatTemplateService = yxWechatTemplateService;
this.redisTemplate = redisTemplate;
this.templateService = templateService;
this.storePinkService = storePinkService;
}
@GetMapping(value = "/data/count")
@ -96,6 +92,7 @@ public class StoreOrderController {
@RequestParam(name = "orderType") String orderType) {
criteria.setShippingType(1);//默认查询所有快递订单
//订单状态查询
if (StrUtil.isNotEmpty(orderStatus)) {
switch (orderStatus) {
@ -161,9 +158,13 @@ public class StoreOrderController {
case "4":
criteria.setNewBargainId(0);
break;
case "5":
criteria.setShippingType(2);
break;
}
}
return new ResponseEntity(yxStoreOrderService.queryAll(criteria, pageable), HttpStatus.OK);
}
@ -220,6 +221,34 @@ public class StoreOrderController {
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@ApiOperation(value = "订单核销")
@PutMapping(value = "/yxStoreOrder/check")
@PreAuthorize("@el.check('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity check(@Validated @RequestBody YxStoreOrder resources) {
if (StrUtil.isBlank(resources.getVerifyCode())) throw new BadRequestException("核销码不能为空");
YxStoreOrderDTO storeOrderDTO = yxStoreOrderService.findById(resources.getId());
if(!resources.getVerifyCode().equals(storeOrderDTO.getVerifyCode())){
throw new BadRequestException("核销码不对");
}
if(OrderInfoEnum.PAY_STATUS_0.getValue().equals(storeOrderDTO.getPaid())){
throw new BadRequestException("订单未支付");
}
if(storeOrderDTO.getStatus() > 0) throw new BadRequestException("订单已核销");
if(storeOrderDTO.getCombinationId() > 0 && storeOrderDTO.getPinkId() > 0){
YxStorePinkDTO storePinkDTO = storePinkService.findById(storeOrderDTO.getPinkId());
if(!OrderInfoEnum.PINK_STATUS_2.getValue().equals(storePinkDTO.getStatus())){
throw new BadRequestException("拼团订单暂未成功无法核销");
}
}
resources.setStatus(OrderInfoEnum.STATUS_2.getValue());
yxStoreOrderService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@ApiOperation(value = "退款")
@PostMapping(value = "/yxStoreOrder/refund")

View File

@ -74,7 +74,7 @@ public class SystemStoreController {
@ApiOperation("设置门店信息")
@PreAuthorize("@el.check('yxSystemStore:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody YxSystemStore resources){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
if(resources.getId() == null){
resources.setAddTime(OrderUtil.getSecondTimestampTwo());
yxSystemStoreService.create(resources);

View File

@ -1,6 +1,8 @@
package co.yixiang.modules.shop.rest;
import cn.hutool.core.util.StrUtil;
import co.yixiang.aop.log.Log;
import co.yixiang.exception.BadRequestException;
import co.yixiang.modules.shop.domain.YxUserRecharge;
import co.yixiang.modules.shop.service.YxUserRechargeService;
import co.yixiang.modules.shop.service.dto.YxUserRechargeQueryCriteria;
@ -62,6 +64,7 @@ public class UserRechargeController {
@PreAuthorize("@el.check('yxUserRecharge:del')")
@DeleteMapping
public ResponseEntity<Object> deleteAll(@RequestBody Integer[] ids) {
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
yxUserRechargeService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}

View File

@ -19,7 +19,7 @@ public interface YxStoreOrderService {
Map<String,Object> chartCount();
String orderType(int id, int pinkId, int combinationId, int seckillId,int bargainId);
String orderType(int id, int pinkId, int combinationId, int seckillId,int bargainId,int shippingType);
void refund(YxStoreOrder resources);

View File

@ -51,4 +51,7 @@ public class YxStoreOrderQueryCriteria{
@Query(propName="bargainId",type = Query.Type.NOT_EQUAL)
private Integer newBargainId;
@Query
private Integer shippingType;
}

View File

@ -3,6 +3,7 @@ package co.yixiang.modules.shop.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.exception.BadRequestException;
import co.yixiang.exception.EntityExistException;
import co.yixiang.modules.activity.domain.YxStorePink;
@ -166,7 +167,8 @@ public class YxStoreOrderServiceImpl implements YxStoreOrderService {
}
@Override
public String orderType(int id,int pinkId, int combinationId,int seckillId,int bargainId) {
public String orderType(int id,int pinkId, int combinationId,int seckillId,
int bargainId,int shippingType) {
String str = "[普通订单]";
if(pinkId > 0 || combinationId > 0){
YxStorePink storePink = storePinkRepository.findByOrderIdKey(id);
@ -194,6 +196,7 @@ public class YxStoreOrderServiceImpl implements YxStoreOrderService {
}else if(bargainId > 0){
str = "[砍价订单]";
}
if(shippingType == 2) str = "[核销订单]";
return str;
}
@ -234,7 +237,8 @@ public class YxStoreOrderServiceImpl implements YxStoreOrderService {
yxStoreOrderDTO.setPinkName(orderType(yxStoreOrder.getId()
,yxStoreOrder.getPinkId(),yxStoreOrder.getCombinationId()
,yxStoreOrder.getSeckillId(),yxStoreOrder.getBargainId()));
,yxStoreOrder.getSeckillId(),yxStoreOrder.getBargainId(),
yxStoreOrder.getShippingType()));
List<StoreOrderCartInfo> cartInfos = yxStoreOrderCartInfoRepository
.findByOid(yxStoreOrder.getId());