Merge remote-tracking branch 'origin/zstmp' into zs
This commit is contained in:
@@ -71,4 +71,5 @@ public interface CacheKey {
|
||||
* 商品库存
|
||||
*/
|
||||
String PRODUCT = "PRODUCT:";
|
||||
String SONG_URL = "song:";
|
||||
}
|
||||
|
||||
@@ -128,6 +128,13 @@
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>dysmsapi20170525</artifactId>
|
||||
<version>2.0.21</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.ysk.cashier.config;
|
||||
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.DirectExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class RabbitConfig {
|
||||
public static final String QUEUE_STOCK_RECORD_SALE = "queue.stock.record.sale";
|
||||
public static final String EXCHANGE_STOCK_RECORD = "exchange.stock.record";
|
||||
public static final String ROUTING_STOCK_RECORD_SALE = "routing.stock.record.sale";
|
||||
|
||||
@Bean
|
||||
Queue stockRecordSaleQueue() {
|
||||
return new Queue(QUEUE_STOCK_RECORD_SALE);
|
||||
}
|
||||
|
||||
@Bean
|
||||
DirectExchange stockRecordExchange() {
|
||||
return new DirectExchange(EXCHANGE_STOCK_RECORD);
|
||||
}
|
||||
|
||||
@Bean
|
||||
Binding binding(Queue stockRecordSaleQueue, DirectExchange stockRecordExchange) {
|
||||
return BindingBuilder.bind(stockRecordSaleQueue).to(stockRecordExchange).with(ROUTING_STOCK_RECORD_SALE);
|
||||
}
|
||||
}
|
||||
@@ -87,10 +87,10 @@ public class AuthorizationController {
|
||||
String code = (String) redisUtils.get(authUser.getUuid());
|
||||
// 清除验证码
|
||||
redisUtils.del(authUser.getUuid());
|
||||
if (StringUtils.isBlank(code)) {
|
||||
if (authUser.isChecked() && StringUtils.isBlank(code)) {
|
||||
throw new BadRequestException("验证码不存在或已过期");
|
||||
}
|
||||
if (StringUtils.isBlank(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) {
|
||||
if (authUser.isChecked() && StringUtils.isBlank(authUser.getCode()) || authUser.isChecked() && !authUser.getCode().equalsIgnoreCase(code)) {
|
||||
throw new BadRequestException("验证码错误");
|
||||
}
|
||||
//生成token
|
||||
|
||||
@@ -36,4 +36,6 @@ public class AuthUserDto {
|
||||
private String code;
|
||||
|
||||
private String uuid = "";
|
||||
|
||||
private boolean checked = true;
|
||||
}
|
||||
|
||||
@@ -72,6 +72,11 @@ public class TbConCheck implements Serializable {
|
||||
@ApiModelProperty(value = "createTime")
|
||||
private Timestamp createTime;
|
||||
|
||||
|
||||
@Column(name = "`remark`")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
public void copy(TbConCheck source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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.cons.domain;
|
||||
|
||||
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 javax.validation.constraints.*;
|
||||
import java.sql.Timestamp;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-12
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="tb_con_unit")
|
||||
public class TbConUnit implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`name`",nullable = false)
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
private String name;
|
||||
|
||||
@Column(name = "`value`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "单位值")
|
||||
private BigDecimal value;
|
||||
|
||||
|
||||
@Column(name = "`parent_id`",nullable = false)
|
||||
@ApiModelProperty(value = "父级单位值")
|
||||
private Integer parentId;
|
||||
|
||||
|
||||
|
||||
@Column(name = "`is_consume`",nullable = false)
|
||||
@ApiModelProperty(value = "是否按照当前单位消耗 1 是 0 否")
|
||||
private String isConsume;
|
||||
|
||||
|
||||
@Column(name = "`status`",nullable = false)
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "状态 1 启用 0 禁用")
|
||||
private String status;
|
||||
|
||||
@Column(name = "`create_time`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "createTime")
|
||||
private Timestamp createTime;
|
||||
|
||||
@Column(name = "`update_time`")
|
||||
@ApiModelProperty(value = "updateTime")
|
||||
private Timestamp updateTime;
|
||||
|
||||
public void copy(TbConUnit source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
@@ -87,6 +87,17 @@ public class TbConsInfoFlow implements Serializable {
|
||||
@ApiModelProperty(value = "店铺id")
|
||||
private Integer shopId;
|
||||
|
||||
|
||||
|
||||
@Column(name = "`order_id`")
|
||||
@ApiModelProperty(value = "订单id")
|
||||
private Integer orderId;
|
||||
|
||||
|
||||
@Column(name = "`order_no`")
|
||||
@ApiModelProperty(value = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String productName;
|
||||
|
||||
@@ -64,6 +64,9 @@ public class TbConsType implements Serializable {
|
||||
@ApiModelProperty(value = "店铺id")
|
||||
private Integer shopId;
|
||||
|
||||
@Transient
|
||||
private int productNum;
|
||||
|
||||
public void copy(TbConsType source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* 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.cons.domain;
|
||||
|
||||
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 javax.validation.constraints.*;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-25
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="tb_handover")
|
||||
public class TbHandover implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`trade_day`")
|
||||
@ApiModelProperty(value = "交班日期")
|
||||
private String tradeDay;
|
||||
|
||||
@Column(name = "`print_no`")
|
||||
@ApiModelProperty(value = "打印机编号")
|
||||
private String printNo;
|
||||
|
||||
@Column(name = "`duty_id`")
|
||||
@ApiModelProperty(value = "dutyId")
|
||||
private Integer dutyId;
|
||||
|
||||
@Column(name = "`shop_id`")
|
||||
@ApiModelProperty(value = "shopId")
|
||||
private Integer shopId;
|
||||
|
||||
@Column(name = "`merchant_name`")
|
||||
@ApiModelProperty(value = "merchantName")
|
||||
private String merchantName;
|
||||
|
||||
@Column(name = "`start_time`")
|
||||
@ApiModelProperty(value = "startTime")
|
||||
private String startTime;
|
||||
|
||||
@Column(name = "`end_time`")
|
||||
@ApiModelProperty(value = "endTime")
|
||||
private String endTime;
|
||||
|
||||
@Column(name = "`staff_id`")
|
||||
@ApiModelProperty(value = "staffId")
|
||||
private Integer staffId;
|
||||
|
||||
@Column(name = "`staff_name`")
|
||||
@ApiModelProperty(value = "staffName")
|
||||
private String staffName;
|
||||
|
||||
@Column(name = "`pay_infos`")
|
||||
@ApiModelProperty(value = "payInfos")
|
||||
private String payInfos;
|
||||
|
||||
@Column(name = "`member_data`")
|
||||
@ApiModelProperty(value = "memberData")
|
||||
private String memberData;
|
||||
|
||||
@Column(name = "`product_categories`")
|
||||
@ApiModelProperty(value = "productCategories")
|
||||
private String productCategories;
|
||||
|
||||
@Column(name = "`total_amount`")
|
||||
@ApiModelProperty(value = "totalAmount")
|
||||
private String totalAmount;
|
||||
|
||||
@Column(name = "`imprest`")
|
||||
@ApiModelProperty(value = "imprest")
|
||||
private String imprest;
|
||||
|
||||
@Column(name = "`payable`")
|
||||
@ApiModelProperty(value = "payable")
|
||||
private String payable;
|
||||
|
||||
@Column(name = "`hand_in`")
|
||||
@ApiModelProperty(value = "handIn")
|
||||
private String handIn;
|
||||
|
||||
|
||||
|
||||
@Column(name = "`return_amount`")
|
||||
@ApiModelProperty(value = "returnAmount")
|
||||
private String returnAmount;
|
||||
|
||||
|
||||
@Column(name = "`order_num`")
|
||||
@ApiModelProperty(value = "orderNum")
|
||||
private String orderNum;
|
||||
|
||||
|
||||
|
||||
@Column(name = "`quick_amount`")
|
||||
@ApiModelProperty(value = "quickAmount")
|
||||
private String quickAmount;
|
||||
|
||||
|
||||
|
||||
@Column(name = "`product_info_pos`")
|
||||
@ApiModelProperty(value = "productInfoPos")
|
||||
private String productInfoPos;
|
||||
|
||||
|
||||
|
||||
@Column(name = "`product_infos`")
|
||||
@ApiModelProperty(value = "productInfos")
|
||||
private String productInfos;
|
||||
|
||||
|
||||
|
||||
@Column(name = "`create_time`")
|
||||
@ApiModelProperty(value = "createTime")
|
||||
private Timestamp createTime;
|
||||
|
||||
|
||||
|
||||
|
||||
public void copy(TbHandover source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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.cons.domain;
|
||||
|
||||
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 javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-17
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="view_con_info_flow")
|
||||
public class ViewConInfoFlow implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`cons_id`")
|
||||
@ApiModelProperty(value = "耗材id")
|
||||
private Integer consId;
|
||||
|
||||
@Column(name = "`con_name`")
|
||||
@ApiModelProperty(value = "耗材名称")
|
||||
private String conName;
|
||||
|
||||
|
||||
@Column(name = "`shop_id`")
|
||||
@ApiModelProperty(value = "店铺id")
|
||||
private Integer shopId;
|
||||
|
||||
@Column(name = "`con_return`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "con_return")
|
||||
private BigDecimal conReturn;
|
||||
|
||||
@Column(name = "`con_in`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "con_in")
|
||||
private BigDecimal conIn;
|
||||
|
||||
@Column(name = "`con_consume`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "con_consume")
|
||||
private BigDecimal conConsume;
|
||||
|
||||
@Column(name = "`con_out`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "con_out")
|
||||
private BigDecimal conOut;
|
||||
|
||||
@Column(name = "`balance`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "balance")
|
||||
private BigDecimal balance;
|
||||
|
||||
|
||||
|
||||
@Column(name = "`product_id`")
|
||||
@ApiModelProperty(value = "商品id")
|
||||
private String productId;
|
||||
|
||||
|
||||
@Column(name = "`product_name`")
|
||||
@ApiModelProperty(value = "商品名称")
|
||||
private String productName;
|
||||
|
||||
|
||||
|
||||
public void copy(ViewConInfoFlow source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.ysk.cashier.cons.repository;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.TbConUnit;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author admin
|
||||
* @date 2024-07-12
|
||||
**/
|
||||
public interface TbConUnitRepository extends JpaRepository<TbConUnit, Integer>, JpaSpecificationExecutor<TbConUnit> {
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package cn.ysk.cashier.cons.repository;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.TbConsInfoFlow;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
@@ -17,9 +16,10 @@ public interface TbConsInfoFlowRepository extends JpaRepository<TbConsInfoFlow,
|
||||
@Query(value = "SELECT\n" +
|
||||
"\tp.`name` \n" +
|
||||
"FROM\n" +
|
||||
"\ttb_cons_info_flow i\n" +
|
||||
"\tLEFT JOIN tb_product_sku s ON i.pro_sku_id = s.id\n" +
|
||||
"\tLEFT JOIN tb_product p ON s.product_id = p.id\n" +
|
||||
"\twhere i.pro_sku_id=?1 limit 1",nativeQuery = true)
|
||||
"\ttb_product_sku s\n" +
|
||||
"\tLEFT JOIN tb_product p ON s.product_id = p.id \n" +
|
||||
"WHERE\n" +
|
||||
"\ts.id = ?1",nativeQuery = true)
|
||||
String selectByPskId(Integer skuId);
|
||||
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import cn.ysk.cashier.cons.domain.TbConsInfo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author admin
|
||||
@@ -13,4 +15,8 @@ public interface TbConsInfoRepository extends JpaRepository<TbConsInfo, Integer>
|
||||
|
||||
|
||||
int countByConCode(String conCode);
|
||||
|
||||
List<TbConsInfo> findByConTypeId(Integer typeId);
|
||||
|
||||
TbConsInfo findByConCode(String conCode);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package cn.ysk.cashier.cons.repository;
|
||||
import cn.ysk.cashier.cons.domain.TbConsType;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
@@ -12,4 +13,9 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
public interface TbConsTypeRepository extends JpaRepository<TbConsType, Integer>, JpaSpecificationExecutor<TbConsType> {
|
||||
|
||||
int countByConTypeCode(String conTypeCode);
|
||||
}
|
||||
|
||||
TbConsType findByConTypeCode(String conTypeCode);
|
||||
|
||||
@Query("SELECT count(*) FROM TbProskuCon c LEFT JOIN TbConsInfo i ON c.conInfoId = i.id WHERE i.conTypeId = :id")
|
||||
int countProByTypeId(Integer id);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.ysk.cashier.cons.repository;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.TbHandover;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author admin
|
||||
* @date 2024-07-25
|
||||
**/
|
||||
public interface TbHandoverRepository extends JpaRepository<TbHandover, Integer>, JpaSpecificationExecutor<TbHandover> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.ysk.cashier.cons.repository;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.ViewConInfoFlow;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author admin
|
||||
* @date 2024-07-17
|
||||
**/
|
||||
public interface ViewConInfoFlowRepository extends JpaRepository<ViewConInfoFlow, Integer>, JpaSpecificationExecutor<ViewConInfoFlow> {
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.ysk.cashier.cons.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.cons.domain.TbConUnit;
|
||||
import cn.ysk.cashier.cons.service.TbConUnitService;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConUnitQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Objects;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-12
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "耗材单位添加管理")
|
||||
@RequestMapping("/api/tbConUnit")
|
||||
public class TbConUnitController {
|
||||
|
||||
private final TbConUnitService tbConUnitService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void exportTbConUnit(HttpServletResponse response, TbConUnitQueryCriteria criteria) throws IOException {
|
||||
tbConUnitService.download(tbConUnitService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询耗材单位添加")
|
||||
@ApiOperation("查询耗材单位添加")
|
||||
public ResponseEntity<Object> queryTbConUnit(TbConUnitQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbConUnitService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增耗材单位添加")
|
||||
@ApiOperation("新增耗材单位添加")
|
||||
public ResponseEntity<Object> createTbConUnit(@Validated @RequestBody TbConUnit resources){
|
||||
|
||||
if(ObjectUtil.isEmpty(resources.getParentId())|| Objects.isNull(resources.getParentId())){
|
||||
resources.setParentId(0);
|
||||
}
|
||||
resources.setStatus("0");
|
||||
resources.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
return new ResponseEntity<>(tbConUnitService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改耗材单位添加")
|
||||
@ApiOperation("修改耗材单位添加")
|
||||
public ResponseEntity<Object> updateTbConUnit(@Validated @RequestBody TbConUnit resources){
|
||||
|
||||
resources.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||
tbConUnitService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除耗材单位添加")
|
||||
@ApiOperation("删除耗材单位添加")
|
||||
public ResponseEntity<Object> deleteTbConUnit(@RequestBody Integer[] ids) {
|
||||
tbConUnitService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("queryTbConUnitInfo")
|
||||
public ResponseEntity<Object> queryTbConUnitInfo(TbConUnitQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbConUnitService.queryAllInfo(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,19 @@ import cn.ysk.cashier.cons.domain.TbConsInfo;
|
||||
import cn.ysk.cashier.cons.domain.TbConsSuppFlow;
|
||||
import cn.ysk.cashier.cons.service.TbConsInfoService;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConsInfoQueryCriteria;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
@@ -39,20 +44,21 @@ public class TbConsInfoController {
|
||||
@Log("查询耗材信息")
|
||||
@ApiOperation("查询耗材信息")
|
||||
public ResponseEntity<Object> queryTbConsInfo(TbConsInfoQueryCriteria criteria, Pageable pageable){
|
||||
pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("createTime").descending());
|
||||
return new ResponseEntity<>(tbConsInfoService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增耗材信息")
|
||||
@ApiOperation("新增耗材信息")
|
||||
public ResponseEntity<Object> createTbConsInfo(@Validated @RequestBody TbConsInfo resources) throws Exception {
|
||||
public ResponseEntity<Object> createTbConsInfo(@Validated @RequestBody List<TbConsInfo> resources) throws Exception {
|
||||
return new ResponseEntity<>(tbConsInfoService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改耗材信息")
|
||||
@ApiOperation("修改耗材信息")
|
||||
public ResponseEntity<Object> updateTbConsInfo(@Validated @RequestBody TbConsInfo resources) throws Exception {
|
||||
public ResponseEntity<Object> updateTbConsInfo(@Validated @RequestBody List<TbConsInfo> resources) throws Exception {
|
||||
tbConsInfoService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@@ -72,4 +78,16 @@ public class TbConsInfoController {
|
||||
tbConsInfoService.stockInOut(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("inputStock")
|
||||
public ResponseEntity<Object> inputStock(@RequestParam String shopId,@RequestParam("file") MultipartFile file){
|
||||
try {
|
||||
tbConsInfoService.inputStock(shopId,file);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package cn.ysk.cashier.cons.rest;
|
||||
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.cons.domain.TbHandover;
|
||||
import cn.ysk.cashier.cons.service.TbHandoverService;
|
||||
import cn.ysk.cashier.cons.service.dto.TbHandoverQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-25
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "查询交班记录管理")
|
||||
@RequestMapping("/api/tbHandover")
|
||||
public class TbHandoverController {
|
||||
|
||||
private final TbHandoverService tbHandoverService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void exportTbHandover(HttpServletResponse response, TbHandoverQueryCriteria criteria) throws IOException {
|
||||
tbHandoverService.download(tbHandoverService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询查询交班记录")
|
||||
@ApiOperation("查询查询交班记录")
|
||||
public ResponseEntity<Object> queryTbHandover(TbHandoverQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbHandoverService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增查询交班记录")
|
||||
@ApiOperation("新增查询交班记录")
|
||||
public ResponseEntity<Object> createTbHandover(@Validated @RequestBody TbHandover resources){
|
||||
return new ResponseEntity<>(tbHandoverService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改查询交班记录")
|
||||
@ApiOperation("修改查询交班记录")
|
||||
public ResponseEntity<Object> updateTbHandover(@Validated @RequestBody TbHandover resources){
|
||||
tbHandoverService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除查询交班记录")
|
||||
@ApiOperation("删除查询交班记录")
|
||||
public ResponseEntity<Object> deleteTbHandover(@RequestBody Integer[] ids) {
|
||||
tbHandoverService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import cn.ysk.cashier.cons.domain.TbProskuCon;
|
||||
import cn.ysk.cashier.cons.service.TbProskuConService;
|
||||
import cn.ysk.cashier.cons.service.dto.ProskuInfo;
|
||||
import cn.ysk.cashier.cons.service.dto.TbProskuConQueryCriteria;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -13,6 +14,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
@@ -44,8 +46,14 @@ public class TbProskuConController {
|
||||
@PostMapping
|
||||
@Log("新增商品规格耗材信息")
|
||||
@ApiOperation("新增商品规格耗材信息")
|
||||
public ResponseEntity<Object> createTbProskuCon(@Validated @RequestBody ProskuInfo resources) throws Exception {
|
||||
return new ResponseEntity<>(tbProskuConService.create(resources),HttpStatus.CREATED);
|
||||
public ResponseEntity<Object> createTbProskuCon(@Validated @RequestBody List<ProskuInfo> resources) throws Exception {
|
||||
try {
|
||||
return new ResponseEntity<>(tbProskuConService.create(resources),HttpStatus.CREATED);
|
||||
} catch (BadRequestException be) {
|
||||
throw new Exception(be.getMessage());
|
||||
}catch (Exception e){
|
||||
throw new Exception("相同商品耗材信息不允许添加");
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package cn.ysk.cashier.cons.rest;
|
||||
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.cons.domain.ViewConInfoFlow;
|
||||
import cn.ysk.cashier.cons.service.ViewConInfoFlowService;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-17
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "获取耗材流水信息管理")
|
||||
@RequestMapping("/api/viewConInfoFlow")
|
||||
public class ViewConInfoFlowController {
|
||||
|
||||
private final ViewConInfoFlowService viewConInfoFlowService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void exportViewConInfoFlow(HttpServletResponse response, ViewConInfoFlowQueryCriteria criteria) throws IOException {
|
||||
viewConInfoFlowService.download(viewConInfoFlowService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询获取耗材流水信息")
|
||||
@ApiOperation("查询获取耗材流水信息")
|
||||
public ResponseEntity<Object> queryViewConInfoFlow(ViewConInfoFlowQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(viewConInfoFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增获取耗材流水信息")
|
||||
@ApiOperation("新增获取耗材流水信息")
|
||||
public ResponseEntity<Object> createViewConInfoFlow(@Validated @RequestBody ViewConInfoFlow resources){
|
||||
return new ResponseEntity<>(viewConInfoFlowService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改获取耗材流水信息")
|
||||
@ApiOperation("修改获取耗材流水信息")
|
||||
public ResponseEntity<Object> updateViewConInfoFlow(@Validated @RequestBody ViewConInfoFlow resources){
|
||||
viewConInfoFlowService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除获取耗材流水信息")
|
||||
@ApiOperation("删除获取耗材流水信息")
|
||||
public ResponseEntity<Object> deleteViewConInfoFlow(@RequestBody Integer[] ids) {
|
||||
viewConInfoFlowService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.ysk.cashier.cons.service;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.TbConUnit;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConUnitDto;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConUnitQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-12
|
||||
**/
|
||||
public interface TbConUnitService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(TbConUnitQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<TbConUnitDto>
|
||||
*/
|
||||
List<TbConUnitDto> queryAll(TbConUnitQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return TbConUnitDto
|
||||
*/
|
||||
TbConUnitDto findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return TbConUnitDto
|
||||
*/
|
||||
TbConUnitDto create(TbConUnit resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(TbConUnit resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<TbConUnitDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
|
||||
|
||||
Map<String,Object> queryAllInfo(TbConUnitQueryCriteria criteria, Pageable pageable);
|
||||
}
|
||||
@@ -6,6 +6,9 @@ import cn.ysk.cashier.cons.domain.TbConsSuppFlow;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConsInfoDto;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConsInfoQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
@@ -44,13 +47,13 @@ public interface TbConsInfoService {
|
||||
* @param resources /
|
||||
* @return TbConsInfoDto
|
||||
*/
|
||||
TbConsInfoDto create(TbConsInfo resources) throws Exception;
|
||||
TbConsInfoDto create(List<TbConsInfo> resources) throws Exception;
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(TbConsInfo resources) throws Exception;
|
||||
void update(List<TbConsInfo> resources) throws Exception;
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
@@ -68,4 +71,7 @@ public interface TbConsInfoService {
|
||||
|
||||
|
||||
void stockInOut(SuppFlow resources) throws Exception;
|
||||
|
||||
|
||||
void inputStock(String shopId, MultipartFile file) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package cn.ysk.cashier.cons.service;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.TbHandover;
|
||||
import cn.ysk.cashier.cons.service.dto.TbHandoverDto;
|
||||
import cn.ysk.cashier.cons.service.dto.TbHandoverQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-25
|
||||
**/
|
||||
public interface TbHandoverService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(TbHandoverQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<TbHandoverDto>
|
||||
*/
|
||||
List<TbHandoverDto> queryAll(TbHandoverQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return TbHandoverDto
|
||||
*/
|
||||
TbHandoverDto findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return TbHandoverDto
|
||||
*/
|
||||
TbHandoverDto create(TbHandover resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(TbHandover resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<TbHandoverDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public interface TbProskuConService {
|
||||
* @param resources /
|
||||
* @return TbProskuConDto
|
||||
*/
|
||||
TbProskuConDto create(ProskuInfo resources) throws Exception;
|
||||
TbProskuConDto create(List<ProskuInfo> resources) throws Exception;
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package cn.ysk.cashier.cons.service;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.ViewConInfoFlow;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowDto;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-17
|
||||
**/
|
||||
public interface ViewConInfoFlowService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(ViewConInfoFlowQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<ViewConInfoFlowDto>
|
||||
*/
|
||||
List<ViewConInfoFlowDto> queryAll(ViewConInfoFlowQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param consId ID
|
||||
* @return ViewConInfoFlowDto
|
||||
*/
|
||||
ViewConInfoFlowDto findById(Integer consId);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return ViewConInfoFlowDto
|
||||
*/
|
||||
ViewConInfoFlowDto create(ViewConInfoFlow resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(ViewConInfoFlow resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<ViewConInfoFlowDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.ysk.cashier.cons.service.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ConUnitPO implements Serializable {
|
||||
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private BigDecimal value;
|
||||
|
||||
private String isConsume;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
private Timestamp updateTime;
|
||||
|
||||
|
||||
private List<ConUnitPO> childConUnit;
|
||||
}
|
||||
@@ -44,4 +44,6 @@ public class TbConCheckDto implements Serializable {
|
||||
private BigDecimal acStockNumber;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.cons.service.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.sql.Timestamp;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-12
|
||||
**/
|
||||
@Data
|
||||
public class TbConUnitDto implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/** 主单位名称 */
|
||||
private String name;
|
||||
|
||||
/** 主单位值 */
|
||||
private BigDecimal value;
|
||||
|
||||
private Integer parentId;
|
||||
|
||||
private String isConsume;
|
||||
|
||||
/** 状态 1 启用 0 禁用 */
|
||||
private String status;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
private Timestamp updateTime;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.ysk.cashier.cons.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
import cn.ysk.cashier.annotation.Query;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-12
|
||||
**/
|
||||
@Data
|
||||
public class TbConUnitQueryCriteria{
|
||||
|
||||
/** 模糊 */
|
||||
@Query(type = Query.Type.INNER_LIKE)
|
||||
private String name;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer parentId;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String status;
|
||||
}
|
||||
@@ -68,12 +68,13 @@ public class TbConsInfoDto implements Serializable {
|
||||
private Integer shopId;
|
||||
|
||||
|
||||
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
private String status;
|
||||
|
||||
|
||||
private BigDecimal stockConsume;
|
||||
|
||||
|
||||
private String contypeCode;
|
||||
}
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package cn.ysk.cashier.cons.service.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.sql.Timestamp;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
@@ -60,4 +63,9 @@ public class TbConsInfoFlowDto implements Serializable {
|
||||
private Integer shopId;
|
||||
|
||||
private String productName;
|
||||
|
||||
|
||||
private Integer orderId;
|
||||
|
||||
private String orderNo;
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package cn.ysk.cashier.cons.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import cn.ysk.cashier.annotation.Query;
|
||||
|
||||
@@ -22,4 +24,12 @@ public class TbConsInfoFlowQueryCriteria{
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer shopId;
|
||||
|
||||
|
||||
@Query
|
||||
private String orderNo;
|
||||
|
||||
|
||||
@Query(type = Query.Type.NOT_EQUAL)
|
||||
private BigDecimal amount;
|
||||
}
|
||||
@@ -45,4 +45,5 @@ public class TbConsTypeDto implements Serializable {
|
||||
|
||||
/** 店铺id */
|
||||
private Integer shopId;
|
||||
}
|
||||
private int productNum;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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.cons.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-25
|
||||
**/
|
||||
@Data
|
||||
public class TbHandoverDto implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/** 交班日期 */
|
||||
private String tradeDay;
|
||||
|
||||
/** 打印机编号 */
|
||||
private String printNo;
|
||||
|
||||
private Integer dutyId;
|
||||
|
||||
private Integer shopId;
|
||||
|
||||
private String merchantName;
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
private Integer staffId;
|
||||
|
||||
private String staffName;
|
||||
|
||||
private String payInfos;
|
||||
|
||||
private String memberData;
|
||||
|
||||
private String productCategories;
|
||||
|
||||
private String totalAmount;
|
||||
|
||||
private String imprest;
|
||||
|
||||
private String payable;
|
||||
|
||||
private String handIn;
|
||||
|
||||
|
||||
private String returnAmount;
|
||||
|
||||
/** 交班日期 */
|
||||
|
||||
private String orderNum;
|
||||
|
||||
/** 打印机编号 */
|
||||
|
||||
private String quickAmount;
|
||||
|
||||
|
||||
private String productInfoPos;
|
||||
|
||||
|
||||
private String productInfos;
|
||||
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.ysk.cashier.cons.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
import cn.ysk.cashier.annotation.Query;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-25
|
||||
**/
|
||||
@Data
|
||||
public class TbHandoverQueryCriteria{
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String tradeDay;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String printNo;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer shopId;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String merchantName;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.cons.service.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-17
|
||||
**/
|
||||
@Data
|
||||
public class ViewConInfoFlowDto implements Serializable {
|
||||
|
||||
/** 耗材id */
|
||||
private Integer consId;
|
||||
|
||||
/** 耗材名称 */
|
||||
private String conName;
|
||||
|
||||
private BigDecimal conReturn;
|
||||
|
||||
private BigDecimal conIn;
|
||||
|
||||
private BigDecimal conConsume;
|
||||
|
||||
private BigDecimal conOut;
|
||||
|
||||
private BigDecimal balance;
|
||||
|
||||
|
||||
private String productId;
|
||||
|
||||
private String productName;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.ysk.cashier.cons.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
import cn.ysk.cashier.annotation.Query;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-17
|
||||
**/
|
||||
@Data
|
||||
public class ViewConInfoFlowQueryCriteria{
|
||||
|
||||
/** 模糊 */
|
||||
@Query(type = Query.Type.INNER_LIKE)
|
||||
private String conName;
|
||||
|
||||
|
||||
@Query
|
||||
private String shopId;
|
||||
}
|
||||
@@ -82,6 +82,7 @@ public class TbConCheckServiceImpl implements TbConCheckService {
|
||||
conCheck.setLpNum(resources.getLpNum());
|
||||
conCheck.setLpAmount(consInfo.getPrice().multiply(resources.getLpNum()));
|
||||
conCheck.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
conCheck.setRemark(resources.getRemark());
|
||||
return tbConCheckMapper.toDto(tbConCheckRepository.save(conCheck));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
package cn.ysk.cashier.cons.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.ysk.cashier.cons.domain.TbConUnit;
|
||||
import cn.ysk.cashier.cons.service.dto.ConUnitPO;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import cn.ysk.cashier.cons.repository.TbConUnitRepository;
|
||||
import cn.ysk.cashier.cons.service.TbConUnitService;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConUnitDto;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConUnitQueryCriteria;
|
||||
import cn.ysk.cashier.cons.service.mapstruct.TbConUnitMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author admin
|
||||
* @date 2024-07-12
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbConUnitServiceImpl implements TbConUnitService {
|
||||
|
||||
private final TbConUnitRepository tbConUnitRepository;
|
||||
private final TbConUnitMapper tbConUnitMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbConUnitQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbConUnit> page = tbConUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(tbConUnitMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbConUnitDto> queryAll(TbConUnitQueryCriteria criteria){
|
||||
return tbConUnitMapper.toDto(tbConUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TbConUnitDto findById(Integer id) {
|
||||
TbConUnit tbConUnit = tbConUnitRepository.findById(id).orElseGet(TbConUnit::new);
|
||||
ValidationUtil.isNull(tbConUnit.getId(),"TbConUnit","id",id);
|
||||
return tbConUnitMapper.toDto(tbConUnit);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbConUnitDto create(TbConUnit resources) {
|
||||
return tbConUnitMapper.toDto(tbConUnitRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbConUnit resources) {
|
||||
TbConUnit tbConUnit = tbConUnitRepository.findById(resources.getId()).orElseGet(TbConUnit::new);
|
||||
ValidationUtil.isNull( tbConUnit.getId(),"TbConUnit","id",resources.getId());
|
||||
tbConUnit.copy(resources);
|
||||
tbConUnitRepository.save(tbConUnit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
tbConUnitRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<TbConUnitDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbConUnitDto tbConUnit : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("主单位名称", tbConUnit.getName());
|
||||
map.put("主单位值", tbConUnit.getValue());
|
||||
map.put("状态 1 启用 0 禁用", tbConUnit.getStatus());
|
||||
map.put(" createTime", tbConUnit.getCreateTime());
|
||||
map.put(" updateTime", tbConUnit.getUpdateTime());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAllInfo(TbConUnitQueryCriteria criteria, Pageable pageable) {
|
||||
List<ConUnitPO> list=new ArrayList<>();
|
||||
if(ObjectUtil.isEmpty(criteria.getParentId())){
|
||||
criteria.setParentId(0);
|
||||
}
|
||||
Page<TbConUnit> page = tbConUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
if(Objects.nonNull(page)&&Objects.nonNull(page.getContent())){
|
||||
page.getContent().parallelStream().forEach(it->{
|
||||
ConUnitPO po=new ConUnitPO();
|
||||
po.setId(it.getId());
|
||||
po.setName(it.getName());
|
||||
po.setValue(it.getValue());
|
||||
po.setIsConsume(it.getIsConsume());
|
||||
po.setCreateTime(it.getCreateTime());
|
||||
po.setUpdateTime(it.getUpdateTime());
|
||||
|
||||
criteria.setParentId(it.getId());
|
||||
criteria.setName(null);
|
||||
criteria.setStatus(null);
|
||||
Page<TbConUnit> childPage = tbConUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
if(Objects.nonNull(childPage)&&Objects.nonNull(childPage.getContent())){
|
||||
List<ConUnitPO> list1=new ArrayList<>();
|
||||
for (TbConUnit tbConUnit : childPage.getContent()) {
|
||||
ConUnitPO child=new ConUnitPO();
|
||||
child.setId(tbConUnit.getId());
|
||||
child.setName(tbConUnit.getName());
|
||||
child.setValue(tbConUnit.getValue());
|
||||
child.setIsConsume(tbConUnit.getIsConsume());
|
||||
child.setCreateTime(tbConUnit.getCreateTime());
|
||||
child.setUpdateTime(tbConUnit.getUpdateTime());
|
||||
list1.add(child);
|
||||
}
|
||||
po.setChildConUnit(list1);
|
||||
}
|
||||
list.add(po);
|
||||
});
|
||||
}
|
||||
Map<String,Object> map = new LinkedHashMap<>(2);
|
||||
map.put("content",list);
|
||||
map.put("totalElements",page.getTotalElements());
|
||||
return map;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -38,12 +39,13 @@ public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService {
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbConsInfoFlowQueryCriteria criteria, Pageable pageable){
|
||||
|
||||
criteria.setAmount(BigDecimal.ZERO);
|
||||
Sort sort = Sort.by(Sort.Direction.DESC, "id");
|
||||
pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), sort);
|
||||
Page<TbConsInfoFlow> page = tbConsInfoFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
|
||||
page.get().forEach(it->{
|
||||
String name= tbConsInfoFlowRepository.selectByPskId(it.getConsId());
|
||||
String name= tbConsInfoFlowRepository.selectByPskId(it.getProSkuId());
|
||||
if(Objects.nonNull(name)){
|
||||
it.setProductName(name);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.ysk.cashier.cons.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.ysk.cashier.cons.domain.*;
|
||||
import cn.ysk.cashier.cons.repository.TbConsInfoFlowRepository;
|
||||
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
|
||||
@@ -17,26 +18,31 @@ import cn.ysk.cashier.repository.product.TbProductStockOperateRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbShopPurveyorRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbShopPurveyorTransactRepository;
|
||||
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 com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.ysk.cashier.utils.StringCodeUtil.TYPE.LETTER_CAPITAL_NUMBER;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @website https://eladmin.vip
|
||||
@@ -64,6 +70,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
private final TbProductStockOperateRepository tbProductStockOperateRepository;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(TbConsInfoQueryCriteria criteria, Pageable pageable) {
|
||||
Page<TbConsInfo> page = tbConsInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
@@ -72,7 +79,14 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
|
||||
@Override
|
||||
public List<TbConsInfoDto> queryAll(TbConsInfoQueryCriteria criteria) {
|
||||
return tbConsInfoMapper.toDto(tbConsInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
||||
|
||||
List<TbConsInfoDto> list= tbConsInfoMapper.toDto(tbConsInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
||||
if(Objects.nonNull(list)&&list.size()>0){
|
||||
list.parallelStream().forEach(it->{
|
||||
it.setContypeCode(tbConsTypeRepository.findById(it.getConTypeId()).orElseGet(TbConsType::new).getConTypeCode());
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,47 +99,52 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbConsInfoDto create(TbConsInfo resources) throws Exception {
|
||||
public TbConsInfoDto create(List<TbConsInfo> resources) throws Exception {
|
||||
|
||||
|
||||
TbConsType tbConsType = tbConsTypeRepository.getById(resources.getConTypeId());
|
||||
if (Objects.isNull(tbConsType)) {
|
||||
throw new Exception("不存在的耗材类型");
|
||||
for (TbConsInfo resource : resources) {
|
||||
TbConsType tbConsType = tbConsTypeRepository.getById(resource.getConTypeId());
|
||||
if (Objects.isNull(tbConsType)) {
|
||||
throw new Exception("不存在的耗材类型");
|
||||
}
|
||||
|
||||
// int count = tbConsInfoRepository.countByConCode(resources.getConCode());
|
||||
// if (count > 0) {
|
||||
// throw new Exception("耗材代码不允许重复");
|
||||
// }
|
||||
|
||||
|
||||
resource.setConCode(StringCodeUtil.getRandom(8,LETTER_CAPITAL_NUMBER));
|
||||
resource.setConTypeName(tbConsType.getConTypeName());
|
||||
resource.setLasterInStock(BigDecimal.ZERO);
|
||||
resource.setStockNumber(BigDecimal.ZERO);
|
||||
resource.setStatus("1");
|
||||
resource.setStockConsume(BigDecimal.ZERO);
|
||||
resource.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
tbConsInfoRepository.save(resource);
|
||||
}
|
||||
|
||||
|
||||
int count = tbConsInfoRepository.countByConCode(resources.getConCode());
|
||||
if (count > 0) {
|
||||
throw new Exception("耗材代码不允许重复");
|
||||
}
|
||||
|
||||
resources.setConTypeName(tbConsType.getConTypeName());
|
||||
resources.setLasterInStock(BigDecimal.ZERO);
|
||||
resources.setStockNumber(BigDecimal.ZERO);
|
||||
resources.setStatus("1");
|
||||
resources.setStockConsume(BigDecimal.ZERO);
|
||||
resources.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
return tbConsInfoMapper.toDto(tbConsInfoRepository.save(resources));
|
||||
return tbConsInfoMapper.toDto(new TbConsInfo());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbConsInfo resources) throws Exception {
|
||||
TbConsInfo tbConsInfo = tbConsInfoRepository.findById(resources.getId()).orElseGet(TbConsInfo::new);
|
||||
public void update(List<TbConsInfo> resources) throws Exception {
|
||||
for (TbConsInfo resource : resources) {
|
||||
TbConsInfo tbConsInfo = tbConsInfoRepository.findById(resource.getId()).orElseGet(TbConsInfo::new);
|
||||
|
||||
if (Objects.isNull(tbConsInfo)) {
|
||||
throw new Exception("耗材信息不存在");
|
||||
if (Objects.isNull(tbConsInfo)) {
|
||||
throw new Exception("耗材信息不存在");
|
||||
}
|
||||
|
||||
tbConsInfo.setConName(resource.getConName());
|
||||
tbConsInfo.setPrice(resource.getPrice());
|
||||
tbConsInfo.setConUnit(resource.getConUnit());
|
||||
tbConsInfo.setConWarning(resource.getConWarning());
|
||||
tbConsInfo.setStatus(resource.getStatus());
|
||||
tbConsInfo.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||
tbConsInfoRepository.save(tbConsInfo);
|
||||
}
|
||||
|
||||
|
||||
tbConsInfo.setConCode(resources.getConCode());
|
||||
tbConsInfo.setConName(resources.getConName());
|
||||
tbConsInfo.setPrice(resources.getPrice());
|
||||
tbConsInfo.setConUnit(resources.getConUnit());
|
||||
tbConsInfo.setConWarning(resources.getConWarning());
|
||||
tbConsInfo.setStatus(resources.getStatus());
|
||||
tbConsInfo.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||
tbConsInfoRepository.save(tbConsInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -140,17 +159,13 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbConsInfoDto tbConsInfo : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("耗材类型id", tbConsInfo.getConTypeId());
|
||||
map.put("耗材类型名称", tbConsInfo.getConTypeName());
|
||||
map.put("耗材代码", tbConsInfo.getConCode());
|
||||
map.put("耗材名称", tbConsInfo.getConName());
|
||||
map.put("库存值", tbConsInfo.getStockNumber());
|
||||
map.put("单位值", tbConsInfo.getConUnit());
|
||||
map.put("最近一次入库量", tbConsInfo.getLasterInStock());
|
||||
map.put("创建时间", tbConsInfo.getCreateTime());
|
||||
map.put("耗材预警值", tbConsInfo.getConWarning());
|
||||
map.put("更新时间", tbConsInfo.getUpdateTime());
|
||||
map.put("店铺id", tbConsInfo.getShopId());
|
||||
map.put("耗材类型代码", tbConsInfo.getContypeCode());
|
||||
map.put("单位", tbConsInfo.getConUnit());
|
||||
map.put("价格",tbConsInfo.getPrice());
|
||||
map.put("耗材预警值",tbConsInfo.getConWarning());
|
||||
map.put("库存",tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()));
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
@@ -255,6 +270,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
purveyorTransact.setPaidAmount(resources.getActualPayment());
|
||||
purveyorTransact.setWaitAmount((resources.getAccountsPayable().subtract(resources.getActualPayment())).negate());
|
||||
purveyorTransact.setType("cons_out");
|
||||
object.put("number",conInfos.getStockNumber());
|
||||
}
|
||||
|
||||
|
||||
@@ -302,8 +318,177 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
stockOperate.setBatchNumber("");
|
||||
stockOperate.setStockSnap(array.toJSONString());
|
||||
tbProductStockOperateRepository.save(stockOperate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void inputStock(String shopId, MultipartFile file) throws Exception {
|
||||
|
||||
|
||||
//根据路径获取这个操作excel的实例
|
||||
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(file.getInputStream());
|
||||
//根据页面index 获取sheet页
|
||||
XSSFSheet sheet = xssfWorkbook.getSheetAt(0);
|
||||
XSSFRow row = null;
|
||||
|
||||
List<TbConsInfo> consInfos=new ArrayList<>();
|
||||
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
|
||||
row = sheet.getRow(i);
|
||||
if (row != null) {
|
||||
XSSFCell cell0 = row.getCell(0);
|
||||
XSSFCell cell1 = row.getCell(1);
|
||||
if (ObjectUtil.isEmpty(cell1)) {
|
||||
log.info("耗材名称为空:{}", cell1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
XSSFCell cell2 = row.getCell(2);
|
||||
|
||||
if (ObjectUtil.isEmpty(cell2)) {
|
||||
log.info("耗材类型为空:{}", cell2);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
XSSFCell cell3 = row.getCell(3);
|
||||
|
||||
if (ObjectUtil.isEmpty(cell3)) {
|
||||
log.info("耗材单位为空:{}", cell3);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
XSSFCell cell4 = row.getCell(4);
|
||||
|
||||
if (ObjectUtil.isEmpty(cell4)) {
|
||||
log.info("耗材价格为空:{}", cell4);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
XSSFCell cell5 = row.getCell(5);
|
||||
|
||||
if (ObjectUtil.isEmpty(cell5)) {
|
||||
log.info("耗材预警值为空:{}", cell5);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
XSSFCell cell6 = row.getCell(6);
|
||||
|
||||
if (ObjectUtil.isEmpty(cell6)) {
|
||||
log.info("耗材库存为空:{}", cell6);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
TbConsType tbConsType = tbConsTypeRepository.findByConTypeCode(cell2.toString());
|
||||
if (Objects.isNull(tbConsType)) {
|
||||
log.info("不存在的耗材类型:{}", cell2.toString());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (ObjectUtil.isNotEmpty(cell0)) {
|
||||
|
||||
TbConsInfo consInfo = tbConsInfoRepository.findByConCode(cell0.toString());
|
||||
if (ObjectUtil.isEmpty(consInfo) || ObjectUtil.isNull(consInfo)) {
|
||||
consInfo = new TbConsInfo();
|
||||
consInfo.setConCode(StringCodeUtil.getRandom(8,LETTER_CAPITAL_NUMBER));
|
||||
consInfo.setShopId(Integer.valueOf(shopId));
|
||||
consInfo.setConTypeId(tbConsType.getId());
|
||||
consInfo.setConTypeName(tbConsType.getConTypeName());
|
||||
consInfo.setConName(cell1.toString());
|
||||
consInfo.setPrice(new BigDecimal(cell4.toString()));
|
||||
consInfo.setStockNumber(new BigDecimal(cell6.toString()));
|
||||
consInfo.setStockConsume(BigDecimal.ZERO);
|
||||
consInfo.setStatus("1");
|
||||
consInfo.setConUnit(cell3.toString());
|
||||
consInfo.setLasterInStock(consInfo.getStockNumber());
|
||||
consInfo.setConWarning(new BigDecimal(cell5.toString()));
|
||||
consInfo.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
consInfo = tbConsInfoRepository.save(consInfo);
|
||||
|
||||
|
||||
TbConsInfoFlow flow = new TbConsInfoFlow();
|
||||
flow.setBizCode("stockOtherIn");
|
||||
flow.setBizName("导入库存");
|
||||
flow.setBizType("+");
|
||||
flow.setConsId(consInfo.getId());
|
||||
flow.setShopId(consInfo.getShopId());
|
||||
flow.setConName(consInfo.getConName());
|
||||
flow.setAmount(consInfo.getStockNumber());
|
||||
flow.setBalance(consInfo.getStockNumber());
|
||||
|
||||
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
tbConsInfoFlowRepository.save(flow);
|
||||
|
||||
|
||||
} else {
|
||||
consInfo.setConName(cell1.toString());
|
||||
consInfo.setPrice(new BigDecimal(cell4.toString()));
|
||||
consInfo.setStockNumber(new BigDecimal(cell6.toString()));
|
||||
consInfo.setStockConsume(BigDecimal.ZERO);
|
||||
consInfo.setConUnit(cell3.toString());
|
||||
consInfo.setLasterInStock(consInfo.getStockNumber());
|
||||
consInfo.setConWarning(new BigDecimal(cell5.toString()));
|
||||
consInfo.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||
consInfo = tbConsInfoRepository.save(consInfo);
|
||||
|
||||
TbConsInfoFlow flow = new TbConsInfoFlow();
|
||||
flow.setBizCode("stockOtherIn");
|
||||
flow.setBizName("导入库存");
|
||||
flow.setBizType("+");
|
||||
flow.setConsId(consInfo.getId());
|
||||
flow.setShopId(consInfo.getShopId());
|
||||
flow.setConName(consInfo.getConName());
|
||||
flow.setAmount(consInfo.getStockNumber());
|
||||
flow.setBalance(consInfo.getStockNumber());
|
||||
|
||||
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
tbConsInfoFlowRepository.save(flow);
|
||||
}
|
||||
} else {
|
||||
TbConsInfo consInfo = new TbConsInfo();
|
||||
consInfo.setConCode(StringCodeUtil.getRandom(8,LETTER_CAPITAL_NUMBER));
|
||||
consInfo.setShopId(Integer.valueOf(shopId));
|
||||
consInfo.setConTypeId(tbConsType.getId());
|
||||
consInfo.setConTypeName(tbConsType.getConTypeName());
|
||||
consInfo.setConName(cell1.toString());
|
||||
consInfo.setPrice(new BigDecimal(cell4.toString()));
|
||||
consInfo.setStockNumber(new BigDecimal(cell6.toString()));
|
||||
consInfo.setStockConsume(BigDecimal.ZERO);
|
||||
consInfo.setStatus("1");
|
||||
consInfo.setConUnit(cell3.toString());
|
||||
consInfo.setLasterInStock(consInfo.getStockNumber());
|
||||
consInfo.setConWarning(new BigDecimal(cell5.toString()));
|
||||
consInfo.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
consInfo = tbConsInfoRepository.save(consInfo);
|
||||
|
||||
|
||||
TbConsInfoFlow flow = new TbConsInfoFlow();
|
||||
flow.setBizCode("stockOtherIn");
|
||||
flow.setBizName("导入库存");
|
||||
flow.setBizType("+");
|
||||
flow.setConsId(consInfo.getId());
|
||||
flow.setShopId(consInfo.getShopId());
|
||||
flow.setConName(consInfo.getConName());
|
||||
flow.setAmount(consInfo.getStockNumber());
|
||||
flow.setBalance(consInfo.getStockNumber());
|
||||
|
||||
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
tbConsInfoFlowRepository.save(flow);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public static void main(String[] args){
|
||||
System.out.println(UUID.randomUUID().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package cn.ysk.cashier.cons.service.impl;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.TbConsInfo;
|
||||
import cn.ysk.cashier.cons.domain.TbConsType;
|
||||
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.cons.repository.TbConsInfoRepository;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import cn.ysk.cashier.cons.repository.TbConsTypeRepository;
|
||||
import cn.ysk.cashier.cons.service.TbConsTypeService;
|
||||
@@ -15,12 +14,12 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import static cn.ysk.cashier.utils.StringCodeUtil.TYPE.LETTER_CAPITAL_NUMBER;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
@@ -35,10 +34,22 @@ public class TbConsTypeServiceImpl implements TbConsTypeService {
|
||||
private final TbConsTypeRepository tbConsTypeRepository;
|
||||
private final TbConsTypeMapper tbConsTypeMapper;
|
||||
|
||||
private final TbConsInfoRepository tbConsInfoRepository;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbConsTypeQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbConsType> page = tbConsTypeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(tbConsTypeMapper::toDto));
|
||||
Page<TbConsType> page = tbConsTypeRepository
|
||||
.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
|
||||
for (TbConsType tbConsType : page.getContent()) {
|
||||
tbConsType.setProductNum(tbConsTypeRepository.countProByTypeId(tbConsType.getId()));
|
||||
}
|
||||
|
||||
Map<String,Object> map = new LinkedHashMap<>(2);
|
||||
map.put("content",page.getContent());
|
||||
map.put("totalElements",page.getTotalElements());
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,11 +70,7 @@ public class TbConsTypeServiceImpl implements TbConsTypeService {
|
||||
public TbConsTypeDto create(TbConsType resources) throws Exception {
|
||||
|
||||
|
||||
int count= tbConsTypeRepository.countByConTypeCode(resources.getConTypeCode());
|
||||
if(count>0){
|
||||
throw new Exception("耗材类型代码不允许重复");
|
||||
}
|
||||
|
||||
resources.setConTypeCode(StringCodeUtil.getRandom(8,LETTER_CAPITAL_NUMBER));
|
||||
return tbConsTypeMapper.toDto(tbConsTypeRepository.save(resources));
|
||||
}
|
||||
|
||||
@@ -74,6 +81,16 @@ public class TbConsTypeServiceImpl implements TbConsTypeService {
|
||||
ValidationUtil.isNull( tbConsType.getId(),"TbConsType","id",resources.getId());
|
||||
tbConsType.copy(resources);
|
||||
tbConsTypeRepository.save(tbConsType);
|
||||
|
||||
List<TbConsInfo> tbConsInfos=tbConsInfoRepository.findByConTypeId(tbConsType.getId());
|
||||
if(Objects.nonNull(tbConsInfos)){
|
||||
tbConsInfos.stream().forEach(it->{
|
||||
it.setConTypeName(resources.getConTypeName());
|
||||
});
|
||||
}
|
||||
|
||||
tbConsInfoRepository.saveAll(tbConsInfos);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,4 +115,4 @@ public class TbConsTypeServiceImpl implements TbConsTypeService {
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
package cn.ysk.cashier.cons.service.impl;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.TbHandover;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import cn.ysk.cashier.cons.repository.TbHandoverRepository;
|
||||
import cn.ysk.cashier.cons.service.TbHandoverService;
|
||||
import cn.ysk.cashier.cons.service.dto.TbHandoverDto;
|
||||
import cn.ysk.cashier.cons.service.dto.TbHandoverQueryCriteria;
|
||||
import cn.ysk.cashier.cons.service.mapstruct.TbHandoverMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author admin
|
||||
* @date 2024-07-25
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbHandoverServiceImpl implements TbHandoverService {
|
||||
|
||||
private final TbHandoverRepository tbHandoverRepository;
|
||||
private final TbHandoverMapper tbHandoverMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbHandoverQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbHandover> page = tbHandoverRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(tbHandoverMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbHandoverDto> queryAll(TbHandoverQueryCriteria criteria){
|
||||
return tbHandoverMapper.toDto(tbHandoverRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TbHandoverDto findById(Integer id) {
|
||||
TbHandover tbHandover = tbHandoverRepository.findById(id).orElseGet(TbHandover::new);
|
||||
ValidationUtil.isNull(tbHandover.getId(),"TbHandover","id",id);
|
||||
return tbHandoverMapper.toDto(tbHandover);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbHandoverDto create(TbHandover resources) {
|
||||
return tbHandoverMapper.toDto(tbHandoverRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbHandover resources) {
|
||||
TbHandover tbHandover = tbHandoverRepository.findById(resources.getId()).orElseGet(TbHandover::new);
|
||||
ValidationUtil.isNull( tbHandover.getId(),"TbHandover","id",resources.getId());
|
||||
tbHandover.copy(resources);
|
||||
tbHandoverRepository.save(tbHandover);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
tbHandoverRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<TbHandoverDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbHandoverDto tbHandover : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("交班日期", tbHandover.getTradeDay());
|
||||
map.put("打印机编号", tbHandover.getPrintNo());
|
||||
map.put(" dutyId", tbHandover.getDutyId());
|
||||
map.put(" shopId", tbHandover.getShopId());
|
||||
map.put(" merchantName", tbHandover.getMerchantName());
|
||||
map.put(" startTime", tbHandover.getStartTime());
|
||||
map.put(" endTime", tbHandover.getEndTime());
|
||||
map.put(" staffId", tbHandover.getStaffId());
|
||||
map.put(" staffName", tbHandover.getStaffName());
|
||||
map.put(" payInfos", tbHandover.getPayInfos());
|
||||
map.put(" memberData", tbHandover.getMemberData());
|
||||
map.put(" productCategories", tbHandover.getProductCategories());
|
||||
map.put(" totalAmount", tbHandover.getTotalAmount());
|
||||
map.put(" imprest", tbHandover.getImprest());
|
||||
map.put(" payable", tbHandover.getPayable());
|
||||
map.put(" handIn", tbHandover.getHandIn());
|
||||
map.put(" returnAmount", tbHandover.getReturnAmount());
|
||||
map.put("交班日期", tbHandover.getTradeDay());
|
||||
map.put(" orderNum", tbHandover.getOrderNum());
|
||||
map.put("打印机编号", tbHandover.getPrintNo());
|
||||
map.put(" quickAmount", tbHandover.getQuickAmount());
|
||||
map.put(" dutyId", tbHandover.getDutyId());
|
||||
map.put(" productInfoPos", tbHandover.getProductInfoPos());
|
||||
map.put(" shopId", tbHandover.getShopId());
|
||||
map.put(" productInfos", tbHandover.getProductInfos());
|
||||
map.put(" merchantName", tbHandover.getMerchantName());
|
||||
map.put(" createTime", tbHandover.getCreateTime());
|
||||
map.put(" startTime", tbHandover.getStartTime());
|
||||
map.put(" endTime", tbHandover.getEndTime());
|
||||
map.put(" staffId", tbHandover.getStaffId());
|
||||
map.put(" staffName", tbHandover.getStaffName());
|
||||
map.put(" payInfos", tbHandover.getPayInfos());
|
||||
map.put(" memberData", tbHandover.getMemberData());
|
||||
map.put(" productCategories", tbHandover.getProductCategories());
|
||||
map.put(" totalAmount", tbHandover.getTotalAmount());
|
||||
map.put(" imprest", tbHandover.getImprest());
|
||||
map.put(" payable", tbHandover.getPayable());
|
||||
map.put(" handIn", tbHandover.getHandIn());
|
||||
map.put(" returnAmount", tbHandover.getReturnAmount());
|
||||
map.put(" orderNum", tbHandover.getOrderNum());
|
||||
map.put(" quickAmount", tbHandover.getQuickAmount());
|
||||
map.put(" productInfoPos", tbHandover.getProductInfoPos());
|
||||
map.put(" productInfos", tbHandover.getProductInfos());
|
||||
map.put(" createTime", tbHandover.getCreateTime());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
@@ -6,20 +6,19 @@ import cn.ysk.cashier.cons.domain.TbConsSuppFlow;
|
||||
import cn.ysk.cashier.cons.domain.TbProskuCon;
|
||||
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
|
||||
import cn.ysk.cashier.cons.service.dto.ProskuInfo;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.pojo.product.TbProduct;
|
||||
import cn.ysk.cashier.pojo.product.TbProductSku;
|
||||
import cn.ysk.cashier.repository.product.TbProductRepository;
|
||||
import cn.ysk.cashier.repository.product.TbProductSkuRepository;
|
||||
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.TbProskuConRepository;
|
||||
import cn.ysk.cashier.cons.service.TbProskuConService;
|
||||
import cn.ysk.cashier.cons.service.dto.TbProskuConDto;
|
||||
import cn.ysk.cashier.cons.service.dto.TbProskuConQueryCriteria;
|
||||
import cn.ysk.cashier.cons.service.mapstruct.TbProskuConMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -38,6 +37,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class TbProskuConServiceImpl implements TbProskuConService {
|
||||
|
||||
private final TbProskuConRepository tbProskuConRepository;
|
||||
@@ -70,65 +70,85 @@ public class TbProskuConServiceImpl implements TbProskuConService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbProskuConDto create(ProskuInfo resources) throws Exception {
|
||||
public TbProskuConDto create(List<ProskuInfo> resources) throws BadRequestException,Exception {
|
||||
for (ProskuInfo resource : resources) {
|
||||
TbProduct product= tbProductRepository.getById(resource.getProductId());
|
||||
if(Objects.isNull(product)){
|
||||
throw new BadRequestException("对应的商品信息不存在");
|
||||
}
|
||||
List<TbProskuCon> list=new ArrayList<>();
|
||||
if(product.getIsDistribute().intValue()==1){
|
||||
|
||||
TbProduct product= tbProductRepository.getById(resources.getProductId());
|
||||
if(Objects.isNull(product)){
|
||||
throw new Exception("对应的商品信息不存在");
|
||||
}
|
||||
TbConsInfo tbConsInfo= tbConsInfoRepository.findById(resource.getConsInfoId()).orElseGet(TbConsInfo::new);
|
||||
|
||||
TbConsInfo tbConsInfo= tbConsInfoRepository.getById(resources.getConsInfoId());
|
||||
if(Objects.isNull(tbConsInfo)){
|
||||
throw new Exception("对应的耗材信息不存在");
|
||||
}
|
||||
log.info("product.getIsDistribute().intValue():{}", JSONUtil.toJSONString(tbConsInfo));
|
||||
if(ObjectUtil.isNull(tbConsInfo)||ObjectUtil.isNull(tbConsInfo.getId())){
|
||||
throw new BadRequestException("对应的耗材信息不存在");
|
||||
}
|
||||
|
||||
List<TbProskuCon> list=new ArrayList<>();
|
||||
if(product.getIsDistribute().intValue()==1){
|
||||
//查询商品对应的所有规格
|
||||
List<TbProductSku> skuList= tbProductSkuRepository.searchSku(product.getId().toString());
|
||||
if(Objects.nonNull(skuList)&&skuList.size()>0){
|
||||
for (TbProductSku tbProductSku : skuList) {
|
||||
int count=tbProskuConRepository.countByConInfoIdAndProductSkuIdAndShopId(resources.getConsInfoId(), tbProductSku.getId(), Integer.valueOf(tbProductSku.getShopId()), Integer.valueOf(tbProductSku.getProductId()));
|
||||
//查询商品对应的所有规格
|
||||
List<TbProductSku> skuList= tbProductSkuRepository.searchSku(product.getId().toString());
|
||||
if(Objects.nonNull(skuList)&&skuList.size()>0){
|
||||
for (TbProductSku tbProductSku : skuList) {
|
||||
int count=tbProskuConRepository.countByConInfoIdAndProductSkuIdAndShopId(resource.getConsInfoId(), tbProductSku.getId(), Integer.valueOf(tbProductSku.getShopId()), Integer.valueOf(tbProductSku.getProductId()));
|
||||
if(count<=0){
|
||||
TbProskuCon tbProskuCon=new TbProskuCon();
|
||||
|
||||
tbProskuCon.setShopId(Integer.valueOf(tbProductSku.getShopId()));
|
||||
tbProskuCon.setConInfoId(tbConsInfo.getId());
|
||||
tbProskuCon.setProductId(Integer.valueOf(tbProductSku.getProductId()));
|
||||
tbProskuCon.setProductSkuId(tbProductSku.getId());
|
||||
tbProskuCon.setSurplusStock(resource.getSurplusStock());
|
||||
tbProskuCon.setStatus("1");
|
||||
tbProskuCon.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
list.add(tbProskuCon);
|
||||
}else {
|
||||
throw new BadRequestException(product.getName().concat("对应的耗材信息已存在"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
for (ProskuInfo.SkuInfo skuInfo : resource.getSkuInfos()) {
|
||||
|
||||
|
||||
TbConsInfo tbConsInfo= tbConsInfoRepository.findById(skuInfo.getConInfoId()).orElseGet(TbConsInfo::new);
|
||||
|
||||
log.info("skuInfo:{}", JSONUtil.toJSONString(tbConsInfo));
|
||||
|
||||
if(ObjectUtil.isNull(tbConsInfo)||ObjectUtil.isNull(tbConsInfo.getId())){
|
||||
throw new BadRequestException("对应的耗材信息不存在");
|
||||
}
|
||||
|
||||
TbProductSku tbProductSku= tbProductSkuRepository.findById(skuInfo.getSkuId()).orElseGet(TbProductSku::new);
|
||||
if(ObjectUtil.isNull(tbProductSku)||ObjectUtil.isNull(tbProductSku.getId())){
|
||||
throw new BadRequestException("规格信息不存在");
|
||||
}
|
||||
|
||||
int count=tbProskuConRepository.countByConInfoIdAndProductSkuIdAndShopId(resource.getConsInfoId(), skuInfo.getSkuId(), skuInfo.getShopId(), resource.getProductId());
|
||||
if(count<=0){
|
||||
TbProskuCon tbProskuCon=new TbProskuCon();
|
||||
|
||||
tbProskuCon.setShopId(Integer.valueOf(tbProductSku.getShopId()));
|
||||
tbProskuCon.setConInfoId(resources.getConsInfoId());
|
||||
tbProskuCon.setProductId(Integer.valueOf(tbProductSku.getProductId()));
|
||||
tbProskuCon.setProductSkuId(tbProductSku.getId());
|
||||
tbProskuCon.setSurplusStock(resources.getSurplusStock());
|
||||
tbProskuCon.setShopId(Integer.valueOf(skuInfo.getShopId()));
|
||||
tbProskuCon.setConInfoId(tbConsInfo.getId());
|
||||
tbProskuCon.setProductId(resource.getProductId());
|
||||
tbProskuCon.setProductSkuId(skuInfo.getSkuId());
|
||||
tbProskuCon.setSurplusStock(skuInfo.getSurplusStock());
|
||||
tbProskuCon.setStatus("1");
|
||||
tbProskuCon.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
list.add(tbProskuCon);
|
||||
}else {
|
||||
throw new Exception(product.getName().concat("对应的耗材信息已存在"));
|
||||
TbProductSku sku= tbProductSkuRepository.getById(skuInfo.getSkuId());
|
||||
throw new BadRequestException(product.getName().concat("商品对应的").concat(Objects.nonNull(sku.getSpecSnap())?sku.getSpecSnap():"").concat("规格已存在"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
for (ProskuInfo.SkuInfo skuInfo : resources.getSkuInfos()) {
|
||||
int count=tbProskuConRepository.countByConInfoIdAndProductSkuIdAndShopId(resources.getConsInfoId(), skuInfo.getSkuId(), skuInfo.getShopId(), resources.getProductId());
|
||||
if(count<=0){
|
||||
TbProskuCon tbProskuCon=new TbProskuCon();
|
||||
tbProskuCon.setShopId(Integer.valueOf(skuInfo.getShopId()));
|
||||
tbProskuCon.setConInfoId(skuInfo.getConInfoId());
|
||||
tbProskuCon.setProductId(resources.getProductId());
|
||||
tbProskuCon.setProductSkuId(skuInfo.getSkuId());
|
||||
tbProskuCon.setSurplusStock(skuInfo.getSurplusStock());
|
||||
tbProskuCon.setStatus("1");
|
||||
tbProskuCon.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
list.add(tbProskuCon);
|
||||
}else {
|
||||
TbProductSku sku= tbProductSkuRepository.getById(skuInfo.getSkuId());
|
||||
throw new Exception(product.getName().concat("商品对应的").concat(Objects.nonNull(sku.getSpecSnap())?sku.getSpecSnap():"").concat("规格已存在"));
|
||||
}
|
||||
}
|
||||
if(Objects.nonNull(list)&&list.size()>0){
|
||||
tbProskuConRepository.saveAll(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(Objects.nonNull(list)&&list.size()>0){
|
||||
tbProskuConRepository.saveAll(list);
|
||||
}
|
||||
return new TbProskuConDto();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package cn.ysk.cashier.cons.service.impl;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.ViewConInfoFlow;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import cn.ysk.cashier.cons.repository.ViewConInfoFlowRepository;
|
||||
import cn.ysk.cashier.cons.service.ViewConInfoFlowService;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowDto;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowQueryCriteria;
|
||||
import cn.ysk.cashier.cons.service.mapstruct.ViewConInfoFlowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author admin
|
||||
* @date 2024-07-17
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ViewConInfoFlowServiceImpl implements ViewConInfoFlowService {
|
||||
|
||||
private final ViewConInfoFlowRepository viewConInfoFlowRepository;
|
||||
private final ViewConInfoFlowMapper viewConInfoFlowMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(ViewConInfoFlowQueryCriteria criteria, Pageable pageable){
|
||||
Page<ViewConInfoFlow> page = viewConInfoFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(viewConInfoFlowMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ViewConInfoFlowDto> queryAll(ViewConInfoFlowQueryCriteria criteria){
|
||||
return viewConInfoFlowMapper.toDto(viewConInfoFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public ViewConInfoFlowDto findById(Integer consId) {
|
||||
ViewConInfoFlow viewConInfoFlow = viewConInfoFlowRepository.findById(consId).orElseGet(ViewConInfoFlow::new);
|
||||
ValidationUtil.isNull(viewConInfoFlow.getConsId(),"ViewConInfoFlow","consId",consId);
|
||||
return viewConInfoFlowMapper.toDto(viewConInfoFlow);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ViewConInfoFlowDto create(ViewConInfoFlow resources) {
|
||||
return viewConInfoFlowMapper.toDto(viewConInfoFlowRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(ViewConInfoFlow resources) {
|
||||
ViewConInfoFlow viewConInfoFlow = viewConInfoFlowRepository.findById(resources.getConsId()).orElseGet(ViewConInfoFlow::new);
|
||||
ValidationUtil.isNull( viewConInfoFlow.getConsId(),"ViewConInfoFlow","id",resources.getConsId());
|
||||
viewConInfoFlow.copy(resources);
|
||||
viewConInfoFlowRepository.save(viewConInfoFlow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer consId : ids) {
|
||||
viewConInfoFlowRepository.deleteById(consId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<ViewConInfoFlowDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (ViewConInfoFlowDto viewConInfoFlow : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("耗材名称", viewConInfoFlow.getConName());
|
||||
map.put(" conreturn", viewConInfoFlow.getConReturn());
|
||||
map.put(" conin", viewConInfoFlow.getConIn());
|
||||
map.put(" conconsume", viewConInfoFlow.getConConsume());
|
||||
map.put(" conout", viewConInfoFlow.getConOut());
|
||||
map.put(" balance", viewConInfoFlow.getBalance());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.ysk.cashier.cons.service.mapstruct;
|
||||
|
||||
import cn.ysk.cashier.base.BaseMapper;
|
||||
import cn.ysk.cashier.cons.domain.TbConUnit;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConUnitDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-12
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface TbConUnitMapper extends BaseMapper<TbConUnitDto, TbConUnit> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.ysk.cashier.cons.service.mapstruct;
|
||||
|
||||
import cn.ysk.cashier.base.BaseMapper;
|
||||
import cn.ysk.cashier.cons.domain.TbHandover;
|
||||
import cn.ysk.cashier.cons.service.dto.TbHandoverDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-25
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface TbHandoverMapper extends BaseMapper<TbHandoverDto, TbHandover> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.ysk.cashier.cons.service.mapstruct;
|
||||
|
||||
import cn.ysk.cashier.base.BaseMapper;
|
||||
import cn.ysk.cashier.cons.domain.ViewConInfoFlow;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-17
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface ViewConInfoFlowMapper extends BaseMapper<ViewConInfoFlowDto, ViewConInfoFlow> {
|
||||
|
||||
}
|
||||
@@ -16,18 +16,31 @@
|
||||
package cn.ysk.cashier.controller;
|
||||
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.pojo.TbUserInfo;
|
||||
import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
|
||||
import cn.ysk.cashier.repository.TbUserInfoRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbMerchantAccountRepository;
|
||||
import cn.ysk.cashier.service.TbUserInfoService;
|
||||
import cn.ysk.cashier.dto.TbUserInfoQueryCriteria;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
@@ -75,4 +88,98 @@ public class TbUserInfoController {
|
||||
tbUserInfoService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
ValidateCodeUtil validateCodeUtil;
|
||||
|
||||
@Autowired
|
||||
RedisUtils redisUtils;
|
||||
|
||||
@GetMapping("sendMsg")
|
||||
public Object sendMsg(){
|
||||
Object o= SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
if(Objects.isNull(o)){
|
||||
throw new BadRequestException("用户登录信息失效");
|
||||
}
|
||||
JSONObject object=JSON.parseObject(JSON.toJSONString(o));
|
||||
if(Objects.isNull(object)){
|
||||
throw new BadRequestException("用户登录信息失效");
|
||||
}
|
||||
String regex="^\\d{11}$";
|
||||
|
||||
if(!object.containsKey("username")||Objects.isNull(object.getString("username"))||
|
||||
!object.getString("username").matches(regex)
|
||||
){
|
||||
throw new BadRequestException("用户登录信息失效");
|
||||
}
|
||||
String phone=object.getString("username");
|
||||
|
||||
String tempcode="SMS_244665149";
|
||||
|
||||
String random = StringUtil.random(6);
|
||||
try {
|
||||
validateCodeUtil.requestValidateCodeAli(phone, random,tempcode);
|
||||
redisUtils.set(phone.concat("#").concat(tempcode),random,300L);
|
||||
return "{\n" +
|
||||
" \"code\": 0,\n" +
|
||||
" \"msg\": \"成功\"\n" +
|
||||
"}";
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
TbMerchantAccountRepository tbMerchantAccountRepository;
|
||||
|
||||
|
||||
@RequestMapping(value = "modfiyUserInfo",method = RequestMethod.POST)
|
||||
public ResponseEntity<Object> modfiyUserInfo(@RequestBody Map<String,String> map){
|
||||
Object o= SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
if(Objects.isNull(o)){
|
||||
throw new BadRequestException("用户登录信息失效");
|
||||
}
|
||||
JSONObject object=JSON.parseObject(JSON.toJSONString(o));
|
||||
if(Objects.isNull(object)){
|
||||
throw new BadRequestException("用户登录信息失效");
|
||||
}
|
||||
String regex="^\\d{11}$";
|
||||
|
||||
if(!object.containsKey("username")||Objects.isNull(object.getString("username"))||
|
||||
!object.getString("username").matches(regex)
|
||||
){
|
||||
throw new BadRequestException("用户登录信息失效");
|
||||
}
|
||||
|
||||
String tempcode="SMS_244665149";
|
||||
String phone=object.getString("username");
|
||||
Object redisCode= redisUtils.get(phone.concat("#").concat(tempcode));
|
||||
if(Objects.isNull(redisCode)){
|
||||
throw new BadRequestException("短信验证码已过期");
|
||||
}
|
||||
|
||||
|
||||
String code= map.get("code");
|
||||
|
||||
if(!redisCode.toString().equals(code)){
|
||||
throw new BadRequestException("短信验证码错误");
|
||||
}
|
||||
redisUtils.del(phone.concat("#").concat(tempcode));
|
||||
String pwd= map.get("pwd");
|
||||
|
||||
TbMerchantAccount account= tbMerchantAccountRepository.findByAccount(phone);
|
||||
if(Objects.isNull(account)){
|
||||
throw new BadRequestException("账户不存在");
|
||||
}
|
||||
|
||||
account.setPwd(MD5Utils.md5(pwd.concat(account.getAccount()).concat(account.getId().toString())));
|
||||
account.setUpdatedAt(System.currentTimeMillis());
|
||||
tbMerchantAccountRepository.save(account);
|
||||
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,8 @@
|
||||
/*
|
||||
* 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.controller.order;
|
||||
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||
import cn.ysk.cashier.dto.order.TbOrderInfoDto;
|
||||
import cn.ysk.cashier.dto.order.TbOrderInfoQueryCriteria;
|
||||
import cn.ysk.cashier.dto.order.TbPayCountQueryCriteria;
|
||||
@@ -55,6 +42,7 @@ public class TbOrderInfoController {
|
||||
|
||||
@PostMapping("/date")
|
||||
@ApiOperation("查询订单")
|
||||
@AnonymousPostMapping
|
||||
public ResponseEntity<Object> queryTbOrderInfo(@RequestBody TbOrderInfoQueryCriteria criteria){
|
||||
return new ResponseEntity<>(tbOrderInfoService.queryAllPage(criteria),HttpStatus.OK);
|
||||
}
|
||||
@@ -90,4 +78,4 @@ public class TbOrderInfoController {
|
||||
// tbOrderInfoService.deleteAll(ids);
|
||||
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package cn.ysk.cashier.controller.order;
|
||||
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||
import cn.ysk.cashier.dto.shop.TbShopSongOrderQueryCriteria;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.utils.CacheKey;
|
||||
import cn.ysk.cashier.utils.RedisUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopSongOrder;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopSongOrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* (TbShopSongOrder)表控制层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-07-08 09:24:23
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "歌曲订单管理")
|
||||
@RequestMapping("/api/tbShopSongOrder")
|
||||
public class TbShopSongOrderController{
|
||||
private final RedisUtils redisUtils;
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private TbShopSongOrderService tbShopSongOrderService;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
* @param tbShopSongOrder 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
@GetMapping
|
||||
@ApiOperation("获取歌曲列表 分页")
|
||||
@AnonymousGetMapping
|
||||
public ResponseEntity<Object> selectAll(TbShopSongOrderQueryCriteria tbShopSongOrder) {
|
||||
return new ResponseEntity<>(tbShopSongOrderService.queryAll(tbShopSongOrder), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
@ApiOperation("订单详情")
|
||||
public ResponseEntity<Object> selectOne(@PathVariable Serializable id) {
|
||||
return new ResponseEntity<>(tbShopSongOrderService.getById(id),HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 歌手页 歌曲列表
|
||||
* @param key 有效key
|
||||
* @return 所有数据
|
||||
*/
|
||||
@GetMapping("songs")
|
||||
@AnonymousGetMapping
|
||||
public ResponseEntity<Object> singerSongs(String key) {
|
||||
String shopId="";
|
||||
if (redisUtils.hasKey(CacheKey.SONG_URL + key)) {
|
||||
shopId = (String)redisUtils.get(CacheKey.SONG_URL + key);
|
||||
}else {
|
||||
throw new BadRequestException("地址已失效,请重新获取地址。");
|
||||
}
|
||||
return new ResponseEntity<>(tbShopSongOrderService.singerSongs(Integer.valueOf(shopId)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下一首
|
||||
* @param shopId 店铺Id
|
||||
*/
|
||||
@PostMapping("next")
|
||||
@AnonymousPostMapping
|
||||
public ResponseEntity<Object> next(@RequestBody Integer shopId) {
|
||||
tbShopSongOrderService.next(shopId);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.ysk.cashier.controller.product;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.annotation.AnonymousAccess;
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||
import cn.ysk.cashier.dto.product.StockQueryDto;
|
||||
@@ -106,11 +107,24 @@ public class StockController {
|
||||
if (stockV2Vos.getContent().isEmpty()) {
|
||||
dataMap.put("warnLine", 0);
|
||||
}else {
|
||||
dataMap.put("warnLine", stockV2Vos.getContent().get(0).getWarnLine());
|
||||
StockV2Vo stockV2Vo = stockV2Vos.getContent().stream().filter(item -> item.getWarnLine() != null).findFirst().orElse(null);
|
||||
dataMap.put("warnLine", stockV2Vo != null ? stockV2Vo.getWarnLine() : 0);
|
||||
}
|
||||
return new ResponseEntity<>(dataMap, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@AnonymousAccess
|
||||
@PutMapping("/grounding")
|
||||
@ApiOperation("上下架商品")
|
||||
public ResponseEntity<Object> grounding(
|
||||
@RequestParam Integer shopId,
|
||||
@RequestParam Integer skuId,
|
||||
@RequestParam Boolean isGrounding
|
||||
){
|
||||
stockService.grounding(shopId,skuId, isGrounding);
|
||||
return ResponseEntity.ok("success");
|
||||
}
|
||||
|
||||
@GetMapping("/sku")
|
||||
@ApiOperation("查询库存")
|
||||
public ResponseEntity<Object> queryProductSku(String productId){
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package cn.ysk.cashier.controller.product;
|
||||
|
||||
import cn.ysk.cashier.annotation.AnonymousAccess;
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.dto.product.TbProductSortCriteria;
|
||||
import cn.ysk.cashier.vo.TbProductVo;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package cn.ysk.cashier.controller.product;
|
||||
|
||||
import cn.ysk.cashier.annotation.AnonymousAccess;
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
||||
import cn.ysk.cashier.service.product.TbProductStockDetailService;
|
||||
@@ -91,4 +92,4 @@ public class TbProductStockDetailController {
|
||||
tbProductStockDetailService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package cn.ysk.cashier.controller.shop;
|
||||
|
||||
import cn.ysk.cashier.annotation.AnonymousAccess;
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.dto.ShopSummaryDto;
|
||||
import cn.ysk.cashier.service.SummaryService;
|
||||
import cn.ysk.cashier.vo.TbOrderPayCountVo;
|
||||
|
||||
@@ -76,6 +76,14 @@ public class TbPlussShopStaffController {
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PutMapping("updateStatus")
|
||||
@Log("修改员工状态:#resources.name")
|
||||
@ApiOperation("修改/shop/shopStaff")
|
||||
public ResponseEntity<Object> updateStatus(@Validated @RequestBody TbPlussShopStaff resources){
|
||||
tbPlussShopStaffService.updateStatus(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除员工:#ids")
|
||||
@ApiOperation("删除/shop/shopStaff")
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package cn.ysk.cashier.controller.shop;
|
||||
|
||||
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousDeleteMapping;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPutMapping;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopExtend;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopExtendService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import cn.ysk.cashier.dto.shop.TbShopExtendQueryCriteria;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺扩展信息(TbShopExtend)表控制层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-07-18 11:10:16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("tbShopExtend")
|
||||
public class TbShopExtendController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private TbShopExtendService tbShopExtendService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("分页查询")
|
||||
@AnonymousGetMapping
|
||||
public ResponseEntity<Object> selectAll(TbShopExtendQueryCriteria criteria) {
|
||||
return new ResponseEntity<>(tbShopExtendService.queryAll(criteria), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@ApiOperation("通过Id查询详情")
|
||||
@AnonymousGetMapping
|
||||
public TbShopExtend selectOne(@PathVariable Serializable id) {
|
||||
return tbShopExtendService.getById(id);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增")
|
||||
@AnonymousPostMapping
|
||||
public ResponseEntity<Object> insert(@RequestBody TbShopExtend tbShopExtend) {
|
||||
tbShopExtend.setCreateTime(new Date());
|
||||
return new ResponseEntity<>(tbShopExtendService.save(tbShopExtend), HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("通过id修改")
|
||||
@AnonymousPutMapping
|
||||
public ResponseEntity<Object> update(@RequestBody TbShopExtend tbShopExtend) {
|
||||
tbShopExtend.setUpdateTime(new Date());
|
||||
tbShopExtendService.updateById(tbShopExtend);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation("删除")
|
||||
@AnonymousDeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestParam("idList") List<Long> idList) {
|
||||
tbShopExtendService.removeByIds(idList);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package cn.ysk.cashier.controller.shop;
|
||||
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||
import cn.ysk.cashier.dto.shop.TbShopSongQueryCriteria;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopSong;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopSongService;
|
||||
import cn.ysk.cashier.utils.CacheKey;
|
||||
import cn.ysk.cashier.utils.RedisUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -16,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@@ -23,12 +28,33 @@ import java.util.List;
|
||||
@Api(tags = "歌曲管理")
|
||||
@RequestMapping("/api/tbShopSong")
|
||||
public class TbShopSongController {
|
||||
private final RedisUtils redisUtils;
|
||||
private final TbShopSongService tbShopSongService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询歌曲列表")
|
||||
public ResponseEntity<Object> queryTbShopPurveyor(TbShopSongQueryCriteria criteria){
|
||||
return new ResponseEntity<>(tbShopSongService.queryAll(criteria), HttpStatus.OK);
|
||||
String code = "";
|
||||
if(redisUtils.hasKey(CacheKey.SONG_URL + criteria.getShopId())){
|
||||
code = (String) redisUtils.get(CacheKey.SONG_URL + criteria.getShopId());
|
||||
}else {
|
||||
code = RandomStringUtils.randomAlphanumeric(12);
|
||||
redisUtils.set(CacheKey.SONG_URL + criteria.getShopId(), code);
|
||||
redisUtils.set(CacheKey.SONG_URL + code, criteria.getShopId());
|
||||
}
|
||||
Map<String, Object> stringObjectMap = tbShopSongService.queryAll(criteria);
|
||||
stringObjectMap.put("songUrl",code);
|
||||
return new ResponseEntity<>(stringObjectMap, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("createUrl")
|
||||
@ApiOperation("更新歌手页地址")
|
||||
@AnonymousPostMapping
|
||||
public ResponseEntity<Object> createUrl(String shopId) {
|
||||
String key = RandomStringUtils.randomAlphanumeric(12);
|
||||
redisUtils.set(CacheKey.SONG_URL + shopId, key);
|
||||
redisUtils.set(CacheKey.SONG_URL + key, shopId);
|
||||
return new ResponseEntity<>(key,HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
|
||||
@@ -2,6 +2,9 @@ package cn.ysk.cashier.controller.shop;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.annotation.AnonymousAccess;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||
import cn.ysk.cashier.dto.shop.TbShopRechargeListDto;
|
||||
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mybatis.service.TbMShopUserService;
|
||||
@@ -20,10 +23,10 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2024-03-01
|
||||
**/
|
||||
* @author lyf
|
||||
* @website https://eladmin.vip
|
||||
* @date 2024-03-01
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "/shop/user管理")
|
||||
@@ -41,35 +44,36 @@ public class TbShopUserController {
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询/shop/user")
|
||||
public ResponseEntity<Object> queryTbShopUser(TbShopUserQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbShopUserService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
public ResponseEntity<Object> queryTbShopUser(TbShopUserQueryCriteria criteria, Pageable pageable) {
|
||||
return new ResponseEntity<>(tbShopUserService.queryAll(criteria, pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("queryAllShopUser")
|
||||
@ApiOperation("查询商家用户")
|
||||
public ResponseEntity<Object> queryAllShopUser(TbShopUserQueryCriteria criteria){
|
||||
return new ResponseEntity<>(tbShopUserService.queryShopUser(criteria),HttpStatus.OK);
|
||||
@AnonymousGetMapping
|
||||
public ResponseEntity<Object> queryAllShopUser(TbShopUserQueryCriteria criteria) {
|
||||
return new ResponseEntity<>(tbShopUserService.queryShopUser(criteria), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("summary")
|
||||
@ApiOperation("查询会员概述")
|
||||
public ResponseEntity<Object> summary(TbShopUserQueryCriteria criteria){
|
||||
public ResponseEntity<Object> summary(TbShopUserQueryCriteria criteria) {
|
||||
if (StrUtil.isBlank(criteria.getShopId())) {
|
||||
throw new BadRequestException("店铺id不为空");
|
||||
}
|
||||
return new ResponseEntity<>(tbMShopUserService.summary(criteria),HttpStatus.OK);
|
||||
return new ResponseEntity<>(tbMShopUserService.summary(criteria), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增/shop/user")
|
||||
public ResponseEntity<Object> createTbShopUser(@Validated @RequestBody TbShopUser resources){
|
||||
return new ResponseEntity<>(tbShopUserService.create(resources),HttpStatus.CREATED);
|
||||
public ResponseEntity<Object> createTbShopUser(@Validated @RequestBody TbShopUser resources) {
|
||||
return new ResponseEntity<>(tbShopUserService.create(resources), HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改/shop/user")
|
||||
public ResponseEntity<Object> updateTbShopUser(@Validated @RequestBody TbShopUser resources){
|
||||
public ResponseEntity<Object> updateTbShopUser(@Validated @RequestBody TbShopUser resources) {
|
||||
tbShopUserService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@@ -80,4 +84,16 @@ public class TbShopUserController {
|
||||
tbShopUserService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/recharge")
|
||||
@ApiOperation("充值记录")
|
||||
public ResponseEntity<Object> rechargeList(TbShopRechargeListDto criteria, Pageable pageable) {
|
||||
return new ResponseEntity<>(tbShopUserService.rechargeList(criteria, pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/recharge/download")
|
||||
@ApiOperation("导出充值记录")
|
||||
public void rechargeListDownload(HttpServletResponse response, @RequestBody TbShopRechargeListDto criteria) throws IOException {
|
||||
tbShopUserService.rechargeListDownload(response, criteria);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
import cn.ysk.cashier.annotation.Query;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
@@ -68,4 +69,14 @@ public class TbOrderInfoQueryCriteria{
|
||||
/** BETWEEN */
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Long> createdAt;
|
||||
}
|
||||
|
||||
|
||||
@Query
|
||||
private String tableName;
|
||||
|
||||
private String productName;
|
||||
|
||||
public void setProductName(String productName) {
|
||||
if(StringUtils.isNotBlank(productName)) this.productName = productName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TbPayCountQueryCriteria {
|
||||
|
||||
|
||||
private String shopId;
|
||||
|
||||
private String tableName;
|
||||
|
||||
private List<Long> createdAt;
|
||||
}
|
||||
|
||||
@@ -16,4 +16,5 @@ public class StockCountDTO {
|
||||
private String unitName;
|
||||
private Integer stockCount;
|
||||
private Integer stockNumber;
|
||||
private String specSnap;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ public class TbProductSkuDto implements Serializable {
|
||||
/** 进货参考价 */
|
||||
private BigDecimal guidePrice;
|
||||
|
||||
private Integer suit;
|
||||
|
||||
private BigDecimal strategyPrice;
|
||||
|
||||
/** 库存数量 */
|
||||
|
||||
@@ -30,4 +30,7 @@ public class TbProductSpecQueryCriteria{
|
||||
*/
|
||||
@Query
|
||||
private String shopId;
|
||||
|
||||
@Query(type = Query.Type.INNER_LIKE)
|
||||
private String name;
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package cn.ysk.cashier.dto.shop;
|
||||
|
||||
import cn.ysk.cashier.system.service.dto.RoleSmallDto;
|
||||
import cn.ysk.cashier.system.service.dto.UserDto;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -22,6 +23,7 @@ import lombok.Data;
|
||||
import javax.persistence.Column;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
@@ -70,7 +72,10 @@ public class TbPlussShopStaffDto implements Serializable {
|
||||
*/
|
||||
private Integer isPc;
|
||||
|
||||
private UserDto user;
|
||||
// private UserDto user;
|
||||
// private RoleSmallDto roles;
|
||||
private Long roleId;
|
||||
private String phone;
|
||||
|
||||
private Long createdAt;
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package cn.ysk.cashier.dto.shop;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 店铺扩展信息(TbShopExtend)表查询类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-07-18 10:46:57
|
||||
*/
|
||||
@Data
|
||||
public class TbShopExtendQueryCriteria {
|
||||
private Integer shopId;
|
||||
//img:图片;text:文本;
|
||||
private String type;
|
||||
//自定义key
|
||||
private String autokey;
|
||||
//值
|
||||
private String value;
|
||||
private long page = 1;
|
||||
private long size = 10;
|
||||
|
||||
public void setPage(long page) {
|
||||
if (page != 0) {
|
||||
this.page = page;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSize(long size) {
|
||||
if (size != 0) {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.ysk.cashier.dto.shop;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
*/
|
||||
@Data
|
||||
public class TbShopRechargeListDto {
|
||||
private String shopId;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package cn.ysk.cashier.dto.shop;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
*/
|
||||
@Data
|
||||
public class TbShopRechargeRespDto {
|
||||
private Integer id;
|
||||
private String shopId;
|
||||
private String shopName;
|
||||
private String userId;
|
||||
private String userName;
|
||||
private String userPhone;
|
||||
private Object rechargeAmount;
|
||||
private String rechargeType;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date rechargeTime;
|
||||
|
||||
public TbShopRechargeRespDto(Integer id, String shopId, String shopName, String userId, String userName, String userPhone,
|
||||
String rechargeAmount, String rechargeType, Date rechargeTime) {
|
||||
this.id = id;
|
||||
this.shopId = shopId;
|
||||
this.shopName = shopName;
|
||||
this.userId = userId;
|
||||
this.userName = userName;
|
||||
this.userPhone = userPhone;
|
||||
this.rechargeAmount = rechargeAmount;
|
||||
this.rechargeType = rechargeType;
|
||||
this.rechargeTime = rechargeTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package cn.ysk.cashier.dto.shop;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@Data
|
||||
public class TbShopSongOrderQueryCriteria {
|
||||
|
||||
private String shopId;
|
||||
private String orderNo;
|
||||
private String name;
|
||||
private Integer state;
|
||||
/**
|
||||
* 从1开始
|
||||
*/
|
||||
private Long page = 1L;
|
||||
/**
|
||||
* 展示数量
|
||||
*/
|
||||
private Long size = 10L;
|
||||
|
||||
public void setShopId(String shopId) {
|
||||
if (StringUtils.isNotBlank(shopId) && !shopId.equals("1")) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
}
|
||||
|
||||
public void setOrderNo(String orderNo) {
|
||||
if (StringUtils.isNotBlank(orderNo))
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
if (StringUtils.isNotBlank(name))
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setState(Integer state) {
|
||||
if (state!=null)
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package cn.ysk.cashier.mybatis.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
|
||||
|
||||
/**
|
||||
* 店铺扩展信息(TbShopExtend)表实体类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-07-18 11:10:16
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class TbShopExtend extends Model<TbShopExtend> {
|
||||
//自增id
|
||||
private Integer id;
|
||||
//商户Id
|
||||
private Integer shopId;
|
||||
//img:图片;text:文本;
|
||||
private String type;
|
||||
//自定义key
|
||||
private String autokey;
|
||||
//值
|
||||
private String value;
|
||||
//更新时间
|
||||
private Date updateTime;
|
||||
//创建时间
|
||||
private Date createTime;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
public void setShopId(Integer shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getAutokey() {
|
||||
return autokey;
|
||||
}
|
||||
|
||||
public void setAutokey(String autokey) {
|
||||
this.autokey = autokey;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
package cn.ysk.cashier.mybatis.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* (TbShopSongOrder)表实体类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-07-08 09:24:27
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class TbShopSongOrder extends Model<TbShopSongOrder> {
|
||||
|
||||
private Integer id;
|
||||
//歌曲id
|
||||
private Integer songId;
|
||||
private Integer shopId;
|
||||
//歌曲名称
|
||||
private String songName;
|
||||
//用户id
|
||||
private Integer userId;
|
||||
//支付金额
|
||||
private Double payMoney;
|
||||
//状态 -1 未支付 0 已取消 1 已支付 2 演唱中 3 已演唱
|
||||
private Integer state;
|
||||
//创建时间
|
||||
private Date createTime;
|
||||
//下单来源
|
||||
private Integer clientType;
|
||||
//订单编号
|
||||
private String orderNo;
|
||||
//点歌人
|
||||
private String fromName;
|
||||
//收歌人
|
||||
private String toName;
|
||||
//祝福语
|
||||
private String note;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getSongId() {
|
||||
return songId;
|
||||
}
|
||||
|
||||
public void setSongId(Integer songId) {
|
||||
this.songId = songId;
|
||||
}
|
||||
|
||||
public String getSongName() {
|
||||
return songName;
|
||||
}
|
||||
|
||||
public void setSongName(String songName) {
|
||||
this.songName = songName;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Double getPayMoney() {
|
||||
return payMoney;
|
||||
}
|
||||
|
||||
public void setPayMoney(Double payMoney) {
|
||||
this.payMoney = payMoney;
|
||||
}
|
||||
|
||||
public Integer getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(Integer state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Integer getClientType() {
|
||||
return clientType;
|
||||
}
|
||||
|
||||
public void setClientType(Integer clientType) {
|
||||
this.clientType = clientType;
|
||||
}
|
||||
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
public void setOrderNo(String orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public String getFromName() {
|
||||
return fromName;
|
||||
}
|
||||
|
||||
public void setFromName(String fromName) {
|
||||
this.fromName = fromName;
|
||||
}
|
||||
|
||||
public String getToName() {
|
||||
return toName;
|
||||
}
|
||||
|
||||
public void setToName(String toName) {
|
||||
this.toName = toName;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
public void setShopId(Integer shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,16 +5,22 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("tb_shop_user_flow")
|
||||
@Table(name="tb_shop_user_flow")
|
||||
public class TbShopUserFlow extends Model<TbShopUserFlow> {
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
private Integer shopUserId;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package cn.ysk.cashier.mybatis.mapper;
|
||||
|
||||
import cn.ysk.cashier.dto.shop.TbShopRechargeListDto;
|
||||
import cn.ysk.cashier.dto.shop.TbShopRechargeRespDto;
|
||||
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopUser;
|
||||
import cn.ysk.cashier.vo.ShopUserInfoVo;
|
||||
@@ -17,18 +19,38 @@ public interface ShopUserMapper extends BaseMapper<TbShopUser> {
|
||||
"FROM tb_shop_user su " +
|
||||
"LEFT JOIN tb_user_info u ON su.user_id = u.id " +
|
||||
"<where> " +
|
||||
"su.user_id is not null and su.user_id != ''" +
|
||||
"<if test='param.shopId != null and param.shopId != "" and param.shopId != 1'>" +
|
||||
"AND su.shop_id = #{param.shopId} " +
|
||||
"</if>" +
|
||||
"<if test='param.name != null and param.name != ""'>" +
|
||||
"AND (u.nick_name like concat('%', #{param.name}, '%') or u.telephone like concat('%', #{param.name}, '%'))" +
|
||||
"AND (u.nick_name like concat('%', #{param.name}, '%') or su.name LIKE concat( '%', #{param.name}, '%' ) " +
|
||||
" or u.telephone like concat('%', #{param.name}, '%') or su.telephone like concat('%', #{param.name}, '%'))" +
|
||||
"</if>" +
|
||||
"<if test='param.isVip != null and param.isVip != ""'>" +
|
||||
"AND su.is_vip=#{param.isVip}" +
|
||||
"<if test='isVip != null'>" +
|
||||
"AND su.is_vip=#{isVip}" +
|
||||
"</if>" +
|
||||
"</where>" +
|
||||
"</script>")
|
||||
IPage<ShopUserInfoVo> queryUser(TbShopUserQueryCriteria param, Page pageInfo);
|
||||
IPage<ShopUserInfoVo> queryUser(TbShopUserQueryCriteria param, Integer isVip, Page pageInfo);
|
||||
|
||||
@Select("<script> " +
|
||||
"select " +
|
||||
"tsuf.id as id, " +
|
||||
"tsu.shop_id as shop_id, " +
|
||||
"tsi.shop_name, " +
|
||||
"tsu.id as user_id, " +
|
||||
"tsu.telephone as user_phone, " +
|
||||
"tsu.`name` as user_name, " +
|
||||
"tsuf.amount as recharge_amount, " +
|
||||
"tsuf.biz_name as recharge_type, " +
|
||||
"tsuf.create_time as recharge_time " +
|
||||
" from tb_shop_user_flow tsuf " +
|
||||
" left join tb_shop_user as tsu on tsuf.shop_user_id = tsu.id " +
|
||||
"left join tb_shop_info as tsi on tsi.id = tsu.shop_id " +
|
||||
"where tsuf.create_time BETWEEN #{param.startTime} and #{param.endTime} and tsuf.biz_code in ('cashMemberIn', 'scanMemberIn', 'scanMemberAwardIn') " +
|
||||
" and tsu.shop_id = #{param.shopId} " +
|
||||
"order by tsuf.create_time desc " +
|
||||
"</script>")
|
||||
IPage<TbShopRechargeRespDto> queryRechargeList(TbShopRechargeListDto param, Page pageInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,19 +16,23 @@ import java.util.Map;
|
||||
*/
|
||||
public interface TbMShopUserMapper extends BaseMapper<TbMShopUser> {
|
||||
@Select("<script>" +
|
||||
"SELECT " +
|
||||
"COUNT(*) userTotal, " +
|
||||
"ifnull(SUM( " +
|
||||
"IFNULL( b.charge_amount, 0 )), 0) chageTotal, ifnull(SUM( IFNULL( a.amount, 0 )), 0) balanceTotal " +
|
||||
"FROM\n" +
|
||||
"tb_shop_user AS a\n" +
|
||||
"LEFT JOIN tb_user_info AS b ON a.user_id = b.id\n" +
|
||||
"WHERE\n" +
|
||||
" a.shop_id = #{shopId}\n" +
|
||||
"SELECT \n" +
|
||||
" COUNT(DISTINCT a.id) AS userTotal, \n" +
|
||||
" COALESCE(SUM(flow.total_amount), 0) AS chageTotal, \n" +
|
||||
" COALESCE(SUM(a.amount), 0) AS balanceTotal \n" +
|
||||
"FROM \n" +
|
||||
" tb_shop_user AS a\n" +
|
||||
" LEFT JOIN (\n" +
|
||||
" SELECT shop_user_id, SUM(amount) AS total_amount \n" +
|
||||
" FROM tb_shop_user_flow \n" +
|
||||
" WHERE biz_code IN ('cashMemberIn','scanMemberIn', 'scanMemberAwardIn') \n" +
|
||||
" GROUP BY shop_user_id\n" +
|
||||
" ) AS flow ON flow.shop_user_id = a.id\n" +
|
||||
"WHERE \n" +
|
||||
" a.shop_id = #{shopId} \n" +
|
||||
"<if test=\"isVip !=null\">\n" +
|
||||
" and a.is_vip=#{isVip}\n" +
|
||||
"</if>" +
|
||||
|
||||
"</script>")
|
||||
Map<String, Object> selectUserSummary(@Param("shopId") String shopId, @Param("isVip") Integer isVip);
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.ysk.cashier.mybatis.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopExtend;
|
||||
|
||||
/**
|
||||
* 店铺扩展信息(TbShopExtend)表数据库访问层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-07-18 11:10:16
|
||||
*/
|
||||
public interface TbShopExtendMapper extends BaseMapper<TbShopExtend> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package cn.ysk.cashier.mybatis.mapper;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopSongOrder;
|
||||
import cn.ysk.cashier.mybatis.vo.SingerSongVo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (TbShopSongOrder)表数据库访问层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-07-08 09:24:26
|
||||
*/
|
||||
public interface TbShopSongOrderMapper extends BaseMapper<TbShopSongOrder> {
|
||||
|
||||
|
||||
@Select("select " +
|
||||
"song.img,song.name as songName,song.origin_singer as originSinger,orders.from_name as fromName," +
|
||||
"orders.to_name as toName,orders.note " +
|
||||
"from tb_shop_song_order orders " +
|
||||
"left join tb_shop_song song on orders.song_id=song.id " +
|
||||
"where state = #{state} and orders.shop_id=#{shopId} order by orders.create_time limit 12")
|
||||
List<SingerSongVo> findByState(@Param("state") Integer state, @Param("shopId") Integer shopId);
|
||||
|
||||
|
||||
@Update("update tb_shop_song_order set state=3 where state=2 and shop_id=#{shopId}")
|
||||
int upState(@Param("shopId") Integer shopId);
|
||||
|
||||
@Update("update tb_shop_song_order " +
|
||||
"set state = 2 " +
|
||||
"where id = (" +
|
||||
" select id " +
|
||||
" from (" +
|
||||
" select id " +
|
||||
" from tb_shop_song_order " +
|
||||
" where state = 1 and shop_id = #{shopId}" +
|
||||
" order by create_time " +
|
||||
" limit 1" +
|
||||
" ) as subquery" +
|
||||
")")
|
||||
int setDuringSinging(@Param("shopId") Integer shopId);
|
||||
}
|
||||
|
||||
@@ -19,23 +19,26 @@ public interface TbShopUserFlowMapper extends BaseMapper<TbShopUserFlow> {
|
||||
* @param shopId 店铺ID
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param types 流水类型
|
||||
* @return 用户流水总金额
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"SELECT IFNULL(SUM(uf.amount), 0) FROM tb_shop_user_flow as uf " +
|
||||
"JOIN tb_shop_user su ON uf.shop_user_id = su.id " +
|
||||
"WHERE su.shop_id = #{shopId} " +
|
||||
"AND uf.create_time BETWEEN #{startTime} AND #{endTime} " +
|
||||
"AND uf.biz_code IN " +
|
||||
"<foreach collection='types' item='type' open='(' separator=',' close=')'> " +
|
||||
"#{type} " +
|
||||
"</foreach> " +
|
||||
" SELECT \n" +
|
||||
" COALESCE(SUM(flow.total_amount), 0) AS chageTotal\n" +
|
||||
"FROM \n" +
|
||||
" tb_shop_user AS a\n" +
|
||||
" LEFT JOIN (\n" +
|
||||
" SELECT shop_user_id, SUM(amount) AS total_amount \n" +
|
||||
" FROM tb_shop_user_flow \n" +
|
||||
" WHERE biz_code IN ('cashMemberIn','scanMemberIn', 'scanMemberAwardIn') \n" +
|
||||
" AND create_time BETWEEN #{startTime} AND #{endTime} \n" +
|
||||
" GROUP BY shop_user_id\n" +
|
||||
" ) AS flow ON flow.shop_user_id = a.id\n" +
|
||||
"WHERE \n" +
|
||||
" a.shop_id = #{shopId}" +
|
||||
"</script>")
|
||||
BigDecimal sumUserFlowAmountByConditions(@Param("shopId") Long shopId,
|
||||
@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime,
|
||||
@Param("types") List<String> types);
|
||||
@Param("endTime") String endTime);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.ysk.cashier.mybatis.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopExtend;
|
||||
import cn.ysk.cashier.dto.shop.TbShopExtendQueryCriteria;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 店铺扩展信息(TbShopExtend)表服务接口
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-07-18 11:10:16
|
||||
*/
|
||||
public interface TbShopExtendService extends IService<TbShopExtend> {
|
||||
|
||||
Map<String, Object> queryAll(TbShopExtendQueryCriteria criteria);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.ysk.cashier.mybatis.service;
|
||||
|
||||
import cn.ysk.cashier.dto.shop.TbShopSongOrderQueryCriteria;
|
||||
import cn.ysk.cashier.dto.shop.TbShopSongQueryCriteria;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopSongOrder;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* (TbShopSongOrder)表服务接口
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-07-08 09:24:27
|
||||
*/
|
||||
public interface TbShopSongOrderService extends IService<TbShopSongOrder> {
|
||||
|
||||
Map<String,Object> queryAll(TbShopSongOrderQueryCriteria criteria);
|
||||
|
||||
Map<String,Object> singerSongs(Integer shopId);
|
||||
|
||||
void next(Integer shopId);
|
||||
}
|
||||
|
||||
@@ -12,5 +12,5 @@ import java.util.List;
|
||||
*/
|
||||
public interface TbShopUserFlowService extends IService<TbShopUserFlow> {
|
||||
|
||||
BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime, List<String> types);
|
||||
BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbShopExtendMapper;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopExtend;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopExtendService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import cn.ysk.cashier.dto.shop.TbShopExtendQueryCriteria;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 店铺扩展信息(TbShopExtend)表服务实现类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-07-18 10:57:39
|
||||
*/
|
||||
@Service("tbShopExtendService")
|
||||
public class TbShopExtendServiceImpl extends ServiceImpl<TbShopExtendMapper, TbShopExtend> implements TbShopExtendService {
|
||||
|
||||
@Autowired
|
||||
private TbShopExtendMapper tbShopExtendmapper;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(TbShopExtendQueryCriteria criteria) {
|
||||
Page<TbShopExtend> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
QueryWrapper<TbShopExtend> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("shop_id", criteria.getShopId());
|
||||
if (StringUtils.isNotBlank(criteria.getType())) {
|
||||
wrapper.eq("type",criteria.getType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(criteria.getAutokey())) {
|
||||
wrapper.like("autokey",criteria.getAutokey());
|
||||
}
|
||||
wrapper.orderByDesc("create_time");
|
||||
Page<TbShopExtend> ipage = tbShopExtendmapper.selectPage(page, wrapper);
|
||||
return PageUtil.toPage(ipage.getRecords(), ipage.getTotal());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import cn.ysk.cashier.dto.shop.TbShopSongOrderQueryCriteria;
|
||||
import cn.ysk.cashier.dto.shop.TbShopSongQueryCriteria;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopSong;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbShopSongMapper;
|
||||
import cn.ysk.cashier.mybatis.vo.SingerSongVo;
|
||||
import cn.ysk.cashier.utils.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbShopSongOrderMapper;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopSongOrder;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopSongOrderService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* (TbShopSongOrder)表服务实现类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-07-08 09:24:27
|
||||
*/
|
||||
@Service("tbShopSongOrderService")
|
||||
public class TbShopSongOrderServiceImpl extends ServiceImpl<TbShopSongOrderMapper, TbShopSongOrder> implements TbShopSongOrderService {
|
||||
|
||||
@Autowired
|
||||
private TbShopSongOrderMapper tbShopSongOrderMapper;
|
||||
@Override
|
||||
public Map<String, Object> queryAll(TbShopSongOrderQueryCriteria criteria) {
|
||||
Page<TbShopSongOrder> page = new Page<>(
|
||||
criteria.getPage(),
|
||||
criteria.getSize());
|
||||
QueryWrapper<TbShopSongOrder> wrapper = new QueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(criteria.getShopId())) {
|
||||
wrapper.eq("shop_id", criteria.getShopId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(criteria.getOrderNo())) {
|
||||
wrapper.eq("order_no", criteria.getOrderNo());
|
||||
}
|
||||
if (criteria.getState() != null) {
|
||||
wrapper.eq("state", criteria.getState());
|
||||
}
|
||||
if (StringUtils.isNotBlank(criteria.getName())) {
|
||||
wrapper.like("song_name", criteria.getName());
|
||||
}
|
||||
wrapper.orderByDesc("create_time");
|
||||
Page<TbShopSongOrder> tbShopSongPage = tbShopSongOrderMapper.selectPage(page, wrapper);
|
||||
return PageUtil.toPage(tbShopSongPage.getRecords(), tbShopSongPage.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> singerSongs(Integer shopId) {
|
||||
Map<String,Object> map = new LinkedHashMap<>(3);
|
||||
map.put("shopId",shopId);
|
||||
List<SingerSongVo> byState = tbShopSongOrderMapper.findByState(2, shopId);
|
||||
if(CollectionUtils.isEmpty(byState)){
|
||||
map.put("afoot","");//演唱中
|
||||
}else {
|
||||
map.put("afoot",byState.get(0));//演唱中
|
||||
}
|
||||
map.put("Waiting",tbShopSongOrderMapper.findByState(1,shopId));
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void next(Integer shopId) {
|
||||
tbShopSongOrderMapper.upState(shopId);
|
||||
tbShopSongOrderMapper.setDuringSinging(shopId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
@Service
|
||||
public class TbShopUserFlowServiceImpl extends ServiceImpl<TbShopUserFlowMapper, TbShopUserFlow> implements TbShopUserFlowService {
|
||||
@Override
|
||||
public BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime, List<String> types) {
|
||||
return baseMapper.sumUserFlowAmountByConditions(shopId, startTime, endTime, types);
|
||||
public BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime) {
|
||||
return baseMapper.sumUserFlowAmountByConditions(shopId, startTime, endTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.ysk.cashier.mybatis.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SingerSongVo {
|
||||
private String img;
|
||||
private String songName;
|
||||
private String originSinger;
|
||||
private String fromName;
|
||||
private String toName;
|
||||
private String note;
|
||||
|
||||
}
|
||||
@@ -1,33 +1,17 @@
|
||||
/*
|
||||
* 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.pojo.product;
|
||||
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
@@ -85,6 +69,9 @@ public class TbProductSku implements Serializable {
|
||||
@ApiModelProperty(value = "进货参考价")
|
||||
private BigDecimal guidePrice;
|
||||
|
||||
@ApiModelProperty(value = "起售数量 默认为1")
|
||||
private Integer suit = 1;
|
||||
|
||||
@Column(name = "`strategy_price`")
|
||||
@ApiModelProperty(value = "strategyPrice")
|
||||
private BigDecimal strategyPrice;
|
||||
@@ -132,13 +119,27 @@ public class TbProductSku implements Serializable {
|
||||
@Column(name = "`updated_at`")
|
||||
@ApiModelProperty(value = "updatedAt")
|
||||
private Long updatedAt;
|
||||
public void copy(TbProductSku source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
@Column(name = "`is_del`")
|
||||
private Integer isDel = 0;
|
||||
|
||||
@Column(name = "`is_pause_sale`")
|
||||
@ApiModelProperty(value = "是否暂停销售")
|
||||
private Integer isPauseSale = 0;
|
||||
|
||||
@Column(name = "`is_grounding`")
|
||||
@ApiModelProperty(value = "是否上架")
|
||||
private Integer isGrounding = 1;
|
||||
|
||||
public void setIsDel(Integer isDel) {
|
||||
if(isDel!=null){
|
||||
this.isDel = isDel;
|
||||
}
|
||||
}
|
||||
|
||||
public void copy(TbProductSku source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -127,6 +127,10 @@ public class TbMerchantAccount implements Serializable {
|
||||
@ApiModelProperty(value = "updatedAt")
|
||||
private Long updatedAt;
|
||||
|
||||
@Column(name = "`pwd`")
|
||||
@ApiModelProperty(value = "操作密码")
|
||||
private String pwd;
|
||||
|
||||
public void copy(TbMerchantAccount source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package cn.ysk.cashier.pojo.shop;
|
||||
|
||||
import cn.ysk.cashier.system.service.dto.RoleSmallDto;
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package cn.ysk.cashier.rabbit;
|
||||
|
||||
import cn.ysk.cashier.config.RabbitConfig;
|
||||
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
||||
import cn.ysk.cashier.service.product.TbProductStockDetailService;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class StockListener {
|
||||
|
||||
private final TbProductStockDetailService productStockDetailService;
|
||||
|
||||
public StockListener(TbProductStockDetailService productStockDetailService) {
|
||||
this.productStockDetailService = productStockDetailService;
|
||||
}
|
||||
|
||||
@RabbitListener(queues = RabbitConfig.QUEUE_STOCK_RECORD_SALE)
|
||||
public void recordSaleHandler(String message) {
|
||||
log.info("接收到下单保存库存信息mq消息,消息内容: {}", message);
|
||||
JSONObject jsonObject = JSONObject.parseObject(message);
|
||||
if (!jsonObject.containsKey("orderId")) {
|
||||
log.info("mq消息体有误,确实orderId");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
productStockDetailService.addSaleRecord(jsonObject.getInteger("orderId"));
|
||||
}catch (Exception e) {
|
||||
log.error("执行保存库存mq失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,4 +25,6 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
* @date 2023-11-13
|
||||
**/
|
||||
public interface TbUserInfoRepository extends JpaRepository<TbUserInfo, Integer>, JpaSpecificationExecutor<TbUserInfo> {
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package cn.ysk.cashier.repository.order;
|
||||
|
||||
import cn.ysk.cashier.dto.product.StockCountDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
@@ -32,4 +33,35 @@ public interface StockCountRepository extends JpaRepository<StockCountDTO, Integ
|
||||
"info.product_id ",nativeQuery = true)
|
||||
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.product_name AS pro_name,\n" +
|
||||
"pro.is_stock,\n" +
|
||||
"info.product_sku_name AS sku_name,\n" +
|
||||
"unit.NAME AS unit_name,\n" +
|
||||
"SUM( CASE WHEN orders.order_type != 'return' THEN info.num ELSE 0 END ) - SUM( CASE WHEN orders.order_type = 'return' THEN info.num ELSE 0 END ) AS stock_count,\n" +
|
||||
"CASE\n" +
|
||||
"\n" +
|
||||
"WHEN pro.is_distribute = 0 THEN\n" +
|
||||
"sku.stock_number ELSE pro.stock_number \n" +
|
||||
"END AS stock_number, ifnull(sku.spec_snap, '')\n" +
|
||||
"FROM\n" +
|
||||
"tb_order_detail info\n" +
|
||||
"LEFT JOIN tb_order_info orders ON orders.id = info.order_id\n" +
|
||||
"LEFT JOIN tb_product pro ON info.product_id = pro.id\n" +
|
||||
"LEFT JOIN tb_product_sku sku ON info.product_sku_id = sku.id\n" +
|
||||
"LEFT JOIN tb_shop_unit unit ON unit.id = pro.unit_id \n" +
|
||||
"WHERE\n" +
|
||||
"orders.id = :orderId \n" +
|
||||
"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)
|
||||
List<StockCountDTO> countStockById(Integer orderId);
|
||||
}
|
||||
|
||||
@@ -136,4 +136,13 @@ public interface TbOrderDetailRepository extends JpaRepository<TbOrderDetail, In
|
||||
"\t) AS total ", nativeQuery = true)
|
||||
Tuple searchCount(@Param("shopId") Integer shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
|
||||
}
|
||||
@Query(value = "SELECT d.order_id \n" +
|
||||
" FROM tb_order_detail d \n" +
|
||||
" WHERE d.product_name LIKE %:productName% \n" +
|
||||
" AND d.shop_id = :shopId \n" +
|
||||
" AND d.create_time BETWEEN :startTime AND :endTime \n" +
|
||||
" GROUP BY d.order_id", nativeQuery = true)
|
||||
List<Integer> findOrderIdsByProductNameLike(@Param("productName") String productName, @Param("shop_id") String shopId,
|
||||
@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
* 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.repository.order;
|
||||
|
||||
import cn.ysk.cashier.pojo.order.TbOrderInfo;
|
||||
@@ -32,26 +32,26 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
* @website https://eladmin.vip
|
||||
* @date 2024-03-02
|
||||
**/
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2024-03-02
|
||||
**/
|
||||
public interface TbOrderInfoRepository extends JpaRepository<TbOrderInfo, Integer>, JpaSpecificationExecutor<TbOrderInfo> {
|
||||
@Query("SELECT new cn.ysk.cashier.vo.TbOrderPayCountVo(info.payType, SUM(info.orderAmount)) " +
|
||||
"FROM TbOrderInfo info " +
|
||||
"WHERE info.shopId = :shopId " +
|
||||
"WHERE 1=1 and (:tableName is null or info.tableName=:tableName ) and info.shopId = :shopId " +
|
||||
"AND info.createdAt>:start AND info.createdAt<:end " +
|
||||
"AND ((info.status = 'closed') OR (info.status = 'refund' AND info.orderType != 'return')) " +
|
||||
"GROUP BY info.payType")
|
||||
List<TbOrderPayCountVo> queryTbOrderPayCount(@Param("shopId") String shopId, @Param("start") Long start, @Param("end") Long end);
|
||||
List<TbOrderPayCountVo> queryTbOrderPayCount(@Param("shopId")String shopId,@Param("tableName") String tableName ,@Param("start") Long start, @Param("end") Long end);
|
||||
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.TbOrderPayCountVo('refund', SUM(info.orderAmount)) " +
|
||||
"FROM TbOrderInfo info " +
|
||||
"WHERE info.shopId = :shopId " +
|
||||
"WHERE 1=1 and (:tableName is null or info.tableName=:tableName ) and info.shopId = :shopId " +
|
||||
"AND info.status = 'refund' AND info.orderType = 'return' " +
|
||||
"AND info.createdAt>:start AND info.createdAt<:end")
|
||||
TbOrderPayCountVo queryTbOrderRefund(@Param("shopId") String shopId, @Param("start") Long start, @Param("end") Long end);
|
||||
TbOrderPayCountVo queryTbOrderRefund(@Param("shopId")String shopId, @Param("tableName") String tableName ,@Param("start") Long start, @Param("end") Long end);
|
||||
|
||||
@Query(value = "SELECT COUNT(1) ,pay_type AS payType FROM tb_order_info Where shop_id = :shopId AND " +
|
||||
" created_at BETWEEN :startTime AND :endTime AND status='closed'AND order_type <>'return' GROUP BY pay_type", nativeQuery = true)
|
||||
@@ -191,4 +191,4 @@ public interface TbOrderInfoRepository extends JpaRepository<TbOrderInfo, Intege
|
||||
|
||||
@Query("select table.qrcode from TbShopTable table where table.shopId = :shopId")
|
||||
List<String> queryShopTableIds(@Param("shopId") Integer shopId);
|
||||
}
|
||||
}
|
||||
@@ -55,4 +55,7 @@ public interface TbProductRepository extends JpaRepository<TbProduct, Integer>,
|
||||
@Modifying
|
||||
@Query("update TbProduct set stockNumber=stockNumber+:num where id=:id")
|
||||
void incrStock(@Param("id") Integer id, @Param("num") Integer num);
|
||||
|
||||
@Query("select product from TbProduct product where product.id=:id and product.shopId=:shopId")
|
||||
TbProduct selectByShopIdAndId(Integer id, String shopId);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package cn.ysk.cashier.repository.product;
|
||||
import cn.ysk.cashier.pojo.product.TbProductSku;
|
||||
import cn.ysk.cashier.vo.StockV2Vo;
|
||||
import cn.ysk.cashier.vo.StockVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -10,7 +11,6 @@ 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;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
@@ -23,10 +23,10 @@ import java.util.List;
|
||||
**/
|
||||
public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Integer>, JpaSpecificationExecutor<TbProductSku> {
|
||||
|
||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.productId IN :productId")
|
||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.productId IN :productId and sku.isDel=0")
|
||||
List<TbProductSku> searchSku(@Param("productId")List<String> productId);
|
||||
|
||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.productId = :productId")
|
||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.productId = :productId and sku.isDel=0")
|
||||
List<TbProductSku> searchSku(@Param("productId")String productId);
|
||||
|
||||
@Transactional
|
||||
@@ -34,7 +34,12 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||
@Query("DELETE FROM TbProductSku sku WHERE sku.productId = :productId")
|
||||
Integer deleteByProductId(@Param("productId") String productId);
|
||||
|
||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.barCode = :barCode")
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query("update FROM TbProductSku sku set sku.isDel=1 WHERE sku.id = :skuId")
|
||||
Integer deleteBySkuId(@Param("skuId") Integer skuId);
|
||||
|
||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.barCode = :barCode and sku.isDel=0")
|
||||
TbProductSku searchBarCode(@Param("barCode")String barCode);
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.StockVo(" +
|
||||
@@ -47,6 +52,7 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||
"WHERE " +
|
||||
"pro.shopId = :shopId " +
|
||||
"AND pro.status = 1 " +
|
||||
"AND sku.isDel=0 " +
|
||||
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
||||
"AND (:num IS NULL OR sku.stockNumber < :num) " +
|
||||
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
||||
@@ -57,7 +63,7 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||
@Query("SELECT new cn.ysk.cashier.vo.StockV2Vo(" +
|
||||
"sku.id,pro.id,pro.coverImg,pro.name,unit.name,pro.typeEnum,sku.specSnap,pro.isStock, " +
|
||||
"CASE WHEN pro.isDistribute = 1 THEN IFNULL(pro.stockNumber, 0) ELSE SUM(sku.stockNumber) END as number" +
|
||||
", pro.isDistribute, pro.isPauseSale, true, sku.warnLine, pro.lowPrice) " +
|
||||
", pro.isDistribute, pro.isPauseSale, true, sku.warnLine, pro.lowPrice, CASE WHEN sku.isGrounding=1 THEN true ELSE false END as isGrounding) " +
|
||||
"from " +
|
||||
"TbProduct pro " +
|
||||
"LEFT JOIN TbProductSku sku on pro.id = sku.productId " +
|
||||
@@ -65,6 +71,7 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||
"WHERE " +
|
||||
"pro.shopId = :shopId " +
|
||||
"AND pro.status = 1 " +
|
||||
"AND sku.isDel = 0 " +
|
||||
"AND (:categoryId IS NULL OR pro.categoryId = :categoryId) " +
|
||||
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
||||
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
||||
@@ -87,16 +94,20 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||
"WHERE " +
|
||||
"pro.shopId = :shopId " +
|
||||
"AND pro.status = 1 " +
|
||||
"AND sku.isDel=0 " +
|
||||
"AND (:categoryId IS NULL OR pro.categoryId = :categoryId) " +
|
||||
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
||||
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
||||
"group by pro.id " +
|
||||
"ORDER BY " +
|
||||
"pro.name DESC,sku.stockNumber DESC")
|
||||
List<StockV2Vo> searchProStockV2(@Param("shopId") String shopId, @Param("proName") String proName, @Param("isStock")Integer isStock);
|
||||
List<StockV2Vo> searchProStockV2(@Param("shopId") String shopId, @Param("proName") String proName, @Param("isStock")Integer isStock,
|
||||
@Param("categoryId") String categoryId);
|
||||
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.StockV2Vo(" +
|
||||
"sku.id,pro.id,pro.coverImg,pro.name,unit.name,pro.typeEnum,sku.specSnap,pro.isStock,sku.stockNumber, 1, sku.isPauseSale, false, 0, sku.salePrice" +
|
||||
"sku.id,pro.id,pro.coverImg,pro.name," +
|
||||
"unit.name,pro.typeEnum,sku.specSnap,pro.isStock,sku.stockNumber, 1, sku.isPauseSale, false, 0, sku.salePrice, CASE WHEN sku.isGrounding=1 THEN true ELSE false END" +
|
||||
") " +
|
||||
"from " +
|
||||
"TbProductSku sku " +
|
||||
@@ -104,6 +115,7 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||
"left join TbShopUnit unit on pro.unitId = unit.id " +
|
||||
"where " +
|
||||
"sku.productId = :productId " +
|
||||
"AND sku.isDel=0 " +
|
||||
"order by " +
|
||||
"sku.stockNumber desc "
|
||||
)
|
||||
@@ -119,6 +131,7 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||
"WHERE " +
|
||||
"pro.shopId = :shopId " +
|
||||
"AND pro.status = 1 " +
|
||||
"AND sku.isDel=0 " +
|
||||
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
||||
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
||||
"AND (:num IS NULL OR sku.stockNumber < :num) " +
|
||||
@@ -158,4 +171,14 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||
@Modifying
|
||||
@Query("update TbProductSku set stockNumber=stockNumber+:num where id=:productId")
|
||||
void incrStock(@Param("productId") Integer productId, @Param("num") Double num);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query("update TbProductSku set isGrounding=:isGrounding where productId=:productId")
|
||||
void updateGroundingByProId(@Param("productId") String productId, @Param("isGrounding") Integer isGrounding);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query("update TbProductSku set isGrounding=:isGrounding where id=:skuId")
|
||||
void updateGrounding(Integer skuId,int isGrounding);
|
||||
}
|
||||
|
||||
@@ -38,4 +38,7 @@ public interface TbMerchantAccountRepository extends JpaRepository<TbMerchantAcc
|
||||
@Modifying
|
||||
@Query(value = "update tb_merchant_account set password = ?2 , updated_at = ?3 where account = ?1",nativeQuery = true)
|
||||
void updatePass(String account, String password, Long lastPasswordResetTime);
|
||||
|
||||
|
||||
TbMerchantAccount findByAccount(String account);
|
||||
}
|
||||
@@ -16,10 +16,7 @@
|
||||
package cn.ysk.cashier.repository.shop;
|
||||
|
||||
import cn.ysk.cashier.pojo.shop.TbShopUser;
|
||||
import cn.ysk.cashier.vo.ShopUserInfoVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
@@ -27,7 +24,6 @@ import org.springframework.data.jpa.repository.Query;
|
||||
import javax.persistence.Tuple;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
@@ -48,6 +44,4 @@ public interface TbShopUserRepository extends JpaRepository<TbShopUser, Integer>
|
||||
@Query("SELECT user.userId from TbShopUser user where user.shopId = :shopId")
|
||||
List<Integer> getUserIdByShopId(String shopId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -80,4 +80,7 @@ public interface TbUserInfoService {
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<TbUserInfoDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -379,8 +379,7 @@ public class SummaryServiceImpl implements SummaryService {
|
||||
|
||||
BigDecimal recharge = tbShopUserFlowService.sumUserFlowAmountByConditions(Long.valueOf(summaryDto.getShopId()),
|
||||
tbOrderPayCountByDayVo.getTradeDay() + " 00:00:00",
|
||||
tbOrderPayCountByDayVo.getTradeDay() + " 23:59:59",
|
||||
Arrays.asList("cashMemberIn", "scanMemberIn"));
|
||||
tbOrderPayCountByDayVo.getTradeDay() + " 23:59:59");
|
||||
tbOrderPayCountByDayVo.setRecharge(recharge);
|
||||
|
||||
BigDecimal decimal = tbOrderInfoRepository.queryRefundOrderAmountByTradeDay(summaryDto.getShopId(), tbOrderPayCountByDayVo.getTradeDay());
|
||||
@@ -463,7 +462,7 @@ public class SummaryServiceImpl implements SummaryService {
|
||||
endTime = new Date();
|
||||
}
|
||||
TbOrderPayCountVo payCount = tbOrderInfoRepository.queryOrderPayCount(shopId, start, end);
|
||||
TbOrderPayCountVo refCount = tbOrderInfoRepository.queryTbOrderRefund(shopId, start, end);
|
||||
TbOrderPayCountVo refCount = tbOrderInfoRepository.queryTbOrderRefund(shopId, null,start, end);
|
||||
payCount.setPayAmount(new BigDecimal(payCount.getPayAmount().toString()).subtract(new BigDecimal(refCount.getPayAmount().toString())));
|
||||
payCount.setIcon("el-icon-coin");
|
||||
list.add(payCount);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user