修改店铺分类,兼容老结构
This commit is contained in:
parent
9039a35234
commit
cec5020eb2
@ -27,11 +27,11 @@ import com.suisung.mall.common.feignService.AuthService;
|
||||
import com.suisung.mall.common.feignService.SnsService;
|
||||
import com.suisung.mall.common.modules.account.AccountUserBase;
|
||||
import com.suisung.mall.common.modules.account.AccountUserBindConnect;
|
||||
import com.suisung.mall.core.web.service.RedisService;
|
||||
import com.suisung.mall.common.utils.CheckUtil;
|
||||
import com.suisung.mall.common.utils.CookieUtils;
|
||||
import com.suisung.mall.common.utils.I18nUtil;
|
||||
import com.suisung.mall.common.utils.WxHttpUtil;
|
||||
import com.suisung.mall.core.web.service.RedisService;
|
||||
import io.seata.spring.annotation.GlobalTransactional;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
@ -70,27 +70,20 @@ import java.util.Map;
|
||||
public class WeiXinServiceImpl implements WeiXinService {
|
||||
|
||||
private static final String GET_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(WeiXinServiceImpl.class);
|
||||
@Autowired
|
||||
private AccountUserBindConnectService accountUserBindConnectService;
|
||||
|
||||
@Autowired
|
||||
private AccountUserBaseService accountUserBaseService;
|
||||
|
||||
@Autowired
|
||||
private AuthService authService;
|
||||
|
||||
@Autowired
|
||||
private AccountBaseConfigService accountBaseConfigService;
|
||||
|
||||
@Autowired
|
||||
private SnsService snsService;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(WeiXinServiceImpl.class);
|
||||
|
||||
/**
|
||||
* 接入校验
|
||||
*
|
||||
@ -177,7 +170,7 @@ public class WeiXinServiceImpl implements WeiXinService {
|
||||
|
||||
/**
|
||||
* @param useCacheFlag 是否从缓存中读取
|
||||
* 获取AccessToken 向外提供
|
||||
* 获取AccessToken 向外提供
|
||||
*/
|
||||
public String getMpAccessToken(boolean useCacheFlag) {
|
||||
if (useCacheFlag) {
|
||||
@ -322,8 +315,7 @@ public class WeiXinServiceImpl implements WeiXinService {
|
||||
AccountUserBindConnect userBindConnect = accountUserBindConnectService.get(data.get("openid"));
|
||||
|
||||
//判断是否存在bind_unionid
|
||||
if (userBindConnect == null && ObjectUtil.isNotEmpty(data.get("unionid")))
|
||||
{
|
||||
if (userBindConnect == null && ObjectUtil.isNotEmpty(data.get("unionid"))) {
|
||||
QueryWrapper<AccountUserBindConnect> where = new QueryWrapper<>();
|
||||
where.eq("bind_unionid", data.get("unionid"));
|
||||
userBindConnect = accountUserBindConnectService.findOne(where);
|
||||
@ -420,6 +412,8 @@ public class WeiXinServiceImpl implements WeiXinService {
|
||||
params.put("code", code);
|
||||
JSON parseParam = JSONUtil.parse(params);
|
||||
String responseStr = WxHttpUtil.request(WxHttpUtil.MethodType.POST, WxHttpUtil.WxType.XCX, accessToken, url, null, Convert.toStr(parseParam));
|
||||
log.debug("获取用户手机号返回的数据:{}", responseStr);
|
||||
|
||||
JSONObject jsonObject = JSONUtil.parseObj(responseStr);
|
||||
Integer errcode = jsonObject.get("errcode", Integer.class);
|
||||
|
||||
@ -543,6 +537,7 @@ public class WeiXinServiceImpl implements WeiXinService {
|
||||
|
||||
/**
|
||||
* 微信网页登录生成二维码
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@ -566,6 +561,7 @@ public class WeiXinServiceImpl implements WeiXinService {
|
||||
|
||||
/**
|
||||
* 微信网页登录回调
|
||||
*
|
||||
* @param code
|
||||
* @param response
|
||||
*/
|
||||
|
||||
@ -12,11 +12,12 @@ import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 市场分类表
|
||||
* 店铺分类表
|
||||
* </p>
|
||||
*
|
||||
* @author Xinze
|
||||
@ -26,7 +27,7 @@ import java.util.List;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("shop_base_store_category")
|
||||
@ApiModel(value = "ShopBaseStoreCategory对象", description = "市场分类表")
|
||||
@ApiModel(value = "ShopBaseStoreCategory对象", description = "店铺分类表")
|
||||
public class ShopBaseStoreCategory implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -62,6 +63,24 @@ public class ShopBaseStoreCategory implements Serializable {
|
||||
@ApiModelProperty(value = "商品分类(DOT)")
|
||||
private String category_ids;
|
||||
|
||||
@ApiModelProperty(value = "分类简介")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(value = "分成比例,范围是1.00-100.00")
|
||||
private BigDecimal split_ratio;
|
||||
|
||||
@ApiModelProperty(value = "创建用户")
|
||||
private String created_by;
|
||||
|
||||
@ApiModelProperty(value = "最后修改用户")
|
||||
private String updated_by;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date created_at;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updated_at;
|
||||
|
||||
@ApiModelProperty(value = "子集数据")
|
||||
@TableField(exist = false)
|
||||
private List<ShopBaseStoreCategory> children;
|
||||
|
||||
@ -36,6 +36,16 @@ public final class StringUtils extends org.apache.commons.lang3.StringUtils {
|
||||
private static final Random RANDOM = new Random();
|
||||
private static final Logger logger = LoggerFactory.getLogger(StringUtils.class);
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
// 老版 15 位营业执照注册号加权因子
|
||||
private static final int[] BIZLICS_OLD_WEIGHTS = {13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2};
|
||||
// 新版 18 位统一社会信用代码加权因子
|
||||
private static final int[] BIZLICS_NEW_WEIGHTS = {1, 3, 9, 27, 19, 26, 16, 17, 20, 29, 25, 13, 8, 24, 10, 30, 28};
|
||||
// 新版统一社会信用代码字符集
|
||||
private static final String NEW_BIZLICS_BASE_CODE_STRING = "0123456789ABCDEFGHJKLMNPQRTUWXY";
|
||||
private static final char[] NEW_BIZLICS_BASE_CODE_ARRAY = NEW_BIZLICS_BASE_CODE_STRING.toCharArray();
|
||||
|
||||
|
||||
/**
|
||||
* 全地址去除省市区,保留详细地址
|
||||
*
|
||||
@ -47,7 +57,7 @@ public final class StringUtils extends org.apache.commons.lang3.StringUtils {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// System.out.println(removeProvinceCityDistrict("广西壮族自治区贵港市桂平市西山镇新安街粤桂花城1102号"));
|
||||
System.out.println(genLklOrderNo(4));
|
||||
System.out.println(verifyBusinessLicense("99365484C3GKUAU964"));
|
||||
}
|
||||
|
||||
public static String encode(String str) {
|
||||
@ -593,6 +603,87 @@ public final class StringUtils extends org.apache.commons.lang3.StringUtils {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验老版 15 位营业执照注册号
|
||||
*
|
||||
* @param code 待校验的 15 位营业执照注册号
|
||||
* @return 若校验通过返回 true,否则返回 false
|
||||
*/
|
||||
public static boolean verifyOldBusinessLicense(String code) {
|
||||
// 检查输入的代码长度是否为 15 位
|
||||
if (code == null || code.length() != 15) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
int sum = 0;
|
||||
// 计算前 14 位的加权和
|
||||
for (int i = 0; i < 14; i++) {
|
||||
int num = Integer.parseInt(String.valueOf(code.charAt(i)));
|
||||
sum += num * BIZLICS_OLD_WEIGHTS[i];
|
||||
}
|
||||
// 计算加权和对 11 取模的结果
|
||||
int mod = sum % 11;
|
||||
// 计算校验码
|
||||
int checkCode = (11 - mod) % 10;
|
||||
// 比较计算出的校验码和输入代码的最后一位
|
||||
return checkCode == Integer.parseInt(String.valueOf(code.charAt(14)));
|
||||
} catch (NumberFormatException e) {
|
||||
// 若输入代码包含非数字字符,捕获异常并返回 false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验新版 18 位统一社会信用代码
|
||||
*
|
||||
* @param code 待校验的 18 位统一社会信用代码
|
||||
* @return 若校验通过返回 true,否则返回 false
|
||||
*/
|
||||
public static boolean verifyNewBusinessLicense(String code) {
|
||||
// 检查输入的代码长度是否为 18 位
|
||||
if (code == null || code.length() != 18) {
|
||||
return false;
|
||||
}
|
||||
char[] chars = code.toCharArray();
|
||||
char checkCode = chars[17];
|
||||
int sum = 0;
|
||||
// 计算前 17 位的加权和
|
||||
for (int i = 0; i < 17; i++) {
|
||||
int index = NEW_BIZLICS_BASE_CODE_STRING.indexOf(chars[i]);
|
||||
// 若字符不在字符集中,返回 false
|
||||
if (index == -1) {
|
||||
return false;
|
||||
}
|
||||
sum += index * BIZLICS_NEW_WEIGHTS[i];
|
||||
}
|
||||
// 计算加权和对 31 取模的结果
|
||||
int modulus = sum % 31;
|
||||
// 计算校验码的索引
|
||||
int checkIndex = (31 - modulus) % 31;
|
||||
// 比较计算出的校验码和输入代码的最后一位
|
||||
return checkCode == NEW_BIZLICS_BASE_CODE_ARRAY[checkIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* 兼容新老版营业执照的校验函数
|
||||
*
|
||||
* @param code 待校验的营业执照代码
|
||||
* @return 若校验通过返回 true,否则返回 false
|
||||
*/
|
||||
public static boolean verifyBusinessLicense(String code) {
|
||||
if (code == null) {
|
||||
return false;
|
||||
}
|
||||
// 根据代码长度调用相应的校验方法
|
||||
if (code.length() == 15) {
|
||||
return verifyOldBusinessLicense(code);
|
||||
} else if (code.length() == 18) {
|
||||
return verifyNewBusinessLicense(code);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成的随机数类型
|
||||
*/
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.suisung.mall.shop.base.controller.admin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.modules.base.ShopBaseStoreCategory;
|
||||
@ -10,23 +12,20 @@ import com.suisung.mall.shop.store.service.ShopStoreBaseService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 市场分类表 前端控制器
|
||||
* 店铺分类表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Xinze
|
||||
* @since 2021-04-23
|
||||
*/
|
||||
@Api(tags = "市场分类表")
|
||||
@Api(tags = "店铺分类表")
|
||||
@RestController
|
||||
@RequestMapping("/admin/shop/shop-base-store-category")
|
||||
public class ShopBaseStoreCategoryController {
|
||||
public class ShopBaseStoreCategoryAdminController {
|
||||
|
||||
@Autowired
|
||||
private ShopBaseStoreCategoryService shopBaseStoreCategoryService;
|
||||
@ -42,22 +41,32 @@ public class ShopBaseStoreCategoryController {
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "市场分类表-分页列表查询", notes = "市场分类表-分页列表查询")
|
||||
@ApiOperation(value = "店铺分类表-分页列表查询", notes = "店铺分类表-分页列表查询")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult list(ShopBaseStoreCategory shopBaseStoreCategory,
|
||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
QueryWrapper<ShopBaseStoreCategory> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderByAsc("store_category_id");
|
||||
queryWrapper.orderByAsc("store_category_order").orderByAsc("store_category_id");
|
||||
return CommonResult.success(shopBaseStoreCategoryService.lists(queryWrapper, pageNum, pageSize));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "店铺分类基础数据", notes = "店铺分类基础数据(适用于绑定下拉列表)")
|
||||
@RequestMapping(value = "/base-list", method = RequestMethod.POST)
|
||||
public CommonResult shopStoreBusinessCategoryList(@RequestBody(required = false) JSONObject params) {
|
||||
String keyword = "";
|
||||
if (params != null && StrUtil.isNotBlank(params.getStr("keyword"))) {
|
||||
keyword = params.getStr("keyword");
|
||||
}
|
||||
return CommonResult.success(shopBaseStoreCategoryService.selectParentListWithChildren(keyword));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "商品分类表-分类强调区别, 类型强调共性-分页列表查询", notes = "商品分类表-分类强调区别, 类型强调共性-分页列表查询")
|
||||
@ApiOperation(value = "店铺分类表-分类强调区别, 类型强调共性-分页列表查询", notes = "店铺分类表-分类强调区别, 类型强调共性-分页列表查询")
|
||||
@RequestMapping(value = "/categoryTree", method = RequestMethod.GET)
|
||||
public CommonResult categoryTree(ShopBaseStoreCategory category) {
|
||||
QueryWrapper<ShopBaseStoreCategory> queryWrapper = new QueryWrapper<>();
|
||||
@ -73,7 +82,7 @@ public class ShopBaseStoreCategoryController {
|
||||
* @param shopBaseStoreCategory
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "市场分类表-编辑", notes = "市场分类表-编辑")
|
||||
@ApiOperation(value = "店铺分类表-编辑", notes = "店铺分类表-编辑")
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.POST)
|
||||
public CommonResult edit(ShopBaseStoreCategory shopBaseStoreCategory) {
|
||||
return CommonResult.success(shopBaseStoreCategoryService.saveOrUpdate(shopBaseStoreCategory));
|
||||
@ -85,7 +94,7 @@ public class ShopBaseStoreCategoryController {
|
||||
* @param store_category_id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "市场分类表-通过store_category_id删除", notes = "市场分类表-通过store_category_id删除")
|
||||
@ApiOperation(value = "店铺分类表-通过store_category_id删除", notes = "店铺分类表-通过store_category_id删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
public CommonResult delete(@RequestParam(name = "store_category_id") String store_category_id) {
|
||||
QueryWrapper<ShopBaseStoreCategory> queryWrapper = new QueryWrapper<>();
|
||||
@ -0,0 +1,43 @@
|
||||
package com.suisung.mall.shop.base.controller.mobile;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.shop.base.service.ShopBaseStoreCategoryService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 店铺分类表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Xinze
|
||||
* @since 2021-06-28
|
||||
*/
|
||||
@Api(tags = "店铺分类表")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/shop/shop-base-store-category")
|
||||
public class ShopBaseStoreCategoryController {
|
||||
|
||||
|
||||
@Resource
|
||||
private ShopBaseStoreCategoryService shopBaseStoreCategoryService;
|
||||
|
||||
@ApiOperation(value = "店铺分类(类目)", notes = "店铺分类(类目)")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.POST)
|
||||
public CommonResult shopStoreBusinessCategoryList(@RequestBody(required = false) JSONObject params) {
|
||||
String keyword = "";
|
||||
if (params != null && StrUtil.isNotBlank(params.getStr("keyword"))) {
|
||||
keyword = params.getStr("keyword");
|
||||
}
|
||||
return CommonResult.success(shopBaseStoreCategoryService.selectParentListWithChildren(keyword));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,8 +2,11 @@ package com.suisung.mall.shop.base.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.suisung.mall.common.modules.base.ShopBaseStoreCategory;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 市场分类表 Mapper 接口
|
||||
@ -16,4 +19,11 @@ import org.springframework.stereotype.Repository;
|
||||
@Repository
|
||||
public interface ShopBaseStoreCategoryMapper extends BaseMapper<ShopBaseStoreCategory> {
|
||||
|
||||
/**
|
||||
* 根据关键字查询店铺一级营业分类信息
|
||||
*
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
List<ShopBaseStoreCategory> selectParentListWithChildren(@Param("keyword") String keyword);
|
||||
}
|
||||
|
||||
@ -20,4 +20,14 @@ public interface ShopBaseStoreCategoryService extends IBaseService<ShopBaseStore
|
||||
List<ShopBaseStoreCategory> getCategoryTree(QueryWrapper<ShopBaseStoreCategory> queryWrapper);
|
||||
|
||||
List<Map> getCategoryTree(Integer store_category_parent_id, Integer category_is_enable);
|
||||
|
||||
|
||||
/**
|
||||
* 根据关键字查询店铺一级店铺分类信息
|
||||
*
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
List<ShopBaseStoreCategory> selectParentListWithChildren(String keyword);
|
||||
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.suisung.mall.shop.base.mapper.ShopBaseStoreCategoryMapper;
|
||||
import com.suisung.mall.shop.base.service.ShopBaseStoreCategoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -27,6 +28,9 @@ public class ShopBaseStoreCategoryServiceImpl extends BaseServiceImpl<ShopBaseSt
|
||||
|
||||
private final String LANG = "zh_CN"; // // todo 多语言动态
|
||||
|
||||
@Resource
|
||||
private ShopBaseStoreCategoryMapper shopBaseStoreCategoryMapper;
|
||||
|
||||
@Override
|
||||
public List<ShopBaseStoreCategory> getCategoryTree(QueryWrapper<ShopBaseStoreCategory> queryWrapper) {
|
||||
List<ShopBaseStoreCategory> list = find(queryWrapper);
|
||||
@ -75,6 +79,18 @@ public class ShopBaseStoreCategoryServiceImpl extends BaseServiceImpl<ShopBaseSt
|
||||
return category_rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关键字查询店铺一级店铺分类信息
|
||||
*
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ShopBaseStoreCategory> selectParentListWithChildren(String keyword) {
|
||||
return shopBaseStoreCategoryMapper.selectParentListWithChildren(keyword);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 递归构建tree
|
||||
*
|
||||
|
||||
@ -19,7 +19,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -93,6 +92,15 @@ public class SFExpressController {
|
||||
return sfExpressApiService.riderViewV2(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "拣货完成", notes = "拣货完成(商家告知餐品制作完成接口)")
|
||||
@RequestMapping(value = "/notifyproductready", method = RequestMethod.POST)
|
||||
public ThirdApiRes notifyProductReady(@RequestParam(name = "store_id", defaultValue = "0") String storeId, @RequestParam(name = "order_id", defaultValue = "") String orderId) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("order_id", shopStoreSfOrderService.getSfOrderIdByShopOrderId(orderId));
|
||||
params.put("store_id", storeId);
|
||||
return sfExpressApiService.notifyProductReady(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 顺丰同城订单状态监听 SSE 服务
|
||||
*
|
||||
|
||||
@ -15,6 +15,7 @@ import java.util.Map;
|
||||
|
||||
public interface SFExpressApiService {
|
||||
|
||||
|
||||
/**
|
||||
* (店铺)创建顺丰同城订单
|
||||
*
|
||||
@ -23,7 +24,6 @@ public interface SFExpressApiService {
|
||||
*/
|
||||
ThirdApiRes createOrder(String shopOrderId);
|
||||
|
||||
|
||||
/**
|
||||
* 内部顺丰同城订单下单
|
||||
*
|
||||
@ -33,7 +33,6 @@ public interface SFExpressApiService {
|
||||
*/
|
||||
Pair<Boolean, String> innerCreateSfExpressOrder(String orderId, Long orderPickupNum);
|
||||
|
||||
|
||||
/**
|
||||
* 取消订单,当商家处发生异常需要取消配送时,可调用此接口对订单进行取消操作,同步返回结果。
|
||||
*
|
||||
@ -44,7 +43,6 @@ public interface SFExpressApiService {
|
||||
*/
|
||||
ThirdApiRes cancelOrder(String sfOrderId, Integer cancelCode, String cancelReason);
|
||||
|
||||
|
||||
/**
|
||||
* 取消订单,当商家处发生异常需要取消配送时,可调用此接口对订单进行取消操作,同步返回结果。
|
||||
*
|
||||
@ -102,6 +100,14 @@ public interface SFExpressApiService {
|
||||
*/
|
||||
ThirdApiRes changeOrder(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 拣货完成,商家告知餐品制作完成接口
|
||||
*
|
||||
* @param params 综合参数,请参考:https://openic.sf-express.com/open/api/docs/index/#/apidoc
|
||||
* @return
|
||||
*/
|
||||
ThirdApiRes notifyProductReady(Map<String, Object> params);
|
||||
|
||||
|
||||
// *********** 顺丰同城回调相关业务 ****************
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ import cn.hutool.json.JSONUtil;
|
||||
import com.suisung.mall.common.api.StateCode;
|
||||
import com.suisung.mall.common.constant.SFExpressConstant;
|
||||
import com.suisung.mall.common.exception.ApiException;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreSameCityTransportBase;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreSfOrder;
|
||||
import com.suisung.mall.common.pojo.req.*;
|
||||
import com.suisung.mall.common.pojo.res.ThirdApiRes;
|
||||
@ -28,16 +29,17 @@ import com.suisung.mall.common.utils.SseEmitterUtil;
|
||||
import com.suisung.mall.shop.order.service.ShopOrderBaseService;
|
||||
import com.suisung.mall.shop.order.service.ShopOrderInfoService;
|
||||
import com.suisung.mall.shop.sfexpress.service.SFExpressApiService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreSfOrderService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -64,6 +66,10 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
@Autowired
|
||||
private ShopOrderInfoService shopOrderInfoService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopStoreSameCityTransportBaseService shopStoreSameCityTransportBaseService;
|
||||
|
||||
@Override
|
||||
public ThirdApiRes createOrder(String shopOrderId) {
|
||||
// 组织请求参数
|
||||
@ -452,6 +458,44 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拣货完成,商家告知餐品制作完成接口
|
||||
*
|
||||
* @param params 综合参数,顺丰订单号order_id必填项,请参考:https://openic.sf-express.com/open/api/docs/index/#/apidoc
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ThirdApiRes notifyProductReady(Map<String, Object> params) {
|
||||
if (params == null || ObjectUtil.isEmpty(params.get("order_id")) || ObjectUtil.isEmpty(params.get("store_id"))) {
|
||||
return new ThirdApiRes().fail(1003, "请求参数有误!");
|
||||
}
|
||||
|
||||
ShopStoreSameCityTransportBase shopStoreSameCityTransportBase = shopStoreSameCityTransportBaseService.getShopStoreSameCityTransportBaseById((long) params.get("store_id"));
|
||||
if (shopStoreSameCityTransportBase == null) {
|
||||
logger.error("无法获取顺丰店铺 Id!");
|
||||
return new ThirdApiRes().fail(1003, "无法获取店铺Id");
|
||||
}
|
||||
|
||||
params.put("order_type", 1); // 1表示顺丰订单号、2表示商家订单号
|
||||
params.put("shop_id", shopStoreSameCityTransportBase.getShop_id());
|
||||
params.put("shop_type", 2);// 1表示顺丰店铺id、2表示接入方店铺id
|
||||
params.put("notice_ready_time", System.currentTimeMillis() / 1000);
|
||||
params.putAll(buildCommonParams());
|
||||
|
||||
// 转换 json 字符串参数
|
||||
String paramJSON = JsonUtil.toJSONString(params);
|
||||
|
||||
// 根据参数生成请求签名
|
||||
String send_url = buildUrl("notifyproductready", paramJSON);
|
||||
String retRespStr = HttpUtil.post(send_url, paramJSON);
|
||||
if (StrUtil.isBlank(retRespStr)) {
|
||||
logger.error("顺丰同城:拣货完成接口异常,无返回值!");
|
||||
return new ThirdApiRes().fail(-1, "顺丰同城:无返回值!");
|
||||
}
|
||||
|
||||
return JsonUtil.json2object(retRespStr, ThirdApiRes.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 接收顺丰原因订单取消回调
|
||||
|
||||
@ -164,6 +164,10 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
|
||||
return CommonResult.failed("缺少企业营业执照信息!");
|
||||
}
|
||||
|
||||
if (!StringUtils.verifyBusinessLicense(record.getBiz_license_number())) {
|
||||
return CommonResult.failed("营业执照号码有误!");
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(record.getLegal_person_id_images()) || StrUtil.isBlank(record.getLegal_person_id_images2())) {
|
||||
return CommonResult.failed("缺少企业法人身份证信息!");
|
||||
}
|
||||
@ -231,7 +235,7 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
|
||||
return CommonResult.failed("未找到入驻记录!");
|
||||
}
|
||||
|
||||
if (oldRecord.getSigned_status() > 0) {
|
||||
if (oldRecord.getSigned_status() >= 0) {
|
||||
return CommonResult.failed("已经签署合同,不能再次申请!");
|
||||
}
|
||||
|
||||
@ -241,6 +245,11 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
|
||||
return CommonResult.failed("参数转换失败,请联系管理员!");
|
||||
}
|
||||
|
||||
// 验证企业营业执照号码
|
||||
if (StrUtil.isNotBlank(record.getBiz_license_number()) && !StringUtils.verifyBusinessLicense(record.getBiz_license_number())) {
|
||||
return CommonResult.failed("营业执照号码有误!");
|
||||
}
|
||||
|
||||
// 校验身份证,手机号格式
|
||||
if (StrUtil.isNotBlank(record.getLegal_person_id_number()) && !StringUtils.validateIDCard(record.getLegal_person_id_number())) {
|
||||
return CommonResult.failed("法人身份证号码有误!");
|
||||
@ -266,7 +275,7 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
|
||||
record.setUpdated_by(userId);
|
||||
record.setUpdated_at(new Date());
|
||||
record.setStatus(CommonConstant.Enable);
|
||||
record.setSigned_status(CommonConstant.Disable); // 重置合同签署状态
|
||||
record.setSigned_status(CommonConstant.CONTRACT_SIGN_STA_ING); // 重置合同签署状态
|
||||
if (!updateById(record)) {
|
||||
return CommonResult.failed("重新申请入驻提交失败!");
|
||||
}
|
||||
|
||||
@ -1,11 +1,58 @@
|
||||
<?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="com.suisung.mall.shop.base.mapper.ShopBaseStoreCategoryMapper">
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
store_category_id
|
||||
, store_category_name, store_category_deposit, store_category_parent_id, store_category_order, category_image, category_level, category_is_leaf, category_is_enable, category_ids
|
||||
</sql>
|
||||
|
||||
<resultMap id="ShopBaseStoreCategoryResultMap" type="com.suisung.mall.common.modules.base.ShopBaseStoreCategory">
|
||||
<id property="store_category_id" column="store_category_id"/>
|
||||
<result property="store_category_name" column="store_category_name"/>
|
||||
<result property="store_category_parent_id" column="store_category_parent_id"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="split_ratio" column="split_ratio"/>
|
||||
<result property="store_category_order" column="store_category_order"/>
|
||||
<result property="category_image" column="category_image"/>
|
||||
<collection property="children" ofType="com.suisung.mall.common.modules.base.ShopBaseStoreCategory">
|
||||
<id property="store_category_id" column="child_store_category_id"/>
|
||||
<result property="store_category_name" column="child_store_category_name"/>
|
||||
<result property="store_category_parent_id" column="child_store_category_parent_id"/>
|
||||
<result property="description" column="child_description"/>
|
||||
<result property="split_ratio" column="child_split_ratio"/>
|
||||
<result property="store_category_order" column="child_store_category_order"/>
|
||||
<result property="category_image" column="child_category_image"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectParentListWithChildren" resultMap="ShopBaseStoreCategoryResultMap">
|
||||
SELECT p.store_category_id,
|
||||
p.store_category_name,
|
||||
p.store_category_parent_id,
|
||||
p.store_category_deposit,
|
||||
p.description,
|
||||
p.split_ratio,
|
||||
p.store_category_order,
|
||||
p.category_image,
|
||||
c.store_category_id AS child_store_category_id,
|
||||
c.store_category_name AS child_store_category_name,
|
||||
c.store_category_parent_id AS child_store_category_parent_id,
|
||||
c.store_category_deposit AS child_store_category_deposit,
|
||||
c.description AS child_description,
|
||||
c.split_ratio AS child_split_ratio,
|
||||
c.store_category_order AS child_store_category_order,
|
||||
c.category_image AS child_category_image
|
||||
FROM shop_base_store_category p
|
||||
LEFT JOIN
|
||||
shop_base_store_category c ON p.store_category_parent_id = c.store_category_id and c.category_is_enable = 1
|
||||
WHERE p.store_category_parent_id = 0 and p.category_is_enable = 1
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (p.store_category_name LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR p.description LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR c.store_category_name LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR c.description LIKE CONCAT('%', #{keyword}, '%'))
|
||||
</if>
|
||||
ORDER BY p.store_category_order asc, c.store_category_order asc, p.store_category_id asc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -695,16 +695,19 @@
|
||||
OR spi.item_barcode LIKE CONCAT('%', #{keyword}, '%'))
|
||||
</if>
|
||||
|
||||
<!--进行中-->
|
||||
<if test="status!=null and status==1">
|
||||
and ob.order_state_id IN (2020, 2030, 2040)
|
||||
and TIMESTAMPADD(MINUTE, #{expiredMinute}, oi.order_time) >= NOW()
|
||||
</if>
|
||||
|
||||
<!--超时异常-->
|
||||
<if test="status!=null and status==2">
|
||||
and ob.order_state_id IN (2020, 2030, 2040)
|
||||
and TIMESTAMPADD(MINUTE, #{expiredMinute}, oi.order_time) <= NOW()
|
||||
</if>
|
||||
|
||||
<!--退款订单-->
|
||||
<if test="status!=null and status==3">
|
||||
and od.order_refund_status IN (1, 2)
|
||||
</if>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user