Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
SongZhang 2024-09-26 17:49:18 +08:00
commit 6686f0c549
14 changed files with 72 additions and 45 deletions

View File

@ -104,6 +104,10 @@ public class TbConsInfoFlow implements Serializable {
@ApiModelProperty(value = "备注")
private String remark;
@Column(name = "`operator`")
@ApiModelProperty(value = "操作人")
private String operator;
@Transient
@TableField(exist = false)
private String productName;

View File

@ -53,7 +53,7 @@ public class TbConsInfoFlowDto implements Serializable {
private String orderNo;
private String coverImg;
private String remark;
private String operator;
}

View File

@ -6,10 +6,7 @@ import cn.ysk.cashier.cons.domain.TbConsInfoFlow;
import cn.ysk.cashier.cons.repository.TbConsInfoFlowRepository;
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.utils.FileUtil;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.*;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.cons.repository.TbConCheckRepository;
import cn.ysk.cashier.cons.service.TbConCheckService;
@ -97,13 +94,12 @@ public class TbConCheckServiceImpl implements TbConCheckService {
flow.setConsId(consInfo.getId());
flow.setShopId(consInfo.getShopId());
flow.setConName(consInfo.getConName());
flow.setAmount(consInfo.getStockNumber());
flow.setBalance(consInfo.getStockNumber());
flow.setOperator(SecurityUtils.getCurrentUsername());
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
tbConsInfoFlowRepository.save(flow);

View File

@ -175,6 +175,7 @@ public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService {
tbConsInfoFlow.setBizName("报损");
tbConsInfoFlow.setBizType("-");
tbConsInfoFlow.setCreateTime(new Timestamp(System.currentTimeMillis()));
tbConsInfoFlow.setOperator(SecurityUtils.getCurrentUsername());
tbConsInfoFlowRepository.save(tbConsInfoFlow);
tbConsInfo.setStockNumber(balance);
consInfoRepository.save(tbConsInfo);

View File

@ -136,7 +136,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
flow.setConName(resource.getConName());
flow.setAmount(BigDecimal.ZERO);
flow.setBalance(BigDecimal.ZERO);
flow.setOperator(SecurityUtils.getCurrentUsername());
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
tbConsInfoFlowRepository.save(flow);
@ -346,7 +346,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
flow.setConName(info.getConName());
flow.setAmount(conInfos.getStockNumber());
flow.setBalance(info.getStockNumber().subtract(info.getStockConsume()));
flow.setOperator(SecurityUtils.getCurrentUsername());
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
tbConsInfoFlowRepository.save(flow);
}
@ -456,7 +456,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
flow.setConName(consInfo.getConName());
flow.setAmount(consInfo.getStockNumber());
flow.setBalance(consInfo.getStockNumber());
flow.setOperator(SecurityUtils.getCurrentUsername());
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
tbConsInfoFlowRepository.save(flow);
@ -481,7 +481,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
flow.setConName(consInfo.getConName());
flow.setAmount(consInfo.getStockNumber());
flow.setBalance(consInfo.getStockNumber());
flow.setOperator(SecurityUtils.getCurrentUsername());
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
tbConsInfoFlowRepository.save(flow);
}
@ -512,7 +512,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
flow.setConName(consInfo.getConName());
flow.setAmount(consInfo.getStockNumber());
flow.setBalance(consInfo.getStockNumber());
flow.setOperator(SecurityUtils.getCurrentUsername());
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
tbConsInfoFlowRepository.save(flow);

View File

@ -62,6 +62,8 @@ public class TbProductStockDetailDto implements Serializable {
/** 关联订单Id */
private String orderId;
private String orderNo;
/** 1入库 -1出库 */
private Integer subType;

View File

@ -10,5 +10,6 @@ public class StockRecordMsg {
private String type;
private Integer subType;
private Integer number;
private String operator;
private String remark;
}

View File

@ -1,24 +1,10 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.mapper.product;
import cn.ysk.cashier.base.BaseMapper;
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
import cn.ysk.cashier.dto.product.TbProductStockDetailDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
/**
@ -29,4 +15,8 @@ import org.mapstruct.ReportingPolicy;
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface TbProductStockDetailMapper extends BaseMapper<TbProductStockDetailDto, TbProductStockDetail> {
@Mapping(target = "orderNo", ignore = true)
TbProductStockDetailDto toDto(TbProductStockDetail entity);
}

View File

@ -15,11 +15,15 @@
*/
package cn.ysk.cashier.pojo.shop;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/**
@ -47,9 +51,13 @@ public class TbMerchantThirdApply implements Serializable {
private String appId;
@Column(name = "`small_appid`")
@ApiModelProperty(value = "小程序appid")
@ApiModelProperty(value = "微信小程序appid")
private String smallAppid;
@Column(name = "`alipay_small_appid`")
@ApiModelProperty(value = "支付宝小程序appid")
private String alipaySmallAppid;
@Column(name = "`store_id`")
@ApiModelProperty(value = "店铺id")
private String storeId;

View File

@ -46,7 +46,7 @@ public interface TbShopUserRepository extends JpaRepository<TbShopUser, Integer>
List<Integer> getUserIdByShopId(String shopId);
@Query("SELECT count(1) from TbShopUser user where user.shopId = :shopId and user.joinTime BETWEEN :startTime AND :endTime")
Integer newFlow(@Param("shopId") String shopId, @Param("startTime") String startTime, @Param("endTime") String endTime);
Integer newFlow(@Param("shopId") String shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
@Query(value = "select IFNULL(sum(amount),0) from tb_shop_user_flow where shop_user_id=:userId and biz_code in ('cashMemberIn','scanMemberIn')",nativeQuery = true)
BigDecimal sumAmount(Integer userId);

View File

@ -83,7 +83,7 @@ public class SummaryServiceImpl implements SummaryService {
//会员 充值金额 inAmount /退款金额 outAmount /会员消费金额 useAmount /会员消费笔数 useNum
Map<String, Object> flowMap = tbShopUserFlowMapper.tradeIndexFlow(param.getShopId(), DateUtil.getStrTime(param.getStartTime()), DateUtil.getStrTime(param.getEndTime()));
// 新增会员数
Integer newFlow = tbShopUserRepository.newFlow(param.getShopId().toString(), DateUtil.getStrTime(param.getStartTime()), DateUtil.getStrTime(param.getEndTime()));
Integer newFlow = tbShopUserRepository.newFlow(param.getShopId().toString(), param.getStartTime(), param.getEndTime());
// Integer newFlow = tbShopUserFlowMapper.tradeIndexNewFlow(param.getShopId(), DateUtil.getStrTime(param.getStartTime()), DateUtil.getStrTime(param.getEndTime()));
//台桌数
int tables = tbShopTableRepository.countAllByShopId(param.getShopId());
@ -117,22 +117,28 @@ public class SummaryServiceImpl implements SummaryService {
BigDecimal payAmount = new BigDecimal(payCountVo.getPayAmount().toString());
switch (payCountVo.getPayType()){
case "微信小程序":
payCountVo.setPayAmount(payAmount.add(payCountMap.get("wx_lite")));
payCountVo.setPayAmount(payCountMap.containsKey("wx_lite")?payAmount.add(payCountMap.get("wx_lite")):payAmount);
break;
case "支付宝小程序":
payCountVo.setPayAmount(payAmount.add(payCountMap.get("ali_lite")));
payCountVo.setPayAmount(payCountMap.containsKey("ali_lite")?payAmount.add(payCountMap.get("ali_lite")):payAmount);
break;
case "主扫收款":
payCountVo.setPayAmount(payAmount.add(payCountMap.get("scanCode")));
payCountVo.setPayAmount(payCountMap.containsKey("scanCode")?payAmount.add(payCountMap.get("scanCode")):payAmount);
break;
case "收款码收款":
payCountVo.setPayAmount(payAmount.add(payCountMap.get("ALIPAY")).add(payCountMap.get("WECHAT")));
if(payCountMap.containsKey("ALIPAY")){
payAmount = payAmount.add(payCountMap.get("ALIPAY"));
}
if(payCountMap.containsKey("WECHAT")){
payAmount = payAmount.add(payCountMap.get("WECHAT"));
}
payCountVo.setPayAmount(payAmount);
break;
case "现金":
payCountVo.setPayAmount(payAmount.add(payCountMap.get("cash")));
payCountVo.setPayAmount(payCountMap.containsKey("cash")?payAmount.add(payCountMap.get("cash")):payAmount);
break;
case "会员":
payCountVo.setPayAmount(payAmount.add(payCountMap.get("deposit")));
payCountVo.setPayAmount(payCountMap.containsKey("deposit")?payAmount.add(payCountMap.get("deposit")):payAmount);
break;
case "充值":
payCountVo.setPayAmount(payAmount.add(vipSaveAmount));

View File

@ -208,6 +208,7 @@ public class StockServiceImpl implements StockService {
stockDetail.setUpdatedAt(System.currentTimeMillis());
stockDetail.setSourcePath("SHOP");
stockDetail.setRemark("一次性入库覆盖库存");
stockDetail.setOperator(SecurityUtils.getCurrentUsername());
if ("sku".equals(productIdStr)) {
Optional<TbProductSku> byId = skuRepository.findById(Double.valueOf(row.getCell(2).toString()).intValue());
if (byId.isPresent()) {
@ -393,6 +394,27 @@ public class StockServiceImpl implements StockService {
case "stockNumber"://库存
description.append(" 库存数量修改为:"+updateValueVO.getValue()+" 原库存:"+product.getStockNumber());
sqlQuery.append(" set stock_number = ").append(updateValueVO.getValue());
TbProductStockDetail detail=new TbProductStockDetail();
detail.setProductId(product.getId().toString());
detail.setProductName(product.getName());
detail.setShopId(product.getShopId());
detail.setOperator(SecurityUtils.getCurrentUsername());
detail.setSourcePath("NORMAL");
detail.setLeftNumber(product.getStockNumber());
detail.setStockNumber(new Double(Integer.valueOf(updateValueVO.getValue())-product.getStockNumber()));
TbShopUnit tbShopUnit = shopUnitRepository.findById(product.getUnitId()).orElse(null);
if(tbShopUnit!=null){
detail.setUnitName(tbShopUnit.getName());
}
if (product.getStockNumber() > Integer.valueOf(updateValueVO.getValue())) {
detail.setSubType(-1);
detail.setType("盘点出库");
} else {
detail.setSubType(1);
detail.setType("盘点入库");
}
detail.setCreatedAt(System.currentTimeMillis());
tbProductStockDetailRepository.save(detail);
break;
case "salePrice"://价格
description.append("修改价格为" + updateValueVO.getValue());

View File

@ -103,21 +103,17 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
-> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
Page<TbProductStockDetailDto> map = page.map(tbProductStockDetailMapper::toDto);
ArrayList<Map<String, Object>> contents = new ArrayList<>();
for (TbProductStockDetailDto tbProductStockDetailDto : map.getContent()) {
Map<String, Object> map1 = BeanUtil.transBean2Map(tbProductStockDetailDto);
if (StrUtil.isNotBlank(tbProductStockDetailDto.getOrderId())) {
TbOrderInfo tbOrderInfo = tbOrderInfoRepository.findById(Integer.valueOf(tbProductStockDetailDto.getOrderId())).orElse(null);
if (tbOrderInfo != null) {
map1.put("orderNo", tbOrderInfo.getOrderNo());
tbProductStockDetailDto.setOrderNo(tbOrderInfo.getOrderNo());
}
}
contents.add(map1);
tbProductStockDetailDto.setTypes();
}
Map<String,Object> info = new LinkedHashMap<>(2);
info.put("content",contents);
info.put("content",map.getContent());
info.put("totalElements",page.getTotalElements());
return info;
}

View File

@ -501,6 +501,7 @@ public class TbProductStockOperateServiceImpl implements TbProductStockOperateSe
productStockDetail.setStockSnap(JSONObject.toJSONString(snapItem));
productStockDetail.setSourcePath("CASHIER");
productStockDetail.setRemark(stockRecordMsg.getRemark());
productStockDetail.setOperator(stockRecordMsg.getOperator());
productStockDetailRepository.save(productStockDetail);
}