移动端多门店完成及其导出新sql
This commit is contained in:
3209
sql/yshop2.0.sql
3209
sql/yshop2.0.sql
File diff suppressed because it is too large
Load Diff
4559
sql/yxshop2.1.sql
Normal file
4559
sql/yxshop2.1.sql
Normal file
File diff suppressed because one or more lines are too long
@ -1,4 +1,3 @@
|
||||
新项目 直接导入yshop2.0.sql即可
|
||||
1.9升级到2.0表变化的只有yx_user_recharge_sql、yx_system_store.sql
|
||||
新项目 直接导入yshop2.1.sql即可
|
||||
2.0升级到2.1,直接把yshop2.1升级sql.txt里面sql语句运行即可
|
||||
|
||||
升级说明:这次2.0代码改动地方多,升级需谨慎!!!
|
@ -1313,7 +1313,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
|
||||
storeOrder.setShippingType(param.getShippingType());
|
||||
//处理门店
|
||||
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().equals(param.getShippingType())){
|
||||
YxSystemStoreQueryVo systemStoreQueryVo = systemStoreService.getStoreInfo();
|
||||
YxSystemStoreQueryVo systemStoreQueryVo = systemStoreService.getYxSystemStoreById(param.getStoreId());
|
||||
if(systemStoreQueryVo == null ) throw new ErrorRequestException("暂无门店无法选择门店自提");
|
||||
storeOrder.setVerifyCode(StrUtil.sub(orderSn,orderSn.length(),-12));
|
||||
storeOrder.setStoreId(systemStoreQueryVo.getId());
|
||||
|
@ -91,6 +91,7 @@ public class StoreOrderController extends BaseController {
|
||||
private final YxStoreBargainUserService storeBargainUserService;
|
||||
private final YxSystemStoreService systemStoreService;
|
||||
private final YxSystemAttachmentService systemAttachmentService;
|
||||
private final YxSystemStoreStaffService systemStoreStaffService;
|
||||
|
||||
private static Lock lock = new ReentrantLock(false);
|
||||
|
||||
@ -163,7 +164,7 @@ public class StoreOrderController extends BaseController {
|
||||
confirmOrderDTO.setUserInfo(userService.getYxUserById(uid));
|
||||
|
||||
//门店
|
||||
confirmOrderDTO.setSystemStore(systemStoreService.getStoreInfo());
|
||||
confirmOrderDTO.setSystemStore(systemStoreService.getStoreInfo("",""));
|
||||
|
||||
return ApiResult.ok(confirmOrderDTO);
|
||||
}
|
||||
@ -446,7 +447,7 @@ public class StoreOrderController extends BaseController {
|
||||
}
|
||||
storeOrder.setCode(qrcodeUrl);
|
||||
storeOrder.setMapKey(mapKey);
|
||||
storeOrder.setSystemStore(systemStoreService.getStoreInfo());
|
||||
storeOrder.setSystemStore(systemStoreService.getYxSystemStoreById(storeOrder.getStoreId()));
|
||||
}
|
||||
|
||||
return ApiResult.ok(storeOrderService.handleOrder(storeOrder));
|
||||
@ -478,14 +479,14 @@ public class StoreOrderController extends BaseController {
|
||||
String couponId = jsonObject.getString("couponId");
|
||||
String shippingType = jsonObject.getString("shipping_type");
|
||||
String useIntegral = jsonObject.getString("useIntegral");
|
||||
//todo 砍价
|
||||
// 砍价
|
||||
if(ObjectUtil.isNotNull(jsonObject.getInteger("bargainId"))){
|
||||
YxStoreBargainUser storeBargainUser = storeBargainUserService.getBargainUserInfo(jsonObject.getInteger("bargainId")
|
||||
,uid);
|
||||
if(ObjectUtil.isNull(storeBargainUser)) return ApiResult.fail("砍价失败");
|
||||
if(storeBargainUser.getStatus() == 3) return ApiResult.fail("砍价已支付");
|
||||
}
|
||||
//todo 拼团
|
||||
// 拼团
|
||||
if(ObjectUtil.isNotNull(jsonObject.getInteger("pinkId"))){
|
||||
int pinkId = jsonObject.getInteger("pinkId");
|
||||
YxStoreOrder yxStoreOrder = storeOrderService.getOrderPink(pinkId,uid,1);
|
||||
@ -707,6 +708,11 @@ public class StoreOrderController extends BaseController {
|
||||
|
||||
YxStoreOrder order = storeOrderService.getOne(Wrappers.query(storeOrder));
|
||||
if(order == null) return ApiResult.fail("核销的订单不存在或未支付或已退款");
|
||||
|
||||
int uid = SecurityUtils.getUserId().intValue();
|
||||
boolean checkStatus = systemStoreStaffService.checkStatus(uid,order.getStoreId());
|
||||
if(!checkStatus) return ApiResult.fail("您没有当前店铺核销权限!");
|
||||
|
||||
if(order.getStatus() > 0) return ApiResult.fail("订单已经核销");
|
||||
|
||||
if(order.getCombinationId() > 0 && order.getPinkId() > 0){
|
||||
|
@ -27,5 +27,6 @@ public class OrderParam implements Serializable {
|
||||
private Integer shippingType;
|
||||
private Double useIntegral;
|
||||
private Integer isChannel = 1;
|
||||
private Integer storeId;
|
||||
|
||||
}
|
||||
|
@ -1,15 +1,20 @@
|
||||
package co.yixiang.modules.shop.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
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.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -21,6 +26,12 @@ import java.io.Serializable;
|
||||
*/
|
||||
@Repository
|
||||
public interface YxSystemStoreMapper extends BaseMapper<YxSystemStore> {
|
||||
@Select("SELECT*,ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN((#{lat} * PI() / 180 - latitude * PI() / 180" +
|
||||
" ) / 2),2) + COS(40.0497810000 * PI() / 180) * COS(latitude * PI() / 180) * POW(" +
|
||||
" SIN((#{lon} * PI() / 180 - longitude * PI() / 180) / 2),2))) * 1000) AS distance" +
|
||||
" FROM yx_system_store WHERE is_del=0 AND is_show = 1 ORDER BY distance ASC"
|
||||
)
|
||||
List<YxSystemStoreQueryVo> getStoreList(Page page,@Param("lon") double lon,@Param("lat") double lat);
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
|
@ -36,7 +36,7 @@ public interface YxStoreProductService extends BaseService<YxStoreProduct> {
|
||||
int getProductStock(int productId,String unique);
|
||||
|
||||
|
||||
ProductDTO goodsDetail(int id,int type,int uid);
|
||||
ProductDTO goodsDetail(int id,int type,int uid,String latitude,String longitude);
|
||||
|
||||
List<YxStoreProductQueryVo> getGoodsList(YxStoreProductQueryParam productQueryParam);
|
||||
|
||||
|
@ -7,6 +7,7 @@ import co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -18,20 +19,23 @@ import java.io.Serializable;
|
||||
*/
|
||||
public interface YxSystemStoreService extends BaseService<YxSystemStore> {
|
||||
|
||||
YxSystemStoreQueryVo getStoreInfo();
|
||||
List<YxSystemStoreQueryVo> getStoreList(String latitude,String longitude,int page, int limit);
|
||||
|
||||
|
||||
YxSystemStoreQueryVo getStoreInfo(String latitude,String longitude);
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
YxSystemStoreQueryVo getYxSystemStoreById(Serializable id) throws Exception;
|
||||
YxSystemStoreQueryVo getYxSystemStoreById(Serializable id);
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param yxSystemStoreQueryParam
|
||||
* @return
|
||||
*/
|
||||
Paging<YxSystemStoreQueryVo> getYxSystemStorePageList(YxSystemStoreQueryParam yxSystemStoreQueryParam) throws Exception;
|
||||
Paging<YxSystemStoreQueryVo> getYxSystemStorePageList(YxSystemStoreQueryParam yxSystemStoreQueryParam);
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
public interface YxSystemStoreStaffService extends BaseService<YxSystemStoreStaff> {
|
||||
|
||||
boolean checkStatus(int uid);
|
||||
boolean checkStatus(int uid,int storeId);
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
|
@ -125,7 +125,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<YxStoreProductMap
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductDTO goodsDetail(int id, int type,int uid) {
|
||||
public ProductDTO goodsDetail(int id, int type,int uid,String latitude,String longitude) {
|
||||
QueryWrapper<YxStoreProduct> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("is_del",0).eq("is_show",1).eq("id",id);
|
||||
YxStoreProduct storeProduct = yxStoreProductMapper.selectOne(wrapper);
|
||||
@ -156,7 +156,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<YxStoreProductMap
|
||||
productDTO.setReplyChance(replyService.doReply(id,replyCount));//百分比
|
||||
|
||||
//门店
|
||||
productDTO.setSystemStore(systemStoreService.getStoreInfo());
|
||||
productDTO.setSystemStore(systemStoreService.getStoreInfo(latitude,longitude));
|
||||
productDTO.setMapKey(RedisUtil.get("tengxun_map_key"));
|
||||
|
||||
return productDTO;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package co.yixiang.modules.shop.service.impl;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.enums.CommonEnum;
|
||||
import co.yixiang.modules.shop.entity.YxSystemStore;
|
||||
import co.yixiang.modules.shop.mapper.YxSystemStoreMapper;
|
||||
@ -9,6 +11,7 @@ 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.LocationUtils;
|
||||
import co.yixiang.utils.RedisUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -20,6 +23,7 @@ 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;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@ -42,7 +46,19 @@ public class YxSystemStoreServiceImpl extends BaseServiceImpl<YxSystemStoreMappe
|
||||
private SystemStoreMap storeMap;
|
||||
|
||||
@Override
|
||||
public YxSystemStoreQueryVo getStoreInfo() {
|
||||
public List<YxSystemStoreQueryVo> getStoreList(String latitude, String longitude, int page, int limit) {
|
||||
|
||||
Page<YxSystemStore> pageModel = new Page<>(page, limit);
|
||||
List<YxSystemStoreQueryVo> list = yxSystemStoreMapper.getStoreList(pageModel,Double.valueOf(longitude),Double.valueOf(latitude));
|
||||
list.forEach(item->{
|
||||
String newDis = NumberUtil.round(Double.valueOf(item.getDistance()) / 1000,2).toString();
|
||||
item.setDistance(newDis);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public YxSystemStoreQueryVo getStoreInfo(String latitude,String longitude) {
|
||||
YxSystemStore systemStore = new YxSystemStore();
|
||||
systemStore.setIsDel(CommonEnum.DEL_STATUS_0.getValue());
|
||||
systemStore.setIsShow(CommonEnum.SHOW_STATUS_1.getValue());
|
||||
@ -54,17 +70,23 @@ public class YxSystemStoreServiceImpl extends BaseServiceImpl<YxSystemStoreMappe
|
||||
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);
|
||||
YxSystemStoreQueryVo systemStoreQueryVo = storeMap.toDto(yxSystemStore);
|
||||
if(StrUtil.isNotEmpty(latitude) && StrUtil.isNotEmpty(longitude)){
|
||||
double distance = LocationUtils.getDistance(Double.valueOf(latitude),Double.valueOf(longitude),
|
||||
Double.valueOf(yxSystemStore.getLatitude()),Double.valueOf(yxSystemStore.getLongitude()));
|
||||
systemStoreQueryVo.setDistance(String.valueOf(distance));
|
||||
}
|
||||
return systemStoreQueryVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public YxSystemStoreQueryVo getYxSystemStoreById(Serializable id) throws Exception{
|
||||
public YxSystemStoreQueryVo getYxSystemStoreById(Serializable id){
|
||||
return yxSystemStoreMapper.getYxSystemStoreById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<YxSystemStoreQueryVo> getYxSystemStorePageList(YxSystemStoreQueryParam yxSystemStoreQueryParam) throws Exception{
|
||||
Page page = setPageParam(yxSystemStoreQueryParam,OrderItem.desc("create_time"));
|
||||
public Paging<YxSystemStoreQueryVo> getYxSystemStorePageList(YxSystemStoreQueryParam yxSystemStoreQueryParam){
|
||||
Page page = setPageParam(yxSystemStoreQueryParam,OrderItem.desc("add_time"));
|
||||
IPage<YxSystemStoreQueryVo> iPage = yxSystemStoreMapper.getYxSystemStorePageList(page,yxSystemStoreQueryParam);
|
||||
return new Paging(iPage);
|
||||
}
|
||||
|
@ -37,9 +37,10 @@ public class YxSystemStoreStaffServiceImpl extends BaseServiceImpl<YxSystemStore
|
||||
private YxSystemStoreStaffMapper yxSystemStoreStaffMapper;
|
||||
|
||||
@Override
|
||||
public boolean checkStatus(int uid) {
|
||||
public boolean checkStatus(int uid,int storeId) {
|
||||
YxSystemStoreStaff storeStaff = new YxSystemStoreStaff();
|
||||
storeStaff.setUid(uid);
|
||||
if(storeId > 0) storeStaff.setStoreId(storeId);
|
||||
return yxSystemStoreStaffMapper.selectCount(Wrappers.query(storeStaff)) > 0;
|
||||
}
|
||||
|
||||
|
@ -10,12 +10,17 @@ package co.yixiang.modules.shop.web.controller;
|
||||
|
||||
import cn.hutool.core.io.file.FileReader;
|
||||
import cn.hutool.core.io.resource.ClassPathResource;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.annotation.AnonymousAccess;
|
||||
import co.yixiang.common.api.ApiResult;
|
||||
import co.yixiang.constant.ShopConstants;
|
||||
import co.yixiang.modules.shop.service.YxStoreProductService;
|
||||
import co.yixiang.modules.shop.service.YxSystemGroupDataService;
|
||||
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.utils.FileUtil;
|
||||
import co.yixiang.utils.RedisUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -23,6 +28,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -46,6 +52,7 @@ public class IndexController {
|
||||
|
||||
private final YxSystemGroupDataService systemGroupDataService;
|
||||
private final YxStoreProductService storeProductService;
|
||||
private final YxSystemStoreService systemStoreService;
|
||||
|
||||
|
||||
|
||||
@ -122,6 +129,28 @@ public class IndexController {
|
||||
|
||||
|
||||
|
||||
@AnonymousAccess
|
||||
@GetMapping("/store_list")
|
||||
@ApiOperation(value = "获取门店列表",notes = "获取门店列表")
|
||||
public ApiResult<Object> storeList( YxSystemStoreQueryParam param){
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
List<YxSystemStoreQueryVo> lists;
|
||||
if(StrUtil.isBlank(param.getLatitude()) || StrUtil.isBlank(param.getLongitude())){
|
||||
lists = systemStoreService.getYxSystemStorePageList(param).getRecords();
|
||||
}else{
|
||||
lists = systemStoreService.getStoreList(
|
||||
param.getLatitude(),
|
||||
param.getLongitude(),
|
||||
param.getPage(),param.getLimit());
|
||||
}
|
||||
|
||||
map.put("list",lists);
|
||||
// map.put("mapKey",RedisUtil.get("tengxun_map_key"));
|
||||
return ApiResult.ok(map);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -119,10 +119,12 @@ public class StoreProductController extends BaseController {
|
||||
@Log(value = "查看商品详情",type = 1)
|
||||
@GetMapping("/product/detail/{id}")
|
||||
@ApiOperation(value = "普通商品详情",notes = "普通商品详情")
|
||||
public ApiResult<ProductDTO> detail(@PathVariable Integer id){
|
||||
public ApiResult<ProductDTO> detail(@PathVariable Integer id,
|
||||
@RequestParam(value = "") String latitude,
|
||||
@RequestParam(value = "") String longitude){
|
||||
int uid = SecurityUtils.getUserId().intValue();
|
||||
|
||||
ProductDTO productDTO = storeProductService.goodsDetail(id,0,uid);
|
||||
ProductDTO productDTO = storeProductService.goodsDetail(id,0,uid,latitude,longitude);
|
||||
|
||||
// 海报
|
||||
String siteUrl = systemConfigService.getData("site_url");
|
||||
|
@ -6,6 +6,9 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
import co.yixiang.common.web.param.QueryParam;
|
||||
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 门店自提 查询参数对象
|
||||
@ -16,7 +19,12 @@ import co.yixiang.common.web.param.QueryParam;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value="YxSystemStoreQueryParam对象", description="门店自提查询参数")
|
||||
@ApiModel(value="门店自提", description="门店自提查询参数")
|
||||
public class YxSystemStoreQueryParam extends QueryParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String latitude;
|
||||
|
||||
private String longitude;
|
||||
|
||||
}
|
||||
|
@ -70,4 +70,6 @@ public class YxSystemStoreQueryVo implements Serializable {
|
||||
|
||||
private Date validTimeStart;
|
||||
|
||||
private String distance;
|
||||
|
||||
}
|
@ -447,7 +447,7 @@ public class YxUserServiceImpl extends BaseServiceImpl<YxUserMapper, YxUser> imp
|
||||
}
|
||||
|
||||
//获取核销权限
|
||||
userQueryVo.setCheckStatus(systemStoreStaffService.checkStatus((int)id));
|
||||
userQueryVo.setCheckStatus(systemStoreStaffService.checkStatus((int)id,0));
|
||||
|
||||
return userQueryVo;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getYxSystemStorePageList" resultType="co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo">
|
||||
select <include refid="Base_Column_List"/> from yx_system_store
|
||||
select <include refid="Base_Column_List"/> from yx_system_store where is_show = 1 and is_del = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -1,5 +1,7 @@
|
||||
package co.yixiang.utils;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
|
||||
/**
|
||||
* @ClassName LocationUtils
|
||||
* @Author hupeng <610796224@qq.com>
|
||||
@ -13,7 +15,7 @@ public class LocationUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过经纬度获取距离(单位:米)
|
||||
* 通过经纬度获取距离(单位:千米)
|
||||
* @param lat1
|
||||
* @param lng1
|
||||
* @param lat2
|
||||
@ -31,7 +33,8 @@ public class LocationUtils {
|
||||
* Math.pow(Math.sin(b / 2), 2)));
|
||||
s = s * EARTH_RADIUS;
|
||||
s = Math.round(s * 10000d) / 10000d;
|
||||
s = s*1000;
|
||||
return s;
|
||||
//s = s*1000;
|
||||
return NumberUtil.round(s,2).doubleValue();
|
||||
//return s;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user