bug--代码规范优化,升级fastjson1.2.73
This commit is contained in:
2
pom.xml
2
pom.xml
@ -38,7 +38,7 @@
|
|||||||
<jedis.version>2.9.0</jedis.version>
|
<jedis.version>2.9.0</jedis.version>
|
||||||
<log4jdbc.version>1.16</log4jdbc.version>
|
<log4jdbc.version>1.16</log4jdbc.version>
|
||||||
<swagger.version>2.9.2</swagger.version>
|
<swagger.version>2.9.2</swagger.version>
|
||||||
<fastjson.version>1.2.70</fastjson.version>
|
<fastjson.version>1.2.73</fastjson.version>
|
||||||
<druid.version>1.1.10</druid.version>
|
<druid.version>1.1.10</druid.version>
|
||||||
<hutool.version>5.2.5</hutool.version>
|
<hutool.version>5.2.5</hutool.version>
|
||||||
<commons-pool2.version>2.5.0</commons-pool2.version>
|
<commons-pool2.version>2.5.0</commons-pool2.version>
|
||||||
|
@ -46,7 +46,9 @@ public class RedisServiceImpl implements RedisService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DataType dataType = redisTemplate.type(s.toString());
|
DataType dataType = redisTemplate.type(s.toString());
|
||||||
if(!dataType.code().equals("string")) continue;
|
if(!"string".equals(dataType.code())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
RedisVo redisVo = new RedisVo(s.toString(),redisTemplate.opsForValue().get(s.toString()).toString());
|
RedisVo redisVo = new RedisVo(s.toString(),redisTemplate.opsForValue().get(s.toString()).toString());
|
||||||
redisVos.add(redisVo);
|
redisVos.add(redisVo);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, Dept> implement
|
|||||||
if(isChild) {
|
if(isChild) {
|
||||||
depts.add(deptDto);
|
depts.add(deptDto);
|
||||||
for (Dept dept : deptList) {
|
for (Dept dept : deptList) {
|
||||||
if(dept.getId() == deptDto.getPid() && !deptNames.contains(dept.getName())){
|
if(dept.getId().equals(deptDto.getPid()) && !deptNames.contains(dept.getName())){
|
||||||
depts.add(deptDto);
|
depts.add(deptDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ public class JobServiceImpl extends BaseServiceImpl<JobMapper, Job> implements J
|
|||||||
//断权限范围
|
//断权限范围
|
||||||
for (Long deptId : criteria.getDeptIds()) {
|
for (Long deptId : criteria.getDeptIds()) {
|
||||||
for (Job job : jobList) {
|
for (Job job : jobList) {
|
||||||
if(deptId ==job.getDeptId()){
|
if(deptId.equals(job.getDeptId())){
|
||||||
job.setDept(deptService.getById(job.getDeptId()));
|
job.setDept(deptService.getById(job.getDeptId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,9 @@ public class MenuServiceImpl extends BaseServiceImpl<MenuMapper, Menu> implement
|
|||||||
|
|
||||||
if(StringUtils.isNotBlank(resources.getComponentName())&&resources.getType()!=0){
|
if(StringUtils.isNotBlank(resources.getComponentName())&&resources.getType()!=0){
|
||||||
int menuCount = this.lambdaQuery().eq(Menu::getComponentName,resources.getComponentName()).count();
|
int menuCount = this.lambdaQuery().eq(Menu::getComponentName,resources.getComponentName()).count();
|
||||||
if(menuCount > 1) throw new YshopException("请保持菜单组件名称唯一");
|
if(menuCount > 1) {
|
||||||
|
throw new YshopException("请保持菜单组件名称唯一");
|
||||||
|
}
|
||||||
menu1 = this.getOne(new QueryWrapper<Menu>().lambda()
|
menu1 = this.getOne(new QueryWrapper<Menu>().lambda()
|
||||||
.eq(Menu::getComponentName,resources.getComponentName()));
|
.eq(Menu::getComponentName,resources.getComponentName()));
|
||||||
if(menu1 != null && !menu1.getId().equals(menu.getId())){
|
if(menu1 != null && !menu1.getId().equals(menu.getId())){
|
||||||
|
@ -144,7 +144,9 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, User> imp
|
|||||||
public UserDto findByName(String userName) {
|
public UserDto findByName(String userName) {
|
||||||
User user = userMapper.findByName(userName);
|
User user = userMapper.findByName(userName);
|
||||||
|
|
||||||
if(user == null) throw new YshopException("当前用户不存在");
|
if(user == null) {
|
||||||
|
throw new YshopException("当前用户不存在");
|
||||||
|
}
|
||||||
//用户所属岗位
|
//用户所属岗位
|
||||||
user.setJob(jobService.getById(user.getJobId()));
|
user.setJob(jobService.getById(user.getJobId()));
|
||||||
//用户所属部门
|
//用户所属部门
|
||||||
|
@ -62,7 +62,9 @@ public class GlobalExceptionHandler {
|
|||||||
|
|
||||||
Collections.sort(list);
|
Collections.sort(list);
|
||||||
String msg = "不能为空";
|
String msg = "不能为空";
|
||||||
if(!list.isEmpty()) msg = list.get(0);
|
if(!list.isEmpty()) {
|
||||||
|
msg = list.get(0);
|
||||||
|
}
|
||||||
log.error(getApiCodeString(ApiCode.PARAMETER_EXCEPTION) + ":" + JSON.toJSONString(list));
|
log.error(getApiCodeString(ApiCode.PARAMETER_EXCEPTION) + ":" + JSON.toJSONString(list));
|
||||||
return ApiResult.fail(ApiCode.PARAMETER_EXCEPTION.getCode(), msg);
|
return ApiResult.fail(ApiCode.PARAMETER_EXCEPTION.getCode(), msg);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,9 @@ public class PermissionInterceptor extends HandlerInterceptorAdapter {
|
|||||||
Integer uid = map.get("uid").asInt();
|
Integer uid = map.get("uid").asInt();
|
||||||
Integer scope = map.get("scope").asInt();
|
Integer scope = map.get("scope").asInt();
|
||||||
YxUser user = userService.getById(uid);
|
YxUser user = userService.getById(uid);
|
||||||
if(user == null) throw new UnAuthenticatedException(ApiCode.NOT_PERMISSION);
|
if(user == null) {
|
||||||
|
throw new UnAuthenticatedException(ApiCode.NOT_PERMISSION);
|
||||||
|
}
|
||||||
LocalUser.set(user, scope);
|
LocalUser.set(user, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,8 +26,9 @@ public class JacksonUtil {
|
|||||||
try {
|
try {
|
||||||
node = mapper.readTree(body);
|
node = mapper.readTree(body);
|
||||||
JsonNode leaf = node.get(field);
|
JsonNode leaf = node.get(field);
|
||||||
if (leaf != null)
|
if (leaf != null) {
|
||||||
return leaf.asText();
|
return leaf.asText();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
@ -42,9 +43,10 @@ public class JacksonUtil {
|
|||||||
node = mapper.readTree(body);
|
node = mapper.readTree(body);
|
||||||
JsonNode leaf = node.get(field);
|
JsonNode leaf = node.get(field);
|
||||||
|
|
||||||
if (leaf != null)
|
if (leaf != null) {
|
||||||
return mapper.convertValue(leaf, new TypeReference<List<String>>() {
|
return mapper.convertValue(leaf, new TypeReference<List<String>>() {
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
@ -57,8 +59,9 @@ public class JacksonUtil {
|
|||||||
try {
|
try {
|
||||||
node = mapper.readTree(body);
|
node = mapper.readTree(body);
|
||||||
JsonNode leaf = node.get(field);
|
JsonNode leaf = node.get(field);
|
||||||
if (leaf != null)
|
if (leaf != null) {
|
||||||
return leaf.asInt();
|
return leaf.asInt();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
@ -72,9 +75,10 @@ public class JacksonUtil {
|
|||||||
node = mapper.readTree(body);
|
node = mapper.readTree(body);
|
||||||
JsonNode leaf = node.get(field);
|
JsonNode leaf = node.get(field);
|
||||||
|
|
||||||
if (leaf != null)
|
if (leaf != null) {
|
||||||
return mapper.convertValue(leaf, new TypeReference<List<Integer>>() {
|
return mapper.convertValue(leaf, new TypeReference<List<Integer>>() {
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
@ -88,8 +92,9 @@ public class JacksonUtil {
|
|||||||
try {
|
try {
|
||||||
node = mapper.readTree(body);
|
node = mapper.readTree(body);
|
||||||
JsonNode leaf = node.get(field);
|
JsonNode leaf = node.get(field);
|
||||||
if (leaf != null)
|
if (leaf != null) {
|
||||||
return leaf.asBoolean();
|
return leaf.asBoolean();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class SmsUtils {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public SmsUtils(RedisUtils redisUtils){
|
public SmsUtils(RedisUtils redisUtils){
|
||||||
this.redisUtils = redisUtils;
|
SmsUtils.redisUtils = redisUtils;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 发送短信
|
* 发送短信
|
||||||
|
@ -106,7 +106,9 @@ public class StoreBargainController {
|
|||||||
@GetMapping("/bargain/detail/{id}")
|
@GetMapping("/bargain/detail/{id}")
|
||||||
@ApiOperation(value = "砍价详情",notes = "砍价详情",response = YxStoreBargainQueryVo.class)
|
@ApiOperation(value = "砍价详情",notes = "砍价详情",response = YxStoreBargainQueryVo.class)
|
||||||
public ApiResult<BargainVo> getYxStoreBargain(@PathVariable Long id){
|
public ApiResult<BargainVo> getYxStoreBargain(@PathVariable Long id){
|
||||||
if(ObjectUtil.isNull(id)) throw new YshopException("参数错误");
|
if(ObjectUtil.isNull(id)) {
|
||||||
|
throw new YshopException("参数错误");
|
||||||
|
}
|
||||||
YxUser yxUser = LocalUser.getUser();
|
YxUser yxUser = LocalUser.getUser();
|
||||||
return ApiResult.ok(storeBargainService.getDetail(id,yxUser));
|
return ApiResult.ok(storeBargainService.getDetail(id,yxUser));
|
||||||
}
|
}
|
||||||
@ -270,7 +272,9 @@ public class StoreBargainController {
|
|||||||
Long uid = LocalUser.getUser().getUid();
|
Long uid = LocalUser.getUser().getUid();
|
||||||
List<YxStoreBargainUserQueryVo> yxStoreBargainUserQueryVos = storeBargainUserService
|
List<YxStoreBargainUserQueryVo> yxStoreBargainUserQueryVos = storeBargainUserService
|
||||||
.bargainUserList(uid,page,limit);
|
.bargainUserList(uid,page,limit);
|
||||||
if(yxStoreBargainUserQueryVos.isEmpty()) throw new YshopException("暂无参与砍价");
|
if(yxStoreBargainUserQueryVos.isEmpty()) {
|
||||||
|
throw new YshopException("暂无参与砍价");
|
||||||
|
}
|
||||||
return ApiResult.ok(yxStoreBargainUserQueryVos);
|
return ApiResult.ok(yxStoreBargainUserQueryVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,9 @@ public class StoreCombinationController {
|
|||||||
@GetMapping("/combination/detail/{id}")
|
@GetMapping("/combination/detail/{id}")
|
||||||
@ApiOperation(value = "拼团产品详情",notes = "拼团产品详情")
|
@ApiOperation(value = "拼团产品详情",notes = "拼团产品详情")
|
||||||
public ApiResult<StoreCombinationVo> detail(@PathVariable Long id){
|
public ApiResult<StoreCombinationVo> detail(@PathVariable Long id){
|
||||||
if(ObjectUtil.isNull(id)) throw new YshopException("参数错误");
|
if(ObjectUtil.isNull(id)) {
|
||||||
|
throw new YshopException("参数错误");
|
||||||
|
}
|
||||||
Long uid = LocalUser.getUser().getUid();
|
Long uid = LocalUser.getUser().getUid();
|
||||||
StoreCombinationVo storeCombinationVo = storeCombinationService.getDetail(id,uid);
|
StoreCombinationVo storeCombinationVo = storeCombinationService.getDetail(id,uid);
|
||||||
storeCombinationVo.setUserCollect(relationService
|
storeCombinationVo.setUserCollect(relationService
|
||||||
@ -106,7 +108,9 @@ public class StoreCombinationController {
|
|||||||
@GetMapping("/combination/pink/{id}")
|
@GetMapping("/combination/pink/{id}")
|
||||||
@ApiOperation(value = "拼团明细",notes = "拼团明细")
|
@ApiOperation(value = "拼团明细",notes = "拼团明细")
|
||||||
public ApiResult<PinkInfoVo> pink(@PathVariable Long id){
|
public ApiResult<PinkInfoVo> pink(@PathVariable Long id){
|
||||||
if(ObjectUtil.isNull(id)) throw new YshopException("参数错误");
|
if(ObjectUtil.isNull(id)) {
|
||||||
|
throw new YshopException("参数错误");
|
||||||
|
}
|
||||||
Long uid = LocalUser.getUser().getUid();
|
Long uid = LocalUser.getUser().getUid();
|
||||||
return ApiResult.ok(storePinkService.pinkInfo(id,uid));
|
return ApiResult.ok(storePinkService.pinkInfo(id,uid));
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ public class StoreSeckillController {
|
|||||||
SimpleDateFormat sdf = new SimpleDateFormat("HH");
|
SimpleDateFormat sdf = new SimpleDateFormat("HH");
|
||||||
String nowTime = sdf.format(new Date());
|
String nowTime = sdf.format(new Date());
|
||||||
String index = nowTime.substring(0, 1);
|
String index = nowTime.substring(0, 1);
|
||||||
int currentHour = index.equals("0") ? Integer.valueOf(nowTime.substring(1, 2)) : Integer.valueOf(nowTime);
|
int currentHour = "0".equals(index) ? Integer.valueOf(nowTime.substring(1, 2)) : Integer.valueOf(nowTime);
|
||||||
SeckillTimeDto seckillTimeDto = new SeckillTimeDto();
|
SeckillTimeDto seckillTimeDto = new SeckillTimeDto();
|
||||||
seckillTimeDto.setId(i.getId());
|
seckillTimeDto.setId(i.getId());
|
||||||
//活动结束时间
|
//活动结束时间
|
||||||
|
@ -143,7 +143,9 @@ public class AuthController {
|
|||||||
.eq(YxUser::getUsername,loginDTO.getUsername())
|
.eq(YxUser::getUsername,loginDTO.getUsername())
|
||||||
.eq(YxUser::getPassword,SecureUtil.md5(loginDTO.getPassword())),false);
|
.eq(YxUser::getPassword,SecureUtil.md5(loginDTO.getPassword())),false);
|
||||||
|
|
||||||
if(yxUser == null) throw new YshopException("账号或者密码不正确");
|
if(yxUser == null) {
|
||||||
|
throw new YshopException("账号或者密码不正确");
|
||||||
|
}
|
||||||
|
|
||||||
String token = JwtToken.makeToken(yxUser.getUid());
|
String token = JwtToken.makeToken(yxUser.getUid());
|
||||||
String expiresTimeStr = JwtToken.getExpireTime(token);
|
String expiresTimeStr = JwtToken.getExpireTime(token);
|
||||||
|
@ -106,7 +106,9 @@ public class ShoperController {
|
|||||||
@GetMapping("/admin/order/detail/{key}")
|
@GetMapping("/admin/order/detail/{key}")
|
||||||
@ApiOperation(value = "订单详情",notes = "订单详情")
|
@ApiOperation(value = "订单详情",notes = "订单详情")
|
||||||
public ApiResult<YxStoreOrderQueryVo> orderDetail(@PathVariable String key){
|
public ApiResult<YxStoreOrderQueryVo> orderDetail(@PathVariable String key){
|
||||||
if(StrUtil.isEmpty(key)) throw new YshopException("参数错误");
|
if(StrUtil.isEmpty(key)) {
|
||||||
|
throw new YshopException("参数错误");
|
||||||
|
}
|
||||||
YxStoreOrderQueryVo storeOrder = storeOrderService.getOrderInfo(key,null);
|
YxStoreOrderQueryVo storeOrder = storeOrderService.getOrderInfo(key,null);
|
||||||
if(ObjectUtil.isNull(storeOrder)){
|
if(ObjectUtil.isNull(storeOrder)){
|
||||||
throw new YshopException("订单不存在");
|
throw new YshopException("订单不存在");
|
||||||
|
@ -155,7 +155,9 @@ public class StoreOrderController {
|
|||||||
//创建订单
|
//创建订单
|
||||||
YxStoreOrder order = storeOrderService.createOrder(yxUser,key,param);
|
YxStoreOrder order = storeOrderService.createOrder(yxUser,key,param);
|
||||||
|
|
||||||
if(ObjectUtil.isNull(order)) throw new YshopException("订单生成失败");
|
if(ObjectUtil.isNull(order)) {
|
||||||
|
throw new YshopException("订单生成失败");
|
||||||
|
}
|
||||||
|
|
||||||
String orderId = order.getOrderId();
|
String orderId = order.getOrderId();
|
||||||
|
|
||||||
@ -190,7 +192,9 @@ public class StoreOrderController {
|
|||||||
Long uid = LocalUser.getUser().getUid();
|
Long uid = LocalUser.getUser().getUid();
|
||||||
YxStoreOrderQueryVo storeOrder = storeOrderService
|
YxStoreOrderQueryVo storeOrder = storeOrderService
|
||||||
.getOrderInfo(param.getUni(),uid);
|
.getOrderInfo(param.getUni(),uid);
|
||||||
if(ObjectUtil.isNull(storeOrder)) throw new YshopException("订单不存在");
|
if(ObjectUtil.isNull(storeOrder)) {
|
||||||
|
throw new YshopException("订单不存在");
|
||||||
|
}
|
||||||
|
|
||||||
if(OrderInfoEnum.REFUND_STATUS_1.getValue().equals(storeOrder.getPaid())) {
|
if(OrderInfoEnum.REFUND_STATUS_1.getValue().equals(storeOrder.getPaid())) {
|
||||||
throw new YshopException("该订单已支付");
|
throw new YshopException("该订单已支付");
|
||||||
@ -245,7 +249,9 @@ public class StoreOrderController {
|
|||||||
@ApiOperation(value = "订单详情",notes = "订单详情")
|
@ApiOperation(value = "订单详情",notes = "订单详情")
|
||||||
public ApiResult<YxStoreOrderQueryVo> detail(@PathVariable String key){
|
public ApiResult<YxStoreOrderQueryVo> detail(@PathVariable String key){
|
||||||
Long uid = LocalUser.getUser().getUid();
|
Long uid = LocalUser.getUser().getUid();
|
||||||
if(StrUtil.isEmpty(key)) throw new YshopException("参数错误");
|
if(StrUtil.isEmpty(key)) {
|
||||||
|
throw new YshopException("参数错误");
|
||||||
|
}
|
||||||
YxStoreOrderQueryVo storeOrder = storeOrderService.getOrderInfo(key,uid);
|
YxStoreOrderQueryVo storeOrder = storeOrderService.getOrderInfo(key,uid);
|
||||||
if(ObjectUtil.isNull(storeOrder)){
|
if(ObjectUtil.isNull(storeOrder)){
|
||||||
throw new YshopException("订单不存在");
|
throw new YshopException("订单不存在");
|
||||||
@ -363,7 +369,9 @@ public class StoreOrderController {
|
|||||||
ExpressService expressService = ExpressAutoConfiguration.expressService();
|
ExpressService expressService = ExpressAutoConfiguration.expressService();
|
||||||
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(),
|
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(),
|
||||||
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode());
|
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode());
|
||||||
if(!expressInfo.isSuccess()) throw new YshopException(expressInfo.getReason());
|
if(!expressInfo.isSuccess()) {
|
||||||
|
throw new YshopException(expressInfo.getReason());
|
||||||
|
}
|
||||||
return ApiResult.ok(expressInfo);
|
return ApiResult.ok(expressInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +386,9 @@ public class StoreOrderController {
|
|||||||
Long uid = LocalUser.getUser().getUid();
|
Long uid = LocalUser.getUser().getUid();
|
||||||
YxStoreOrderQueryVo orderQueryVo = storeOrderService.verificOrder(param.getVerifyCode(),
|
YxStoreOrderQueryVo orderQueryVo = storeOrderService.verificOrder(param.getVerifyCode(),
|
||||||
param.getIsConfirm(),uid);
|
param.getIsConfirm(),uid);
|
||||||
if(orderQueryVo != null) return ApiResult.ok(orderQueryVo);
|
if(orderQueryVo != null) {
|
||||||
|
return ApiResult.ok(orderQueryVo);
|
||||||
|
}
|
||||||
|
|
||||||
return ApiResult.ok("核销成功");
|
return ApiResult.ok("核销成功");
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,9 @@ public class StoreProductController {
|
|||||||
@ApiOperation(value = "添加收藏",notes = "添加收藏")
|
@ApiOperation(value = "添加收藏",notes = "添加收藏")
|
||||||
public ApiResult<Boolean> collectAdd(@Validated @RequestBody YxStoreProductRelationQueryParam param){
|
public ApiResult<Boolean> collectAdd(@Validated @RequestBody YxStoreProductRelationQueryParam param){
|
||||||
long uid = LocalUser.getUser().getUid();
|
long uid = LocalUser.getUser().getUid();
|
||||||
if(!NumberUtil.isNumber(param.getId())) throw new YshopException("参数非法");
|
if(!NumberUtil.isNumber(param.getId())) {
|
||||||
|
throw new YshopException("参数非法");
|
||||||
|
}
|
||||||
productRelationService.addRroductRelation(Long.valueOf(param.getId()),uid);
|
productRelationService.addRroductRelation(Long.valueOf(param.getId()),uid);
|
||||||
return ApiResult.ok();
|
return ApiResult.ok();
|
||||||
}
|
}
|
||||||
@ -239,7 +241,9 @@ public class StoreProductController {
|
|||||||
@ApiOperation(value = "取消收藏",notes = "取消收藏")
|
@ApiOperation(value = "取消收藏",notes = "取消收藏")
|
||||||
public ApiResult<Boolean> collectDel(@Validated @RequestBody YxStoreProductRelationQueryParam param){
|
public ApiResult<Boolean> collectDel(@Validated @RequestBody YxStoreProductRelationQueryParam param){
|
||||||
long uid = LocalUser.getUser().getUid();
|
long uid = LocalUser.getUser().getUid();
|
||||||
if(!NumberUtil.isNumber(param.getId())) throw new YshopException("参数非法");
|
if(!NumberUtil.isNumber(param.getId())) {
|
||||||
|
throw new YshopException("参数非法");
|
||||||
|
}
|
||||||
productRelationService.delRroductRelation(Long.valueOf(param.getId()),
|
productRelationService.delRroductRelation(Long.valueOf(param.getId()),
|
||||||
uid);
|
uid);
|
||||||
return ApiResult.ok();
|
return ApiResult.ok();
|
||||||
|
@ -79,7 +79,9 @@ public class CreatShareProductService {
|
|||||||
//门店
|
//门店
|
||||||
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().equals(storeOrder.getShippingType())){
|
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().equals(storeOrder.getShippingType())){
|
||||||
String mapKey = RedisUtil.get(SystemConfigConstants.TENGXUN_MAP_KEY);
|
String mapKey = RedisUtil.get(SystemConfigConstants.TENGXUN_MAP_KEY);
|
||||||
if(StrUtil.isBlank(mapKey)) throw new YshopException("请配置腾讯地图key");
|
if(StrUtil.isBlank(mapKey)) {
|
||||||
|
throw new YshopException("请配置腾讯地图key");
|
||||||
|
}
|
||||||
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
|
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
|
||||||
if(StrUtil.isEmpty(apiUrl)){
|
if(StrUtil.isEmpty(apiUrl)){
|
||||||
throw new YshopException("未配置api地址");
|
throw new YshopException("未配置api地址");
|
||||||
@ -463,9 +465,13 @@ public class CreatShareProductService {
|
|||||||
String apiUrl,String path){
|
String apiUrl,String path){
|
||||||
Long uid = userInfo.getUid();
|
Long uid = userInfo.getUid();
|
||||||
YxStorePink storePink = storePinkService.getById(pinkId);
|
YxStorePink storePink = storePinkService.getById(pinkId);
|
||||||
if(ObjectUtil.isNull(storePink)) throw new YshopException("拼团不存在");
|
if(ObjectUtil.isNull(storePink)) {
|
||||||
|
throw new YshopException("拼团不存在");
|
||||||
|
}
|
||||||
YxStoreCombination storeCombination = storeCombinationService.getById(storePink.getCid());
|
YxStoreCombination storeCombination = storeCombinationService.getById(storePink.getCid());
|
||||||
if(ObjectUtil.isNull(storeCombination)) throw new YshopException("拼团产品不存在");
|
if(ObjectUtil.isNull(storeCombination)) {
|
||||||
|
throw new YshopException("拼团产品不存在");
|
||||||
|
}
|
||||||
|
|
||||||
String userType = userInfo.getUserType();
|
String userType = userInfo.getUserType();
|
||||||
if(StrUtil.isBlank(userType)) {
|
if(StrUtil.isBlank(userType)) {
|
||||||
|
@ -105,7 +105,9 @@ public class OrderSupplyService {
|
|||||||
*/
|
*/
|
||||||
public Map<String,Object> check(Long uid,String key, ComputeOrderParam param){
|
public Map<String,Object> check(Long uid,String key, ComputeOrderParam param){
|
||||||
Map<String,Object> map = Maps.newHashMap();
|
Map<String,Object> map = Maps.newHashMap();
|
||||||
if(StrUtil.isBlank(key)) throw new YshopException("参数错误");
|
if(StrUtil.isBlank(key)) {
|
||||||
|
throw new YshopException("参数错误");
|
||||||
|
}
|
||||||
YxStoreOrderQueryVo storeOrder = storeOrderService.getOrderInfo(key,uid);
|
YxStoreOrderQueryVo storeOrder = storeOrderService.getOrderInfo(key,uid);
|
||||||
if(ObjectUtil.isNotNull(storeOrder)){
|
if(ObjectUtil.isNotNull(storeOrder)){
|
||||||
|
|
||||||
@ -124,7 +126,9 @@ public class OrderSupplyService {
|
|||||||
if(bargainId > 0){
|
if(bargainId > 0){
|
||||||
YxStoreBargainUser storeBargainUser = storeBargainUserService
|
YxStoreBargainUser storeBargainUser = storeBargainUserService
|
||||||
.getBargainUserInfo(bargainId,uid);
|
.getBargainUserInfo(bargainId,uid);
|
||||||
if(storeBargainUser == null) throw new YshopException("砍价失败");
|
if(storeBargainUser == null) {
|
||||||
|
throw new YshopException("砍价失败");
|
||||||
|
}
|
||||||
if(OrderInfoEnum.BARGAIN_STATUS_3.getValue().equals(storeBargainUser.getStatus())) {
|
if(OrderInfoEnum.BARGAIN_STATUS_3.getValue().equals(storeBargainUser.getStatus())) {
|
||||||
throw new YshopException("砍价已支付");
|
throw new YshopException("砍价已支付");
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,9 @@ public class UserBillController {
|
|||||||
@RequestParam(value = "limit",defaultValue = "10") int limit,
|
@RequestParam(value = "limit",defaultValue = "10") int limit,
|
||||||
@PathVariable String type){
|
@PathVariable String type){
|
||||||
int newType = 0;
|
int newType = 0;
|
||||||
if(NumberUtil.isNumber(type)) newType = Integer.valueOf(type);
|
if(NumberUtil.isNumber(type)) {
|
||||||
|
newType = Integer.valueOf(type);
|
||||||
|
}
|
||||||
Long uid = LocalUser.getUser().getUid();
|
Long uid = LocalUser.getUser().getUid();
|
||||||
return ApiResult.ok(userBillService.getUserBillList(page,limit,uid,newType));
|
return ApiResult.ok(userBillService.getUserBillList(page,limit,uid,newType));
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,9 @@ public class UserRechargeController {
|
|||||||
Map<String,Object> map = new LinkedHashMap<>();
|
Map<String,Object> map = new LinkedHashMap<>();
|
||||||
map.put("type",param.getFrom());
|
map.put("type",param.getFrom());
|
||||||
YxSystemGroupData systemGroupData = systemGroupDataService.getById(param.getRecharId());
|
YxSystemGroupData systemGroupData = systemGroupDataService.getById(param.getRecharId());
|
||||||
if(systemGroupData == null) throw new YshopException("充值方案不存在");
|
if(systemGroupData == null) {
|
||||||
|
throw new YshopException("充值方案不存在");
|
||||||
|
}
|
||||||
|
|
||||||
JSONObject jsonObject = JSON.parseObject(systemGroupData.getValue());
|
JSONObject jsonObject = JSON.parseObject(systemGroupData.getValue());
|
||||||
String price = jsonObject.getString("price");
|
String price = jsonObject.getString("price");
|
||||||
|
@ -134,14 +134,20 @@ public class WechatController {
|
|||||||
public String renotify(@RequestBody String xmlData) {
|
public String renotify(@RequestBody String xmlData) {
|
||||||
try {
|
try {
|
||||||
WxPayService wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WECHAT);
|
WxPayService wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WECHAT);
|
||||||
if(wxPayService == null) wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WXAPP);
|
if(wxPayService == null) {
|
||||||
if(wxPayService == null) wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.APP);
|
wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WXAPP);
|
||||||
|
}
|
||||||
|
if(wxPayService == null) {
|
||||||
|
wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.APP);
|
||||||
|
}
|
||||||
WxPayOrderNotifyResult notifyResult = wxPayService.parseOrderNotifyResult(xmlData);
|
WxPayOrderNotifyResult notifyResult = wxPayService.parseOrderNotifyResult(xmlData);
|
||||||
String orderId = notifyResult.getOutTradeNo();
|
String orderId = notifyResult.getOutTradeNo();
|
||||||
String attach = notifyResult.getAttach();
|
String attach = notifyResult.getAttach();
|
||||||
if(BillDetailEnum.TYPE_3.getValue().equals(attach)){
|
if(BillDetailEnum.TYPE_3.getValue().equals(attach)){
|
||||||
YxStoreOrderQueryVo orderInfo = orderService.getOrderInfo(orderId,null);
|
YxStoreOrderQueryVo orderInfo = orderService.getOrderInfo(orderId,null);
|
||||||
if(orderInfo == null) return WxPayNotifyResponse.success("处理成功!");
|
if(orderInfo == null) {
|
||||||
|
return WxPayNotifyResponse.success("处理成功!");
|
||||||
|
}
|
||||||
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())){
|
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())){
|
||||||
return WxPayNotifyResponse.success("处理成功!");
|
return WxPayNotifyResponse.success("处理成功!");
|
||||||
}
|
}
|
||||||
@ -149,7 +155,9 @@ public class WechatController {
|
|||||||
}else if(BillDetailEnum.TYPE_1.getValue().equals(attach)){
|
}else if(BillDetailEnum.TYPE_1.getValue().equals(attach)){
|
||||||
//处理充值
|
//处理充值
|
||||||
YxUserRecharge userRecharge = userRechargeService.getInfoByOrderId(orderId);
|
YxUserRecharge userRecharge = userRechargeService.getInfoByOrderId(orderId);
|
||||||
if(userRecharge == null) return WxPayNotifyResponse.success("处理成功!");
|
if(userRecharge == null) {
|
||||||
|
return WxPayNotifyResponse.success("处理成功!");
|
||||||
|
}
|
||||||
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(userRecharge.getPaid())){
|
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(userRecharge.getPaid())){
|
||||||
return WxPayNotifyResponse.success("处理成功!");
|
return WxPayNotifyResponse.success("处理成功!");
|
||||||
}
|
}
|
||||||
@ -173,8 +181,12 @@ public class WechatController {
|
|||||||
public String parseRefundNotifyResult(@RequestBody String xmlData) {
|
public String parseRefundNotifyResult(@RequestBody String xmlData) {
|
||||||
try {
|
try {
|
||||||
WxPayService wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WECHAT);
|
WxPayService wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WECHAT);
|
||||||
if(wxPayService == null) wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WXAPP);
|
if(wxPayService == null) {
|
||||||
if(wxPayService == null) wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.APP);
|
wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WXAPP);
|
||||||
|
}
|
||||||
|
if(wxPayService == null) {
|
||||||
|
wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.APP);
|
||||||
|
}
|
||||||
WxPayRefundNotifyResult result = wxPayService.parseRefundNotifyResult(xmlData);
|
WxPayRefundNotifyResult result = wxPayService.parseRefundNotifyResult(xmlData);
|
||||||
String orderId = result.getReqInfo().getOutTradeNo();
|
String orderId = result.getReqInfo().getOutTradeNo();
|
||||||
BigDecimal refundFee = BigNum.div(result.getReqInfo().getRefundFee(), 100);
|
BigDecimal refundFee = BigNum.div(result.getReqInfo().getRefundFee(), 100);
|
||||||
@ -242,14 +254,18 @@ public class WechatController {
|
|||||||
// 明文传输的消息
|
// 明文传输的消息
|
||||||
WxMpXmlMessage inMessage = WxMpXmlMessage.fromXml(requestBody);
|
WxMpXmlMessage inMessage = WxMpXmlMessage.fromXml(requestBody);
|
||||||
WxMpXmlOutMessage outMessage = this.route(inMessage);
|
WxMpXmlOutMessage outMessage = this.route(inMessage);
|
||||||
if(outMessage == null) return;
|
if(outMessage == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
out = outMessage.toXml();;
|
out = outMessage.toXml();;
|
||||||
} else if ("aes".equalsIgnoreCase(encType)) {
|
} else if ("aes".equalsIgnoreCase(encType)) {
|
||||||
// aes加密的消息
|
// aes加密的消息
|
||||||
WxMpXmlMessage inMessage = WxMpXmlMessage.fromEncryptedXml(requestBody, wxService.getWxMpConfigStorage(),
|
WxMpXmlMessage inMessage = WxMpXmlMessage.fromEncryptedXml(requestBody, wxService.getWxMpConfigStorage(),
|
||||||
timestamp, nonce, msgSignature);
|
timestamp, nonce, msgSignature);
|
||||||
WxMpXmlOutMessage outMessage = this.route(inMessage);
|
WxMpXmlOutMessage outMessage = this.route(inMessage);
|
||||||
if(outMessage == null) return;
|
if(outMessage == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
out = outMessage.toEncryptedXml(wxService.getWxMpConfigStorage());
|
out = outMessage.toEncryptedXml(wxService.getWxMpConfigStorage());
|
||||||
}
|
}
|
||||||
|
@ -169,5 +169,7 @@ public interface ShopConstants {
|
|||||||
|
|
||||||
String YSHOP_APP_LOGIN_USER = "app-online-token";
|
String YSHOP_APP_LOGIN_USER = "app-online-token";
|
||||||
|
|
||||||
|
String YSHOP_WECHAT_PUSH_REMARK = "yshop为您服务!";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -569,8 +569,9 @@ public class PrintUtil4 {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String substring(String str, int f, int t) {
|
public static String substring(String str, int f, int t) {
|
||||||
if (f > str.length())
|
if (f > str.length()) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
if (t > str.length()) {
|
if (t > str.length()) {
|
||||||
return str.substring(f, str.length());
|
return str.substring(f, str.length());
|
||||||
} else {
|
} else {
|
||||||
|
@ -27,7 +27,7 @@ public class OrderUtil {
|
|||||||
* @return
|
* @return
|
||||||
**/
|
**/
|
||||||
public static int getSecondTimestamp(){
|
public static int getSecondTimestamp(){
|
||||||
String timestamp = String.valueOf(new Date().getTime()/1000);
|
String timestamp = String.valueOf(System.currentTimeMillis()/1000);
|
||||||
return Integer.valueOf(timestamp);
|
return Integer.valueOf(timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +42,9 @@ public class OrderUtil {
|
|||||||
public static String checkActivityStatus(Date starTime,Date endTime,Integer status){
|
public static String checkActivityStatus(Date starTime,Date endTime,Integer status){
|
||||||
Date nowTime = new Date();
|
Date nowTime = new Date();
|
||||||
|
|
||||||
if(ShopCommonEnum.IS_STATUS_0.getValue().equals(status)) return "关闭";
|
if(ShopCommonEnum.IS_STATUS_0.getValue().equals(status)) {
|
||||||
|
return "关闭";
|
||||||
|
}
|
||||||
|
|
||||||
if(DateUtil.compare(starTime,nowTime) > 0){
|
if(DateUtil.compare(starTime,nowTime) > 0){
|
||||||
return "活动未开始";
|
return "活动未开始";
|
||||||
@ -131,7 +133,7 @@ public class OrderUtil {
|
|||||||
* @return
|
* @return
|
||||||
**/
|
**/
|
||||||
public static int getSecondTimestampTwo() {
|
public static int getSecondTimestampTwo() {
|
||||||
String timestamp = String.valueOf(new Date().getTime() / 1000);
|
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||||
return Integer.valueOf(timestamp);
|
return Integer.valueOf(timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,9 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
|||||||
@Override
|
@Override
|
||||||
public void decStockIncSales(int num, Long bargainId) {
|
public void decStockIncSales(int num, Long bargainId) {
|
||||||
int res = yxStoreBargainMapper.decStockIncSales(num,bargainId);
|
int res = yxStoreBargainMapper.decStockIncSales(num,bargainId);
|
||||||
if(res == 0) throw new YshopException("砍价产品库存不足");
|
if(res == 0) {
|
||||||
|
throw new YshopException("砍价产品库存不足");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
@ -133,14 +135,18 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
|||||||
//用户剩余要砍掉的价格
|
//用户剩余要砍掉的价格
|
||||||
double surplusPrice = NumberUtil.sub(coverPrice,
|
double surplusPrice = NumberUtil.sub(coverPrice,
|
||||||
storeBargainUser.getPrice()).doubleValue();
|
storeBargainUser.getPrice()).doubleValue();
|
||||||
if(surplusPrice == 0) return;
|
if(surplusPrice == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//生成一个区间随机数
|
//生成一个区间随机数
|
||||||
random = OrderUtil.randomNumber(
|
random = OrderUtil.randomNumber(
|
||||||
storeBargain.getBargainMinPrice().doubleValue(),
|
storeBargain.getBargainMinPrice().doubleValue(),
|
||||||
storeBargain.getBargainMaxPrice().doubleValue());
|
storeBargain.getBargainMaxPrice().doubleValue());
|
||||||
if(random > surplusPrice) random = surplusPrice;
|
if(random > surplusPrice) {
|
||||||
|
random = surplusPrice;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -174,7 +180,9 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TopCountVo topCount(Long bargainId) {
|
public TopCountVo topCount(Long bargainId) {
|
||||||
if(bargainId != null) this.addBargainShare(bargainId);
|
if(bargainId != null) {
|
||||||
|
this.addBargainShare(bargainId);
|
||||||
|
}
|
||||||
return TopCountVo.builder()
|
return TopCountVo.builder()
|
||||||
.lookCount(yxStoreBargainMapper.lookCount())
|
.lookCount(yxStoreBargainMapper.lookCount())
|
||||||
.shareCount(yxStoreBargainMapper.shareCount())
|
.shareCount(yxStoreBargainMapper.shareCount())
|
||||||
@ -214,7 +222,9 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
|||||||
.eq(YxStoreBargainUserHelp::getUid,myUid)
|
.eq(YxStoreBargainUserHelp::getUid,myUid)
|
||||||
.count();
|
.count();
|
||||||
|
|
||||||
if(helpCount > 0) userBargainStatus = false;
|
if(helpCount > 0) {
|
||||||
|
userBargainStatus = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int count = storeBargainUserHelpService
|
int count = storeBargainUserHelpService
|
||||||
@ -268,7 +278,9 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
|||||||
.ge(YxStoreBargain::getStopTime,now)
|
.ge(YxStoreBargain::getStopTime,now)
|
||||||
.one();
|
.one();
|
||||||
|
|
||||||
if(storeBargain == null) throw new YshopException("砍价已结束");
|
if(storeBargain == null) {
|
||||||
|
throw new YshopException("砍价已结束");
|
||||||
|
}
|
||||||
|
|
||||||
this.addBargainLook(id);
|
this.addBargainLook(id);
|
||||||
|
|
||||||
|
@ -65,12 +65,18 @@ public class YxStoreBargainUserServiceImpl extends BaseServiceImpl<YxStoreBargai
|
|||||||
@Override
|
@Override
|
||||||
public void setBargainUserStatus(Long bargainId, Long uid) {
|
public void setBargainUserStatus(Long bargainId, Long uid) {
|
||||||
YxStoreBargainUser storeBargainUser = getBargainUserInfo(bargainId.longValue(),uid);
|
YxStoreBargainUser storeBargainUser = getBargainUserInfo(bargainId.longValue(),uid);
|
||||||
if(ObjectUtil.isNull(storeBargainUser)) return;
|
if(ObjectUtil.isNull(storeBargainUser)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(storeBargainUser.getStatus() != 1) return;
|
if(storeBargainUser.getStatus() != 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
double price = NumberUtil.sub(NumberUtil.sub(storeBargainUser.getBargainPrice(),
|
double price = NumberUtil.sub(NumberUtil.sub(storeBargainUser.getBargainPrice(),
|
||||||
storeBargainUser.getBargainPriceMin()),storeBargainUser.getPrice()).doubleValue();
|
storeBargainUser.getBargainPriceMin()),storeBargainUser.getPrice()).doubleValue();
|
||||||
if(price > 0) return;
|
if(price > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
storeBargainUser.setStatus(3);
|
storeBargainUser.setStatus(3);
|
||||||
|
|
||||||
@ -85,7 +91,9 @@ public class YxStoreBargainUserServiceImpl extends BaseServiceImpl<YxStoreBargai
|
|||||||
@Override
|
@Override
|
||||||
public void bargainCancel(Long bargainId, Long uid) {
|
public void bargainCancel(Long bargainId, Long uid) {
|
||||||
YxStoreBargainUser storeBargainUser = this.getBargainUserInfo(bargainId,uid);
|
YxStoreBargainUser storeBargainUser = this.getBargainUserInfo(bargainId,uid);
|
||||||
if(ObjectUtil.isNull(storeBargainUser)) throw new YshopException("数据不存在");
|
if(ObjectUtil.isNull(storeBargainUser)) {
|
||||||
|
throw new YshopException("数据不存在");
|
||||||
|
}
|
||||||
if(!OrderInfoEnum.BARGAIN_STATUS_1.getValue().equals(storeBargainUser.getStatus())){
|
if(!OrderInfoEnum.BARGAIN_STATUS_1.getValue().equals(storeBargainUser.getStatus())){
|
||||||
throw new YshopException("状态错误");
|
throw new YshopException("状态错误");
|
||||||
}
|
}
|
||||||
@ -125,7 +133,9 @@ public class YxStoreBargainUserServiceImpl extends BaseServiceImpl<YxStoreBargai
|
|||||||
.eq(YxStoreBargainUserHelp::getBargainUserId,storeBargainUser.getId())
|
.eq(YxStoreBargainUserHelp::getBargainUserId,storeBargainUser.getId())
|
||||||
.eq(YxStoreBargainUserHelp::getUid,uid)
|
.eq(YxStoreBargainUserHelp::getUid,uid)
|
||||||
.count();
|
.count();
|
||||||
if(count == 0) return true;
|
if(count == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,9 +147,13 @@ public class YxStoreBargainUserServiceImpl extends BaseServiceImpl<YxStoreBargai
|
|||||||
@Override
|
@Override
|
||||||
public void setBargain(Long bargainId, Long uid) {
|
public void setBargain(Long bargainId, Long uid) {
|
||||||
YxStoreBargainUser storeBargainUser = this.getBargainUserInfo(bargainId,uid);
|
YxStoreBargainUser storeBargainUser = this.getBargainUserInfo(bargainId,uid);
|
||||||
if(storeBargainUser != null) throw new YshopException("你已经参与了");
|
if(storeBargainUser != null) {
|
||||||
|
throw new YshopException("你已经参与了");
|
||||||
|
}
|
||||||
YxStoreBargain storeBargain = storeBargainService.getById(bargainId);
|
YxStoreBargain storeBargain = storeBargainService.getById(bargainId);
|
||||||
if(storeBargain == null) throw new YshopException("砍价商品不存在");
|
if(storeBargain == null) {
|
||||||
|
throw new YshopException("砍价商品不存在");
|
||||||
|
}
|
||||||
YxStoreBargainUser yxStoreBargainUser = YxStoreBargainUser
|
YxStoreBargainUser yxStoreBargainUser = YxStoreBargainUser
|
||||||
.builder()
|
.builder()
|
||||||
.bargainId(bargainId)
|
.bargainId(bargainId)
|
||||||
|
@ -105,7 +105,9 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
|
|||||||
@Override
|
@Override
|
||||||
public void decStockIncSales(int num, Long combinationId) {
|
public void decStockIncSales(int num, Long combinationId) {
|
||||||
int res = yxStoreCombinationMapper.decStockIncSales(num,combinationId);
|
int res = yxStoreCombinationMapper.decStockIncSales(num,combinationId);
|
||||||
if(res == 0) throw new YshopException("拼团产品库存不足");
|
if(res == 0) {
|
||||||
|
throw new YshopException("拼团产品库存不足");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -315,7 +317,9 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
|
|||||||
//添加商品
|
//添加商品
|
||||||
YxStoreCombination yxStoreCombination = new YxStoreCombination();
|
YxStoreCombination yxStoreCombination = new YxStoreCombination();
|
||||||
BeanUtil.copyProperties(resources,yxStoreCombination,"images");
|
BeanUtil.copyProperties(resources,yxStoreCombination,"images");
|
||||||
if(resources.getImages().isEmpty()) throw new YshopException("请上传轮播图");
|
if(resources.getImages().isEmpty()) {
|
||||||
|
throw new YshopException("请上传轮播图");
|
||||||
|
}
|
||||||
|
|
||||||
yxStoreCombination.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice()));
|
yxStoreCombination.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice()));
|
||||||
yxStoreCombination.setCost(resultDTO.getMinCost().intValue());
|
yxStoreCombination.setCost(resultDTO.getMinCost().intValue());
|
||||||
@ -379,7 +383,9 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
|
|||||||
.reduce(Integer::sum)
|
.reduce(Integer::sum)
|
||||||
.orElse(0);
|
.orElse(0);
|
||||||
|
|
||||||
if(stock <= 0) throw new YshopException("库存不能低于0");
|
if(stock <= 0) {
|
||||||
|
throw new YshopException("库存不能低于0");
|
||||||
|
}
|
||||||
|
|
||||||
return ProductResultDto.builder()
|
return ProductResultDto.builder()
|
||||||
.minPrice(minPrice)
|
.minPrice(minPrice)
|
||||||
|
@ -68,10 +68,14 @@ public class YxStoreCouponIssueServiceImpl extends BaseServiceImpl<YxStoreCoupon
|
|||||||
public void issueUserCoupon(Integer id, Long uid) {
|
public void issueUserCoupon(Integer id, Long uid) {
|
||||||
YxStoreCouponIssueQueryVo couponIssueQueryVo = yxStoreCouponIssueMapper
|
YxStoreCouponIssueQueryVo couponIssueQueryVo = yxStoreCouponIssueMapper
|
||||||
.selectOne(id);
|
.selectOne(id);
|
||||||
if(ObjectUtil.isNull(couponIssueQueryVo)) throw new YshopException("领取的优惠劵已领完或已过期");
|
if(ObjectUtil.isNull(couponIssueQueryVo)) {
|
||||||
|
throw new YshopException("领取的优惠劵已领完或已过期");
|
||||||
|
}
|
||||||
|
|
||||||
int count = this.couponCount(id,uid);
|
int count = this.couponCount(id,uid);
|
||||||
if(count > 0) throw new YshopException("已领取过该优惠劵");
|
if(count > 0) {
|
||||||
|
throw new YshopException("已领取过该优惠劵");
|
||||||
|
}
|
||||||
|
|
||||||
if(couponIssueQueryVo.getRemainCount() <= 0
|
if(couponIssueQueryVo.getRemainCount() <= 0
|
||||||
&& CouponEnum.PERMANENT_0.getValue().equals(couponIssueQueryVo.getIsPermanent())){
|
&& CouponEnum.PERMANENT_0.getValue().equals(couponIssueQueryVo.getIsPermanent())){
|
||||||
@ -100,7 +104,9 @@ public class YxStoreCouponIssueServiceImpl extends BaseServiceImpl<YxStoreCoupon
|
|||||||
public List<YxStoreCouponIssueQueryVo> getCouponList(int page, int limit, Long uid,Long productId,Integer type) {
|
public List<YxStoreCouponIssueQueryVo> getCouponList(int page, int limit, Long uid,Long productId,Integer type) {
|
||||||
Page<YxStoreCouponIssue> pageModel = new Page<>(page, limit);
|
Page<YxStoreCouponIssue> pageModel = new Page<>(page, limit);
|
||||||
|
|
||||||
if(type == null) type = CouponEnum.TYPE_0.getValue();
|
if(type == null) {
|
||||||
|
type = CouponEnum.TYPE_0.getValue();
|
||||||
|
}
|
||||||
List<YxStoreCouponIssueQueryVo> list = yxStoreCouponIssueMapper
|
List<YxStoreCouponIssueQueryVo> list = yxStoreCouponIssueMapper
|
||||||
.selecCoupontList(pageModel,type,productId);
|
.selecCoupontList(pageModel,type,productId);
|
||||||
for (YxStoreCouponIssueQueryVo couponIssue : list) {
|
for (YxStoreCouponIssueQueryVo couponIssue : list) {
|
||||||
|
@ -179,7 +179,7 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
|
|||||||
.selectList(Wrappers.<YxStoreCouponUser>lambdaQuery()
|
.selectList(Wrappers.<YxStoreCouponUser>lambdaQuery()
|
||||||
.eq(YxStoreCouponUser::getUid,uid));
|
.eq(YxStoreCouponUser::getUid,uid));
|
||||||
List<YxStoreCouponUserQueryVo> storeCouponUserQueryVoList = new ArrayList<>();
|
List<YxStoreCouponUserQueryVo> storeCouponUserQueryVoList = new ArrayList<>();
|
||||||
long nowTime = new Date().getTime();
|
long nowTime = System.currentTimeMillis();
|
||||||
for (YxStoreCouponUser couponUser : storeCouponUsers) {
|
for (YxStoreCouponUser couponUser : storeCouponUsers) {
|
||||||
YxStoreCouponUserQueryVo queryVo = generator.convert(couponUser,YxStoreCouponUserQueryVo.class);
|
YxStoreCouponUserQueryVo queryVo = generator.convert(couponUser,YxStoreCouponUserQueryVo.class);
|
||||||
if(couponUser.getIsFail() == 1){
|
if(couponUser.getIsFail() == 1){
|
||||||
@ -212,7 +212,9 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
|
|||||||
@Override
|
@Override
|
||||||
public void addUserCoupon(Long uid, Integer cid) {
|
public void addUserCoupon(Long uid, Integer cid) {
|
||||||
YxStoreCoupon storeCoupon = storeCouponService.getById(cid);
|
YxStoreCoupon storeCoupon = storeCouponService.getById(cid);
|
||||||
if(storeCoupon == null) throw new YshopException("优惠劵不存在");
|
if(storeCoupon == null) {
|
||||||
|
throw new YshopException("优惠劵不存在");
|
||||||
|
}
|
||||||
|
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
|
|
||||||
@ -240,7 +242,9 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private boolean isSame(List<String> list1,List<String> list2){
|
private boolean isSame(List<String> list1,List<String> list2){
|
||||||
if(list2.isEmpty()) return true;
|
if(list2.isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
list1 = new ArrayList<>(list1);
|
list1 = new ArrayList<>(list1);
|
||||||
list2 = new ArrayList<>(list2);
|
list2 = new ArrayList<>(list2);
|
||||||
list1.addAll(list2);
|
list1.addAll(list2);
|
||||||
|
@ -104,7 +104,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
|||||||
.eq(YxStorePink::getStatus,OrderInfoEnum.REFUND_STATUS_1.getValue())
|
.eq(YxStorePink::getStatus,OrderInfoEnum.REFUND_STATUS_1.getValue())
|
||||||
.gt(YxStorePink::getStopTime,new Date())
|
.gt(YxStorePink::getStopTime,new Date())
|
||||||
.one();
|
.one();
|
||||||
if(pink == null) throw new YshopException("拼团不存在或已经取消");
|
if(pink == null) {
|
||||||
|
throw new YshopException("拼团不存在或已经取消");
|
||||||
|
}
|
||||||
|
|
||||||
PinkUserDto pinkUserDto = this.getPinkMemberAndPinK(pink);
|
PinkUserDto pinkUserDto = this.getPinkMemberAndPinK(pink);
|
||||||
List<YxStorePink> pinkAll = pinkUserDto.getPinkAll();
|
List<YxStorePink> pinkAll = pinkUserDto.getPinkAll();
|
||||||
@ -156,6 +158,7 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
|||||||
* @param pink 拼团信息
|
* @param pink 拼团信息
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int surplusPeople(YxStorePink pink) {
|
public int surplusPeople(YxStorePink pink) {
|
||||||
List<YxStorePink> listT = new ArrayList<>();
|
List<YxStorePink> listT = new ArrayList<>();
|
||||||
if(pink.getKId() > 0){ //团长存在
|
if(pink.getKId() > 0){ //团长存在
|
||||||
@ -178,7 +181,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
|||||||
@Override
|
@Override
|
||||||
public PinkInfoVo pinkInfo(Long id, Long uid) {
|
public PinkInfoVo pinkInfo(Long id, Long uid) {
|
||||||
YxStorePink pink = this.getPinkUserOne(id);
|
YxStorePink pink = this.getPinkUserOne(id);
|
||||||
if(ObjectUtil.isNull(pink)) throw new YshopException("拼团不存在");
|
if(ObjectUtil.isNull(pink)) {
|
||||||
|
throw new YshopException("拼团不存在");
|
||||||
|
}
|
||||||
if( OrderInfoEnum.PINK_REFUND_STATUS_1.getValue().equals(pink.getIsRefund())){
|
if( OrderInfoEnum.PINK_REFUND_STATUS_1.getValue().equals(pink.getIsRefund())){
|
||||||
throw new YshopException("订单已退款");
|
throw new YshopException("订单已退款");
|
||||||
}
|
}
|
||||||
@ -194,7 +199,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
|||||||
List<Long> uidAll = pinkUserDto.getUidAll();
|
List<Long> uidAll = pinkUserDto.getUidAll();
|
||||||
int count = pinkUserDto.getCount();
|
int count = pinkUserDto.getCount();
|
||||||
|
|
||||||
if(count < 0) count = 0;
|
if(count < 0) {
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
if(OrderInfoEnum.PINK_STATUS_2.getValue().equals(pinkT.getStatus())){
|
if(OrderInfoEnum.PINK_STATUS_2.getValue().equals(pinkT.getStatus())){
|
||||||
pinkBool = PinkEnum.PINK_BOOL_1.getValue();
|
pinkBool = PinkEnum.PINK_BOOL_1.getValue();
|
||||||
isOk = PinkEnum.IS_OK_1.getValue();
|
isOk = PinkEnum.IS_OK_1.getValue();
|
||||||
@ -213,14 +220,20 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
|||||||
//团员是否在团
|
//团员是否在团
|
||||||
if(ObjectUtil.isNotNull(pinkAll)){
|
if(ObjectUtil.isNotNull(pinkAll)){
|
||||||
for (YxStorePink storePink : pinkAll) {
|
for (YxStorePink storePink : pinkAll) {
|
||||||
if(storePink.getUid().equals(uid)) userBool = PinkEnum.USER_BOOL_1.getValue();
|
if(storePink.getUid().equals(uid)) {
|
||||||
|
userBool = PinkEnum.USER_BOOL_1.getValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//团长
|
//团长
|
||||||
if(pinkT.getUid().equals(uid)) userBool = PinkEnum.USER_BOOL_1.getValue();
|
if(pinkT.getUid().equals(uid)) {
|
||||||
|
userBool = PinkEnum.USER_BOOL_1.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
YxStoreCombinationQueryVo storeCombinationQueryVo = yxStoreCombinationMapper.getCombDetail(pink.getCid());
|
YxStoreCombinationQueryVo storeCombinationQueryVo = yxStoreCombinationMapper.getCombDetail(pink.getCid());
|
||||||
if(ObjectUtil.isNull(storeCombinationQueryVo)) throw new YshopException("拼团不存在或已下架");
|
if(ObjectUtil.isNull(storeCombinationQueryVo)) {
|
||||||
|
throw new YshopException("拼团不存在或已下架");
|
||||||
|
}
|
||||||
|
|
||||||
YxUserQueryVo userInfo = userService.getYxUserById(uid);
|
YxUserQueryVo userInfo = userService.getYxUserById(uid);
|
||||||
|
|
||||||
@ -265,7 +278,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
|||||||
order = storeOrderService.handleOrder(order);
|
order = storeOrderService.handleOrder(order);
|
||||||
int pinkCount = yxStorePinkMapper.selectCount(Wrappers.<YxStorePink>lambdaQuery()
|
int pinkCount = yxStorePinkMapper.selectCount(Wrappers.<YxStorePink>lambdaQuery()
|
||||||
.eq(YxStorePink::getOrderId,order.getOrderId()));
|
.eq(YxStorePink::getOrderId,order.getOrderId()));
|
||||||
if(pinkCount > 0) return;
|
if(pinkCount > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(storeCombination != null){
|
if(storeCombination != null){
|
||||||
YxStorePink storePink = YxStorePink.builder()
|
YxStorePink storePink = YxStorePink.builder()
|
||||||
.uid(order.getUid())
|
.uid(order.getUid())
|
||||||
@ -285,7 +300,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
|||||||
storePink.setPeople(storeCombination.getPeople());
|
storePink.setPeople(storeCombination.getPeople());
|
||||||
storePink.setStopTime(stopTime);
|
storePink.setStopTime(stopTime);
|
||||||
if(order.getPinkId() > 0){ //其他成员入团
|
if(order.getPinkId() > 0){ //其他成员入团
|
||||||
if(this.getIsPinkUid(order.getPinkId(),order.getUid())) return;
|
if(this.getIsPinkUid(order.getPinkId(),order.getUid())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
storePink.setKId(order.getPinkId());
|
storePink.setKId(order.getPinkId());
|
||||||
storePink.setStopTime(null);
|
storePink.setStopTime(null);
|
||||||
this.save(storePink);
|
this.save(storePink);
|
||||||
@ -434,7 +451,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
|||||||
if(pink == null){
|
if(pink == null){
|
||||||
pink = yxStorePinkMapper.selectOne(Wrappers.<YxStorePink>lambdaQuery()
|
pink = yxStorePinkMapper.selectOne(Wrappers.<YxStorePink>lambdaQuery()
|
||||||
.eq(YxStorePink::getKId,id).eq(YxStorePink::getUid,uid));
|
.eq(YxStorePink::getKId,id).eq(YxStorePink::getUid,uid));
|
||||||
if(pink == null) return "";
|
if(pink == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return pink.getOrderId();
|
return pink.getOrderId();
|
||||||
}
|
}
|
||||||
@ -471,7 +490,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
|||||||
int count = this.lambdaQuery().in(YxStorePink::getId,idAll)
|
int count = this.lambdaQuery().in(YxStorePink::getId,idAll)
|
||||||
.eq(YxStorePink::getIsRefund,OrderInfoEnum.PINK_REFUND_STATUS_1.getValue())
|
.eq(YxStorePink::getIsRefund,OrderInfoEnum.PINK_REFUND_STATUS_1.getValue())
|
||||||
.count();
|
.count();
|
||||||
if(count == 0) return true;
|
if(count == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,9 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
|
|||||||
@Override
|
@Override
|
||||||
public void decStockIncSales(int num, Long seckillId) {
|
public void decStockIncSales(int num, Long seckillId) {
|
||||||
int res = yxStoreSeckillMapper.decStockIncSales(num,seckillId);
|
int res = yxStoreSeckillMapper.decStockIncSales(num,seckillId);
|
||||||
if(res == 0) throw new YshopException("秒杀产品库存不足");
|
if(res == 0) {
|
||||||
|
throw new YshopException("秒杀产品库存不足");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
@ -245,7 +247,9 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
|
|||||||
//添加商品
|
//添加商品
|
||||||
YxStoreSeckill yxStoreSeckill = new YxStoreSeckill();
|
YxStoreSeckill yxStoreSeckill = new YxStoreSeckill();
|
||||||
BeanUtil.copyProperties(resources,yxStoreSeckill,"images");
|
BeanUtil.copyProperties(resources,yxStoreSeckill,"images");
|
||||||
if(resources.getImages().isEmpty()) throw new YshopException("请上传轮播图");
|
if(resources.getImages().isEmpty()) {
|
||||||
|
throw new YshopException("请上传轮播图");
|
||||||
|
}
|
||||||
|
|
||||||
yxStoreSeckill.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice()));
|
yxStoreSeckill.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice()));
|
||||||
yxStoreSeckill.setCost(new BigDecimal(resultDTO.getMinCost()));
|
yxStoreSeckill.setCost(new BigDecimal(resultDTO.getMinCost()));
|
||||||
@ -308,7 +312,9 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
|
|||||||
.reduce(Integer::sum)
|
.reduce(Integer::sum)
|
||||||
.orElse(0);
|
.orElse(0);
|
||||||
|
|
||||||
if(stock <= 0) throw new YshopException("库存不能低于0");
|
if(stock <= 0) {
|
||||||
|
throw new YshopException("库存不能低于0");
|
||||||
|
}
|
||||||
|
|
||||||
return ProductResultDto.builder()
|
return ProductResultDto.builder()
|
||||||
.minPrice(minPrice)
|
.minPrice(minPrice)
|
||||||
|
@ -68,15 +68,23 @@ public class YxUserExtractServiceImpl extends BaseServiceImpl<YxUserExtractMappe
|
|||||||
@Override
|
@Override
|
||||||
public void userExtract(YxUser userInfo, UserExtParam param) {
|
public void userExtract(YxUser userInfo, UserExtParam param) {
|
||||||
BigDecimal extractPrice = userInfo.getBrokeragePrice();
|
BigDecimal extractPrice = userInfo.getBrokeragePrice();
|
||||||
if(extractPrice.compareTo(BigDecimal.ZERO) <= 0) throw new YshopException("提现佣金不足");
|
if(extractPrice.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
throw new YshopException("提现佣金不足");
|
||||||
|
}
|
||||||
|
|
||||||
double money = Double.valueOf(param.getMoney());
|
double money = Double.valueOf(param.getMoney());
|
||||||
if( extractPrice.compareTo(BigDecimal.valueOf(money)) < 0) throw new YshopException("提现佣金不足");
|
if( extractPrice.compareTo(BigDecimal.valueOf(money)) < 0) {
|
||||||
|
throw new YshopException("提现佣金不足");
|
||||||
|
}
|
||||||
|
|
||||||
if(money <= 0) throw new YshopException("提现佣金大于0");
|
if(money <= 0) {
|
||||||
|
throw new YshopException("提现佣金大于0");
|
||||||
|
}
|
||||||
|
|
||||||
double balance = NumberUtil.sub(extractPrice.doubleValue(),money);
|
double balance = NumberUtil.sub(extractPrice.doubleValue(),money);
|
||||||
if(balance < 0) balance = 0;
|
if(balance < 0) {
|
||||||
|
balance = 0;
|
||||||
|
}
|
||||||
|
|
||||||
YxUserExtract userExtract = new YxUserExtract();
|
YxUserExtract userExtract = new YxUserExtract();
|
||||||
userExtract.setUid(userInfo.getUid());
|
userExtract.setUid(userInfo.getUid());
|
||||||
@ -184,6 +192,7 @@ public class YxUserExtractServiceImpl extends BaseServiceImpl<YxUserExtractMappe
|
|||||||
* 操作提现
|
* 操作提现
|
||||||
* @param resources YxUserExtract
|
* @param resources YxUserExtract
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void doExtract(YxUserExtract resources){
|
public void doExtract(YxUserExtract resources){
|
||||||
if(resources.getStatus() == null){
|
if(resources.getStatus() == null){
|
||||||
throw new BadRequestException("请选择审核状态");
|
throw new BadRequestException("请选择审核状态");
|
||||||
|
@ -138,7 +138,9 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
|
|||||||
throw new YshopException("该产品库存不足"+cartNum);
|
throw new YshopException("该产品库存不足"+cartNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cartNum == cart.getCartNum()) return;
|
if(cartNum == cart.getCartNum()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
YxStoreCart storeCart = new YxStoreCart();
|
YxStoreCart storeCart = new YxStoreCart();
|
||||||
storeCart.setCartNum(cartNum);
|
storeCart.setCartNum(cartNum);
|
||||||
@ -162,8 +164,12 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
|
|||||||
wrapper.lambda().eq(YxStoreCart::getUid,uid)
|
wrapper.lambda().eq(YxStoreCart::getUid,uid)
|
||||||
.eq(YxStoreCart::getIsPay,OrderInfoEnum.PAY_STATUS_0.getValue())
|
.eq(YxStoreCart::getIsPay,OrderInfoEnum.PAY_STATUS_0.getValue())
|
||||||
.orderByDesc(YxStoreCart::getId);
|
.orderByDesc(YxStoreCart::getId);
|
||||||
if(status == null) wrapper.lambda().eq(YxStoreCart::getIsNew, CartTypeEnum.NEW_0.getValue());
|
if(status == null) {
|
||||||
if(StrUtil.isNotEmpty(cartIds)) wrapper.lambda().in(YxStoreCart::getId, Arrays.asList(cartIds.split(",")));
|
wrapper.lambda().eq(YxStoreCart::getIsNew, CartTypeEnum.NEW_0.getValue());
|
||||||
|
}
|
||||||
|
if(StrUtil.isNotEmpty(cartIds)) {
|
||||||
|
wrapper.lambda().in(YxStoreCart::getId, Arrays.asList(cartIds.split(",")));
|
||||||
|
}
|
||||||
List<YxStoreCart> carts = yxStoreCartMapper.selectList(wrapper);
|
List<YxStoreCart> carts = yxStoreCartMapper.selectList(wrapper);
|
||||||
|
|
||||||
List<YxStoreCartQueryVo> valid = new ArrayList<>();
|
List<YxStoreCartQueryVo> valid = new ArrayList<>();
|
||||||
|
@ -130,10 +130,11 @@ public class YxStoreCategoryServiceImpl extends BaseServiceImpl<StoreCategoryMap
|
|||||||
deptDTO.getChildren().add(it);
|
deptDTO.getChildren().add(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isChild)
|
if (isChild) {
|
||||||
cates.add(deptDTO);
|
cates.add(deptDTO);
|
||||||
|
}
|
||||||
for (YxStoreCategory category : categories) {
|
for (YxStoreCategory category : categories) {
|
||||||
if (category.getId() == deptDTO.getPid() && !deptNames.contains(category.getCateName())) {
|
if (category.getId().equals(deptDTO.getPid()) && !deptNames.contains(category.getCateName())) {
|
||||||
cates.add(deptDTO);
|
cates.add(deptDTO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,10 +162,14 @@ public class YxStoreCategoryServiceImpl extends BaseServiceImpl<StoreCategoryMap
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkCategory(int pid){
|
public boolean checkCategory(int pid){
|
||||||
if(pid == 0) return true;
|
if(pid == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
YxStoreCategory yxStoreCategory = this.getOne(Wrappers.<YxStoreCategory>lambdaQuery()
|
YxStoreCategory yxStoreCategory = this.getOne(Wrappers.<YxStoreCategory>lambdaQuery()
|
||||||
.eq(YxStoreCategory::getId,pid));
|
.eq(YxStoreCategory::getId,pid));
|
||||||
if(yxStoreCategory.getPid() > 0) return false;
|
if(yxStoreCategory.getPid() > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -174,11 +179,14 @@ public class YxStoreCategoryServiceImpl extends BaseServiceImpl<StoreCategoryMap
|
|||||||
* @param id 分类id
|
* @param id 分类id
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean checkProductCategory(int id){
|
public boolean checkProductCategory(int id){
|
||||||
YxStoreCategory yxStoreCategory = this.getOne(Wrappers.<YxStoreCategory>lambdaQuery()
|
YxStoreCategory yxStoreCategory = this.getOne(Wrappers.<YxStoreCategory>lambdaQuery()
|
||||||
.eq(YxStoreCategory::getId,id));
|
.eq(YxStoreCategory::getId,id));
|
||||||
|
|
||||||
if(yxStoreCategory.getPid() == 0) return false;
|
if(yxStoreCategory.getPid() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
.getUsableCouponList(uid, priceGroup.getTotalPrice().doubleValue(), productIds);
|
.getUsableCouponList(uid, priceGroup.getTotalPrice().doubleValue(), productIds);
|
||||||
|
|
||||||
StoreCouponUserVo storeCouponUser = null;
|
StoreCouponUserVo storeCouponUser = null;
|
||||||
if(storeCouponUsers != null && !storeCouponUsers.isEmpty()) storeCouponUser = storeCouponUsers.get(0);
|
if(storeCouponUsers != null && !storeCouponUsers.isEmpty()) {
|
||||||
|
storeCouponUser = storeCouponUsers.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
return ConfirmOrderVo.builder()
|
return ConfirmOrderVo.builder()
|
||||||
.addressInfo(userAddress)
|
.addressInfo(userAddress)
|
||||||
@ -365,7 +367,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
BigDecimal couponPrice = BigDecimal.ZERO;
|
BigDecimal couponPrice = BigDecimal.ZERO;
|
||||||
if(StrUtil.isNotBlank(couponId) && !ShopConstants.YSHOP_ZERO.equals(couponId)){//使用优惠券
|
if(StrUtil.isNotBlank(couponId) && !ShopConstants.YSHOP_ZERO.equals(couponId)){//使用优惠券
|
||||||
YxStoreCouponUser couponUser = couponUserService.getCoupon(Integer.valueOf(couponId),uid);
|
YxStoreCouponUser couponUser = couponUserService.getCoupon(Integer.valueOf(couponId),uid);
|
||||||
if(couponUser == null) throw new YshopException("使用优惠劵失败");
|
if(couponUser == null) {
|
||||||
|
throw new YshopException("使用优惠劵失败");
|
||||||
|
}
|
||||||
|
|
||||||
if(couponUser.getUseMinPrice().compareTo(payPrice) > 0){
|
if(couponUser.getUseMinPrice().compareTo(payPrice) > 0){
|
||||||
throw new YshopException("不满足优惠劵的使用条件");
|
throw new YshopException("不满足优惠劵的使用条件");
|
||||||
@ -401,7 +405,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(payPrice.compareTo(BigDecimal.ZERO) <= 0) payPrice = BigDecimal.ZERO;
|
if(payPrice.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
payPrice = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
return ComputeVo.builder()
|
return ComputeVo.builder()
|
||||||
.totalPrice(cacheDTO.getPriceGroup().getTotalPrice())
|
.totalPrice(cacheDTO.getPriceGroup().getTotalPrice())
|
||||||
@ -434,9 +440,13 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
//处理选择门店与正常选择地址下单
|
//处理选择门店与正常选择地址下单
|
||||||
YxUserAddress userAddress = null;
|
YxUserAddress userAddress = null;
|
||||||
if(OrderInfoEnum.SHIPPIING_TYPE_1.getValue().equals(Integer.valueOf(param.getShippingType()))){
|
if(OrderInfoEnum.SHIPPIING_TYPE_1.getValue().equals(Integer.valueOf(param.getShippingType()))){
|
||||||
if(StrUtil.isEmpty(param.getAddressId())) throw new YshopException("请选择收货地址");
|
if(StrUtil.isEmpty(param.getAddressId())) {
|
||||||
|
throw new YshopException("请选择收货地址");
|
||||||
|
}
|
||||||
userAddress = userAddressService.getById(param.getAddressId());
|
userAddress = userAddressService.getById(param.getAddressId());
|
||||||
if(ObjectUtil.isNull(userAddress)) throw new YshopException("地址选择有误");
|
if(ObjectUtil.isNull(userAddress)) {
|
||||||
|
throw new YshopException("地址选择有误");
|
||||||
|
}
|
||||||
}else{ //门店
|
}else{ //门店
|
||||||
if(StrUtil.isBlank(param.getRealName()) || StrUtil.isBlank(param.getPhone())) {
|
if(StrUtil.isBlank(param.getRealName()) || StrUtil.isBlank(param.getPhone())) {
|
||||||
throw new YshopException("请填写姓名和电话");
|
throw new YshopException("请填写姓名和电话");
|
||||||
@ -517,13 +527,17 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
//处理门店
|
//处理门店
|
||||||
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().toString().equals(param.getShippingType())){
|
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().toString().equals(param.getShippingType())){
|
||||||
YxSystemStore systemStoreQueryVo = systemStoreService.getById(param.getStoreId());
|
YxSystemStore systemStoreQueryVo = systemStoreService.getById(param.getStoreId());
|
||||||
if(systemStoreQueryVo == null ) throw new ErrorRequestException("暂无门店无法选择门店自提");
|
if(systemStoreQueryVo == null ) {
|
||||||
|
throw new ErrorRequestException("暂无门店无法选择门店自提");
|
||||||
|
}
|
||||||
storeOrder.setVerifyCode(StrUtil.sub(orderSn,orderSn.length(),-12));
|
storeOrder.setVerifyCode(StrUtil.sub(orderSn,orderSn.length(),-12));
|
||||||
storeOrder.setStoreId(systemStoreQueryVo.getId());
|
storeOrder.setStoreId(systemStoreQueryVo.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean res = this.save(storeOrder);
|
boolean res = this.save(storeOrder);
|
||||||
if(!res) throw new YshopException("订单生成失败");
|
if(!res) {
|
||||||
|
throw new YshopException("订单生成失败");
|
||||||
|
}
|
||||||
|
|
||||||
//使用了积分扣积分
|
//使用了积分扣积分
|
||||||
if(computeVo.getUsedIntegral() > 0){
|
if(computeVo.getUsedIntegral() > 0){
|
||||||
@ -588,12 +602,16 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
.getOne(Wrappers.<YxStoreOrderCartInfo>lambdaQuery()
|
.getOne(Wrappers.<YxStoreOrderCartInfo>lambdaQuery()
|
||||||
.eq(YxStoreOrderCartInfo::getUnique,unique));
|
.eq(YxStoreOrderCartInfo::getUnique,unique));
|
||||||
|
|
||||||
if(ObjectUtil.isEmpty(orderCartInfo)) throw new YshopException("评价产品不存在");
|
if(ObjectUtil.isEmpty(orderCartInfo)) {
|
||||||
|
throw new YshopException("评价产品不存在");
|
||||||
|
}
|
||||||
|
|
||||||
int count = productReplyService.count(Wrappers.<YxStoreProductReply>lambdaQuery()
|
int count = productReplyService.count(Wrappers.<YxStoreProductReply>lambdaQuery()
|
||||||
.eq(YxStoreProductReply::getOid,orderCartInfo.getOid())
|
.eq(YxStoreProductReply::getOid,orderCartInfo.getOid())
|
||||||
.eq(YxStoreProductReply::getProductId,orderCartInfo.getProductId()));
|
.eq(YxStoreProductReply::getProductId,orderCartInfo.getProductId()));
|
||||||
if(count > 0) throw new YshopException("该产品已评价");
|
if(count > 0) {
|
||||||
|
throw new YshopException("该产品已评价");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
YxStoreProductReply storeProductReply = YxStoreProductReply.builder()
|
YxStoreProductReply storeProductReply = YxStoreProductReply.builder()
|
||||||
@ -634,16 +652,22 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
public void orderRefund(String orderId,BigDecimal price,Integer type) {
|
public void orderRefund(String orderId,BigDecimal price,Integer type) {
|
||||||
|
|
||||||
YxStoreOrderQueryVo orderQueryVo = getOrderInfo(orderId,null);
|
YxStoreOrderQueryVo orderQueryVo = getOrderInfo(orderId,null);
|
||||||
if(ObjectUtil.isNull(orderQueryVo)) throw new YshopException("订单不存在");
|
if(ObjectUtil.isNull(orderQueryVo)) {
|
||||||
|
throw new YshopException("订单不存在");
|
||||||
|
}
|
||||||
|
|
||||||
YxUserQueryVo userQueryVo = userService.getYxUserById(orderQueryVo.getUid());
|
YxUserQueryVo userQueryVo = userService.getYxUserById(orderQueryVo.getUid());
|
||||||
if(ObjectUtil.isNull(userQueryVo)) throw new YshopException("用户不存在");
|
if(ObjectUtil.isNull(userQueryVo)) {
|
||||||
|
throw new YshopException("用户不存在");
|
||||||
|
}
|
||||||
|
|
||||||
if(OrderInfoEnum.REFUND_STATUS_2.getValue().equals(orderQueryVo.getRefundStatus())){
|
if(OrderInfoEnum.REFUND_STATUS_2.getValue().equals(orderQueryVo.getRefundStatus())){
|
||||||
throw new YshopException("订单已经退款了哦!");
|
throw new YshopException("订单已经退款了哦!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(orderQueryVo.getPayPrice().compareTo(price) < 0) throw new YshopException("退款金额不正确");
|
if(orderQueryVo.getPayPrice().compareTo(price) < 0) {
|
||||||
|
throw new YshopException("退款金额不正确");
|
||||||
|
}
|
||||||
|
|
||||||
YxStoreOrder storeOrder = new YxStoreOrder();
|
YxStoreOrder storeOrder = new YxStoreOrder();
|
||||||
//修改状态
|
//修改状态
|
||||||
@ -697,7 +721,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
@Override
|
@Override
|
||||||
public void orderDelivery(String orderId,String deliveryId,String deliveryName,String deliveryType) {
|
public void orderDelivery(String orderId,String deliveryId,String deliveryName,String deliveryType) {
|
||||||
YxStoreOrderQueryVo orderQueryVo = this.getOrderInfo(orderId,null);
|
YxStoreOrderQueryVo orderQueryVo = this.getOrderInfo(orderId,null);
|
||||||
if(ObjectUtil.isNull(orderQueryVo)) throw new YshopException("订单不存在");
|
if(ObjectUtil.isNull(orderQueryVo)) {
|
||||||
|
throw new YshopException("订单不存在");
|
||||||
|
}
|
||||||
|
|
||||||
if(!OrderInfoEnum.STATUS_0.getValue().equals(orderQueryVo.getStatus()) ||
|
if(!OrderInfoEnum.STATUS_0.getValue().equals(orderQueryVo.getStatus()) ||
|
||||||
OrderInfoEnum.PAY_STATUS_0.getValue().equals( orderQueryVo.getPaid())){
|
OrderInfoEnum.PAY_STATUS_0.getValue().equals( orderQueryVo.getPaid())){
|
||||||
@ -705,7 +731,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
}
|
}
|
||||||
|
|
||||||
YxExpress expressQueryVo = expressService.getById(Integer.valueOf(deliveryName));
|
YxExpress expressQueryVo = expressService.getById(Integer.valueOf(deliveryName));
|
||||||
if(ObjectUtil.isNull(expressQueryVo)) throw new YshopException("请后台先添加快递公司");
|
if(ObjectUtil.isNull(expressQueryVo)) {
|
||||||
|
throw new YshopException("请后台先添加快递公司");
|
||||||
|
}
|
||||||
|
|
||||||
//判断拼团产品
|
//判断拼团产品
|
||||||
if(orderQueryVo.getPinkId() != null && orderQueryVo.getPinkId() >0 ){
|
if(orderQueryVo.getPinkId() != null && orderQueryVo.getPinkId() >0 ){
|
||||||
@ -759,10 +787,14 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
@Override
|
@Override
|
||||||
public void editOrderPrice(String orderId,String price) {
|
public void editOrderPrice(String orderId,String price) {
|
||||||
YxStoreOrderQueryVo orderQueryVo = getOrderInfo(orderId,null);
|
YxStoreOrderQueryVo orderQueryVo = getOrderInfo(orderId,null);
|
||||||
if(ObjectUtil.isNull(orderQueryVo)) throw new YshopException("订单不存在");
|
if(ObjectUtil.isNull(orderQueryVo)) {
|
||||||
|
throw new YshopException("订单不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(orderQueryVo.getPayPrice().compareTo(new BigDecimal(price)) == 0) return;
|
if(orderQueryVo.getPayPrice().compareTo(new BigDecimal(price)) == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderQueryVo.getPaid())) {
|
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderQueryVo.getPaid())) {
|
||||||
@ -811,7 +843,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
@Override
|
@Override
|
||||||
public void cancelOrder(String orderId, Long uid) {
|
public void cancelOrder(String orderId, Long uid) {
|
||||||
YxStoreOrderQueryVo order = this.getOrderInfo(orderId,uid);
|
YxStoreOrderQueryVo order = this.getOrderInfo(orderId,uid);
|
||||||
if(ObjectUtil.isNull(order)) throw new YshopException("订单不存在");
|
if(ObjectUtil.isNull(order)) {
|
||||||
|
throw new YshopException("订单不存在");
|
||||||
|
}
|
||||||
|
|
||||||
this.regressionIntegral(order);
|
this.regressionIntegral(order);
|
||||||
|
|
||||||
@ -834,7 +868,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
@Override
|
@Override
|
||||||
public void removeOrder(String orderId, Long uid) {
|
public void removeOrder(String orderId, Long uid) {
|
||||||
YxStoreOrderQueryVo order = getOrderInfo(orderId,(long)uid);
|
YxStoreOrderQueryVo order = getOrderInfo(orderId,(long)uid);
|
||||||
if(order == null) throw new YshopException("订单不存在");
|
if(order == null) {
|
||||||
|
throw new YshopException("订单不存在");
|
||||||
|
}
|
||||||
order = handleOrder(order);
|
order = handleOrder(order);
|
||||||
if(!OrderInfoEnum.STATUS_3.getValue().equals(order.getStatus())) {
|
if(!OrderInfoEnum.STATUS_3.getValue().equals(order.getStatus())) {
|
||||||
throw new YshopException("该订单无法删除");
|
throw new YshopException("该订单无法删除");
|
||||||
@ -857,7 +893,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
@Override
|
@Override
|
||||||
public void takeOrder(String orderId, Long uid) {
|
public void takeOrder(String orderId, Long uid) {
|
||||||
YxStoreOrderQueryVo order = this.getOrderInfo(orderId,uid);
|
YxStoreOrderQueryVo order = this.getOrderInfo(orderId,uid);
|
||||||
if(ObjectUtil.isNull(order)) throw new YshopException("订单不存在");
|
if(ObjectUtil.isNull(order)) {
|
||||||
|
throw new YshopException("订单不存在");
|
||||||
|
}
|
||||||
order = handleOrder(order);
|
order = handleOrder(order);
|
||||||
if(!OrderStatusEnum.STATUS_2.getValue().toString().equals(order.get_status().get_type())) {
|
if(!OrderStatusEnum.STATUS_2.getValue().toString().equals(order.get_status().get_type())) {
|
||||||
throw new BusinessException("订单状态错误");
|
throw new BusinessException("订单状态错误");
|
||||||
@ -896,14 +934,20 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
.eq(YxStoreOrder::getVerifyCode,verifyCode)
|
.eq(YxStoreOrder::getVerifyCode,verifyCode)
|
||||||
.eq(YxStoreOrder::getPaid,OrderInfoEnum.PAY_STATUS_1.getValue())
|
.eq(YxStoreOrder::getPaid,OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||||
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue()));
|
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue()));
|
||||||
if(order == null) throw new YshopException("核销的订单不存在或未支付或已退款");
|
if(order == null) {
|
||||||
|
throw new YshopException("核销的订单不存在或未支付或已退款");
|
||||||
|
}
|
||||||
|
|
||||||
if(uid != null){
|
if(uid != null){
|
||||||
boolean checkStatus = systemStoreStaffService.checkStatus(uid,order.getStoreId());
|
boolean checkStatus = systemStoreStaffService.checkStatus(uid,order.getStoreId());
|
||||||
if(!checkStatus) throw new YshopException("您没有当前店铺核销权限");
|
if(!checkStatus) {
|
||||||
|
throw new YshopException("您没有当前店铺核销权限");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!OrderInfoEnum.STATUS_0.getValue().equals(order.getStatus())) throw new YshopException("订单已经核销");
|
if(!OrderInfoEnum.STATUS_0.getValue().equals(order.getStatus())) {
|
||||||
|
throw new YshopException("订单已经核销");
|
||||||
|
}
|
||||||
|
|
||||||
if(order.getCombinationId() != null && order.getCombinationId() > 0
|
if(order.getCombinationId() != null && order.getCombinationId() > 0
|
||||||
&& order.getPinkId() != null && order.getPinkId() > 0){
|
&& order.getPinkId() != null && order.getPinkId() > 0){
|
||||||
@ -950,7 +994,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
@Override
|
@Override
|
||||||
public void orderApplyRefund(String explain,String Img,String text,String orderId, Long uid) {
|
public void orderApplyRefund(String explain,String Img,String text,String orderId, Long uid) {
|
||||||
YxStoreOrderQueryVo order = getOrderInfo(orderId,uid);
|
YxStoreOrderQueryVo order = getOrderInfo(orderId,uid);
|
||||||
if(order == null) throw new YshopException("订单不存在");
|
if(order == null) {
|
||||||
|
throw new YshopException("订单不存在");
|
||||||
|
}
|
||||||
|
|
||||||
if(OrderInfoEnum.REFUND_STATUS_2.getValue().equals(order.getRefundStatus())){
|
if(OrderInfoEnum.REFUND_STATUS_2.getValue().equals(order.getRefundStatus())){
|
||||||
throw new YshopException("订单已退款");
|
throw new YshopException("订单已退款");
|
||||||
@ -958,7 +1004,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
if(OrderInfoEnum.REFUND_STATUS_1.getValue().equals(order.getRefundStatus())) {
|
if(OrderInfoEnum.REFUND_STATUS_1.getValue().equals(order.getRefundStatus())) {
|
||||||
throw new YshopException("正在申请退款中");
|
throw new YshopException("正在申请退款中");
|
||||||
}
|
}
|
||||||
if(OrderInfoEnum.STATUS_1.getValue().equals(order.getStatus())) throw new YshopException("订单当前无法退款");
|
if(OrderInfoEnum.STATUS_1.getValue().equals(order.getStatus())) {
|
||||||
|
throw new YshopException("订单当前无法退款");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
YxStoreOrder storeOrder = new YxStoreOrder();
|
YxStoreOrder storeOrder = new YxStoreOrder();
|
||||||
@ -1174,7 +1222,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
|
|
||||||
//订单支付没有退款 数量
|
//订单支付没有退款 数量
|
||||||
QueryWrapper<YxStoreOrder> wrapperOne = new QueryWrapper<>();
|
QueryWrapper<YxStoreOrder> wrapperOne = new QueryWrapper<>();
|
||||||
if(uid != null) wrapperOne.lambda().eq(YxStoreOrder::getUid,uid);
|
if(uid != null) {
|
||||||
|
wrapperOne.lambda().eq(YxStoreOrder::getUid,uid);
|
||||||
|
}
|
||||||
wrapperOne.lambda().eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
wrapperOne.lambda().eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||||
.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue());
|
.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue());
|
||||||
Integer orderCount = yxStoreOrderMapper.selectCount(wrapperOne);
|
Integer orderCount = yxStoreOrderMapper.selectCount(wrapperOne);
|
||||||
@ -1184,7 +1234,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
|
|
||||||
//订单待支付 数量
|
//订单待支付 数量
|
||||||
QueryWrapper<YxStoreOrder> wrapperTwo = new QueryWrapper<>();
|
QueryWrapper<YxStoreOrder> wrapperTwo = new QueryWrapper<>();
|
||||||
if(uid != null) wrapperTwo.lambda().eq(YxStoreOrder::getUid,uid);
|
if(uid != null) {
|
||||||
|
wrapperTwo.lambda().eq(YxStoreOrder::getUid,uid);
|
||||||
|
}
|
||||||
wrapperTwo.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_0.getValue())
|
wrapperTwo.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_0.getValue())
|
||||||
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||||
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_0.getValue());
|
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_0.getValue());
|
||||||
@ -1192,7 +1244,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
|
|
||||||
//订单待发货 数量
|
//订单待发货 数量
|
||||||
QueryWrapper<YxStoreOrder> wrapperThree = new QueryWrapper<>();
|
QueryWrapper<YxStoreOrder> wrapperThree = new QueryWrapper<>();
|
||||||
if(uid != null) wrapperThree.lambda().eq(YxStoreOrder::getUid,uid);
|
if(uid != null) {
|
||||||
|
wrapperThree.lambda().eq(YxStoreOrder::getUid,uid);
|
||||||
|
}
|
||||||
wrapperThree.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
wrapperThree.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||||
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||||
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_0.getValue());
|
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_0.getValue());
|
||||||
@ -1200,7 +1254,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
|
|
||||||
//订单待收货 数量
|
//订单待收货 数量
|
||||||
QueryWrapper<YxStoreOrder> wrapperFour = new QueryWrapper<>();
|
QueryWrapper<YxStoreOrder> wrapperFour = new QueryWrapper<>();
|
||||||
if(uid != null) wrapperFour.lambda().eq(YxStoreOrder::getUid,uid);
|
if(uid != null) {
|
||||||
|
wrapperFour.lambda().eq(YxStoreOrder::getUid,uid);
|
||||||
|
}
|
||||||
wrapperFour.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
wrapperFour.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||||
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||||
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_1.getValue());
|
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_1.getValue());
|
||||||
@ -1208,7 +1264,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
|
|
||||||
//订单待评价 数量
|
//订单待评价 数量
|
||||||
QueryWrapper<YxStoreOrder> wrapperFive = new QueryWrapper<>();
|
QueryWrapper<YxStoreOrder> wrapperFive = new QueryWrapper<>();
|
||||||
if(uid != null) wrapperFive.lambda().eq(YxStoreOrder::getUid,uid);
|
if(uid != null) {
|
||||||
|
wrapperFive.lambda().eq(YxStoreOrder::getUid,uid);
|
||||||
|
}
|
||||||
wrapperFive.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
wrapperFive.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||||
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||||
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_2.getValue());
|
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_2.getValue());
|
||||||
@ -1216,7 +1274,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
|
|
||||||
//订单已完成 数量
|
//订单已完成 数量
|
||||||
QueryWrapper<YxStoreOrder> wrapperSix= new QueryWrapper<>();
|
QueryWrapper<YxStoreOrder> wrapperSix= new QueryWrapper<>();
|
||||||
if(uid != null) wrapperSix.lambda().eq(YxStoreOrder::getUid,uid);
|
if(uid != null) {
|
||||||
|
wrapperSix.lambda().eq(YxStoreOrder::getUid,uid);
|
||||||
|
}
|
||||||
wrapperSix.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
wrapperSix.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||||
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||||
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_3.getValue());
|
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_3.getValue());
|
||||||
@ -1224,7 +1284,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
|
|
||||||
//订单退款
|
//订单退款
|
||||||
QueryWrapper<YxStoreOrder> wrapperSeven= new QueryWrapper<>();
|
QueryWrapper<YxStoreOrder> wrapperSeven= new QueryWrapper<>();
|
||||||
if(uid != null) wrapperSeven.lambda().eq(YxStoreOrder::getUid,uid);
|
if(uid != null) {
|
||||||
|
wrapperSeven.lambda().eq(YxStoreOrder::getUid,uid);
|
||||||
|
}
|
||||||
String[] strArr = {"1","2"};
|
String[] strArr = {"1","2"};
|
||||||
wrapperSeven.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
wrapperSeven.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||||
.in(YxStoreOrder::getRefundStatus,Arrays.asList(strArr));
|
.in(YxStoreOrder::getRefundStatus,Arrays.asList(strArr));
|
||||||
@ -1364,7 +1426,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
orderStatusService.create(orderInfo.getId(),OrderLogEnum.PAY_ORDER_SUCCESS.getValue(),
|
orderStatusService.create(orderInfo.getId(),OrderLogEnum.PAY_ORDER_SUCCESS.getValue(),
|
||||||
OrderLogEnum.PAY_ORDER_SUCCESS.getDesc());
|
OrderLogEnum.PAY_ORDER_SUCCESS.getDesc());
|
||||||
//拼团
|
//拼团
|
||||||
if(orderInfo.getCombinationId() > 0) pinkService.createPink(orderInfo);
|
if(orderInfo.getCombinationId() > 0) {
|
||||||
|
pinkService.createPink(orderInfo);
|
||||||
|
}
|
||||||
|
|
||||||
//砍价
|
//砍价
|
||||||
if(orderInfo.getBargainId() > 0) {
|
if(orderInfo.getBargainId() > 0) {
|
||||||
@ -1374,7 +1438,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
YxUser userInfo = userService.getById(orderInfo.getUid());
|
YxUser userInfo = userService.getById(orderInfo.getUid());
|
||||||
//增加流水
|
//增加流水
|
||||||
String payTypeMsg = PayTypeEnum.WEIXIN.getDesc();
|
String payTypeMsg = PayTypeEnum.WEIXIN.getDesc();
|
||||||
if(PayTypeEnum.YUE.getValue().equals(payType)) payTypeMsg = PayTypeEnum.YUE.getDesc();
|
if(PayTypeEnum.YUE.getValue().equals(payType)) {
|
||||||
|
payTypeMsg = PayTypeEnum.YUE.getDesc();
|
||||||
|
}
|
||||||
billService.expend(userInfo.getUid(), "购买商品",
|
billService.expend(userInfo.getUid(), "购买商品",
|
||||||
BillDetailEnum.CATEGORY_1.getValue(),
|
BillDetailEnum.CATEGORY_1.getValue(),
|
||||||
BillDetailEnum.TYPE_3.getValue(),
|
BillDetailEnum.TYPE_3.getValue(),
|
||||||
@ -1403,12 +1469,20 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
@Override
|
@Override
|
||||||
public String aliPay(String orderId) throws Exception {
|
public String aliPay(String orderId) throws Exception {
|
||||||
AlipayConfig alipay = alipayService.find();
|
AlipayConfig alipay = alipayService.find();
|
||||||
if(ObjectUtil.isNull(alipay)) throw new YshopException("请先配置支付宝");
|
if(ObjectUtil.isNull(alipay)) {
|
||||||
|
throw new YshopException("请先配置支付宝");
|
||||||
|
}
|
||||||
YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId,null);
|
YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId,null);
|
||||||
if(ObjectUtil.isNull(orderInfo)) throw new YshopException("订单不存在");
|
if(ObjectUtil.isNull(orderInfo)) {
|
||||||
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) throw new YshopException("该订单已支付");
|
throw new YshopException("订单不存在");
|
||||||
|
}
|
||||||
|
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) {
|
||||||
|
throw new YshopException("该订单已支付");
|
||||||
|
}
|
||||||
|
|
||||||
if(orderInfo.getPayPrice().compareTo(BigDecimal.ZERO) <= 0) throw new YshopException("该支付无需支付");
|
if(orderInfo.getPayPrice().compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
throw new YshopException("该支付无需支付");
|
||||||
|
}
|
||||||
TradeVo trade = new TradeVo();
|
TradeVo trade = new TradeVo();
|
||||||
trade.setOutTradeNo(orderId);
|
trade.setOutTradeNo(orderId);
|
||||||
String payUrl = alipayService.toPayAsWeb(alipay,trade);
|
String payUrl = alipayService.toPayAsWeb(alipay,trade);
|
||||||
@ -1427,9 +1501,13 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
@Override
|
@Override
|
||||||
public void yuePay(String orderId, Long uid) {
|
public void yuePay(String orderId, Long uid) {
|
||||||
YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId,uid);
|
YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId,uid);
|
||||||
if(ObjectUtil.isNull(orderInfo)) throw new YshopException("订单不存在");
|
if(ObjectUtil.isNull(orderInfo)) {
|
||||||
|
throw new YshopException("订单不存在");
|
||||||
|
}
|
||||||
|
|
||||||
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) throw new YshopException("该订单已支付");
|
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) {
|
||||||
|
throw new YshopException("该订单已支付");
|
||||||
|
}
|
||||||
|
|
||||||
YxUserQueryVo userInfo = userService.getYxUserById(uid);
|
YxUserQueryVo userInfo = userService.getYxUserById(uid);
|
||||||
|
|
||||||
@ -1459,7 +1537,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
wrapper.lambda().and(
|
wrapper.lambda().and(
|
||||||
i->i.eq(YxStoreOrder::getOrderId,unique).or().eq(YxStoreOrder::getUnique,unique).or()
|
i->i.eq(YxStoreOrder::getOrderId,unique).or().eq(YxStoreOrder::getUnique,unique).or()
|
||||||
.eq(YxStoreOrder::getExtendOrderId,unique));
|
.eq(YxStoreOrder::getExtendOrderId,unique));
|
||||||
if(uid != null) wrapper.lambda().eq(YxStoreOrder::getUid,uid);
|
if(uid != null) {
|
||||||
|
wrapper.lambda().eq(YxStoreOrder::getUid,uid);
|
||||||
|
}
|
||||||
|
|
||||||
return generator.convert(yxStoreOrderMapper.selectOne(wrapper),YxStoreOrderQueryVo.class);
|
return generator.convert(yxStoreOrderMapper.selectOne(wrapper),YxStoreOrderQueryVo.class);
|
||||||
}
|
}
|
||||||
@ -1506,7 +1586,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
storeBargainService.decStockIncSales(storeCartVO.getCartNum(),bargainId);
|
storeBargainService.decStockIncSales(storeCartVO.getCartNum(),bargainId);
|
||||||
} else {
|
} else {
|
||||||
productService.decProductStock(storeCartVO.getCartNum(),storeCartVO.getProductId(),
|
productService.decProductStock(storeCartVO.getCartNum(),storeCartVO.getProductId(),
|
||||||
storeCartVO.getProductAttrUnique(),0l,"");
|
storeCartVO.getProductAttrUnique(), 0L,"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1533,7 +1613,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
private BigDecimal getGainIntegral(List<YxStoreCartQueryVo> cartInfo){
|
private BigDecimal getGainIntegral(List<YxStoreCartQueryVo> cartInfo){
|
||||||
BigDecimal gainIntegral = BigDecimal.ZERO;
|
BigDecimal gainIntegral = BigDecimal.ZERO;
|
||||||
for (YxStoreCartQueryVo cart : cartInfo) {
|
for (YxStoreCartQueryVo cart : cartInfo) {
|
||||||
if(cart.getCombinationId() >0 || cart.getSeckillId() > 0 || cart.getBargainId() > 0) continue;
|
if(cart.getCombinationId() >0 || cart.getSeckillId() > 0 || cart.getBargainId() > 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
BigDecimal cartInfoGainIntegral = BigDecimal.ZERO;
|
BigDecimal cartInfoGainIntegral = BigDecimal.ZERO;
|
||||||
Double gain = cart.getProductInfo().getGiveIntegral().doubleValue();
|
Double gain = cart.getProductInfo().getGiveIntegral().doubleValue();
|
||||||
if(gain > 0){
|
if(gain > 0){
|
||||||
@ -1614,7 +1696,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(order.getUseIntegral().compareTo(BigDecimal.ZERO) <= 0) return;
|
if(order.getUseIntegral().compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!OrderStatusEnum.STATUS_MINUS_2.getValue().equals(order.getStatus())
|
if(!OrderStatusEnum.STATUS_MINUS_2.getValue().equals(order.getStatus())
|
||||||
&& !OrderInfoEnum.REFUND_STATUS_2.getValue().equals(order.getRefundStatus())
|
&& !OrderInfoEnum.REFUND_STATUS_2.getValue().equals(order.getRefundStatus())
|
||||||
@ -1651,7 +1735,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
*/
|
*/
|
||||||
private CacheDto getCacheOrderInfo(Long uid, String key) {
|
private CacheDto getCacheOrderInfo(Long uid, String key) {
|
||||||
Object obj = redisUtils.get(ShopConstants.YSHOP_ORDER_CACHE_KEY + uid + key);
|
Object obj = redisUtils.get(ShopConstants.YSHOP_ORDER_CACHE_KEY + uid + key);
|
||||||
if(obj == null) return null;
|
if(obj == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return JSON.parseObject(obj.toString(), CacheDto.class);
|
return JSON.parseObject(obj.toString(), CacheDto.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1733,7 +1819,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
private BigDecimal handlePostage(List<YxStoreCartQueryVo> cartInfo,YxUserAddress userAddress){
|
private BigDecimal handlePostage(List<YxStoreCartQueryVo> cartInfo,YxUserAddress userAddress){
|
||||||
BigDecimal storePostage = BigDecimal.ZERO;
|
BigDecimal storePostage = BigDecimal.ZERO;
|
||||||
if(userAddress != null){
|
if(userAddress != null){
|
||||||
if(userAddress.getCityId() == null) return storePostage;
|
if(userAddress.getCityId() == null) {
|
||||||
|
return storePostage;
|
||||||
|
}
|
||||||
//城市包括默认
|
//城市包括默认
|
||||||
int cityId = userAddress.getCityId();
|
int cityId = userAddress.getCityId();
|
||||||
List<Integer> citys = new ArrayList<>();
|
List<Integer> citys = new ArrayList<>();
|
||||||
@ -1782,7 +1870,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
Integer tempId = storeCartVO.getProductInfo().getTempId();
|
Integer tempId = storeCartVO.getProductInfo().getTempId();
|
||||||
|
|
||||||
//处理拼团等营销商品没有设置运费模板
|
//处理拼团等营销商品没有设置运费模板
|
||||||
if(tempId == null) return storePostage;
|
if(tempId == null) {
|
||||||
|
return storePostage;
|
||||||
|
}
|
||||||
|
|
||||||
//根据模板类型获取相应的数量
|
//根据模板类型获取相应的数量
|
||||||
double num = 0d;
|
double num = 0d;
|
||||||
@ -1832,7 +1922,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
.le(YxShippingTemplatesFree::getNumber,mapValue.getNumber())
|
.le(YxShippingTemplatesFree::getNumber,mapValue.getNumber())
|
||||||
.le(YxShippingTemplatesFree::getPrice,mapValue.getPrice()));
|
.le(YxShippingTemplatesFree::getPrice,mapValue.getPrice()));
|
||||||
//满足包邮条件剔除
|
//满足包邮条件剔除
|
||||||
if(count > 0) templateDTOMap.remove(mapKey);
|
if(count > 0) {
|
||||||
|
templateDTOMap.remove(mapKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//处理区域邮费
|
//处理区域邮费
|
||||||
@ -1892,16 +1984,16 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
private BigDecimal getOrderSumPrice(List<YxStoreCartQueryVo> cartInfo, String key) {
|
private BigDecimal getOrderSumPrice(List<YxStoreCartQueryVo> cartInfo, String key) {
|
||||||
BigDecimal sumPrice = BigDecimal.ZERO;
|
BigDecimal sumPrice = BigDecimal.ZERO;
|
||||||
|
|
||||||
if(key.equals("truePrice")){
|
if("truePrice".equals(key)){
|
||||||
for (YxStoreCartQueryVo storeCart : cartInfo) {
|
for (YxStoreCartQueryVo storeCart : cartInfo) {
|
||||||
sumPrice = NumberUtil.add(sumPrice,NumberUtil.mul(storeCart.getCartNum(),storeCart.getTruePrice()));
|
sumPrice = NumberUtil.add(sumPrice,NumberUtil.mul(storeCart.getCartNum(),storeCart.getTruePrice()));
|
||||||
}
|
}
|
||||||
}else if(key.equals("costPrice")){
|
}else if("costPrice".equals(key)){
|
||||||
for (YxStoreCartQueryVo storeCart : cartInfo) {
|
for (YxStoreCartQueryVo storeCart : cartInfo) {
|
||||||
sumPrice = NumberUtil.add(sumPrice,
|
sumPrice = NumberUtil.add(sumPrice,
|
||||||
NumberUtil.mul(storeCart.getCartNum(),storeCart.getCostPrice()));
|
NumberUtil.mul(storeCart.getCartNum(),storeCart.getCostPrice()));
|
||||||
}
|
}
|
||||||
}else if(key.equals("vipTruePrice")){
|
}else if("vipTruePrice".equals(key)){
|
||||||
for (YxStoreCartQueryVo storeCart : cartInfo) {
|
for (YxStoreCartQueryVo storeCart : cartInfo) {
|
||||||
sumPrice = NumberUtil.add(sumPrice,
|
sumPrice = NumberUtil.add(sumPrice,
|
||||||
NumberUtil.mul(storeCart.getCartNum(),storeCart.getVipTruePrice()));
|
NumberUtil.mul(storeCart.getCartNum(),storeCart.getVipTruePrice()));
|
||||||
@ -2195,7 +2287,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
str = "[砍价订单]";
|
str = "[砍价订单]";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().equals(shippingType)) str = "[核销订单]";
|
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().equals(shippingType)) {
|
||||||
|
str = "[核销订单]";
|
||||||
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,9 @@ public class YxStoreProductAttrServiceImpl extends BaseServiceImpl<StoreProductA
|
|||||||
* @param productId 商品id
|
* @param productId 商品id
|
||||||
*/
|
*/
|
||||||
private void clearProductAttr(Long productId) {
|
private void clearProductAttr(Long productId) {
|
||||||
if(ObjectUtil.isNull(productId)) throw new YshopException("产品不存在");
|
if(ObjectUtil.isNull(productId)) {
|
||||||
|
throw new YshopException("产品不存在");
|
||||||
|
}
|
||||||
|
|
||||||
yxStoreProductAttrMapper.delete(Wrappers.<YxStoreProductAttr>lambdaQuery()
|
yxStoreProductAttrMapper.delete(Wrappers.<YxStoreProductAttr>lambdaQuery()
|
||||||
.eq(YxStoreProductAttr::getProductId,productId));
|
.eq(YxStoreProductAttr::getProductId,productId));
|
||||||
@ -180,7 +182,9 @@ public class YxStoreProductAttrServiceImpl extends BaseServiceImpl<StoreProductA
|
|||||||
}else {
|
}else {
|
||||||
res = yxStoreProductAttrValueMapper.decStockIncSales(num,productId,unique);
|
res = yxStoreProductAttrValueMapper.decStockIncSales(num,productId,unique);
|
||||||
}
|
}
|
||||||
if(res == 0) throw new YshopException("商品库存不足");
|
if(res == 0) {
|
||||||
|
throw new YshopException("商品库存不足");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,7 +62,9 @@ public class YxStoreProductRelationServiceImpl extends BaseServiceImpl<YxStorePr
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addRroductRelation(long productId,long uid) {
|
public void addRroductRelation(long productId,long uid) {
|
||||||
if(isProductRelation(productId,uid)) throw new YshopException("已收藏");
|
if(isProductRelation(productId,uid)) {
|
||||||
|
throw new YshopException("已收藏");
|
||||||
|
}
|
||||||
YxStoreProductRelation storeProductRelation = YxStoreProductRelation.builder()
|
YxStoreProductRelation storeProductRelation = YxStoreProductRelation.builder()
|
||||||
.productId(productId)
|
.productId(productId)
|
||||||
.uid(uid)
|
.uid(uid)
|
||||||
@ -81,7 +83,9 @@ public class YxStoreProductRelationServiceImpl extends BaseServiceImpl<YxStorePr
|
|||||||
.eq(YxStoreProductRelation::getProductId,productId)
|
.eq(YxStoreProductRelation::getProductId,productId)
|
||||||
.eq(YxStoreProductRelation::getUid,uid)
|
.eq(YxStoreProductRelation::getUid,uid)
|
||||||
.one();
|
.one();
|
||||||
if(productRelation == null) throw new YshopException("已取消");
|
if(productRelation == null) {
|
||||||
|
throw new YshopException("已取消");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.removeById(productRelation.getId());
|
this.removeById(productRelation.getId());
|
||||||
@ -100,7 +104,9 @@ public class YxStoreProductRelationServiceImpl extends BaseServiceImpl<YxStorePr
|
|||||||
.selectCount(Wrappers.<YxStoreProductRelation>lambdaQuery()
|
.selectCount(Wrappers.<YxStoreProductRelation>lambdaQuery()
|
||||||
.eq(YxStoreProductRelation::getUid,uid)
|
.eq(YxStoreProductRelation::getUid,uid)
|
||||||
.eq(YxStoreProductRelation::getProductId,productId));
|
.eq(YxStoreProductRelation::getProductId,productId));
|
||||||
if(count > 0) return true;
|
if(count > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
res = storeProductMapper.decStockIncSales(num,productId);
|
res = storeProductMapper.decStockIncSales(num,productId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(res == 0) throw new YshopException("商品库存不足");
|
if(res == 0) {
|
||||||
|
throw new YshopException("商品库存不足");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -193,7 +195,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
.eq(YxStoreProductAttrValue::getUnique, unique)
|
.eq(YxStoreProductAttrValue::getUnique, unique)
|
||||||
.eq(YxStoreProductAttrValue::getProductId, productId));
|
.eq(YxStoreProductAttrValue::getProductId, productId));
|
||||||
|
|
||||||
if (storeProductAttrValue == null) return 0;
|
if (storeProductAttrValue == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if("pink".equals(type)){
|
if("pink".equals(type)){
|
||||||
return storeProductAttrValue.getPinkStock();
|
return storeProductAttrValue.getPinkStock();
|
||||||
}else if ("seckill".equals(type)){
|
}else if ("seckill".equals(type)){
|
||||||
@ -482,7 +486,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
//添加商品
|
//添加商品
|
||||||
YxStoreProduct yxStoreProduct = new YxStoreProduct();
|
YxStoreProduct yxStoreProduct = new YxStoreProduct();
|
||||||
BeanUtil.copyProperties(storeProductDto,yxStoreProduct,"sliderImage");
|
BeanUtil.copyProperties(storeProductDto,yxStoreProduct,"sliderImage");
|
||||||
if(storeProductDto.getSliderImage().isEmpty()) throw new YshopException("请上传轮播图");
|
if(storeProductDto.getSliderImage().isEmpty()) {
|
||||||
|
throw new YshopException("请上传轮播图");
|
||||||
|
}
|
||||||
|
|
||||||
yxStoreProduct.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice()));
|
yxStoreProduct.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice()));
|
||||||
yxStoreProduct.setOtPrice(BigDecimal.valueOf(resultDTO.getMinOtPrice()));
|
yxStoreProduct.setOtPrice(BigDecimal.valueOf(resultDTO.getMinOtPrice()));
|
||||||
@ -683,7 +689,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
.reduce(Integer::sum)
|
.reduce(Integer::sum)
|
||||||
.orElse(0);
|
.orElse(0);
|
||||||
|
|
||||||
if(stock <= 0) throw new YshopException("库存不能低于0");
|
if(stock <= 0) {
|
||||||
|
throw new YshopException("库存不能低于0");
|
||||||
|
}
|
||||||
|
|
||||||
return ProductResultDto.builder()
|
return ProductResultDto.builder()
|
||||||
.minPrice(minPrice)
|
.minPrice(minPrice)
|
||||||
@ -807,14 +815,20 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
fromatDetailDTOList.stream()
|
fromatDetailDTOList.stream()
|
||||||
.map(FromatDetailDto::getDetail)
|
.map(FromatDetailDto::getDetail)
|
||||||
.forEach(i -> {
|
.forEach(i -> {
|
||||||
if(i == null || i.isEmpty()) throw new YshopException("请至少添加一个规格值哦");
|
if(i == null || i.isEmpty()) {
|
||||||
|
throw new YshopException("请至少添加一个规格值哦");
|
||||||
|
}
|
||||||
String str = ArrayUtil.join(i.toArray(),",");
|
String str = ArrayUtil.join(i.toArray(),",");
|
||||||
if(str.contains("-")) throw new YshopException("规格值里包含'-',请重新添加");
|
if(str.contains("-")) {
|
||||||
|
throw new YshopException("规格值里包含'-',请重新添加");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(fromatDetailDTOList.size() > 1){
|
if(fromatDetailDTOList.size() > 1){
|
||||||
for (int i=0; i < fromatDetailDTOList.size() - 1;i++){
|
for (int i=0; i < fromatDetailDTOList.size() - 1;i++){
|
||||||
if(i == 0) data = fromatDetailDTOList.get(i).getDetail();
|
if(i == 0) {
|
||||||
|
data = fromatDetailDTOList.get(i).getDetail();
|
||||||
|
}
|
||||||
List<String> tmp = new LinkedList<>();
|
List<String> tmp = new LinkedList<>();
|
||||||
for (String v : data) {
|
for (String v : data) {
|
||||||
for (String g : fromatDetailDTOList.get(i+1).getDetail()) {
|
for (String g : fromatDetailDTOList.get(i+1).getDetail()) {
|
||||||
|
@ -55,12 +55,16 @@ public class YxSystemConfigServiceImpl extends BaseServiceImpl<SystemConfigMappe
|
|||||||
@Override
|
@Override
|
||||||
public String getData(String name) {
|
public String getData(String name) {
|
||||||
String result = redisUtils.getY(name);
|
String result = redisUtils.getY(name);
|
||||||
if(StrUtil.isNotBlank(result)) return result;
|
if(StrUtil.isNotBlank(result)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
QueryWrapper<YxSystemConfig> wrapper = new QueryWrapper<>();
|
QueryWrapper<YxSystemConfig> wrapper = new QueryWrapper<>();
|
||||||
wrapper.lambda().eq(YxSystemConfig::getMenuName,name);
|
wrapper.lambda().eq(YxSystemConfig::getMenuName,name);
|
||||||
YxSystemConfig systemConfig = this.baseMapper.selectOne(wrapper);
|
YxSystemConfig systemConfig = this.baseMapper.selectOne(wrapper);
|
||||||
if(systemConfig == null) return "";
|
if(systemConfig == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
return systemConfig.getValue();
|
return systemConfig.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,9 +94,13 @@ public class YxSystemStoreServiceImpl extends BaseServiceImpl<SystemStoreMapper,
|
|||||||
.eq(YxSystemStore::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
.eq(YxSystemStore::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
||||||
.orderByDesc(YxSystemStore::getId)
|
.orderByDesc(YxSystemStore::getId)
|
||||||
.last("limit 1"));
|
.last("limit 1"));
|
||||||
if(yxSystemStore == null) return null;
|
if(yxSystemStore == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
String mention = RedisUtil.get(ShopKeyUtils.getStoreSelfMention());
|
String mention = RedisUtil.get(ShopKeyUtils.getStoreSelfMention());
|
||||||
if(StrUtil.isBlank(mention) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(mention)) return null;
|
if(StrUtil.isBlank(mention) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(mention)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
YxSystemStoreQueryVo systemStoreQueryVo = generator.convert(yxSystemStore,YxSystemStoreQueryVo.class);
|
YxSystemStoreQueryVo systemStoreQueryVo = generator.convert(yxSystemStore,YxSystemStoreQueryVo.class);
|
||||||
if(StrUtil.isNotEmpty(latitude) && StrUtil.isNotEmpty(longitude)){
|
if(StrUtil.isNotEmpty(latitude) && StrUtil.isNotEmpty(longitude)){
|
||||||
double distance = LocationUtils.getDistance(Double.valueOf(latitude),Double.valueOf(longitude),
|
double distance = LocationUtils.getDistance(Double.valueOf(latitude),Double.valueOf(longitude),
|
||||||
|
@ -58,7 +58,9 @@ public class YxSystemStoreStaffServiceImpl extends BaseServiceImpl<SystemStoreSt
|
|||||||
YxSystemStoreStaff storeStaff = new YxSystemStoreStaff();
|
YxSystemStoreStaff storeStaff = new YxSystemStoreStaff();
|
||||||
storeStaff.setUid(uid);
|
storeStaff.setUid(uid);
|
||||||
storeStaff.setVerifyStatus(ShopCommonEnum.IS_STATUS_1.getValue());
|
storeStaff.setVerifyStatus(ShopCommonEnum.IS_STATUS_1.getValue());
|
||||||
if(storeId != null) storeStaff.setStoreId(storeId);
|
if(storeId != null) {
|
||||||
|
storeStaff.setStoreId(storeId);
|
||||||
|
}
|
||||||
return this.baseMapper.selectCount(Wrappers.query(storeStaff)) > 0;
|
return this.baseMapper.selectCount(Wrappers.query(storeStaff)) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,9 @@ public class YxShippingTemplatesServiceImpl extends BaseServiceImpl<YxShippingTe
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(shippingTemplatesFrees.isEmpty()) throw new YshopException("请添加包邮区域");
|
if(shippingTemplatesFrees.isEmpty()) {
|
||||||
|
throw new YshopException("请添加包邮区域");
|
||||||
|
}
|
||||||
|
|
||||||
yxShippingTemplatesFreeService.saveBatch(shippingTemplatesFrees);
|
yxShippingTemplatesFreeService.saveBatch(shippingTemplatesFrees);
|
||||||
|
|
||||||
@ -243,7 +245,9 @@ public class YxShippingTemplatesServiceImpl extends BaseServiceImpl<YxShippingTe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(shippingTemplatesRegions.isEmpty()) throw new BusinessException("请添加区域");
|
if(shippingTemplatesRegions.isEmpty()) {
|
||||||
|
throw new BusinessException("请添加区域");
|
||||||
|
}
|
||||||
|
|
||||||
yxShippingTemplatesRegionService.saveBatch(shippingTemplatesRegions);
|
yxShippingTemplatesRegionService.saveBatch(shippingTemplatesRegions);
|
||||||
|
|
||||||
|
@ -74,7 +74,9 @@ public class YxSystemUserLevelServiceImpl extends BaseServiceImpl<SystemUserLeve
|
|||||||
|
|
||||||
int grade = 0;
|
int grade = 0;
|
||||||
for (YxSystemUserLevel userLevel : list) {
|
for (YxSystemUserLevel userLevel : list) {
|
||||||
if(userLevel.getId() == levelId) grade = userLevel.getGrade();
|
if(userLevel.getId() == levelId) {
|
||||||
|
grade = userLevel.getGrade();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
YxSystemUserLevel userLevel = this.lambdaQuery()
|
YxSystemUserLevel userLevel = this.lambdaQuery()
|
||||||
@ -83,7 +85,9 @@ public class YxSystemUserLevelServiceImpl extends BaseServiceImpl<SystemUserLeve
|
|||||||
.gt(YxSystemUserLevel::getGrade,grade)
|
.gt(YxSystemUserLevel::getGrade,grade)
|
||||||
.last("limit 1")
|
.last("limit 1")
|
||||||
.one();
|
.one();
|
||||||
if(ObjectUtil.isNull(userLevel)) return 0;
|
if(ObjectUtil.isNull(userLevel)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return userLevel.getId();
|
return userLevel.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +117,9 @@ public class YxSystemUserLevelServiceImpl extends BaseServiceImpl<SystemUserLeve
|
|||||||
|
|
||||||
//会员等级列表
|
//会员等级列表
|
||||||
List<YxSystemUserLevelQueryVo> list = this.getLevelListAndGrade(levelId);
|
List<YxSystemUserLevelQueryVo> list = this.getLevelListAndGrade(levelId);
|
||||||
if(list.isEmpty()) throw new YshopException("请后台设置会员等级");
|
if(list.isEmpty()) {
|
||||||
|
throw new YshopException("请后台设置会员等级");
|
||||||
|
}
|
||||||
|
|
||||||
//任务列表
|
//任务列表
|
||||||
TaskDto taskDTO = systemUserTaskService.getTaskList(list.get(0).getId(),uid);
|
TaskDto taskDTO = systemUserTaskService.getTaskList(list.get(0).getId(),uid);
|
||||||
@ -138,7 +144,9 @@ public class YxSystemUserLevelServiceImpl extends BaseServiceImpl<SystemUserLeve
|
|||||||
.list();
|
.list();
|
||||||
List<YxSystemUserLevelQueryVo> newList = generator.convert(list,YxSystemUserLevelQueryVo.class);
|
List<YxSystemUserLevelQueryVo> newList = generator.convert(list,YxSystemUserLevelQueryVo.class);
|
||||||
for (YxSystemUserLevelQueryVo userLevelQueryVo : newList) {
|
for (YxSystemUserLevelQueryVo userLevelQueryVo : newList) {
|
||||||
if(userLevelQueryVo.getId().compareTo(levelId) == 0) grade = userLevelQueryVo.getGrade();
|
if(userLevelQueryVo.getId().compareTo(levelId) == 0) {
|
||||||
|
grade = userLevelQueryVo.getGrade();
|
||||||
|
}
|
||||||
if(grade.compareTo(userLevelQueryVo.getGrade()) < 0){
|
if(grade.compareTo(userLevelQueryVo.getGrade()) < 0){
|
||||||
userLevelQueryVo.setIsClear(true); //不解锁
|
userLevelQueryVo.setIsClear(true); //不解锁
|
||||||
}else{
|
}else{
|
||||||
|
@ -94,7 +94,9 @@ public class YxSystemUserTaskServiceImpl extends BaseServiceImpl<SystemUserTaskM
|
|||||||
.list();
|
.list();
|
||||||
List<Integer> taskIds = list.stream().map(YxSystemUserTask::getId)
|
List<Integer> taskIds = list.stream().map(YxSystemUserTask::getId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if(taskIds.isEmpty()) return 0;
|
if(taskIds.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int count = yxUserTaskFinishMapper.selectCount(Wrappers.<YxUserTaskFinish>lambdaQuery()
|
int count = yxUserTaskFinishMapper.selectCount(Wrappers.<YxUserTaskFinish>lambdaQuery()
|
||||||
.in(YxUserTaskFinish::getTaskId,taskIds)
|
.in(YxUserTaskFinish::getTaskId,taskIds)
|
||||||
@ -192,7 +194,9 @@ public class YxSystemUserTaskServiceImpl extends BaseServiceImpl<SystemUserTaskM
|
|||||||
List<YxSystemUserTaskDto> systemUserTaskDTOS = generator.convert(page.getList(),YxSystemUserTaskDto.class);
|
List<YxSystemUserTaskDto> systemUserTaskDTOS = generator.convert(page.getList(),YxSystemUserTaskDto.class);
|
||||||
for (YxSystemUserTaskDto systemUserTaskDTO : systemUserTaskDTOS) {
|
for (YxSystemUserTaskDto systemUserTaskDTO : systemUserTaskDTOS) {
|
||||||
YxSystemUserLevel userLevel=systemUserLevelService.getById(systemUserTaskDTO.getLevelId());
|
YxSystemUserLevel userLevel=systemUserLevelService.getById(systemUserTaskDTO.getLevelId());
|
||||||
if(userLevel == null) continue;
|
if(userLevel == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
systemUserTaskDTO.setLevalName(userLevel.getName());
|
systemUserTaskDTO.setLevalName(userLevel.getName());
|
||||||
}
|
}
|
||||||
Map<String, Object> map = new LinkedHashMap<>(2);
|
Map<String, Object> map = new LinkedHashMap<>(2);
|
||||||
|
@ -72,7 +72,8 @@ public class YxUserAddressServiceImpl extends BaseServiceImpl<YxUserAddressMappe
|
|||||||
* @param uid uid
|
* @param uid uid
|
||||||
* @param param AddressParam
|
* @param param AddressParam
|
||||||
*/
|
*/
|
||||||
public Long addAndEdit(Long uid,AddressParam param){
|
@Override
|
||||||
|
public Long addAndEdit(Long uid, AddressParam param){
|
||||||
YxUserAddress userAddress = YxUserAddress.builder()
|
YxUserAddress userAddress = YxUserAddress.builder()
|
||||||
.city(param.getAddress().getCity())
|
.city(param.getAddress().getCity())
|
||||||
.cityId(param.getAddress().getCityId())
|
.cityId(param.getAddress().getCityId())
|
||||||
|
@ -68,7 +68,9 @@ public class YxUserLevelServiceImpl extends BaseServiceImpl<YxUserLevelMapper, Y
|
|||||||
levelId = yxUserLevel.getLevelId();
|
levelId = yxUserLevel.getLevelId();
|
||||||
}
|
}
|
||||||
int nextLevelId = systemUserLevelService.getNextLevelId(levelId);
|
int nextLevelId = systemUserLevelService.getNextLevelId(levelId);
|
||||||
if(nextLevelId == 0) return false;
|
if(nextLevelId == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int finishCount = systemUserTaskService.getTaskComplete(nextLevelId,uid);
|
int finishCount = systemUserTaskService.getTaskComplete(nextLevelId,uid);
|
||||||
|
|
||||||
@ -95,10 +97,16 @@ public class YxUserLevelServiceImpl extends BaseServiceImpl<YxUserLevelMapper, Y
|
|||||||
.eq(YxUserLevel::getStatus, ShopCommonEnum.IS_STATUS_1.getValue())
|
.eq(YxUserLevel::getStatus, ShopCommonEnum.IS_STATUS_1.getValue())
|
||||||
.eq(YxUserLevel::getUid,uid)
|
.eq(YxUserLevel::getUid,uid)
|
||||||
.orderByDesc(YxUserLevel::getGrade);
|
.orderByDesc(YxUserLevel::getGrade);
|
||||||
if(grade != null) wrapper.lambda().lt(YxUserLevel::getGrade,grade);
|
if(grade != null) {
|
||||||
|
wrapper.lambda().lt(YxUserLevel::getGrade,grade);
|
||||||
|
}
|
||||||
YxUserLevel userLevel = this.getOne(wrapper,false);
|
YxUserLevel userLevel = this.getOne(wrapper,false);
|
||||||
if(ObjectUtil.isNull(userLevel)) return null;
|
if(ObjectUtil.isNull(userLevel)) {
|
||||||
if(ShopCommonEnum.IS_FOREVER_1.getValue().equals(userLevel.getIsForever())) return userLevel;
|
return null;
|
||||||
|
}
|
||||||
|
if(ShopCommonEnum.IS_FOREVER_1.getValue().equals(userLevel.getIsForever())) {
|
||||||
|
return userLevel;
|
||||||
|
}
|
||||||
int nowTime = OrderUtil.getSecondTimestampTwo();
|
int nowTime = OrderUtil.getSecondTimestampTwo();
|
||||||
if(nowTime > userLevel.getValidTime()){
|
if(nowTime > userLevel.getValidTime()){
|
||||||
if(ShopCommonEnum.IS_STATUS_1.getValue().equals(userLevel.getStatus())){
|
if(ShopCommonEnum.IS_STATUS_1.getValue().equals(userLevel.getStatus())){
|
||||||
@ -119,7 +127,9 @@ public class YxUserLevelServiceImpl extends BaseServiceImpl<YxUserLevelMapper, Y
|
|||||||
private void setUserLevel(Long uid, int levelId){
|
private void setUserLevel(Long uid, int levelId){
|
||||||
YxSystemUserLevel systemUserLevelQueryVo = systemUserLevelService
|
YxSystemUserLevel systemUserLevelQueryVo = systemUserLevelService
|
||||||
.getById(levelId);
|
.getById(levelId);
|
||||||
if(ObjectUtil.isNull(systemUserLevelQueryVo)) return;
|
if(ObjectUtil.isNull(systemUserLevelQueryVo)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int validTime = systemUserLevelQueryVo.getValidDate() * 86400;
|
int validTime = systemUserLevelQueryVo.getValidDate() * 86400;
|
||||||
|
|
||||||
|
@ -167,9 +167,13 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
List<PromUserDto> list = new ArrayList<>();
|
List<PromUserDto> list = new ArrayList<>();
|
||||||
if (userIds.isEmpty()) return list;
|
if (userIds.isEmpty()) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
if (StrUtil.isBlank(sort)) sort = "u.uid desc";
|
if (StrUtil.isBlank(sort)) {
|
||||||
|
sort = "u.uid desc";
|
||||||
|
}
|
||||||
|
|
||||||
Page<YxUser> pageModel = new Page<>(page, limit);
|
Page<YxUser> pageModel = new Page<>(page, limit);
|
||||||
if (ShopCommonEnum.GRADE_0.getValue().equals(grade)) {//-级
|
if (ShopCommonEnum.GRADE_0.getValue().equals(grade)) {//-级
|
||||||
@ -181,7 +185,9 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
|||||||
List<Long> userIdsT = userListT.stream()
|
List<Long> userIdsT = userListT.stream()
|
||||||
.map(YxUser::getUid)
|
.map(YxUser::getUid)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (userIdsT.isEmpty()) return list;
|
if (userIdsT.isEmpty()) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
list = yxUserMapper.getUserSpreadCountList(pageModel, userIdsT,
|
list = yxUserMapper.getUserSpreadCountList(pageModel, userIdsT,
|
||||||
keyword, sort);
|
keyword, sort);
|
||||||
|
|
||||||
@ -224,14 +230,18 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
|||||||
public void backOrderBrokerage(YxStoreOrderQueryVo order) {
|
public void backOrderBrokerage(YxStoreOrderQueryVo order) {
|
||||||
//如果分销没开启直接返回
|
//如果分销没开启直接返回
|
||||||
String open = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_OPEN);
|
String open = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_OPEN);
|
||||||
if(StrUtil.isBlank(open) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(open)) return;
|
if(StrUtil.isBlank(open) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(open)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//获取购买商品的用户
|
//获取购买商品的用户
|
||||||
YxUser userInfo = this.getById(order.getUid());
|
YxUser userInfo = this.getById(order.getUid());
|
||||||
System.out.println("userInfo:"+userInfo);
|
System.out.println("userInfo:"+userInfo);
|
||||||
//当前用户不存在 没有上级 直接返回
|
//当前用户不存在 没有上级 直接返回
|
||||||
if(ObjectUtil.isNull(userInfo) || userInfo.getSpreadUid() == 0) return;
|
if(ObjectUtil.isNull(userInfo) || userInfo.getSpreadUid() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
YxUser preUser = this.getById(userInfo.getSpreadUid());
|
YxUser preUser = this.getById(userInfo.getSpreadUid());
|
||||||
@ -241,7 +251,9 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
|||||||
|
|
||||||
//返佣金额小于等于0 直接返回不返佣金
|
//返佣金额小于等于0 直接返回不返佣金
|
||||||
|
|
||||||
if(brokeragePrice.compareTo(BigDecimal.ZERO) <= 0) return;
|
if(brokeragePrice.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//计算上级推广员返佣之后的金额
|
//计算上级推广员返佣之后的金额
|
||||||
double balance = NumberUtil.add(preUser.getBrokeragePrice(),brokeragePrice).doubleValue();
|
double balance = NumberUtil.add(preUser.getBrokeragePrice(),brokeragePrice).doubleValue();
|
||||||
@ -351,9 +363,13 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
|||||||
.last("limit 1");
|
.last("limit 1");
|
||||||
YxUserLevel userLevel = userLevelService.getOne(wrapper);
|
YxUserLevel userLevel = userLevelService.getOne(wrapper);
|
||||||
YxSystemUserLevel systemUserLevel = new YxSystemUserLevel();
|
YxSystemUserLevel systemUserLevel = new YxSystemUserLevel();
|
||||||
if(ObjectUtil.isNotNull(userLevel)) systemUserLevel= systemUserLevelService.getById(userLevel.getLevelId());
|
if(ObjectUtil.isNotNull(userLevel)) {
|
||||||
|
systemUserLevel= systemUserLevelService.getById(userLevel.getLevelId());
|
||||||
|
}
|
||||||
int discount = 100;
|
int discount = 100;
|
||||||
if(ObjectUtil.isNotNull(userLevel)) discount = systemUserLevel.getDiscount().intValue();
|
if(ObjectUtil.isNotNull(userLevel)) {
|
||||||
|
discount = systemUserLevel.getDiscount().intValue();
|
||||||
|
}
|
||||||
return NumberUtil.mul(NumberUtil.div(discount,100),price);
|
return NumberUtil.mul(NumberUtil.div(discount,100),price);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,27 +381,43 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setSpread(String spread, long uid) {
|
public void setSpread(String spread, long uid) {
|
||||||
if(StrUtil.isBlank(spread) || !NumberUtil.isNumber(spread)) return;
|
if(StrUtil.isBlank(spread) || !NumberUtil.isNumber(spread)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//如果分销没开启直接返回
|
//如果分销没开启直接返回
|
||||||
String open = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_OPEN);
|
String open = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_OPEN);
|
||||||
if(StrUtil.isBlank(open) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(open)) return;
|
if(StrUtil.isBlank(open) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(open)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
//当前用户信息
|
//当前用户信息
|
||||||
YxUser userInfo = this.getById(uid);
|
YxUser userInfo = this.getById(uid);
|
||||||
if(ObjectUtil.isNull(userInfo)) return;
|
if(ObjectUtil.isNull(userInfo)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//当前用户有上级直接返回
|
//当前用户有上级直接返回
|
||||||
if(userInfo.getSpreadUid() != null && userInfo.getSpreadUid() > 0) return;
|
if(userInfo.getSpreadUid() != null && userInfo.getSpreadUid() > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
//没有推广编号直接返回
|
//没有推广编号直接返回
|
||||||
long spreadInt = Long.valueOf(spread);
|
long spreadInt = Long.valueOf(spread);
|
||||||
if(spreadInt == 0) return;
|
if(spreadInt == 0) {
|
||||||
if(spreadInt == uid) return;
|
return;
|
||||||
|
}
|
||||||
|
if(spreadInt == uid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//不能互相成为上下级
|
//不能互相成为上下级
|
||||||
YxUser userInfoT = this.getById(spreadInt);
|
YxUser userInfoT = this.getById(spreadInt);
|
||||||
if(ObjectUtil.isNull(userInfoT)) return;
|
if(ObjectUtil.isNull(userInfoT)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(userInfoT.getSpreadUid() == uid) return;
|
if(userInfoT.getSpreadUid() == uid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
YxUser yxUser = YxUser.builder()
|
YxUser yxUser = YxUser.builder()
|
||||||
.spreadUid(spreadInt)
|
.spreadUid(spreadInt)
|
||||||
@ -410,7 +442,9 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
|||||||
YxUser userInfoTwo = this.getById(userInfo.getSpreadUid());
|
YxUser userInfoTwo = this.getById(userInfo.getSpreadUid());
|
||||||
|
|
||||||
//上推广人不存在 或者 上推广人没有上级 直接返回
|
//上推广人不存在 或者 上推广人没有上级 直接返回
|
||||||
if(ObjectUtil.isNull(userInfoTwo) || userInfoTwo.getSpreadUid() == 0) return;
|
if(ObjectUtil.isNull(userInfoTwo) || userInfoTwo.getSpreadUid() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//指定分销 判断 上上级是否时推广员 如果不是推广员直接返回
|
//指定分销 判断 上上级是否时推广员 如果不是推广员直接返回
|
||||||
@ -421,7 +455,9 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
|||||||
BigDecimal brokeragePrice = this.computeProductBrokerage(order,Brokerage.LEVEL_2);
|
BigDecimal brokeragePrice = this.computeProductBrokerage(order,Brokerage.LEVEL_2);
|
||||||
|
|
||||||
//返佣金额小于等于0 直接返回不返佣金
|
//返佣金额小于等于0 直接返回不返佣金
|
||||||
if(brokeragePrice.compareTo(BigDecimal.ZERO) <= 0) return;
|
if(brokeragePrice.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//获取上上级推广员信息
|
//获取上上级推广员信息
|
||||||
double balance = NumberUtil.add(preUser.getBrokeragePrice(),brokeragePrice).doubleValue();
|
double balance = NumberUtil.add(preUser.getBrokeragePrice(),brokeragePrice).doubleValue();
|
||||||
@ -627,7 +663,9 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
|||||||
}else{
|
}else{
|
||||||
mark = "系统扣除了"+param.getMoney()+"余额";
|
mark = "系统扣除了"+param.getMoney()+"余额";
|
||||||
newMoney = NumberUtil.sub(yxUser.getNowMoney(),param.getMoney()).doubleValue();
|
newMoney = NumberUtil.sub(yxUser.getNowMoney(),param.getMoney()).doubleValue();
|
||||||
if(newMoney < 0) newMoney = 0d;
|
if(newMoney < 0) {
|
||||||
|
newMoney = 0d;
|
||||||
|
}
|
||||||
billService.expend(yxUser.getUid(), "系统减少余额",
|
billService.expend(yxUser.getUid(), "系统减少余额",
|
||||||
BillDetailEnum.CATEGORY_1.getValue(),
|
BillDetailEnum.CATEGORY_1.getValue(),
|
||||||
BillDetailEnum.TYPE_7.getValue(),
|
BillDetailEnum.TYPE_7.getValue(),
|
||||||
|
@ -79,10 +79,14 @@ public class YxUserSignServiceImpl extends BaseServiceImpl<YxUserSignMapper, YxU
|
|||||||
@Override
|
@Override
|
||||||
public int sign(YxUser yxUser) {
|
public int sign(YxUser yxUser) {
|
||||||
List<JSONObject> list = systemGroupDataService.getDatas(ShopConstants.YSHOP_SIGN_DAY_NUM);
|
List<JSONObject> list = systemGroupDataService.getDatas(ShopConstants.YSHOP_SIGN_DAY_NUM);
|
||||||
if(ObjectUtil.isNull(list) || list.isEmpty()) throw new YshopException("请先配置签到天数");
|
if(ObjectUtil.isNull(list) || list.isEmpty()) {
|
||||||
|
throw new YshopException("请先配置签到天数");
|
||||||
|
}
|
||||||
|
|
||||||
boolean isDaySign = this.getToDayIsSign(yxUser.getUid());
|
boolean isDaySign = this.getToDayIsSign(yxUser.getUid());
|
||||||
if(isDaySign) throw new YshopException("已签到");
|
if(isDaySign) {
|
||||||
|
throw new YshopException("已签到");
|
||||||
|
}
|
||||||
int signNumber = 0; //积分
|
int signNumber = 0; //积分
|
||||||
int userSignNum = yxUser.getSignNum(); //签到次数
|
int userSignNum = yxUser.getSignNum(); //签到次数
|
||||||
if(getYesterDayIsSign(yxUser.getUid())){
|
if(getYesterDayIsSign(yxUser.getUid())){
|
||||||
@ -121,7 +125,9 @@ public class YxUserSignServiceImpl extends BaseServiceImpl<YxUserSignMapper, YxU
|
|||||||
.signNum(userSignNum)
|
.signNum(userSignNum)
|
||||||
.build();
|
.build();
|
||||||
boolean res = yxUserService.updateById(user);
|
boolean res = yxUserService.updateById(user);
|
||||||
if(!res) throw new YshopException("签到失败");
|
if(!res) {
|
||||||
|
throw new YshopException("签到失败");
|
||||||
|
}
|
||||||
|
|
||||||
//插入流水
|
//插入流水
|
||||||
billService.income(yxUser.getUid(),title, BillDetailEnum.CATEGORY_2.getValue(),
|
billService.income(yxUser.getUid(),title, BillDetailEnum.CATEGORY_2.getValue(),
|
||||||
@ -162,7 +168,9 @@ public class YxUserSignServiceImpl extends BaseServiceImpl<YxUserSignMapper, YxU
|
|||||||
userQueryVo.setSumSignDay(sumSignDay);
|
userQueryVo.setSumSignDay(sumSignDay);
|
||||||
userQueryVo.setIsDaySign(isDaySign);
|
userQueryVo.setIsDaySign(isDaySign);
|
||||||
userQueryVo.setIsYesterDaySign(isYesterDaySign);
|
userQueryVo.setIsYesterDaySign(isYesterDaySign);
|
||||||
if(!isDaySign && !isYesterDaySign) userQueryVo.setSignNum(0);
|
if(!isDaySign && !isYesterDaySign) {
|
||||||
|
userQueryVo.setSignNum(0);
|
||||||
|
}
|
||||||
return userQueryVo;
|
return userQueryVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +184,9 @@ public class YxUserSignServiceImpl extends BaseServiceImpl<YxUserSignMapper, YxU
|
|||||||
int count = this.lambdaQuery().eq(YxUserSign::getUid,uid)
|
int count = this.lambdaQuery().eq(YxUserSign::getUid,uid)
|
||||||
.ge(YxUserSign::getCreateTime,today)
|
.ge(YxUserSign::getCreateTime,today)
|
||||||
.count();
|
.count();
|
||||||
if(count > 0) return true;
|
if(count > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +203,9 @@ public class YxUserSignServiceImpl extends BaseServiceImpl<YxUserSignMapper, YxU
|
|||||||
.lt(YxUserSign::getCreateTime,today)
|
.lt(YxUserSign::getCreateTime,today)
|
||||||
.ge(YxUserSign::getCreateTime,yesterday)
|
.ge(YxUserSign::getCreateTime,yesterday)
|
||||||
.count();
|
.count();
|
||||||
if(count > 0) return true;
|
if(count > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public class MetaHandler implements MetaObjectHandler {
|
|||||||
this.setFieldValByName("delFlag", false, metaObject);
|
this.setFieldValByName("delFlag", false, metaObject);
|
||||||
}
|
}
|
||||||
if(metaObject.hasSetter("addTime")){
|
if(metaObject.hasSetter("addTime")){
|
||||||
String timestamp = String.valueOf(new Date().getTime()/1000);
|
String timestamp = String.valueOf(System.currentTimeMillis()/1000);
|
||||||
this.setFieldValByName("addTime", Integer.valueOf(timestamp), metaObject);
|
this.setFieldValByName("addTime", Integer.valueOf(timestamp), metaObject);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -90,7 +90,9 @@ public class StoreCategoryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean checkResult = yxStoreCategoryService.checkCategory(resources.getPid());
|
boolean checkResult = yxStoreCategoryService.checkCategory(resources.getPid());
|
||||||
if(!checkResult) throw new YshopException("分类最多能添加2级哦");
|
if(!checkResult) {
|
||||||
|
throw new YshopException("分类最多能添加2级哦");
|
||||||
|
}
|
||||||
|
|
||||||
return new ResponseEntity<>(yxStoreCategoryService.save(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(yxStoreCategoryService.save(resources),HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
@ -112,7 +114,9 @@ public class StoreCategoryController {
|
|||||||
|
|
||||||
boolean checkResult = yxStoreCategoryService.checkCategory(resources.getPid());
|
boolean checkResult = yxStoreCategoryService.checkCategory(resources.getPid());
|
||||||
|
|
||||||
if(!checkResult) throw new YshopException("分类最多能添加2级哦");
|
if(!checkResult) {
|
||||||
|
throw new YshopException("分类最多能添加2级哦");
|
||||||
|
}
|
||||||
|
|
||||||
yxStoreCategoryService.saveOrUpdate(resources);
|
yxStoreCategoryService.saveOrUpdate(resources);
|
||||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||||
@ -142,12 +146,16 @@ public class StoreCategoryController {
|
|||||||
int count = yxStoreCategoryService.lambdaQuery()
|
int count = yxStoreCategoryService.lambdaQuery()
|
||||||
.eq(YxStoreCategory::getPid,id)
|
.eq(YxStoreCategory::getPid,id)
|
||||||
.count();
|
.count();
|
||||||
if(count > 0) throw new YshopException("请先删除子分类");
|
if(count > 0) {
|
||||||
|
throw new YshopException("请先删除子分类");
|
||||||
|
}
|
||||||
|
|
||||||
int countP = yxStoreProductService.lambdaQuery()
|
int countP = yxStoreProductService.lambdaQuery()
|
||||||
.eq(YxStoreProduct::getCateId,id)
|
.eq(YxStoreProduct::getCateId,id)
|
||||||
.count();
|
.count();
|
||||||
|
|
||||||
if(countP > 0) throw new YshopException("当前分类下有商品不可删除");
|
if(countP > 0) {
|
||||||
|
throw new YshopException("当前分类下有商品不可删除");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,8 +131,12 @@ public class StoreOrderController {
|
|||||||
@PutMapping(value = "/yxStoreOrder")
|
@PutMapping(value = "/yxStoreOrder")
|
||||||
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||||
public ResponseEntity update(@Validated @RequestBody YxStoreOrder resources) {
|
public ResponseEntity update(@Validated @RequestBody YxStoreOrder resources) {
|
||||||
if (StrUtil.isBlank(resources.getDeliveryName())) throw new BadRequestException("请选择快递公司");
|
if (StrUtil.isBlank(resources.getDeliveryName())) {
|
||||||
if (StrUtil.isBlank(resources.getDeliveryId())) throw new BadRequestException("快递单号不能为空");
|
throw new BadRequestException("请选择快递公司");
|
||||||
|
}
|
||||||
|
if (StrUtil.isBlank(resources.getDeliveryId())) {
|
||||||
|
throw new BadRequestException("快递单号不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
yxStoreOrderService.orderDelivery(resources.getOrderId(),resources.getDeliveryId(),
|
yxStoreOrderService.orderDelivery(resources.getOrderId(),resources.getDeliveryId(),
|
||||||
resources.getDeliveryName(),resources.getDeliveryType());
|
resources.getDeliveryName(),resources.getDeliveryType());
|
||||||
@ -143,7 +147,9 @@ public class StoreOrderController {
|
|||||||
@PutMapping(value = "/yxStoreOrder/check")
|
@PutMapping(value = "/yxStoreOrder/check")
|
||||||
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||||
public ResponseEntity check(@Validated @RequestBody YxStoreOrder resources) {
|
public ResponseEntity check(@Validated @RequestBody YxStoreOrder resources) {
|
||||||
if (StrUtil.isBlank(resources.getVerifyCode())) throw new BadRequestException("核销码不能为空");
|
if (StrUtil.isBlank(resources.getVerifyCode())) {
|
||||||
|
throw new BadRequestException("核销码不能为空");
|
||||||
|
}
|
||||||
YxStoreOrderDto storeOrderDTO = generator.convert(yxStoreOrderService.getById(resources.getId()),YxStoreOrderDto.class);
|
YxStoreOrderDto storeOrderDTO = generator.convert(yxStoreOrderService.getById(resources.getId()),YxStoreOrderDto.class);
|
||||||
if(!resources.getVerifyCode().equals(storeOrderDTO.getVerifyCode())){
|
if(!resources.getVerifyCode().equals(storeOrderDTO.getVerifyCode())){
|
||||||
throw new BadRequestException("核销码不对");
|
throw new BadRequestException("核销码不对");
|
||||||
@ -185,8 +191,12 @@ public class StoreOrderController {
|
|||||||
@PostMapping(value = "/yxStoreOrder/edit")
|
@PostMapping(value = "/yxStoreOrder/edit")
|
||||||
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||||
public ResponseEntity editOrder(@RequestBody YxStoreOrder resources) {
|
public ResponseEntity editOrder(@RequestBody YxStoreOrder resources) {
|
||||||
if (ObjectUtil.isNull(resources.getPayPrice())) throw new BadRequestException("请输入支付金额");
|
if (ObjectUtil.isNull(resources.getPayPrice())) {
|
||||||
if (resources.getPayPrice().doubleValue() < 0) throw new BadRequestException("金额不能低于0");
|
throw new BadRequestException("请输入支付金额");
|
||||||
|
}
|
||||||
|
if (resources.getPayPrice().doubleValue() < 0) {
|
||||||
|
throw new BadRequestException("金额不能低于0");
|
||||||
|
}
|
||||||
YxStoreOrderDto storeOrder = generator.convert(yxStoreOrderService.getById(resources.getId()),YxStoreOrderDto.class);
|
YxStoreOrderDto storeOrder = generator.convert(yxStoreOrderService.getById(resources.getId()),YxStoreOrderDto.class);
|
||||||
//判断金额是否有变动,生成一个额外订单号去支付
|
//判断金额是否有变动,生成一个额外订单号去支付
|
||||||
int res = NumberUtil.compare(storeOrder.getPayPrice().doubleValue(), resources.getPayPrice().doubleValue());
|
int res = NumberUtil.compare(storeOrder.getPayPrice().doubleValue(), resources.getPayPrice().doubleValue());
|
||||||
@ -208,7 +218,9 @@ public class StoreOrderController {
|
|||||||
@PostMapping(value = "/yxStoreOrder/remark")
|
@PostMapping(value = "/yxStoreOrder/remark")
|
||||||
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||||
public ResponseEntity editOrderRemark(@RequestBody YxStoreOrder resources) {
|
public ResponseEntity editOrderRemark(@RequestBody YxStoreOrder resources) {
|
||||||
if (StrUtil.isBlank(resources.getRemark())) throw new BadRequestException("请输入备注");
|
if (StrUtil.isBlank(resources.getRemark())) {
|
||||||
|
throw new BadRequestException("请输入备注");
|
||||||
|
}
|
||||||
yxStoreOrderService.saveOrUpdate(resources);
|
yxStoreOrderService.saveOrUpdate(resources);
|
||||||
return new ResponseEntity(HttpStatus.OK);
|
return new ResponseEntity(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@ -223,7 +235,9 @@ public class StoreOrderController {
|
|||||||
ExpressService expressService = ExpressAutoConfiguration.expressService();
|
ExpressService expressService = ExpressAutoConfiguration.expressService();
|
||||||
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(),
|
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(),
|
||||||
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode());
|
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode());
|
||||||
if(!expressInfo.isSuccess()) throw new BadRequestException(expressInfo.getReason());
|
if(!expressInfo.isSuccess()) {
|
||||||
|
throw new BadRequestException(expressInfo.getReason());
|
||||||
|
}
|
||||||
return new ResponseEntity<>(expressInfo, HttpStatus.OK);
|
return new ResponseEntity<>(expressInfo, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class WechatArticleService {
|
|||||||
|
|
||||||
WxMpMassSendResult massResult = wxMpService.getMassMessageService()
|
WxMpMassSendResult massResult = wxMpService.getMassMessageService()
|
||||||
.massGroupMessageSend(massMessage);
|
.massGroupMessageSend(massMessage);
|
||||||
if(!massResult.getErrorCode().equals("0")) {
|
if(!"0".equals(massResult.getErrorCode())) {
|
||||||
log.info("error:"+massResult.getErrorMsg());
|
log.info("error:"+massResult.getErrorMsg());
|
||||||
throw new ErrorRequestException("发送失败");
|
throw new ErrorRequestException("发送失败");
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,9 @@ public class SystemStoreController {
|
|||||||
@PreAuthorize("@el.check('yxSystemStore:getl')")
|
@PreAuthorize("@el.check('yxSystemStore:getl')")
|
||||||
public ResponseEntity<Object> create(@Validated @RequestBody String jsonStr){
|
public ResponseEntity<Object> create(@Validated @RequestBody String jsonStr){
|
||||||
String key = RedisUtil.get(ShopKeyUtils.getTengXunMapKey());
|
String key = RedisUtil.get(ShopKeyUtils.getTengXunMapKey());
|
||||||
if(StrUtil.isBlank(key)) throw new BadRequestException("请先配置腾讯地图key");
|
if(StrUtil.isBlank(key)) {
|
||||||
|
throw new BadRequestException("请先配置腾讯地图key");
|
||||||
|
}
|
||||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||||
String addr = jsonObject.getString("addr");
|
String addr = jsonObject.getString("addr");
|
||||||
String url = StrUtil.format("?address={}&key={}",addr,key);
|
String url = StrUtil.format("?address={}&key={}",addr,key);
|
||||||
|
@ -97,7 +97,7 @@ public class ShippingTemplatesController {
|
|||||||
List<YxStoreProduct> productList = yxStoreProductService.list();
|
List<YxStoreProduct> productList = yxStoreProductService.list();
|
||||||
Arrays.asList(ids).forEach(id->{
|
Arrays.asList(ids).forEach(id->{
|
||||||
for (YxStoreProduct yxStoreProduct : productList) {
|
for (YxStoreProduct yxStoreProduct : productList) {
|
||||||
if(id==yxStoreProduct.getTempId()){
|
if(id.equals(yxStoreProduct.getTempId())){
|
||||||
throw new BadRequestException("运费模板存在商品关联,请删除对应商品");
|
throw new BadRequestException("运费模板存在商品关联,请删除对应商品");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,7 @@ public class WxMaConfiguration {
|
|||||||
}
|
}
|
||||||
@Autowired
|
@Autowired
|
||||||
public WxMaConfiguration(RedisUtils redisUtils) {
|
public WxMaConfiguration(RedisUtils redisUtils) {
|
||||||
this.redisUtils = redisUtils;
|
WxMaConfiguration.redisUtils = redisUtils;
|
||||||
this.wxMaMessageHandler = wxMaMessageHandler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WxMaService getWxMaService() {
|
public static WxMaService getWxMaService() {
|
||||||
@ -67,10 +66,10 @@ public class WxMaConfiguration {
|
|||||||
final WxMaMessageRouter router = new WxMaMessageRouter(service);
|
final WxMaMessageRouter router = new WxMaMessageRouter(service);
|
||||||
router
|
router
|
||||||
.rule().handler(wxMaMessageHandler).next()
|
.rule().handler(wxMaMessageHandler).next()
|
||||||
.rule().async(false).msgType(WxConsts.XmlMsgType.EVENT).event(SystemConfigConstants.BINDSTATECHANGE).handler(bindstatechangeHandler).end();
|
.rule().async(false).msgType(WxConsts.XmlMsgType.EVENT).event(SystemConfigConstants.BINDSTATECHANGE).handler(BINDSTATECHANGE_HANDLER).end();
|
||||||
return router;
|
return router;
|
||||||
}
|
}
|
||||||
private static final WxMaMessageHandler bindstatechangeHandler = (wxMessage, context, service, sessionManager) -> {
|
private static final WxMaMessageHandler BINDSTATECHANGE_HANDLER = (wxMessage, context, service, sessionManager) -> {
|
||||||
wxMessage.getFromUser();
|
wxMessage.getFromUser();
|
||||||
wxMessage.getContent();
|
wxMessage.getContent();
|
||||||
return null;
|
return null;
|
||||||
|
@ -48,8 +48,9 @@ public class ExpressService implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public String getVendorName(String vendorCode) {
|
public String getVendorName(String vendorCode) {
|
||||||
for (Map<String, String> item : properties.getVendors()) {
|
for (Map<String, String> item : properties.getVendors()) {
|
||||||
if (item.get("code").equals(vendorCode))
|
if (item.get("code").equals(vendorCode)) {
|
||||||
return item.get("name");
|
return item.get("name");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,14 @@ public class ExpressAutoConfiguration {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ExpressAutoConfiguration(RedisUtils redisUtil) {
|
public ExpressAutoConfiguration(RedisUtils redisUtil) {
|
||||||
this.redisUtil = redisUtil;
|
ExpressAutoConfiguration.redisUtil = redisUtil;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ExpressService expressService() {
|
public static ExpressService expressService() {
|
||||||
ExpressService expressService = (ExpressService)redisUtil.get(ShopConstants.YSHOP_EXPRESS_SERVICE);
|
ExpressService expressService = (ExpressService)redisUtil.get(ShopConstants.YSHOP_EXPRESS_SERVICE);
|
||||||
if(expressService != null) return expressService;
|
if(expressService != null) {
|
||||||
|
return expressService;
|
||||||
|
}
|
||||||
|
|
||||||
ExpressProperties properties = new ExpressProperties();
|
ExpressProperties properties = new ExpressProperties();
|
||||||
String enable = redisUtil.getY("exp_enable");
|
String enable = redisUtil.getY("exp_enable");
|
||||||
|
@ -26,8 +26,9 @@ public class JacksonUtil {
|
|||||||
try {
|
try {
|
||||||
node = mapper.readTree(body);
|
node = mapper.readTree(body);
|
||||||
JsonNode leaf = node.get(field);
|
JsonNode leaf = node.get(field);
|
||||||
if (leaf != null)
|
if (leaf != null) {
|
||||||
return leaf.asText();
|
return leaf.asText();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
@ -42,9 +43,10 @@ public class JacksonUtil {
|
|||||||
node = mapper.readTree(body);
|
node = mapper.readTree(body);
|
||||||
JsonNode leaf = node.get(field);
|
JsonNode leaf = node.get(field);
|
||||||
|
|
||||||
if (leaf != null)
|
if (leaf != null) {
|
||||||
return mapper.convertValue(leaf, new TypeReference<List<String>>() {
|
return mapper.convertValue(leaf, new TypeReference<List<String>>() {
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
@ -57,8 +59,9 @@ public class JacksonUtil {
|
|||||||
try {
|
try {
|
||||||
node = mapper.readTree(body);
|
node = mapper.readTree(body);
|
||||||
JsonNode leaf = node.get(field);
|
JsonNode leaf = node.get(field);
|
||||||
if (leaf != null)
|
if (leaf != null) {
|
||||||
return leaf.asInt();
|
return leaf.asInt();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
@ -72,9 +75,10 @@ public class JacksonUtil {
|
|||||||
node = mapper.readTree(body);
|
node = mapper.readTree(body);
|
||||||
JsonNode leaf = node.get(field);
|
JsonNode leaf = node.get(field);
|
||||||
|
|
||||||
if (leaf != null)
|
if (leaf != null) {
|
||||||
return mapper.convertValue(leaf, new TypeReference<List<Integer>>() {
|
return mapper.convertValue(leaf, new TypeReference<List<Integer>>() {
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
@ -88,8 +92,9 @@ public class JacksonUtil {
|
|||||||
try {
|
try {
|
||||||
node = mapper.readTree(body);
|
node = mapper.readTree(body);
|
||||||
JsonNode leaf = node.get(field);
|
JsonNode leaf = node.get(field);
|
||||||
if (leaf != null)
|
if (leaf != null) {
|
||||||
return leaf.asBoolean();
|
return leaf.asBoolean();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
@ -62,17 +62,17 @@ public class WxMpConfiguration {
|
|||||||
MenuHandler menuHandler,MsgHandler msgHandler,UnsubscribeHandler unsubscribeHandler,
|
MenuHandler menuHandler,MsgHandler msgHandler,UnsubscribeHandler unsubscribeHandler,
|
||||||
SubscribeHandler subscribeHandler,ScanHandler scanHandler,
|
SubscribeHandler subscribeHandler,ScanHandler scanHandler,
|
||||||
RedisUtils redisUtils){
|
RedisUtils redisUtils){
|
||||||
this.logHandler = logHandler;
|
WxMpConfiguration.logHandler = logHandler;
|
||||||
this.nullHandler = nullHandler;
|
WxMpConfiguration.nullHandler = nullHandler;
|
||||||
this.kfSessionHandler = kfSessionHandler;
|
WxMpConfiguration.kfSessionHandler = kfSessionHandler;
|
||||||
this.storeCheckNotifyHandler = storeCheckNotifyHandler;
|
WxMpConfiguration.storeCheckNotifyHandler = storeCheckNotifyHandler;
|
||||||
this.locationHandler = locationHandler;
|
WxMpConfiguration.locationHandler = locationHandler;
|
||||||
this.menuHandler = menuHandler;
|
WxMpConfiguration.menuHandler = menuHandler;
|
||||||
this.msgHandler = msgHandler;
|
WxMpConfiguration.msgHandler = msgHandler;
|
||||||
this.unsubscribeHandler = unsubscribeHandler;
|
WxMpConfiguration.unsubscribeHandler = unsubscribeHandler;
|
||||||
this.subscribeHandler = subscribeHandler;
|
WxMpConfiguration.subscribeHandler = subscribeHandler;
|
||||||
this.scanHandler = scanHandler;
|
WxMpConfiguration.scanHandler = scanHandler;
|
||||||
this.redisUtils = redisUtils;
|
WxMpConfiguration.redisUtils = redisUtils;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public class WxPayConfiguration {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public WxPayConfiguration(RedisUtils redisUtils) {
|
public WxPayConfiguration(RedisUtils redisUtils) {
|
||||||
this.redisUtils = redisUtils;
|
WxPayConfiguration.redisUtils = redisUtils;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,6 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
|
|||||||
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
|
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import co.yixiang.config.SubscribeProperties;
|
import co.yixiang.config.SubscribeProperties;
|
||||||
|
import co.yixiang.constant.ShopConstants;
|
||||||
import co.yixiang.modules.user.domain.YxUser;
|
import co.yixiang.modules.user.domain.YxUser;
|
||||||
import co.yixiang.modules.user.service.YxUserService;
|
import co.yixiang.modules.user.service.YxUserService;
|
||||||
import co.yixiang.modules.user.service.dto.WechatUserDto;
|
import co.yixiang.modules.user.service.dto.WechatUserDto;
|
||||||
@ -42,14 +43,16 @@ public class WeiXinSubscribeService {
|
|||||||
public void rechargeSuccessNotice(String time,String price,Long uid){
|
public void rechargeSuccessNotice(String time,String price,Long uid){
|
||||||
String openid = this.getUserOpenid(uid);
|
String openid = this.getUserOpenid(uid);
|
||||||
|
|
||||||
if(StrUtil.isBlank(openid)) return;
|
if(StrUtil.isBlank(openid)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String,String> map = new HashMap<>();
|
||||||
map.put("first","您的账户金币发生变动,详情如下:");
|
map.put("first","您的账户金币发生变动,详情如下:");
|
||||||
map.put("keyword1","充值");
|
map.put("keyword1","充值");
|
||||||
map.put("keyword2",time);
|
map.put("keyword2",time);
|
||||||
map.put("keyword3",price);
|
map.put("keyword3",price);
|
||||||
map.put("remark","yshop为你服务!");
|
map.put("remark", ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||||
String tempId = this.getTempId(WechatTempateEnum.RECHARGE_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.RECHARGE_SUCCESS.getValue());
|
||||||
this.sendSubscribeMsg( openid, tempId, "/user/account",map);
|
this.sendSubscribeMsg( openid, tempId, "/user/account",map);
|
||||||
}
|
}
|
||||||
@ -64,7 +67,9 @@ public class WeiXinSubscribeService {
|
|||||||
public void paySuccessNotice(String orderId,String price,Long uid){
|
public void paySuccessNotice(String orderId,String price,Long uid){
|
||||||
|
|
||||||
String openid = this.getUserOpenid(uid);
|
String openid = this.getUserOpenid(uid);
|
||||||
if(StrUtil.isBlank(openid)) return;
|
if(StrUtil.isBlank(openid)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String,String> map = new HashMap<>();
|
||||||
map.put("amount1",price);
|
map.put("amount1",price);
|
||||||
@ -87,14 +92,17 @@ public class WeiXinSubscribeService {
|
|||||||
|
|
||||||
String openid = this.getUserOpenid(uid);
|
String openid = this.getUserOpenid(uid);
|
||||||
|
|
||||||
if(StrUtil.isBlank(openid)) return;
|
if(StrUtil.isBlank(openid)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String,String> map = new HashMap<>();
|
||||||
map.put("first","您的订单退款申请被通过,钱款将很快还至您的支付账户。");
|
map.put("first","您的订单退款申请被通过,钱款将很快还至您的支付账户。");
|
||||||
map.put("keyword1",orderId);//订单号
|
//订单号
|
||||||
|
map.put("keyword1",orderId);
|
||||||
map.put("keyword2",price);
|
map.put("keyword2",price);
|
||||||
map.put("keyword3", time);
|
map.put("keyword3", time);
|
||||||
map.put("remark","yshop为你服务!");
|
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||||
String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
|
||||||
this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
|
this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
|
||||||
}
|
}
|
||||||
@ -111,14 +119,16 @@ public class WeiXinSubscribeService {
|
|||||||
|
|
||||||
String openid = this.getUserOpenid(uid);
|
String openid = this.getUserOpenid(uid);
|
||||||
|
|
||||||
if(StrUtil.isEmpty(openid)) return;
|
if(StrUtil.isEmpty(openid)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String,String> map = new HashMap<>();
|
||||||
map.put("first","亲,宝贝已经启程了,好想快点来到你身边。");
|
map.put("first","亲,宝贝已经启程了,好想快点来到你身边。");
|
||||||
map.put("keyword2",deliveryName);
|
map.put("keyword2",deliveryName);
|
||||||
map.put("keyword1",orderId);
|
map.put("keyword1",orderId);
|
||||||
map.put("keyword3",deliveryId);
|
map.put("keyword3",deliveryId);
|
||||||
map.put("remark","yshop为你服务!");
|
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||||
String tempId = this.getTempId(WechatTempateEnum.DELIVERY_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.DELIVERY_SUCCESS.getValue());
|
||||||
this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
|
this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
|
||||||
}
|
}
|
||||||
@ -170,11 +180,17 @@ public class WeiXinSubscribeService {
|
|||||||
*/
|
*/
|
||||||
private String getUserOpenid(Long uid){
|
private String getUserOpenid(Long uid){
|
||||||
YxUser yxUser = userService.getById(uid);
|
YxUser yxUser = userService.getById(uid);
|
||||||
if(yxUser == null) return "";
|
if(yxUser == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
WechatUserDto wechatUserDto = yxUser.getWxProfile();
|
WechatUserDto wechatUserDto = yxUser.getWxProfile();
|
||||||
if(wechatUserDto == null) return "";
|
if(wechatUserDto == null) {
|
||||||
if(StrUtil.isBlank(wechatUserDto.getRoutineOpenid())) return "";
|
return "";
|
||||||
|
}
|
||||||
|
if(StrUtil.isBlank(wechatUserDto.getRoutineOpenid())) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
return wechatUserDto.getRoutineOpenid();
|
return wechatUserDto.getRoutineOpenid();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,21 +72,29 @@ public class WeixinPayService {
|
|||||||
long uid = 0;
|
long uid = 0;
|
||||||
int payPrice = 0;
|
int payPrice = 0;
|
||||||
BigDecimal bigDecimal = new BigDecimal(100);
|
BigDecimal bigDecimal = new BigDecimal(100);
|
||||||
if(BillDetailEnum.TYPE_3.getValue().equals(attach)){ //普通支付
|
//普通支付
|
||||||
|
if(BillDetailEnum.TYPE_3.getValue().equals(attach)){
|
||||||
YxStoreOrderQueryVo orderInfo = storeOrderService.getOrderInfo(orderId,null);
|
YxStoreOrderQueryVo orderInfo = storeOrderService.getOrderInfo(orderId,null);
|
||||||
if(ObjectUtil.isNull(orderInfo)) throw new YshopException("订单不存在");
|
if(ObjectUtil.isNull(orderInfo)) {
|
||||||
|
throw new YshopException("订单不存在");
|
||||||
|
}
|
||||||
if(orderInfo.getPaid().equals(OrderInfoEnum.PAY_STATUS_1.getValue())) {
|
if(orderInfo.getPaid().equals(OrderInfoEnum.PAY_STATUS_1.getValue())) {
|
||||||
throw new YshopException("该订单已支付");
|
throw new YshopException("该订单已支付");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(orderInfo.getPayPrice().compareTo(BigDecimal.ZERO) <= 0) throw new YshopException("该支付无需支付");
|
if(orderInfo.getPayPrice().compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
throw new YshopException("该支付无需支付");
|
||||||
|
}
|
||||||
|
|
||||||
uid = orderInfo.getUid().intValue();
|
uid = orderInfo.getUid().intValue();
|
||||||
payPrice = bigDecimal.multiply(orderInfo.getPayPrice()).intValue();//计算分
|
//计算分
|
||||||
|
payPrice = bigDecimal.multiply(orderInfo.getPayPrice()).intValue();
|
||||||
}else{ //充值
|
}else{ //充值
|
||||||
YxUserRecharge userRecharge = userRechargeService.getOne(Wrappers.<YxUserRecharge>lambdaQuery()
|
YxUserRecharge userRecharge = userRechargeService.getOne(Wrappers.<YxUserRecharge>lambdaQuery()
|
||||||
.eq(YxUserRecharge::getOrderId,orderId));
|
.eq(YxUserRecharge::getOrderId,orderId));
|
||||||
if(userRecharge == null) throw new BusinessException("充值订单不存在");
|
if(userRecharge == null) {
|
||||||
|
throw new BusinessException("充值订单不存在");
|
||||||
|
}
|
||||||
|
|
||||||
if(userRecharge.getPaid().equals(OrderInfoEnum.PAY_STATUS_1.getValue())) {
|
if(userRecharge.getPaid().equals(OrderInfoEnum.PAY_STATUS_1.getValue())) {
|
||||||
throw new YshopException("该订单已支付");
|
throw new YshopException("该订单已支付");
|
||||||
@ -97,7 +105,9 @@ public class WeixinPayService {
|
|||||||
|
|
||||||
|
|
||||||
YxUser yxUser = userService.getById(uid);
|
YxUser yxUser = userService.getById(uid);
|
||||||
if(yxUser == null) throw new YshopException("用户错误");
|
if(yxUser == null) {
|
||||||
|
throw new YshopException("用户错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WechatUserDto wechatUserDto = yxUser.getWxProfile();
|
WechatUserDto wechatUserDto = yxUser.getWxProfile();
|
||||||
@ -151,15 +161,18 @@ public class WeixinPayService {
|
|||||||
public void refundOrder(String orderId, Integer totalFee) {
|
public void refundOrder(String orderId, Integer totalFee) {
|
||||||
|
|
||||||
YxStoreOrderQueryVo orderInfo = storeOrderService.getOrderInfo(orderId,null);
|
YxStoreOrderQueryVo orderInfo = storeOrderService.getOrderInfo(orderId,null);
|
||||||
if(PayTypeEnum.YUE.getValue().equals(orderInfo.getPayType())) return;
|
if(PayTypeEnum.YUE.getValue().equals(orderInfo.getPayType())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WxPayService wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WECHAT);
|
WxPayService wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WECHAT);
|
||||||
WxPayRefundRequest wxPayRefundRequest = new WxPayRefundRequest();
|
WxPayRefundRequest wxPayRefundRequest = new WxPayRefundRequest();
|
||||||
|
//订单总金额
|
||||||
wxPayRefundRequest.setTotalFee(totalFee);//订单总金额
|
wxPayRefundRequest.setTotalFee(totalFee);
|
||||||
wxPayRefundRequest.setOutTradeNo(orderId);
|
wxPayRefundRequest.setOutTradeNo(orderId);
|
||||||
wxPayRefundRequest.setOutRefundNo(orderId);
|
wxPayRefundRequest.setOutRefundNo(orderId);
|
||||||
wxPayRefundRequest.setRefundFee(totalFee);//退款金额
|
//退款金额
|
||||||
|
wxPayRefundRequest.setRefundFee(totalFee);
|
||||||
wxPayRefundRequest.setNotifyUrl(this.getApiUrl() + "/api/notify/refund");
|
wxPayRefundRequest.setNotifyUrl(this.getApiUrl() + "/api/notify/refund");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -10,6 +10,7 @@ package co.yixiang.mp.service;
|
|||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import co.yixiang.api.YshopException;
|
import co.yixiang.api.YshopException;
|
||||||
|
import co.yixiang.constant.ShopConstants;
|
||||||
import co.yixiang.modules.user.domain.YxUser;
|
import co.yixiang.modules.user.domain.YxUser;
|
||||||
import co.yixiang.modules.user.service.YxUserService;
|
import co.yixiang.modules.user.service.YxUserService;
|
||||||
import co.yixiang.modules.user.service.dto.WechatUserDto;
|
import co.yixiang.modules.user.service.dto.WechatUserDto;
|
||||||
@ -57,14 +58,16 @@ public class WeixinTemplateService {
|
|||||||
public void rechargeSuccessNotice(String time,String price,Long uid){
|
public void rechargeSuccessNotice(String time,String price,Long uid){
|
||||||
String openid = this.getUserOpenid(uid);
|
String openid = this.getUserOpenid(uid);
|
||||||
|
|
||||||
if(StrUtil.isBlank(openid)) return;
|
if(StrUtil.isBlank(openid)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String,String> map = new HashMap<>();
|
||||||
map.put("first","您的账户金币发生变动,详情如下:");
|
map.put("first","您的账户金币发生变动,详情如下:");
|
||||||
map.put("keyword1","充值");
|
map.put("keyword1","充值");
|
||||||
map.put("keyword2",time);
|
map.put("keyword2",time);
|
||||||
map.put("keyword3",price);
|
map.put("keyword3",price);
|
||||||
map.put("remark","yshop为你服务!");
|
map.put("remark", ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||||
String tempId = this.getTempId(WechatTempateEnum.RECHARGE_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.RECHARGE_SUCCESS.getValue());
|
||||||
this.sendWxMpTemplateMessage( openid, tempId, this.getSiteUrl()+"/user/account",map);
|
this.sendWxMpTemplateMessage( openid, tempId, this.getSiteUrl()+"/user/account",map);
|
||||||
}
|
}
|
||||||
@ -80,13 +83,16 @@ public class WeixinTemplateService {
|
|||||||
|
|
||||||
String openid = this.getUserOpenid(uid);
|
String openid = this.getUserOpenid(uid);
|
||||||
|
|
||||||
if(StrUtil.isBlank(openid)) return;
|
if(StrUtil.isBlank(openid)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String,String> map = new HashMap<>();
|
||||||
map.put("first","您的订单已支付成功,我们会尽快为您发货。");
|
map.put("first","您的订单已支付成功,我们会尽快为您发货。");
|
||||||
map.put("keyword1",orderId);//订单号
|
//订单号
|
||||||
|
map.put("keyword1",orderId);
|
||||||
map.put("keyword2",price);
|
map.put("keyword2",price);
|
||||||
map.put("remark","yshop为你服务!");
|
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||||
String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
|
||||||
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
||||||
}
|
}
|
||||||
@ -102,14 +108,17 @@ public class WeixinTemplateService {
|
|||||||
|
|
||||||
String openid = this.getUserOpenid(uid);
|
String openid = this.getUserOpenid(uid);
|
||||||
|
|
||||||
if(StrUtil.isBlank(openid)) return;
|
if(StrUtil.isBlank(openid)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String,String> map = new HashMap<>();
|
||||||
map.put("first","您的订单退款申请被通过,钱款将很快还至您的支付账户。");
|
map.put("first","您的订单退款申请被通过,钱款将很快还至您的支付账户。");
|
||||||
map.put("keyword1",orderId);//订单号
|
//订单号
|
||||||
|
map.put("keyword1",orderId);
|
||||||
map.put("keyword2",price);
|
map.put("keyword2",price);
|
||||||
map.put("keyword3", time);
|
map.put("keyword3", time);
|
||||||
map.put("remark","yshop为你服务!");
|
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||||
String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
|
||||||
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
||||||
}
|
}
|
||||||
@ -126,14 +135,16 @@ public class WeixinTemplateService {
|
|||||||
|
|
||||||
String openid = this.getUserOpenid(uid);
|
String openid = this.getUserOpenid(uid);
|
||||||
|
|
||||||
if(StrUtil.isEmpty(openid)) return;
|
if(StrUtil.isEmpty(openid)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String,String> map = new HashMap<>();
|
||||||
map.put("first","亲,宝贝已经启程了,好想快点来到你身边。");
|
map.put("first","亲,宝贝已经启程了,好想快点来到你身边。");
|
||||||
map.put("keyword2",deliveryName);
|
map.put("keyword2",deliveryName);
|
||||||
map.put("keyword1",orderId);
|
map.put("keyword1",orderId);
|
||||||
map.put("keyword3",deliveryId);
|
map.put("keyword3",deliveryId);
|
||||||
map.put("remark","yshop为你服务!");
|
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||||
String tempId = this.getTempId(WechatTempateEnum.DELIVERY_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.DELIVERY_SUCCESS.getValue());
|
||||||
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
||||||
}
|
}
|
||||||
@ -173,7 +184,9 @@ public class WeixinTemplateService {
|
|||||||
YxWechatTemplate yxWechatTemplate = yxWechatTemplateService.lambdaQuery()
|
YxWechatTemplate yxWechatTemplate = yxWechatTemplateService.lambdaQuery()
|
||||||
.eq(YxWechatTemplate::getTempkey,key)
|
.eq(YxWechatTemplate::getTempkey,key)
|
||||||
.one();
|
.one();
|
||||||
if (yxWechatTemplate == null) throw new YshopException("请后台配置key:" + key + "模板消息id");
|
if (yxWechatTemplate == null) {
|
||||||
|
throw new YshopException("请后台配置key:" + key + "模板消息id");
|
||||||
|
}
|
||||||
|
|
||||||
return yxWechatTemplate.getTempid();
|
return yxWechatTemplate.getTempid();
|
||||||
}
|
}
|
||||||
@ -197,11 +210,17 @@ public class WeixinTemplateService {
|
|||||||
*/
|
*/
|
||||||
private String getUserOpenid(Long uid){
|
private String getUserOpenid(Long uid){
|
||||||
YxUser yxUser = userService.getById(uid);
|
YxUser yxUser = userService.getById(uid);
|
||||||
if(yxUser == null) return "";
|
if(yxUser == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
WechatUserDto wechatUserDto = yxUser.getWxProfile();
|
WechatUserDto wechatUserDto = yxUser.getWxProfile();
|
||||||
if(wechatUserDto == null) return "";
|
if(wechatUserDto == null) {
|
||||||
if(StrUtil.isBlank(wechatUserDto.getOpenid())) return "";
|
return "";
|
||||||
|
}
|
||||||
|
if(StrUtil.isBlank(wechatUserDto.getOpenid())) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
return wechatUserDto.getOpenid();
|
return wechatUserDto.getOpenid();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user