Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
a0274410a8
|
|
@ -28,18 +28,29 @@ public class TbVersionController {
|
|||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("版本管理 新增")
|
||||
@ApiOperation("新增版本")
|
||||
public ResponseEntity<Object> createTbVersion(@Validated @RequestBody TbVersion resources){
|
||||
return new ResponseEntity<>(tbVersionService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("版本管理 修改")
|
||||
@ApiOperation("修改版本")
|
||||
public ResponseEntity<Object> updateTbVersion(@Validated @RequestBody TbVersion resources){
|
||||
tbVersionService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PutMapping("upSel")
|
||||
@Log("版本管理 修改选中")
|
||||
@ApiOperation("修改当前选中")
|
||||
public ResponseEntity<Object> updateSel(@Validated @RequestBody TbVersion resources){
|
||||
tbVersionService.updateSel(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation("删除版本")
|
||||
public ResponseEntity<Object> deleteTbVersion(@RequestBody Integer[] ids) {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ public class TbOrderInfoController {
|
|||
|
||||
@PostMapping("/date")
|
||||
@ApiOperation("查询订单")
|
||||
@AnonymousPostMapping
|
||||
public ResponseEntity<Object> queryTbOrderInfo(@RequestBody TbOrderInfoQueryCriteria criteria){
|
||||
return new ResponseEntity<>(tbOrderInfoService.queryAllPage(criteria),HttpStatus.OK);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package cn.ysk.cashier.controller.shop;
|
||||
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopExtend;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopExtendService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
|
@ -51,8 +53,11 @@ public class TbShopExtendController {
|
|||
@PutMapping
|
||||
@ApiOperation("通过id修改")
|
||||
public ResponseEntity<Object> update(@RequestBody TbShopExtend tbShopExtend) {
|
||||
tbShopExtend.setUpdateTime(new Date());
|
||||
tbShopExtendService.updateById(tbShopExtend);
|
||||
if (tbShopExtend.getId() != null) {
|
||||
tbShopExtendService.updateById(tbShopExtend);
|
||||
} else {
|
||||
tbShopExtendService.saveInfo(tbShopExtend);
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public class TbVersionDto implements Serializable {
|
|||
|
||||
private Integer id;
|
||||
|
||||
/** LDBL_APP;WX; */
|
||||
/** PC;APP; */
|
||||
private String source;
|
||||
|
||||
/** ios;android; */
|
||||
|
|
@ -22,9 +22,12 @@ public class TbVersionDto implements Serializable {
|
|||
|
||||
/** 版本号 */
|
||||
private String version;
|
||||
/** 下载地址 */
|
||||
private String url;
|
||||
|
||||
/** 0:不更新;1:更新 */
|
||||
/** 是否强制更新 0:否 1:是 */
|
||||
private Integer isUp;
|
||||
private Integer sel;
|
||||
|
||||
/** 更新提示内容 */
|
||||
private String message;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import lombok.Data;
|
|||
public class TbVersionQueryCriteria{
|
||||
|
||||
@Query
|
||||
/** LDBL-APP;WX; */
|
||||
/** PC;APP; */
|
||||
private String source;
|
||||
@Query
|
||||
/** ios;android; */
|
||||
|
|
@ -21,7 +21,7 @@ public class TbVersionQueryCriteria{
|
|||
/** 版本号 */
|
||||
private String version;
|
||||
@Query
|
||||
/** 0:不更新;1:更新 */
|
||||
/** 是否强制更新 0:否 1:是*/
|
||||
private Integer isUp;
|
||||
|
||||
private Integer pageSize;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ public class TbOrderInfoQueryCriteria{
|
|||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Long> createdAt;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
|
||||
@Query
|
||||
private String tableName;
|
||||
|
|
@ -79,4 +81,18 @@ public class TbOrderInfoQueryCriteria{
|
|||
public void setProductName(String productName) {
|
||||
if(StringUtils.isNotBlank(productName)) this.productName = productName;
|
||||
}
|
||||
|
||||
public Integer getPage() {
|
||||
if (page == null) {
|
||||
return 0;
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
if (pageSize == null) {
|
||||
return 10;
|
||||
}
|
||||
return pageSize;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,15 @@ import javax.persistence.Id;
|
|||
public class StockCountDTO {
|
||||
private String shopId;
|
||||
@Id
|
||||
private Long skuId;
|
||||
private Long proId;
|
||||
private String proName;
|
||||
private Integer isStock;
|
||||
private String skuName;
|
||||
private String unitName;
|
||||
// 消耗数
|
||||
private Integer stockCount;
|
||||
// 当前库存
|
||||
private Integer stockNumber;
|
||||
private String specSnap;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class CreateOrderDTO {
|
|||
@NotNull
|
||||
private Integer shopId;
|
||||
@NotEmpty
|
||||
private Long tableId;
|
||||
private String tableId;
|
||||
private String note;
|
||||
private boolean postPay;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ public class PendingDTO {
|
|||
private String masterId;
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
private Long tableId;
|
||||
private String tableId;
|
||||
private Integer vipUserId;
|
||||
@NotNull
|
||||
private Boolean isPending;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package cn.ysk.cashier.mybatis.entity;
|
|||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -24,6 +25,7 @@ public class TbShopExtend extends Model<TbShopExtend> {
|
|||
private String autokey;
|
||||
//值
|
||||
private String value;
|
||||
private String detail;
|
||||
//更新时间
|
||||
private Date updateTime;
|
||||
//创建时间
|
||||
|
|
@ -93,5 +95,47 @@ public class TbShopExtend extends Model<TbShopExtend> {
|
|||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
|
||||
public String getDetail() {
|
||||
return detail;
|
||||
}
|
||||
|
||||
public void setDetail(String detail) {
|
||||
this.detail = detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* index_bg:店铺首页背景图
|
||||
* my_bg: 我的页面背景图
|
||||
* member_bg:会员卡页面背景图
|
||||
* shopinfo_bg:商品列表顶部背景图
|
||||
* @param autokey
|
||||
*/
|
||||
public void initAutoKey(String autokey,Integer shopId) {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
switch (autokey) {
|
||||
case "index_bg":
|
||||
this.name = "店铺首页背景图";
|
||||
this.detail="建议尺寸: 375*600 ";
|
||||
break;
|
||||
case "my_bg":
|
||||
this.name = "我的页面背景图";
|
||||
this.detail="建议尺寸: 375*200";
|
||||
break;
|
||||
case "member_bg":
|
||||
this.name = "会员卡页面背景图";
|
||||
this.detail="建议尺寸: 315*152";
|
||||
break;
|
||||
case "shopinfo_bg":
|
||||
this.name = "商品列表顶部背景图";
|
||||
this.detail="建议尺寸: 375*120";
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.type="img";
|
||||
this.shopId=shopId;
|
||||
this.autokey = autokey;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,10 @@ package cn.ysk.cashier.mybatis.mapper;
|
|||
|
||||
import cn.ysk.cashier.pojo.product.TbProductSku;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TbProducSkutMapper extends BaseMapper<TbProductSku> {
|
||||
|
||||
|
|
@ -22,6 +19,9 @@ public interface TbProducSkutMapper extends BaseMapper<TbProductSku> {
|
|||
@Update("update tb_product_sku set stock_number=stock_number+#{addNum} WHERE id=#{skuId}")
|
||||
int incrStock(@Param("skuId") Integer skuId, @Param("addNum") Integer addNum);
|
||||
|
||||
@Update("update tb_product_sku set real_sales_number=real_sales_number+#{num} WHERE id=#{skuId}")
|
||||
int incrRealSalesNumber(@Param("skuId") Integer skuId, @Param("num") Integer num);
|
||||
|
||||
@Update("update tb_product_sku set stock_number=stock_number-#{num} WHERE id=#{id} and stock_number-#{num} >= 0")
|
||||
int decrStock(String id, int num);
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ public class TbShopAdServiceImpl extends ServiceImpl<TbShopAdMapper, TbShopAd> i
|
|||
return ResponseEntity.badRequest().body("店铺ID不能为空");
|
||||
}
|
||||
|
||||
wrapper.eq("shop_id", params.get("shopId"));
|
||||
|
||||
if (StrUtil.isNotBlank((String) params.get("status"))) {
|
||||
wrapper.eq("status", params.get("status"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import cn.ysk.cashier.utils.PageUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 店铺扩展信息(TbShopExtend)表服务实现类
|
||||
|
|
@ -40,6 +41,7 @@ public class TbShopExtendServiceImpl extends ServiceImpl<TbShopExtendMapper, TbS
|
|||
}
|
||||
wrapper.orderByDesc("create_time");
|
||||
Page<TbShopExtend> ipage = tbShopExtendmapper.selectPage(page, wrapper);
|
||||
checkAndInitialize(ipage,criteria.getShopId());
|
||||
return PageUtil.toPage(ipage.getRecords(), ipage.getTotal());
|
||||
}
|
||||
|
||||
|
|
@ -53,5 +55,43 @@ public class TbShopExtendServiceImpl extends ServiceImpl<TbShopExtendMapper, TbS
|
|||
}
|
||||
tbShopExtendmapper.insert(tbShopExtend);
|
||||
}
|
||||
|
||||
public Page<TbShopExtend> checkAndInitialize(Page<TbShopExtend> ipage, Integer shopId) {
|
||||
List<TbShopExtend> newRecords = new ArrayList<>();
|
||||
List<String> requiredAutokeys = Arrays.asList("index_bg", "my_bg", "member_bg", "shopinfo_bg");
|
||||
|
||||
if (ipage == null || ipage.getRecords() == null || ipage.getRecords().isEmpty()) {
|
||||
// ipage 为空,直接创建包含四种类型数据的新 Page 对象
|
||||
for (String key : requiredAutokeys) {
|
||||
TbShopExtend newRecord = new TbShopExtend();
|
||||
newRecord.initAutoKey(key, shopId);
|
||||
newRecords.add(newRecord);
|
||||
}
|
||||
return new Page<TbShopExtend>(1, newRecords.size(), newRecords.size()) // pageNum, pageSize, total
|
||||
.setRecords(newRecords);
|
||||
} else {
|
||||
// ipage 不为空,补充缺失的数据
|
||||
List<TbShopExtend> shopExtends = ipage.getRecords();
|
||||
Set<String> existingAutokeys = shopExtends.stream()
|
||||
.map(TbShopExtend::getAutokey)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<String> missingAutokeys = requiredAutokeys.stream()
|
||||
.filter(key -> !existingAutokeys.contains(key))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (String key : missingAutokeys) {
|
||||
TbShopExtend newRecord = new TbShopExtend();
|
||||
newRecord.initAutoKey(key, shopId);
|
||||
newRecords.add(newRecord);
|
||||
}
|
||||
|
||||
// 更新现有记录并将新记录添加到原来的列表中
|
||||
shopExtends.addAll(newRecords);
|
||||
|
||||
return new Page<TbShopExtend>(ipage.getCurrent(), ipage.getSize(), ipage.getTotal() + newRecords.size())
|
||||
.setRecords(shopExtends);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class TbVersion implements Serializable {
|
|||
private Integer id;
|
||||
|
||||
@Column(name = "`source`")
|
||||
@ApiModelProperty(value = "LDBL-APP;WX;")
|
||||
@ApiModelProperty(value = "PC;APP;")
|
||||
private String source;
|
||||
|
||||
@Column(name = "`type`")
|
||||
|
|
@ -30,10 +30,17 @@ public class TbVersion implements Serializable {
|
|||
@ApiModelProperty(value = "版本号")
|
||||
private String version;
|
||||
|
||||
@Column(name = "`url`")
|
||||
@ApiModelProperty(value = "下载地址")
|
||||
private String url;
|
||||
|
||||
@Column(name = "`is_up`")
|
||||
@ApiModelProperty(value = "0:不更新;1:更新")
|
||||
@ApiModelProperty(value = "是否强制更新 0:否 1:是")
|
||||
private Integer isUp;
|
||||
|
||||
@ApiModelProperty(value = "选中 0:否 1:是")
|
||||
private Integer sel;
|
||||
|
||||
@Column(name = "`message`")
|
||||
@ApiModelProperty(value = "更新提示内容")
|
||||
private String message;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.ysk.cashier.pojo.TbVersion;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
/**
|
||||
|
|
@ -15,4 +16,15 @@ public interface TbVersionRepository extends JpaRepository<TbVersion, Integer>,
|
|||
|
||||
@Query("SELECT count(1) FROM TbVersion WHERE source = :source AND type =:type AND version =:version")
|
||||
int isExist(@Param("source") String source, @Param("type") String type, @Param("version") String version);
|
||||
|
||||
@Query("SELECT count(1) FROM TbVersion WHERE source = :source AND version =:version")
|
||||
int isExist(@Param("source") String source, @Param("version") String version);
|
||||
|
||||
@Modifying
|
||||
@Query("update TbVersion version set version.sel=CASE" +
|
||||
" WHEN version.source=:source AND version.id=:id THEN 1 " +
|
||||
" WHEN version.source=:source AND version.id!=:id THEN 0 " +
|
||||
" ELSE version.sel END " +
|
||||
" WHERE version.source = :source")
|
||||
int updateSelBySource(@Param("source") String source, @Param("id") Integer id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,9 +34,10 @@ public interface StockCountRepository extends JpaRepository<StockCountDTO, Integ
|
|||
List<StockCountDTO> countStock( @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
|
||||
@Query(value = "SELECT\n" +
|
||||
"pro.shop_id AS shop_id,\n" +
|
||||
"pro.id AS pro_id,\n" +
|
||||
"info.shop_id AS shop_id,\n" +
|
||||
"info.product_id AS pro_id,\n" +
|
||||
"info.product_name AS pro_name,\n" +
|
||||
"info.product_sku_id AS sku_id,\n" +
|
||||
"pro.is_stock,\n" +
|
||||
"info.product_sku_name AS sku_name,\n" +
|
||||
"unit.NAME AS unit_name,\n" +
|
||||
|
|
@ -57,11 +58,6 @@ public interface StockCountRepository extends JpaRepository<StockCountDTO, Integ
|
|||
"AND ( info.STATUS = 'closed' OR info.STATUS = 'refund' ) \n" +
|
||||
"GROUP BY\n" +
|
||||
"info.product_id,\n" +
|
||||
"pro.shop_id,\n" +
|
||||
"pro.id,\n" +
|
||||
"info.product_name,\n" +
|
||||
"pro.is_stock,\n" +
|
||||
"info.product_sku_name,\n" +
|
||||
"unit.NAME;",nativeQuery = true)
|
||||
"info.product_sku_id;",nativeQuery = true)
|
||||
List<StockCountDTO> countStockById(Integer orderId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ public interface TbVersionService {
|
|||
*/
|
||||
void update(TbVersion resources);
|
||||
|
||||
void updateSel(TbVersion resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
|
|
|
|||
|
|
@ -7,10 +7,7 @@ import cn.ysk.cashier.mapper.TbVersionMapper;
|
|||
import cn.ysk.cashier.pojo.TbVersion;
|
||||
import cn.ysk.cashier.repository.TbVersionRepository;
|
||||
import cn.ysk.cashier.service.TbVersionService;
|
||||
import cn.ysk.cashier.utils.PageUtil;
|
||||
import cn.ysk.cashier.utils.QueryHelp;
|
||||
import cn.ysk.cashier.utils.RedisUtils;
|
||||
import cn.ysk.cashier.utils.ValidationUtil;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
|
@ -61,17 +58,17 @@ public class TbVersionServiceImpl implements TbVersionService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbVersionDto create(TbVersion resources) {
|
||||
int exist = tbVersionRepository.isExist(resources.getSource(), resources.getType(), resources.getVersion());
|
||||
int exist = tbVersionRepository.isExist(resources.getSource(), resources.getVersion());
|
||||
if (exist > 0) {
|
||||
throw new BadRequestException("该版本已存在。");
|
||||
}
|
||||
resources.setCreatedAt(Instant.now().toEpochMilli());
|
||||
TbVersionDto dto = tbVersionMapper.toDto(tbVersionRepository.save(resources));
|
||||
if (dto.getIsUp() == 1) {
|
||||
//产品标识:型号:版本
|
||||
//LDBL_APP_VERSION:ios:version 存在即需要强制更新
|
||||
redisUtils.set(dto.getSource() + "_VERSION:" + dto.getType() + ":" + dto.getVersion(), dto.getMessage());
|
||||
}
|
||||
// if (dto.getIsUp() == 1) {
|
||||
// //产品标识:型号:版本
|
||||
// //VERSION:PC::version 存在即需要强制更新
|
||||
// redisUtils.set(CacheKey.VERSION + dto.getSource() + ":" + dto.getVersion(), dto);
|
||||
// }
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
|
@ -80,17 +77,23 @@ public class TbVersionServiceImpl implements TbVersionService {
|
|||
public void update(TbVersion resources) {
|
||||
TbVersion tbVersion = tbVersionRepository.findById(resources.getId()).orElseGet(TbVersion::new);
|
||||
ValidationUtil.isNull(tbVersion.getId(), "TbVersion", "id", resources.getId());
|
||||
redisUtils.del(tbVersion.getSource() + "_VERSION:" + tbVersion.getType() + ":" + tbVersion.getVersion());
|
||||
// redisUtils.del(tbVersion.getSource() + "_VERSION:" + tbVersion.getType() + ":" + tbVersion.getVersion());
|
||||
tbVersion.copy(resources);
|
||||
tbVersion.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
tbVersionRepository.save(tbVersion);
|
||||
if (resources.getIsUp() == 1) {
|
||||
//产品标识:型号:版本
|
||||
//LDBL_APP_VERSION:ios:version 存在即需要强制更新
|
||||
redisUtils.set(tbVersion.getSource() + "_VERSION:" + tbVersion.getType() + ":" + tbVersion.getVersion(), tbVersion.getMessage());
|
||||
} else {
|
||||
redisUtils.del(tbVersion.getSource() + "_VERSION:" + tbVersion.getType() + ":" + tbVersion.getVersion());
|
||||
}
|
||||
// if (resources.getIsUp() == 1) {
|
||||
// //产品标识:型号:版本
|
||||
// //LDBL_APP_VERSION:ios:version 存在即需要强制更新
|
||||
// redisUtils.set(tbVersion.getSource() + "_VERSION:" + tbVersion.getType() + ":" + tbVersion.getVersion(), tbVersion.getMessage());
|
||||
// } else {
|
||||
// redisUtils.del(tbVersion.getSource() + "_VERSION:" + tbVersion.getType() + ":" + tbVersion.getVersion());
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateSel(TbVersion resources) {
|
||||
tbVersionRepository.updateSelBySource(resources.getSource(),resources.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -99,9 +102,9 @@ public class TbVersionServiceImpl implements TbVersionService {
|
|||
TbVersion tbVersion = tbVersionRepository.findById(id).orElseGet(TbVersion::new);
|
||||
ValidationUtil.isNull(tbVersion.getId(), "TbVersion", "id", id);
|
||||
tbVersionRepository.deleteById(id);
|
||||
if (tbVersion.getIsUp() == 1) {
|
||||
redisUtils.del(tbVersion.getSource() + "_VERSION:" + tbVersion.getType() + ":" + tbVersion.getVersion());
|
||||
}
|
||||
// if (tbVersion.getIsUp() == 1) {
|
||||
// redisUtils.del(tbVersion.getSource() + "_VERSION:" + tbVersion.getType() + ":" + tbVersion.getVersion());
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,6 +108,10 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||
predicate = criteriaBuilder.and(predicate, criteriaBuilder.notEqual(root.get("orderType"), "return"));
|
||||
}
|
||||
|
||||
if (criteria.getUserId() != null && criteria.getUserId() != 0) {
|
||||
predicate = criteriaBuilder.and(predicate, criteriaBuilder.equal(root.get("userId"), criteria.getUserId()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(criteria.getProductName())) {
|
||||
Date startTime, endTime;
|
||||
DateTime offsetMonth = cn.hutool.core.date.DateUtil.offsetMonth(new Date(), 3);
|
||||
|
|
@ -120,11 +124,6 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||
|
||||
startTime = new Date(startLong);
|
||||
endTime = new Date(endLong);
|
||||
|
||||
// 如果开始时间小于三个月前,不查询
|
||||
// if (startTime.before(offsetMonth)) {
|
||||
// throw new BadRequestException("查询时间范围不能超过三个月");
|
||||
// }
|
||||
} else {
|
||||
startTime = offsetMonth;
|
||||
endTime = new Date();
|
||||
|
|
|
|||
|
|
@ -727,7 +727,7 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
}
|
||||
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page<TbProduct> tbProductPage = productMapper.selectPage(page1, queryWrapper);
|
||||
tbProductPage.getRecords().stream().parallel().forEach(item -> {
|
||||
tbProductPage.getRecords().forEach(item -> {
|
||||
TbProductSkuResult skuResult = productSkuResultRepository.findById(item.getId()).orElse(null);
|
||||
List<TbProductSku> tbProductSkus = producSkutMapper.selectList(new LambdaQueryWrapper<TbProductSku>().eq(TbProductSku::getIsDel, 0)
|
||||
.eq(TbProductSku::getIsPauseSale, 0)
|
||||
|
|
@ -811,4 +811,8 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
current.remove(current.size() - 1); // 回溯
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ package cn.ysk.cashier.service.impl.productimpl;
|
|||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.dto.product.StockCountDTO;
|
||||
import cn.ysk.cashier.dto.rabbit.StockRecordMsg;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbProducSkutMapper;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderInfo;
|
||||
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
||||
import cn.ysk.cashier.repository.order.StockCountRepository;
|
||||
|
|
@ -60,6 +60,7 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
|
|||
private final StockCountRepository stockCountRepository;
|
||||
private final EntityManager entityManager;
|
||||
private final TbOrderInfoRepository tbOrderInfoRepository;
|
||||
private final TbProducSkutMapper skutMapper;
|
||||
|
||||
|
||||
@Override
|
||||
|
|
@ -203,7 +204,7 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
|
|||
productStockDetail.setSubType(-1);
|
||||
tbProductStockDetailRepository.save(productStockDetail);
|
||||
}
|
||||
|
||||
skutMapper.incrRealSalesNumber(s.getSkuId().intValue(),s.getStockCount());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -914,6 +914,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
pushConsMsg(orderInfo, cashierCarts);
|
||||
|
||||
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getShopId, createOrderDTO.getShopId())
|
||||
.eq(TbShopTable::getQrcode, createOrderDTO.getTableId())
|
||||
.set(TbShopTable::getStatus, TableStateEnum.USING.getState()));
|
||||
|
||||
|
|
|
|||
|
|
@ -234,8 +234,8 @@ public class TbShopUserServiceImpl implements TbShopUserService {
|
|||
flow.setBizCode("inMoney".equals(type)?"inMoneyIn":"consumeIn");
|
||||
tbShopUser.setAmount(tbShopUser.getAmount().add(amount));
|
||||
}else if("out".equals(operationType)){
|
||||
flow.setBizName("inMoney".equals(type)?"充值退款":"消费");
|
||||
flow.setBizCode("inMoney".equals(type)?"inMoneyOut":"consumeOut");
|
||||
flow.setBizName("inMoneyOut".equals(type)?"充值退款":"消费");
|
||||
flow.setBizCode("inMoneyOut".equals(type)?"inMoneyOut":"consumeOut");
|
||||
flow.setType("-");
|
||||
tbShopUser.setAmount(tbShopUser.getAmount().subtract(amount));
|
||||
}else {
|
||||
|
|
|
|||
|
|
@ -1,73 +1,65 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="false" debug="false">
|
||||
|
||||
<!-- 日志存放路径, 读取application.yml 需要使用springProperty获取 -->
|
||||
<springProperty scope="context" name="currentLoggerFilePath" source="logging.file.path"/>
|
||||
|
||||
<!-- 主日志级别配置 -->
|
||||
<springProperty scope="context" name="currentRootLevel" source="logging.level.root"/>
|
||||
|
||||
<!-- 项目配置, 如修改包名,请搜索并全部替换掉 -->
|
||||
<springProperty scope="context" name="currentProjectLevel" source="logging.level.com.jeequan.jeepay"/>
|
||||
|
||||
<!-- 日志文件名称 logback属性 -->
|
||||
<property name="currentLoggerFileName" value="pay" />
|
||||
<!-- 日志格式, 参考:https://logback.qos.ch/manual/layouts.html -->
|
||||
<property name="currentLoggerPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{15} - %msg%n" />
|
||||
|
||||
<!-- appender: 控制台日志 -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder charset="UTF-8" >
|
||||
<pattern>${currentLoggerPattern}</pattern>
|
||||
<configuration scan="true" scanPeriod="30 seconds" debug="false">
|
||||
<contextName>elAdmin</contextName>
|
||||
<property name="log.charset" value="utf-8" />
|
||||
<property name="log.pattern" value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
|
||||
<!--写入文件格式-->
|
||||
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/>
|
||||
<!--输出到控制台-->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!--按天生成日志-->
|
||||
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${user.dir}/logback.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!--生成日志文件名称-->
|
||||
<FileNamePattern>${user.dir}/logs/cashierAdmin/%d{yyyy-MM-dd}.log.gz</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<MaxHistory>15</MaxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 日志输出格式 -->
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>${p_file}</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- appender:主日志文件 -->
|
||||
<appender name="ALL_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 日志文件路径及文件名 -->
|
||||
<file>${currentLoggerFilePath}/${currentLoggerFileName}.all.log</file>
|
||||
<!-- 内容编码及格式 -->
|
||||
<encoder charset="UTF-8" ><pattern>${currentLoggerPattern}</pattern></encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 每天日志归档路径以及格式 -->
|
||||
<fileNamePattern>${currentLoggerFilePath}/${currentLoggerFileName}.all.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>5</maxHistory> <!--日志文件保留天数-->
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<!-- appender:错误信息日志文件 -->
|
||||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 日志文件路径及文件名 -->
|
||||
<file>${currentLoggerFilePath}/${currentLoggerFileName}.error.log</file>
|
||||
<!-- 内容编码及格式 -->
|
||||
<encoder charset="UTF-8" ><pattern>${currentLoggerPattern}</pattern></encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 每天日志归档路径以及格式 -->
|
||||
<fileNamePattern>${currentLoggerFilePath}/${currentLoggerFileName}.error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>20</maxHistory> <!--日志文件保留天数-->
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文件只记录ERROR级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>ERROR</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 主日志级别配置 -->
|
||||
<root level="${currentRootLevel}">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="ALL_FILE" />
|
||||
<appender-ref ref="ERROR_FILE" />
|
||||
<!--普通日志输出到控制台-->
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
<appender-ref ref="logFile"/>
|
||||
</root>
|
||||
|
||||
<!-- 项目日志级别配置 -->
|
||||
<logger name="cn.ysk.cashier" level="${currentProjectLevel}"/>
|
||||
<!--监控sql日志输出,如需监控 Sql 打印,请设置为 INFO -->
|
||||
<logger name="jdbc.sqlonly" level="ERROR" additivity="false">
|
||||
<appender-ref ref="console" />
|
||||
</logger>
|
||||
<logger name="org.hibernate.SQL" level="debug">
|
||||
|
||||
<logger name="org.apache.hc.client5.http.wire" level="info"/>
|
||||
</logger>
|
||||
|
||||
<logger name="org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager" level="info" />
|
||||
<logger name="jdbc.resultset" level="ERROR" additivity="false">
|
||||
<appender-ref ref="console" />
|
||||
</logger>
|
||||
|
||||
</configuration>
|
||||
<!-- 如想看到表格数据,将OFF改为INFO -->
|
||||
<logger name="jdbc.resultsettable" level="OFF" additivity="false">
|
||||
<appender-ref ref="console" />
|
||||
</logger>
|
||||
|
||||
<logger name="jdbc.connection" level="OFF" additivity="false">
|
||||
<appender-ref ref="console" />
|
||||
</logger>
|
||||
|
||||
<logger name="jdbc.sqltiming" level="OFF" additivity="false">
|
||||
<appender-ref ref="console" />
|
||||
</logger>
|
||||
|
||||
<logger name="jdbc.audit" level="OFF" additivity="false">
|
||||
<appender-ref ref="console" />
|
||||
</logger>
|
||||
</configuration>
|
||||
|
|
@ -77,7 +77,7 @@ public class QiniuController {
|
|||
return new ResponseEntity<>(qiNiuService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
// @Log("上传文件")
|
||||
@Log("上传版本文件")
|
||||
@ApiOperation("上传文件")
|
||||
@AnonymousPostMapping
|
||||
public ResponseEntity<Object> uploadQiNiu(@RequestParam MultipartFile file){
|
||||
|
|
@ -89,6 +89,15 @@ public class QiniuController {
|
|||
return new ResponseEntity<>(map,HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("上传PC版本文件")
|
||||
@AnonymousPostMapping("uploadVersionFile")
|
||||
public ResponseEntity<Object> uploadVersionFile(@RequestParam MultipartFile file,@RequestParam String name){
|
||||
String url = qiNiuService.uploadVersionFile(file,qiNiuService.findCloud(),name);
|
||||
Map<String,Object> map = new HashMap<>(1);
|
||||
map.put("data",url);
|
||||
return new ResponseEntity<>(map,HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
// @Log("上传文件")
|
||||
@ApiOperation("上传文件")
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ public interface QiNiuService {
|
|||
*/
|
||||
List<QiniuContent> queryAll(QiniuQueryCriteria criteria);
|
||||
|
||||
String uploadVersionFile(MultipartFile file, CloudStorageConfig qiniuConfig,String fileName);
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param file 文件
|
||||
|
|
|
|||
|
|
@ -115,6 +115,22 @@ public class QiNiuServiceImpl implements QiNiuService {
|
|||
return qiniuContentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String uploadVersionFile(MultipartFile file, CloudStorageConfig qiniuConfig,String fileName) {
|
||||
if(qiniuConfig== null){
|
||||
throw new BadRequestException("请先添加相应配置,再操作");
|
||||
}
|
||||
// 构造一个带指定Zone对象的配置类
|
||||
try {
|
||||
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
||||
|
||||
return OSSFactory.build(qiniuConfig).uploadFileName(file.getBytes(), extension,fileName);
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public QiniuContent upload(MultipartFile file, CloudStorageConfig qiniuConfig) {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,25 @@ public abstract class AbstractCloudStorageService {
|
|||
return path + "." + suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
* @param prefix 前缀
|
||||
* @param fileName 文件名
|
||||
* @param suffix 后缀
|
||||
* @return 返回上传路径
|
||||
*/
|
||||
public String getPath(String prefix,String suffix, String fileName) {
|
||||
//文件路径
|
||||
// String path = DateUtils.getDays() + "/" + fileName;
|
||||
String path = "version/" + fileName;
|
||||
|
||||
if(StringUtils.isNotBlank(prefix)){
|
||||
path = prefix + "/" + path;
|
||||
}
|
||||
|
||||
return path + "." + suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param data 文件字节数组
|
||||
|
|
@ -58,6 +77,7 @@ public abstract class AbstractCloudStorageService {
|
|||
* @return 返回http地址
|
||||
*/
|
||||
public abstract String uploadSuffix(byte[] data, String suffix) throws Exception;
|
||||
public abstract String uploadFileName(byte[] data, String suffix,String fileName) throws Exception;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
|
|
|
|||
|
|
@ -49,6 +49,11 @@ public class AliyunCloudStorageService extends AbstractCloudStorageService {
|
|||
return upload(data, getPath(config.getPrefix(), suffix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadFileName(byte[] data, String suffix,String fileName) throws Exception {
|
||||
return upload(data, getPath(config.getPrefix(), suffix,fileName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(InputStream inputStream, String suffix) throws Exception {
|
||||
return upload(inputStream, getPath(config.getPrefix(), suffix));
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ public class HuaweiCloudStorageService extends AbstractCloudStorageService {
|
|||
return config.getUrl() + "/" + path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadFileName(byte[] data, String suffix,String fileName) throws Exception {
|
||||
return upload(data, getPath(config.getPrefix(), suffix,fileName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(InputStream inputStream, String suffix) throws Exception {
|
||||
return upload(inputStream, getPath(config.getPrefix(), suffix));
|
||||
|
|
|
|||
|
|
@ -82,4 +82,9 @@ public class QcloudCloudStorageService extends AbstractCloudStorageService {
|
|||
public String uploadSuffix(InputStream inputStream, String suffix) throws Exception {
|
||||
return upload(inputStream, getPath(config.getPrefix(), suffix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadFileName(byte[] data, String suffix,String fileName) throws Exception {
|
||||
return upload(data, getPath(config.getPrefix(), suffix,fileName));
|
||||
}
|
||||
}
|
||||
|
|
@ -75,4 +75,9 @@ public class QiniuCloudStorageService extends AbstractCloudStorageService {
|
|||
public String uploadSuffix(InputStream inputStream, String suffix) throws Exception {
|
||||
return upload(inputStream, getPath(config.getPrefix(), suffix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadFileName(byte[] data, String suffix,String fileName) throws Exception {
|
||||
return upload(data, getPath(config.getPrefix(), suffix,fileName));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue