yshop1.3版本发布及其导出最新sql
This commit is contained in:
@ -53,8 +53,8 @@ public class YxStoreCombination implements Serializable {
|
||||
private String attr;
|
||||
|
||||
// 参团人数
|
||||
@Column(name = "people",nullable = false,insertable = false)
|
||||
@Min(value = 1,message = "拼团人数必须大于0")
|
||||
@Column(name = "people",nullable = false)
|
||||
@Min(value = 2,message = "拼团人数必须大于1")
|
||||
private Integer people;
|
||||
|
||||
// 简介
|
||||
@ -63,16 +63,16 @@ public class YxStoreCombination implements Serializable {
|
||||
private String info;
|
||||
|
||||
// 价格
|
||||
@Column(name = "price",nullable = false,insertable = false)
|
||||
@Column(name = "price",nullable = false)
|
||||
@Min(value = 0,message = "拼团价必须大于0")
|
||||
private BigDecimal price;
|
||||
|
||||
// 排序
|
||||
@Column(name = "sort",nullable = false,insertable = false)
|
||||
@Column(name = "sort",nullable = false)
|
||||
private Integer sort;
|
||||
|
||||
// 销量
|
||||
@Column(name = "sales",nullable = false,insertable = false)
|
||||
@Column(name = "sales",nullable = false)
|
||||
private Integer sales;
|
||||
|
||||
// 库存
|
||||
@ -102,11 +102,11 @@ public class YxStoreCombination implements Serializable {
|
||||
private Integer merUse;
|
||||
|
||||
// 是否包邮1是0否
|
||||
@Column(name = "is_postage",nullable = false,insertable = false)
|
||||
@Column(name = "is_postage",nullable = false)
|
||||
private Integer isPostage;
|
||||
|
||||
// 邮费
|
||||
@Column(name = "postage",nullable = false,insertable = false)
|
||||
@Column(name = "postage",nullable = false)
|
||||
private BigDecimal postage;
|
||||
|
||||
// 拼团内容
|
||||
|
@ -12,4 +12,9 @@ public interface YxStorePinkRepository extends JpaRepository<YxStorePink, Intege
|
||||
int countByCid(int cid);
|
||||
|
||||
int countByCidAndKId(int cid,int kid);
|
||||
|
||||
int countByKId(int kid);
|
||||
|
||||
YxStorePink findByOrderIdKey(int id);
|
||||
|
||||
}
|
@ -2,6 +2,7 @@ package co.yixiang.modules.activity.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.aop.log.Log;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.modules.activity.domain.YxStoreCombination;
|
||||
import co.yixiang.modules.activity.service.YxStoreCombinationService;
|
||||
import co.yixiang.modules.activity.service.dto.YxStoreCombinationQueryCriteria;
|
||||
@ -44,6 +45,7 @@ public class YxStoreCombinationController {
|
||||
@PutMapping(value = "/yxStoreCombination")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody YxStoreCombination resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources.getStartTimeDate())){
|
||||
resources.setStartTime(OrderUtil.
|
||||
dateToTimestamp(resources.getStartTimeDate()));
|
||||
@ -65,6 +67,7 @@ public class YxStoreCombinationController {
|
||||
@ApiOperation(value = "开启关闭")
|
||||
@PostMapping(value = "/yxStoreCombination/onsale/{id}")
|
||||
public ResponseEntity onSale(@PathVariable Integer id,@RequestBody String jsonStr){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
int status = Integer.valueOf(jsonObject.get("status").toString());
|
||||
//System.out.println(status);
|
||||
@ -77,6 +80,7 @@ public class YxStoreCombinationController {
|
||||
@DeleteMapping(value = "/yxStoreCombination/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
YxStoreCombination combination = new YxStoreCombination();
|
||||
combination.setIsDel(1);
|
||||
yxStoreCombinationService.update(combination);
|
||||
|
@ -17,7 +17,7 @@ import io.swagger.annotations.*;
|
||||
* @author hupeng
|
||||
* @date 2019-11-18
|
||||
*/
|
||||
@Api(tags = "YxStorePink管理")
|
||||
@Api(tags = "拼团记录管理")
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class YxStorePinkController {
|
||||
@ -25,8 +25,8 @@ public class YxStorePinkController {
|
||||
@Autowired
|
||||
private YxStorePinkService yxStorePinkService;
|
||||
|
||||
@Log("查询YxStorePink")
|
||||
@ApiOperation(value = "查询YxStorePink")
|
||||
@Log("查询记录")
|
||||
@ApiOperation(value = "查询记录")
|
||||
@GetMapping(value = "/yxStorePink")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPINK_ALL','YXSTOREPINK_SELECT')")
|
||||
public ResponseEntity getYxStorePinks(YxStorePinkQueryCriteria criteria, Pageable pageable){
|
||||
|
@ -17,6 +17,8 @@ import java.util.List;
|
||||
//@CacheConfig(cacheNames = "yxStorePink")
|
||||
public interface YxStorePinkService {
|
||||
|
||||
int countPeople(int id);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria
|
||||
|
@ -23,6 +23,14 @@ public class YxStorePinkDTO implements Serializable {
|
||||
// 订单id 数据库
|
||||
private Integer orderIdKey;
|
||||
|
||||
private String title;
|
||||
|
||||
private String nickname;
|
||||
|
||||
private String avatar;
|
||||
|
||||
private Integer countPeople;
|
||||
|
||||
// 购买商品个数
|
||||
private Integer totalNum;
|
||||
|
||||
|
@ -10,4 +10,6 @@ import co.yixiang.annotation.Query;
|
||||
*/
|
||||
@Data
|
||||
public class YxStorePinkQueryCriteria{
|
||||
@Query
|
||||
private Integer kId;
|
||||
}
|
@ -1,6 +1,10 @@
|
||||
package co.yixiang.modules.activity.service.impl;
|
||||
|
||||
import co.yixiang.modules.activity.domain.YxStorePink;
|
||||
import co.yixiang.modules.activity.service.YxStoreCombinationService;
|
||||
import co.yixiang.modules.activity.service.dto.YxStoreCombinationDTO;
|
||||
import co.yixiang.modules.shop.service.YxUserService;
|
||||
import co.yixiang.modules.shop.service.dto.YxUserDTO;
|
||||
import co.yixiang.utils.ValidationUtil;
|
||||
import co.yixiang.modules.activity.repository.YxStorePinkRepository;
|
||||
import co.yixiang.modules.activity.service.YxStorePinkService;
|
||||
@ -11,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@ -30,13 +36,47 @@ public class YxStorePinkServiceImpl implements YxStorePinkService {
|
||||
@Autowired
|
||||
private YxStorePinkRepository yxStorePinkRepository;
|
||||
|
||||
@Autowired
|
||||
private YxStoreCombinationService combinationService;
|
||||
|
||||
@Autowired
|
||||
private YxUserService userService;
|
||||
|
||||
@Autowired
|
||||
private YxStorePinkMapper yxStorePinkMapper;
|
||||
|
||||
/**
|
||||
* 参与拼团的人
|
||||
* @param id id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int countPeople(int id) {
|
||||
return yxStorePinkRepository.countByKId(id) + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(YxStorePinkQueryCriteria criteria, Pageable pageable){
|
||||
Page<YxStorePink> page = yxStorePinkRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(yxStorePinkMapper::toDto));
|
||||
criteria.setKId(0);
|
||||
Page<YxStorePink> page = yxStorePinkRepository
|
||||
.findAll((root, criteriaQuery, criteriaBuilder)
|
||||
-> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
List<YxStorePinkDTO> storePinkDTOS = yxStorePinkMapper.toDto(page.getContent());
|
||||
for (YxStorePinkDTO storePinkDTO : storePinkDTOS) {
|
||||
YxStoreCombinationDTO combinationDTO = combinationService
|
||||
.findById(storePinkDTO.getCid());
|
||||
YxUserDTO userDTO = userService.findById(storePinkDTO.getUid());
|
||||
|
||||
storePinkDTO.setAvatar(userDTO.getAvatar());
|
||||
storePinkDTO.setNickname(userDTO.getNickname());
|
||||
storePinkDTO.setTitle(combinationDTO.getTitle());
|
||||
storePinkDTO.setCountPeople(countPeople(storePinkDTO.getId()));
|
||||
}
|
||||
Map<String,Object> map = new LinkedHashMap<>(2);
|
||||
map.put("content",storePinkDTOS);
|
||||
map.put("totalElements",page.getTotalElements());
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,6 +14,8 @@ import java.util.List;
|
||||
//@CacheConfig(cacheNames = "yxStoreOrder")
|
||||
public interface YxStoreOrderService {
|
||||
|
||||
String orderType(int id,int pinkId,int combinationId);
|
||||
|
||||
void refund(YxStoreOrder resources);
|
||||
|
||||
/**
|
||||
|
@ -2,8 +2,12 @@ package co.yixiang.modules.shop.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.exception.EntityExistException;
|
||||
import co.yixiang.modules.activity.domain.YxStorePink;
|
||||
import co.yixiang.modules.activity.repository.YxStorePinkRepository;
|
||||
import co.yixiang.modules.activity.service.YxStorePinkService;
|
||||
import co.yixiang.modules.shop.domain.YxStoreOrder;
|
||||
import co.yixiang.modules.shop.domain.YxStoreOrderStatus;
|
||||
import co.yixiang.modules.shop.domain.YxUserBill;
|
||||
@ -63,6 +67,9 @@ public class YxStoreOrderServiceImpl implements YxStoreOrderService {
|
||||
@Autowired
|
||||
private YxUserBillService yxUserBillService;
|
||||
|
||||
@Autowired
|
||||
private YxStorePinkRepository storePinkRepository;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void refund(YxStoreOrder resources) {
|
||||
@ -104,6 +111,34 @@ public class YxStoreOrderServiceImpl implements YxStoreOrderService {
|
||||
yxStoreOrderStatusService.create(storeOrderStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String orderType(int id,int pinkId, int combinationId) {
|
||||
String str = "[普通订单]";
|
||||
if(pinkId > 0 || combinationId > 0){
|
||||
YxStorePink storePink = storePinkRepository.findByOrderIdKey(id);
|
||||
if(ObjectUtil.isNull(storePink)) {
|
||||
str = "[拼团订单]";
|
||||
}else{
|
||||
switch (storePink.getStatus()){
|
||||
case 1:
|
||||
str = "[拼团订单]正在进行中";
|
||||
break;
|
||||
case 2:
|
||||
str = "[拼团订单]已完成";
|
||||
break;
|
||||
case 3:
|
||||
str = "[拼团订单]未完成";
|
||||
break;
|
||||
default:
|
||||
str = "[拼团订单]历史订单";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(YxStoreOrderQueryCriteria criteria, Pageable pageable){
|
||||
|
||||
@ -139,8 +174,8 @@ public class YxStoreOrderServiceImpl implements YxStoreOrderService {
|
||||
,yxStoreOrder.getPaid());
|
||||
yxStoreOrderDTO.setPayTypeName(payTypeName);
|
||||
|
||||
String orderType = OrderUtil.orderType(1);
|
||||
yxStoreOrderDTO.setPinkName(orderType);
|
||||
yxStoreOrderDTO.setPinkName(orderType(yxStoreOrder.getId()
|
||||
,yxStoreOrder.getPinkId(),yxStoreOrder.getCombinationId()));
|
||||
|
||||
List<StoreOrderCartInfo> cartInfos = yxStoreOrderCartInfoRepository
|
||||
.findByOid(yxStoreOrder.getId());
|
||||
|
@ -94,7 +94,7 @@ public class MenuController {
|
||||
@DeleteMapping(value = "/menus/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','MENU_ALL','MENU_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Long id){
|
||||
// if(id>0) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(id>0) throw new BadRequestException("演示环境禁止操作");
|
||||
List<Menu> menuList = menuService.findByPid(id);
|
||||
Set<Menu> menuSet = new HashSet<>();
|
||||
menuSet.add(menuService.findOne(id));
|
||||
|
@ -68,7 +68,7 @@ public class YxSystemConfigController {
|
||||
@PutMapping(value = "/yxSystemConfig")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMCONFIG_ALL','YXSYSTEMCONFIG_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody YxSystemConfig resources){
|
||||
// if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
yxSystemConfigService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
Reference in New Issue
Block a user