Compare commits
72 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
568375b115 | ||
|
|
13961cc6fc | ||
|
|
b8e1907d49 | ||
|
|
115c722e3b | ||
|
|
e89b9e4eef | ||
|
|
9de0c594cd | ||
|
|
e9b0301eb9 | ||
|
|
11e2663fb3 | ||
|
|
443df8faa3 | ||
| 60cdf33b7b | |||
| cd8ccb9a8e | |||
| f18769abd5 | |||
|
|
db15b53826 | ||
| a1ebe64c20 | |||
| cf2ac9755f | |||
| b70c00667a | |||
| 96b9d50088 | |||
| f0755c58a1 | |||
| 48488daad8 | |||
| 49ec7ab65d | |||
| 6cc0da2ed0 | |||
| b0e60ba54e | |||
| 8a07cde563 | |||
| 16c6ff1ccf | |||
| d2a18664ea | |||
|
|
0a0a863472 | ||
| 9fcc5df6b9 | |||
|
|
cdceb51f92 | ||
| 25b4a4ca2f | |||
| c219d32259 | |||
| 556b0338de | |||
| 4f7a387349 | |||
| ccba29361b | |||
| 3b8cbdee6e | |||
|
|
b7453e1123 | ||
| 420c52abbc | |||
| 498de25b9b | |||
| 762e5a9f36 | |||
| a2844da331 | |||
| 4655786218 | |||
| 407f58ea37 | |||
|
|
b7ec560d11 | ||
|
|
84802d508f | ||
|
|
1b116ed8b7 | ||
|
|
4a94d85b83 | ||
| 090203afef | |||
| 2671526c11 | |||
| d68de07728 | |||
| 292d2325a3 | |||
|
|
1d0e81a55a | ||
|
|
f8e4834e69 | ||
| e6db1a41bc | |||
|
|
820237d63e | ||
|
|
f1ee8d0de5 | ||
|
|
8486461224 | ||
|
|
0aa0bcda77 | ||
|
|
d8aaeff997 | ||
|
|
68ed64849a | ||
|
|
08f3f8b5e0 | ||
|
|
cb7246d5fa | ||
|
|
02167b163a | ||
|
|
e44cf94993 | ||
|
|
37c5aa1226 | ||
| ff1be0554a | |||
| 59b983dd77 | |||
| 92e743cb8f | |||
| 80e666126c | |||
| 5dff4105e6 | |||
| e592d5503d | |||
| 0d81d6ea5a | |||
| aee7e1fa0f | |||
| 576d358c47 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -5,4 +5,5 @@
|
||||
*/*.iml
|
||||
/.gradle/
|
||||
/application.pid
|
||||
*.log
|
||||
*.log
|
||||
logs/*
|
||||
@@ -22,6 +22,8 @@ package cn.ysk.cashier.utils;
|
||||
*/
|
||||
public interface CacheKey {
|
||||
|
||||
String ONLINE_ADMIN = "ONLINE_ADMIN:";
|
||||
|
||||
/**
|
||||
* 激活码
|
||||
*/
|
||||
|
||||
@@ -17,14 +17,19 @@ package cn.ysk.cashier.utils;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.poi.excel.BigExcelWriter;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -32,6 +37,7 @@ import java.io.*;
|
||||
import java.security.MessageDigest;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -153,7 +159,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
/**
|
||||
* inputStream 转 File
|
||||
*/
|
||||
static File inputStreamToFile(InputStream ins, String name){
|
||||
static File inputStreamToFile(InputStream ins, String name) {
|
||||
File file = new File(SYS_TEM_DIR + name);
|
||||
if (file.exists()) {
|
||||
return file;
|
||||
@@ -214,7 +220,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
BigExcelWriter writer = ExcelUtil.getBigWriter(file);
|
||||
// 一次性写出内容,使用默认样式,强制输出标题
|
||||
writer.write(list, true);
|
||||
SXSSFSheet sheet = (SXSSFSheet)writer.getSheet();
|
||||
SXSSFSheet sheet = (SXSSFSheet) writer.getSheet();
|
||||
//上面需要强转SXSSFSheet 不然没有trackAllColumnsForAutoSizing方法
|
||||
sheet.trackAllColumnsForAutoSizing();
|
||||
//列宽自适应
|
||||
@@ -231,6 +237,79 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
IoUtil.close(out);
|
||||
}
|
||||
|
||||
/**
|
||||
* 输入标题到excel
|
||||
*
|
||||
* @param writer excel对象
|
||||
* @param column 当前列位置
|
||||
* @param cellValue 标题内容
|
||||
* @param requiredFlag 是否标红
|
||||
*/
|
||||
private static void writeCell(ExcelWriter writer, int column, int row, String cellValue, boolean requiredFlag) {
|
||||
// 根据x,y轴设置单元格内容
|
||||
if (StrUtil.isNotBlank(cellValue)) {
|
||||
writer.writeCellValue(column, row, cellValue);
|
||||
}
|
||||
Font font = writer.createFont();
|
||||
font.setColor(Font.COLOR_RED);
|
||||
if (requiredFlag) {
|
||||
// 根据x,y轴获取当前单元格样式
|
||||
CellStyle cellStyle = writer.createCellStyle(column, row);
|
||||
// 内容水平居中
|
||||
cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
// 内容垂直居中
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
// 设置边框
|
||||
cellStyle.setBorderBottom(BorderStyle.THIN);
|
||||
cellStyle.setBorderLeft(BorderStyle.THIN);
|
||||
cellStyle.setBorderRight(BorderStyle.THIN);
|
||||
// 字体颜色标红
|
||||
// cellStyle.setFont(font);
|
||||
cellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex());
|
||||
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
}
|
||||
}
|
||||
|
||||
public static void downloadExcelAndMerge(List<Map<String, Object>> list, int colSize, HttpServletResponse response, ArrayList<Integer> mergeRowIndex) throws IOException {
|
||||
String tempPath = SYS_TEM_DIR + IdUtil.fastSimpleUUID() + ".xlsx";
|
||||
File file = new File(tempPath);
|
||||
ExcelWriter writer = ExcelUtil.getWriter(file);
|
||||
for (int i = 0; i < mergeRowIndex.size(); i++) {
|
||||
|
||||
int start = i == 0 ? 1 : mergeRowIndex.get(i - 1) + 1;
|
||||
for (int i1 = 0; i1 < colSize; i1++) {
|
||||
|
||||
if (start != mergeRowIndex.get(i)) {
|
||||
writer.merge(i == 0 ? 1 : mergeRowIndex.get(i - 1) + 1, mergeRowIndex.get(i), i1, i1, "", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 一次性写出内容,使用默认样式,强制输出标题
|
||||
writer.write(list, true);
|
||||
|
||||
XSSFSheet sheet = (XSSFSheet) writer.getSheet();
|
||||
// 设置列宽
|
||||
for (int i = 0; i < colSize + 2; i++) {
|
||||
sheet.setColumnWidth(i, 4000); // 200个字符宽度
|
||||
}
|
||||
//上面需要强转SXSSFSheet 不然没有trackAllColumnsForAutoSizing方法
|
||||
// sheet.trackAllColumnsForAutoSizing();
|
||||
//列宽自适应
|
||||
// writer.autoSizeColumnAll();
|
||||
//response为HttpServletResponse对象
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
||||
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
|
||||
response.setHeader("Content-Disposition", "attachment;filename=file.xlsx");
|
||||
// 将写入的Excel作为文件流写出到response
|
||||
ServletOutputStream out = response.getOutputStream();
|
||||
// 终止后删除临时文件
|
||||
file.deleteOnExit();
|
||||
writer.flush(out, true);
|
||||
//此处记得关闭输出Servlet流
|
||||
IoUtil.close(out);
|
||||
}
|
||||
|
||||
public static String getFileType(String type) {
|
||||
String documents = "txt doc pdf ppt pps xlsx xls docx";
|
||||
String music = "mp3 wav wma mpa ram ra aac aif m4a";
|
||||
@@ -263,7 +342,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
public static boolean check(File file1, File file2) {
|
||||
String img1Md5 = getMd5(file1);
|
||||
String img2Md5 = getMd5(file2);
|
||||
if(img1Md5 != null){
|
||||
if (img1Md5 != null) {
|
||||
return img1Md5.equals(img2Md5);
|
||||
}
|
||||
return false;
|
||||
@@ -353,4 +432,6 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
public static String getMd5(File file) {
|
||||
return getMd5(getByte(file));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
public class PhoneUtil {
|
||||
public static boolean validator(String phone) {
|
||||
String regex = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(166)|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[8|9]))\\d{8}$";
|
||||
String regex = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(166)|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[0-9]))\\d{8}$";
|
||||
if (phone.length() != 11) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -78,12 +78,14 @@ public class LogAspect {
|
||||
Object o = redisUtils.get("online-token-"+getToken(request));
|
||||
JSONObject jsonObject = null;
|
||||
Integer shopId = null;
|
||||
if (o!= null){
|
||||
String nickName = "";
|
||||
if (o != null) {
|
||||
String jsonString = JSON.toJSONString(o);
|
||||
jsonObject = JSONObject.parseObject(jsonString);
|
||||
shopId = (Integer)jsonObject.get("shopId");
|
||||
shopId = (Integer) jsonObject.get("shopId");
|
||||
nickName = jsonObject.get("nickName") == null ? "" : jsonObject.get("nickName").toString();
|
||||
}
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request),joinPoint, log, shopId);
|
||||
logService.save(nickName+":"+getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request),joinPoint, log, shopId);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -110,6 +112,7 @@ public class LogAspect {
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint)joinPoint, log, shopId);
|
||||
}
|
||||
|
||||
|
||||
public String getUsername() {
|
||||
try {
|
||||
return SecurityUtils.getCurrentUsername();
|
||||
@@ -117,6 +120,7 @@ public class LogAspect {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public String getToken(HttpServletRequest request) {
|
||||
final String requestHeader = request.getHeader("Authorization");
|
||||
if (requestHeader != null && requestHeader.startsWith("Bearer")) {
|
||||
|
||||
@@ -96,6 +96,26 @@ public class LogServiceImpl implements LogService {
|
||||
String value = SpelUtil.generateKeyBySpEL(split[1], joinPoint);
|
||||
// 描述
|
||||
log.setDescription(split[0] + ":" + value);
|
||||
}
|
||||
if (split.length == 3) {
|
||||
// String v1 = SpelUtil.generateKeyBySpEL(split[1], joinPoint);
|
||||
String v2 = SpelUtil.generateKeyBySpEL(split[2], joinPoint);
|
||||
if (methodName.contains("createOutAndONOperate")) {
|
||||
//subType 1入库 -1出库
|
||||
if ("purchase".equals(v2) || "purveyor".equals(v2)) {
|
||||
v2 = "入库";
|
||||
} else {
|
||||
v2 = "出库";
|
||||
}
|
||||
}else if(methodName.contains("stockInOut")){
|
||||
if (("in".equals(v2) || "purveyor".equals(v2))) {
|
||||
v2 = "入库";
|
||||
} else {
|
||||
v2 = "出库";
|
||||
}
|
||||
}
|
||||
// 描述
|
||||
log.setDescription(split[0] + ":" + v2 );
|
||||
}else {
|
||||
log.setDescription(split[0]);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 代码生成模块 -->
|
||||
<dependency>
|
||||
<groupId>cn.ysk.cashier</groupId>
|
||||
@@ -39,6 +40,11 @@
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>5.2.1</version>
|
||||
</dependency>
|
||||
<!-- Spring boot websocket -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -137,6 +137,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
// 所有类型的接口都放行
|
||||
.antMatchers(anonymousUrls.get(RequestMethodEnum.ALL.getType()).toArray(new String[0])).permitAll()
|
||||
.antMatchers("/auth/appletsLogin").permitAll()
|
||||
.antMatchers("/api/tbHandover").permitAll()
|
||||
// 所有请求都需要认证
|
||||
.anyRequest().authenticated()
|
||||
.and().apply(securityConfigurerAdapter());
|
||||
|
||||
@@ -16,9 +16,12 @@
|
||||
package cn.ysk.cashier.config.security.rest;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.config.security.config.bean.LoginCodeEnum;
|
||||
import cn.ysk.cashier.config.security.security.TokenProvider;
|
||||
import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
|
||||
import cn.ysk.cashier.pojo.shop.TbPlussShopStaff;
|
||||
import cn.ysk.cashier.repository.shop.TbMerchantAccountRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbPlussShopStaffRepository;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import com.wf.captcha.base.Captcha;
|
||||
@@ -75,6 +78,8 @@ public class AuthorizationController {
|
||||
private final AuthenticationManagerBuilder authenticationManagerBuilder;
|
||||
private final TbShopInfoRepository tbShopInfoRepository;
|
||||
private final TbPlussShopStaffRepository staffRepository;
|
||||
private final TbMerchantAccountRepository tbMerchantAccountRepository;
|
||||
|
||||
@Resource
|
||||
private LoginProperties loginProperties;
|
||||
|
||||
@@ -93,9 +98,25 @@ public class AuthorizationController {
|
||||
if (authUser.isChecked() && StringUtils.isBlank(authUser.getCode()) || authUser.isChecked() && !authUser.getCode().equalsIgnoreCase(code)) {
|
||||
throw new BadRequestException("验证码错误");
|
||||
}
|
||||
String loginpre="";
|
||||
String shopId="";
|
||||
// 判断是否是员工登录
|
||||
if (authUser.getLoginType() != null && "staff".equals(authUser.getLoginType())) {
|
||||
if (StrUtil.isBlank(authUser.getMerchantName())) {
|
||||
throw new BadRequestException("商户名称不能为空");
|
||||
}
|
||||
|
||||
TbMerchantAccount merchant = tbMerchantAccountRepository.findByAccount(authUser.getMerchantName());
|
||||
if (merchant == null) {
|
||||
throw new BadRequestException("商户不存在");
|
||||
}
|
||||
loginpre = merchant.getShopId() + "@";
|
||||
shopId = merchant.getShopId();
|
||||
}
|
||||
|
||||
//生成token
|
||||
UsernamePasswordAuthenticationToken authenticationToken =
|
||||
new UsernamePasswordAuthenticationToken(authUser.getUsername(), password);
|
||||
new UsernamePasswordAuthenticationToken(loginpre+authUser.getUsername(), password);
|
||||
Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
// 生成令牌与第三方系统获取令牌方式
|
||||
@@ -104,12 +125,22 @@ public class AuthorizationController {
|
||||
// SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
|
||||
// TbShopInfo byAccount = tbShopInfoRepository.findByAccount(jwtUserDto.getUsername());
|
||||
TbPlussShopStaff tbPlussShopStaff = staffRepository.queryByAccount(jwtUserDto.getUsername());
|
||||
TbPlussShopStaff tbPlussShopStaff;
|
||||
if (authUser.getLoginType() != null && "staff".equals(authUser.getLoginType())) {
|
||||
tbPlussShopStaff = staffRepository.queryByAccount(authUser.getUsername(),shopId);
|
||||
} else {
|
||||
tbPlussShopStaff = staffRepository.queryByAccount(authUser.getUsername());
|
||||
}
|
||||
if (tbPlussShopStaff != null && tbPlussShopStaff.getType().equals("staff")) {
|
||||
Integer isManage = tbPlussShopStaff.getIsManage();
|
||||
if (isManage != null && isManage != 1) {
|
||||
throw new BadRequestException("该账号无权限登录,请联系管理员");
|
||||
}
|
||||
|
||||
Integer status = tbPlussShopStaff.getStatus();
|
||||
if (status != null && status != 1) {
|
||||
throw new BadRequestException("该账号已被禁用,请联系管理员");
|
||||
}
|
||||
}
|
||||
TbShopInfo byAccount = tbShopInfoRepository.findById(Integer.valueOf(tbPlussShopStaff.getShopId())).get();
|
||||
//校验商户商户激活是否到期(未激活)
|
||||
@@ -119,6 +150,7 @@ public class AuthorizationController {
|
||||
put("user", jwtUserDto);
|
||||
if (byAccount != null) {
|
||||
put("shopId", byAccount.getId());
|
||||
put("loginType", org.apache.commons.lang3.StringUtils.isNotBlank(authUser.getLoginType())?authUser.getLoginType():"merchant");
|
||||
put("shopName", byAccount.getShopName());
|
||||
put("logo", byAccount.getLogo());
|
||||
}
|
||||
|
||||
@@ -33,6 +33,10 @@ public class AuthUserDto {
|
||||
@NotBlank
|
||||
private String password;
|
||||
|
||||
private String merchantName;
|
||||
|
||||
private String loginType = "merchant";
|
||||
|
||||
private String code;
|
||||
|
||||
private String uuid = "";
|
||||
|
||||
@@ -25,6 +25,8 @@ public class SuppFlow implements Serializable {
|
||||
|
||||
private List<ConInfos> list;
|
||||
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
@Data
|
||||
|
||||
@@ -59,8 +59,7 @@ public class TbConsSuppFlow implements Serializable {
|
||||
@ApiModelProperty(value = "productId")
|
||||
private Integer productId;
|
||||
|
||||
@Column(name = "`supplier_id`",nullable = false)
|
||||
@NotNull
|
||||
@Column(name = "`supplier_id`")
|
||||
@ApiModelProperty(value = "supplierId")
|
||||
private Integer supplierId;
|
||||
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* 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-08-05
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="view_handover")
|
||||
public class ViewHandover implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`trade_day`")
|
||||
@ApiModelProperty(value = "交班日期")
|
||||
private Integer 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(ViewHandover 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.ViewHandover;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author admin
|
||||
* @date 2024-08-05
|
||||
**/
|
||||
public interface ViewHandoverRepository extends JpaRepository<ViewHandover, Integer>, JpaSpecificationExecutor<ViewHandover> {
|
||||
}
|
||||
@@ -34,7 +34,6 @@ public class TbConCheckController {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询盘点耗材")
|
||||
@ApiOperation("查询盘点耗材")
|
||||
public ResponseEntity<Object> queryTbConCheck(TbConCheckQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbConCheckService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
|
||||
@@ -37,7 +37,6 @@ public class TbConUnitController {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询耗材单位添加")
|
||||
@ApiOperation("查询耗材单位添加")
|
||||
public ResponseEntity<Object> queryTbConUnit(TbConUnitQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbConUnitService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
|
||||
@@ -41,7 +41,6 @@ public class TbConsInfoController {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询耗材信息")
|
||||
@ApiOperation("查询耗材信息")
|
||||
public ResponseEntity<Object> queryTbConsInfo(TbConsInfoQueryCriteria criteria, Pageable pageable){
|
||||
pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("createTime").descending());
|
||||
@@ -72,9 +71,10 @@ public class TbConsInfoController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "stockInOut")
|
||||
@Log("耗材出入库")
|
||||
@Log("耗材::#resources.type")
|
||||
@ApiOperation("耗材出入库")
|
||||
public ResponseEntity<Object> stockInOut(@Validated @RequestBody SuppFlow resources) throws Exception {
|
||||
|
||||
tbConsInfoService.stockInOut(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ public class TbConsInfoFlowController {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询耗材流水")
|
||||
@ApiOperation("查询耗材流水")
|
||||
public ResponseEntity<Object> queryTbConsInfoFlow(TbConsInfoFlowQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbConsInfoFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
|
||||
@@ -34,7 +34,6 @@ public class TbConsSuppFlowController {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询入库记录")
|
||||
@ApiOperation("查询入库记录")
|
||||
public ResponseEntity<Object> queryTbConsSuppFlow(TbConsSuppFlowQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbConsSuppFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
|
||||
@@ -35,7 +35,6 @@ public class TbConsTypeController {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询耗材类型")
|
||||
@ApiOperation("查询耗材类型")
|
||||
public ResponseEntity<Object> queryTbConsType(TbConsTypeQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbConsTypeService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
|
||||
@@ -1,65 +1,57 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
//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
|
||||
// @ApiOperation("查询查询交班记录")
|
||||
// public ResponseEntity<Object> queryTbHandover(TbHandoverQueryCriteria criteria, Pageable pageable){
|
||||
// return new ResponseEntity<>(tbHandoverService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
// @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);
|
||||
// }
|
||||
//}
|
||||
@@ -37,7 +37,6 @@ public class TbProskuConController {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询商品规格耗材信息")
|
||||
@ApiOperation("查询商品规格耗材信息")
|
||||
public ResponseEntity<Object> queryTbProskuCon(TbProskuConQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbProskuConService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
|
||||
@@ -34,7 +34,6 @@ public class ViewConInfoFlowController {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询获取耗材流水信息")
|
||||
@ApiOperation("查询获取耗材流水信息")
|
||||
public ResponseEntity<Object> queryViewConInfoFlow(ViewConInfoFlowQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(viewConInfoFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
|
||||
@@ -34,7 +34,6 @@ public class ViewConSkuController {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询查询耗材规格信息")
|
||||
@ApiOperation("查询查询耗材规格信息")
|
||||
public ResponseEntity<Object> queryViewConSku(ViewConSkuQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(viewConSkuService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
|
||||
@@ -34,7 +34,6 @@ public class ViewConsSuppFlowController {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询出入库记录")
|
||||
@ApiOperation("查询出入库记录")
|
||||
public ResponseEntity<Object> queryViewConsSuppFlow(ViewConsSuppFlowQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(viewConsSuppFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package cn.ysk.cashier.cons.rest;
|
||||
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.cons.domain.ViewHandover;
|
||||
import cn.ysk.cashier.cons.service.ViewHandoverService;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewHandoverQueryCriteria;
|
||||
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-08-05
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "交班查询管理")
|
||||
@RequestMapping("/api/tbHandover")
|
||||
public class ViewHandoverController {
|
||||
|
||||
private final ViewHandoverService viewHandoverService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void exportViewHandover(HttpServletResponse response, ViewHandoverQueryCriteria criteria) throws IOException {
|
||||
viewHandoverService.download(viewHandoverService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询交班查询")
|
||||
public ResponseEntity<Object> queryViewHandover(ViewHandoverQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(viewHandoverService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增交班查询")
|
||||
@ApiOperation("新增交班查询")
|
||||
public ResponseEntity<Object> createViewHandover(@Validated @RequestBody ViewHandover resources){
|
||||
return new ResponseEntity<>(viewHandoverService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改交班查询")
|
||||
@ApiOperation("修改交班查询")
|
||||
public ResponseEntity<Object> updateViewHandover(@Validated @RequestBody ViewHandover resources){
|
||||
viewHandoverService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除交班查询")
|
||||
@ApiOperation("删除交班查询")
|
||||
public ResponseEntity<Object> deleteViewHandover(@RequestBody Integer[] ids) {
|
||||
viewHandoverService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ public class ViewProductSkuShopController {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询商品规格信息查询")
|
||||
@ApiOperation("查询商品规格信息查询")
|
||||
public ResponseEntity<Object> queryViewProductSkuShop(ViewProductSkuShopQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(viewProductSkuShopService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package cn.ysk.cashier.cons.service;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.ViewHandover;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewHandoverDto;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewHandoverQueryCriteria;
|
||||
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-08-05
|
||||
**/
|
||||
public interface ViewHandoverService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(ViewHandoverQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<ViewHandoverDto>
|
||||
*/
|
||||
List<ViewHandoverDto> queryAll(ViewHandoverQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return ViewHandoverDto
|
||||
*/
|
||||
ViewHandoverDto findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return ViewHandoverDto
|
||||
*/
|
||||
ViewHandoverDto create(ViewHandover resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(ViewHandover resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<ViewHandoverDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -12,8 +12,8 @@ import cn.ysk.cashier.annotation.Query;
|
||||
public class TbHandoverQueryCriteria{
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String tradeDay;
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<String> tradeDay;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
@@ -26,4 +26,6 @@ public class TbHandoverQueryCriteria{
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String merchantName;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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-08-05
|
||||
**/
|
||||
@Data
|
||||
public class ViewHandoverDto implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/** 交班日期 */
|
||||
private Integer 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,24 @@
|
||||
package cn.ysk.cashier.cons.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
import cn.ysk.cashier.annotation.Query;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-08-05
|
||||
**/
|
||||
@Data
|
||||
public class ViewHandoverQueryCriteria{
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer shopId;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String merchantName;
|
||||
/** BETWEEN */
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Integer> tradeDay;
|
||||
}
|
||||
@@ -2,7 +2,10 @@ package cn.ysk.cashier.cons.service.impl;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.TbConCheck;
|
||||
import cn.ysk.cashier.cons.domain.TbConsInfo;
|
||||
import cn.ysk.cashier.cons.domain.TbConsInfoFlow;
|
||||
import cn.ysk.cashier.cons.repository.TbConsInfoFlowRepository;
|
||||
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.utils.FileUtil;
|
||||
import cn.ysk.cashier.utils.PageUtil;
|
||||
import cn.ysk.cashier.utils.QueryHelp;
|
||||
@@ -39,6 +42,8 @@ public class TbConCheckServiceImpl implements TbConCheckService {
|
||||
|
||||
private final TbConsInfoRepository tbConsInfoRepository;
|
||||
|
||||
public final TbConsInfoFlowRepository tbConsInfoFlowRepository;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbConCheckQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbConCheck> page = tbConCheckRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
@@ -61,24 +66,56 @@ public class TbConCheckServiceImpl implements TbConCheckService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbConCheckDto create(TbConCheck resources) throws Exception {
|
||||
|
||||
if(BigDecimal.ZERO.compareTo(resources.getStockNumber())>0||resources.getStockNumber().compareTo(new BigDecimal("99999999999999"))>0){
|
||||
throw new BadRequestException("请输入正确的数值");
|
||||
}
|
||||
|
||||
|
||||
TbConsInfo consInfo= tbConsInfoRepository.getById(resources.getConInfoId());
|
||||
if(Objects.isNull(consInfo)){
|
||||
throw new Exception("耗材信息不存在");
|
||||
}
|
||||
TbConsInfoFlow flow=new TbConsInfoFlow();
|
||||
|
||||
BigDecimal stonum=consInfo.getStockNumber().subtract(consInfo.getStockConsume());
|
||||
if(consInfo.getStockNumber().compareTo(resources.getStockNumber())>=0){
|
||||
flow.setBizCode("checkStockOut");
|
||||
flow.setBizName("盘点出库");
|
||||
flow.setBizType("-");
|
||||
}else {
|
||||
flow.setBizCode("checkStockIn");
|
||||
flow.setBizName("盘点入库");
|
||||
flow.setBizType("+");
|
||||
}
|
||||
|
||||
consInfo.setStockConsume(consInfo.getStockConsume().add(resources.getLpNum().negate()));
|
||||
|
||||
consInfo.setStockConsume(BigDecimal.ZERO);
|
||||
consInfo.setStockNumber(resources.getStockNumber());
|
||||
consInfo.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||
tbConsInfoRepository.save(consInfo);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
TbConCheck conCheck=new TbConCheck();
|
||||
|
||||
conCheck.setConInfoId(consInfo.getId());
|
||||
conCheck.setConName(consInfo.getConName());
|
||||
conCheck.setPrice(consInfo.getPrice());
|
||||
conCheck.setAcStockNumber(consInfo.getStockNumber().subtract(consInfo.getStockConsume()));
|
||||
conCheck.setStockNumber(stonum);
|
||||
conCheck.setAcStockNumber(resources.getStockNumber());
|
||||
conCheck.setStockNumber(resources.getStockNumber());
|
||||
conCheck.setLpNum(resources.getLpNum());
|
||||
conCheck.setLpAmount(consInfo.getPrice().multiply(resources.getLpNum()));
|
||||
conCheck.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
|
||||
@@ -10,6 +10,7 @@ import cn.ysk.cashier.cons.service.TbConsInfoService;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConsInfoDto;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConsInfoQueryCriteria;
|
||||
import cn.ysk.cashier.cons.service.mapstruct.TbConsInfoMapper;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.pojo.product.TbProductStockOperate;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopInfo;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopPurveyor;
|
||||
@@ -174,6 +175,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void stockInOut(SuppFlow resources) throws Exception {
|
||||
log.info("resources:{}",JSON.toJSONString(resources));
|
||||
if (Objects.isNull(resources)) {
|
||||
throw new Exception("参数错误");
|
||||
}
|
||||
@@ -182,13 +184,17 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
if (Objects.isNull(tbShopInfo)) {
|
||||
throw new Exception("店铺信息不存在");
|
||||
}
|
||||
TbShopPurveyor purveyor = tbShopPurveyorRepository.getById(resources.getSupplierId());
|
||||
if (Objects.isNull(purveyor)) {
|
||||
throw new Exception("不存在的供应商");
|
||||
|
||||
TbShopPurveyor purveyor=null;
|
||||
TbProductStockOperate stockOperate = new TbProductStockOperate();
|
||||
if(Objects.nonNull(resources.getSupplierId())){
|
||||
purveyor = tbShopPurveyorRepository.getById(resources.getSupplierId());
|
||||
if (Objects.nonNull(purveyor)) {
|
||||
stockOperate.setPurveyorId(resources.getSupplierId().toString());
|
||||
stockOperate.setPurveyorName(purveyor.getPurveyorName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TbProductStockOperate stockOperate = new TbProductStockOperate();
|
||||
stockOperate.setShopId(tbShopInfo.getId().toString());
|
||||
stockOperate.setStockSnap("");
|
||||
stockOperate.setType(resources.getType().equals("in")?"cons_in":"cons_out");
|
||||
@@ -197,13 +203,12 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
operatorSnapMap.put("account", tbShopInfo.getAccount());
|
||||
|
||||
stockOperate.setOperatorSnap(JSON.toJSONString(operatorSnapMap));
|
||||
stockOperate.setRemark("");
|
||||
stockOperate.setRemark(resources.getRemark());
|
||||
stockOperate.setStockTime(System.currentTimeMillis());
|
||||
stockOperate.setCreatedAt(System.currentTimeMillis());
|
||||
stockOperate.setUpdatedAt(System.currentTimeMillis());
|
||||
stockOperate.setStatus("normal");
|
||||
stockOperate.setPurveyorId(resources.getSupplierId().toString());
|
||||
stockOperate.setPurveyorName(purveyor.getPurveyorName());
|
||||
|
||||
JSONArray array=new JSONArray();
|
||||
|
||||
|
||||
@@ -222,15 +227,15 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
|
||||
TbShopPurveyorTransact purveyorTransact = new TbShopPurveyorTransact();
|
||||
purveyorTransact.setShopId(tbShopInfo.getId().toString());
|
||||
purveyorTransact.setPurveyorName(purveyor.getPurveyorName());
|
||||
purveyorTransact.setPurveyorId(purveyor.getId().toString());
|
||||
purveyorTransact.setRemark("");
|
||||
purveyorTransact.setPurveyorName(Objects.isNull(purveyor)?"":purveyor.getPurveyorName());
|
||||
purveyorTransact.setPurveyorId(Objects.isNull(purveyor)?"":purveyor.getId().toString());
|
||||
purveyorTransact.setRemark(resources.getRemark());
|
||||
purveyorTransact.setCreatedAt(System.currentTimeMillis());
|
||||
purveyorTransact.setUpdatedAt(System.currentTimeMillis());
|
||||
|
||||
suppFlow.setConInfoId(info.getConTypeId());
|
||||
suppFlow.setShopId(resources.getShopId());
|
||||
suppFlow.setSupplierId(resources.getSupplierId());
|
||||
suppFlow.setSupplierId(Objects.isNull(resources.getSupplierId())?0: resources.getSupplierId());
|
||||
suppFlow.setType(resources.getType());
|
||||
suppFlow.setStockNumber(conInfos.getStockNumber());
|
||||
|
||||
@@ -255,9 +260,18 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
purveyorTransact.setType("cons_in");
|
||||
|
||||
object.put("number",conInfos.getStockNumber());
|
||||
} else {
|
||||
} else if("out".equals(resources.getType())) {
|
||||
stockOperate.setSubType(-1);
|
||||
|
||||
if(conInfos.getStockNumber().compareTo(info.getStockNumber())>0){
|
||||
throw new BadRequestException("出库数量大于现有的库存数量");
|
||||
}
|
||||
|
||||
info.setStockNumber(info.getStockNumber().subtract(conInfos.getStockNumber()));
|
||||
|
||||
|
||||
|
||||
|
||||
suppFlow.setBalance(info.getStockNumber().subtract(info.getStockConsume()).subtract(conInfos.getStockNumber()));
|
||||
|
||||
|
||||
@@ -265,12 +279,14 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||
flow.setBizName("耗材出库");
|
||||
flow.setBizType("-");
|
||||
|
||||
|
||||
purveyorTransact.setTotalAmount(resources.getAccountsPayable().negate());
|
||||
purveyorTransact.setPaidAmount(resources.getActualPayment());
|
||||
purveyorTransact.setTotalAmount(resources.getAccountsPayable().negate());
|
||||
|
||||
purveyorTransact.setWaitAmount((resources.getAccountsPayable().subtract(resources.getActualPayment())).negate());
|
||||
purveyorTransact.setType("cons_out");
|
||||
object.put("number",conInfos.getStockNumber());
|
||||
}else {
|
||||
throw new BadRequestException("错误操作类型");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ public class TbHandoverServiceImpl implements TbHandoverService {
|
||||
|
||||
@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));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
package cn.ysk.cashier.cons.service.impl;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.ViewHandover;
|
||||
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.ViewHandoverRepository;
|
||||
import cn.ysk.cashier.cons.service.ViewHandoverService;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewHandoverDto;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewHandoverQueryCriteria;
|
||||
import cn.ysk.cashier.cons.service.mapstruct.ViewHandoverMapper;
|
||||
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-08-05
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ViewHandoverServiceImpl implements ViewHandoverService {
|
||||
|
||||
private final ViewHandoverRepository viewHandoverRepository;
|
||||
private final ViewHandoverMapper viewHandoverMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(ViewHandoverQueryCriteria criteria, Pageable pageable){
|
||||
Page<ViewHandover> page = viewHandoverRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(viewHandoverMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ViewHandoverDto> queryAll(ViewHandoverQueryCriteria criteria){
|
||||
return viewHandoverMapper.toDto(viewHandoverRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public ViewHandoverDto findById(Integer id) {
|
||||
ViewHandover viewHandover = viewHandoverRepository.findById(id).orElseGet(ViewHandover::new);
|
||||
ValidationUtil.isNull(viewHandover.getId(),"ViewHandover","id",id);
|
||||
return viewHandoverMapper.toDto(viewHandover);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ViewHandoverDto create(ViewHandover resources) {
|
||||
return viewHandoverMapper.toDto(viewHandoverRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(ViewHandover resources) {
|
||||
ViewHandover viewHandover = viewHandoverRepository.findById(resources.getId()).orElseGet(ViewHandover::new);
|
||||
ValidationUtil.isNull( viewHandover.getId(),"ViewHandover","id",resources.getId());
|
||||
viewHandover.copy(resources);
|
||||
viewHandoverRepository.save(viewHandover);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
viewHandoverRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<ViewHandoverDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (ViewHandoverDto viewHandover : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("交班日期", viewHandover.getTradeDay());
|
||||
map.put("打印机编号", viewHandover.getPrintNo());
|
||||
map.put(" dutyId", viewHandover.getDutyId());
|
||||
map.put(" shopId", viewHandover.getShopId());
|
||||
map.put(" merchantName", viewHandover.getMerchantName());
|
||||
map.put(" startTime", viewHandover.getStartTime());
|
||||
map.put(" endTime", viewHandover.getEndTime());
|
||||
map.put(" staffId", viewHandover.getStaffId());
|
||||
map.put(" staffName", viewHandover.getStaffName());
|
||||
map.put(" payInfos", viewHandover.getPayInfos());
|
||||
map.put(" memberData", viewHandover.getMemberData());
|
||||
map.put(" productCategories", viewHandover.getProductCategories());
|
||||
map.put(" totalAmount", viewHandover.getTotalAmount());
|
||||
map.put(" imprest", viewHandover.getImprest());
|
||||
map.put(" payable", viewHandover.getPayable());
|
||||
map.put(" handIn", viewHandover.getHandIn());
|
||||
map.put(" returnAmount", viewHandover.getReturnAmount());
|
||||
map.put(" orderNum", viewHandover.getOrderNum());
|
||||
map.put(" quickAmount", viewHandover.getQuickAmount());
|
||||
map.put(" productInfoPos", viewHandover.getProductInfoPos());
|
||||
map.put(" productInfos", viewHandover.getProductInfos());
|
||||
map.put(" createTime", viewHandover.getCreateTime());
|
||||
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.ViewHandover;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewHandoverDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-08-05
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface ViewHandoverMapper extends BaseMapper<ViewHandoverDto, ViewHandover> {
|
||||
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
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;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.service.product.StockService;
|
||||
import cn.ysk.cashier.utils.BeanUtil;
|
||||
import cn.ysk.cashier.utils.SecurityUtils;
|
||||
import cn.ysk.cashier.vo.StockPageImpl;
|
||||
import cn.ysk.cashier.vo.StockUpdateValueVO;
|
||||
import cn.ysk.cashier.vo.StockUpdateWarnLineVO;
|
||||
import cn.ysk.cashier.vo.StockV2Vo;
|
||||
@@ -18,15 +14,12 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -113,7 +106,8 @@ public class StockController {
|
||||
return new ResponseEntity<>(dataMap, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@AnonymousAccess
|
||||
|
||||
@Log("商品库存 上下架商品")
|
||||
@PutMapping("/grounding")
|
||||
@ApiOperation("上下架商品")
|
||||
public ResponseEntity<Object> grounding(
|
||||
@@ -140,6 +134,7 @@ public class StockController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("商品库存 修改商品状态")
|
||||
@PutMapping("productStatus")
|
||||
public ResponseEntity<Object> updateProductStatus(@RequestBody StockUpdateValueVO updateValueVO) {
|
||||
stockService.updateProductStatus(updateValueVO);
|
||||
|
||||
@@ -39,8 +39,8 @@ public class TbProductController {
|
||||
}
|
||||
|
||||
@GetMapping("/isHot")
|
||||
public ResponseEntity<Object> updateIsHot(@RequestParam String shopId, @RequestParam Integer id){
|
||||
tbProductService.updateIsHot(id,shopId);
|
||||
public ResponseEntity<Object> updateIsHot(@RequestParam Integer isHot, @RequestParam Integer id){
|
||||
tbProductService.updateIsHot(id,isHot);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class TbProductStockOperateController {
|
||||
|
||||
@PostMapping("/outAndOn")
|
||||
@ApiOperation("新增/product/StockOperate")
|
||||
@Log("出入库")
|
||||
@Log("商品::#outAndOnDto.type")
|
||||
// @PreAuthorize("@el.check('tbProductStockOperate:add')")
|
||||
public ResponseEntity<Object> createOutAndONOperate(@RequestBody OutAndOnDto outAndOnDto){
|
||||
return new ResponseEntity<>(tbProductStockOperateService.createOutAndONOperate(outAndOnDto),HttpStatus.CREATED);
|
||||
|
||||
@@ -26,7 +26,6 @@ public class TbCouponCategoryController {
|
||||
private final TbCouponCategoryService tbCouponCategoryService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询团购卷类别")
|
||||
@ApiOperation("查询团购卷类别")
|
||||
public ResponseEntity<Object> queryTbCouponCategory(TbCouponCategoryQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbCouponCategoryService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
|
||||
@@ -1,25 +1,9 @@
|
||||
/*
|
||||
* 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.shop;
|
||||
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.pojo.shop.TbPlussShopStaff;
|
||||
import cn.ysk.cashier.service.shop.TbPlussShopStaffService;
|
||||
import cn.ysk.cashier.dto.shop.TbPlussShopStaffQueryCriteria;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -91,4 +75,15 @@ public class TbPlussShopStaffController {
|
||||
tbPlussShopStaffService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
// @ApiOperation("修改个人密码")
|
||||
// @PostMapping(value = "/upPass")
|
||||
// @AnonymousPostMapping
|
||||
// public ResponseEntity<Object> upshopStaffPass(HttpServletRequest request, @RequestBody Map<String, String> map){
|
||||
// tbShopInfoService.upShopPass(map.get("username"),map.get("password"));
|
||||
// //根据token踢出用户
|
||||
// onlineUserService.logout(tokenProvider.getToken(request));
|
||||
// log.info("修改商户密码成功。");
|
||||
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
// }
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class TbShopInfoController {
|
||||
public ResponseEntity<Object> upShopPass(HttpServletRequest request, @RequestBody Map<String, String> map) throws Exception {
|
||||
tbShopInfoService.upShopPass(map.get("username"),map.get("password"));
|
||||
//根据token踢出用户
|
||||
// onlineUserService.logout(tokenProvider.getToken(request));
|
||||
onlineUserService.logout(tokenProvider.getToken(request));
|
||||
log.info("修改商户密码成功。");
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package cn.ysk.cashier.mybatis.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 商家openid信息表
|
||||
* @TableName tb_shop_open_id
|
||||
*/
|
||||
@Table(name="tb_shop_open_id")
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
public class TbShopOpenId implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer shopId;
|
||||
|
||||
/**
|
||||
* 已经订阅消息的商家微信号
|
||||
*/
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 类型 -1 任意消息 0库存预警
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.ysk.cashier.mybatis.mapper;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopOpenId;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_shop_open_id(商家openid信息表)】的数据库操作Mapper
|
||||
* @createDate 2024-08-02 10:00:27
|
||||
* @Entity cn.ysk.cashier.mybatis.entity.TbShopOpenId
|
||||
*/
|
||||
public interface TbShopOpenIdMapper extends BaseMapper<TbShopOpenId> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.ysk.cashier.mybatis.service;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopOpenId;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_shop_open_id(商家openid信息表)】的数据库操作Service
|
||||
* @createDate 2024-08-02 10:00:27
|
||||
*/
|
||||
public interface TbShopOpenIdService extends IService<TbShopOpenId> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopOpenId;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopOpenIdService;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbShopOpenIdMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_shop_open_id(商家openid信息表)】的数据库操作Service实现
|
||||
* @createDate 2024-08-02 10:00:27
|
||||
*/
|
||||
@Service
|
||||
public class TbShopOpenIdServiceImpl extends ServiceImpl<TbShopOpenIdMapper, TbShopOpenId>
|
||||
implements TbShopOpenIdService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public interface StockCountRepository extends JpaRepository<StockCountDTO, Integ
|
||||
"\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" +
|
||||
"END AS stock_number, ifnull(sku.spec_snap, '') spec_snap\n" +
|
||||
"FROM\n" +
|
||||
"tb_order_detail info\n" +
|
||||
"LEFT JOIN tb_order_info orders ON orders.id = info.order_id\n" +
|
||||
|
||||
@@ -3,6 +3,7 @@ package cn.ysk.cashier.repository.order;
|
||||
import cn.ysk.cashier.dto.product.StockCountDTO;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderDetail;
|
||||
import cn.ysk.cashier.vo.TbOrderPayCountVo;
|
||||
import cn.ysk.cashier.vo.TbOrderSaleVO;
|
||||
import cn.ysk.cashier.vo.TbOrderSalesCountByDayVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -14,6 +15,8 @@ import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
|
||||
import javax.persistence.Tuple;
|
||||
import java.sql.Time;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -82,7 +85,9 @@ public interface TbOrderDetailRepository extends JpaRepository<TbOrderDetail, In
|
||||
"SUM(CASE WHEN orders.orderType='return' THEN info.num ELSE 0 END), " +
|
||||
"SUM(info.num), " +
|
||||
"SUM(CASE WHEN orders.orderType!='return' THEN info.priceAmount ELSE 0 END), " +
|
||||
"SUM(CASE WHEN orders.orderType='return' THEN info.priceAmount ELSE 0 END)) " +
|
||||
"SUM(CASE WHEN orders.orderType='return' THEN info.priceAmount ELSE 0 END), " +
|
||||
"info.productId, " +
|
||||
"info.productSkuId ) " +
|
||||
"FROM TbOrderInfo orders " +
|
||||
"LEFT JOIN TbOrderDetail info on orders.id=info.orderId " +
|
||||
"LEFT JOIN TbProduct pro ON info.productId = pro.id " +
|
||||
@@ -97,6 +102,20 @@ public interface TbOrderDetailRepository extends JpaRepository<TbOrderDetail, In
|
||||
"ORDER BY salesNum DESC")
|
||||
List<TbOrderSalesCountByDayVo> queryTbOrderSalesCountByDay(@Param("shopId") Integer shopId,@Param("cateId")String cateId,@Param("proName")String proName, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
|
||||
@Query(value = "SELECT " +
|
||||
"new cn.ysk.cashier.vo.TbOrderSaleVO(oi.orderNo, od.num, od.price, od.status)\n" +
|
||||
"FROM\n" +
|
||||
"TbOrderInfo oi\n" +
|
||||
"LEFT JOIN TbOrderDetail od ON oi.id = od.orderId \n" +
|
||||
"WHERE\n" +
|
||||
"od.shopId = :shopId \n" +
|
||||
"AND ( od.status = 'closed' OR od.status = 'refund' ) \n" +
|
||||
"AND od.createTime > :startTime \n" +
|
||||
"AND od.createTime < :endTime \n" +
|
||||
"AND (:productId is null or od.productId = :productId)\n" +
|
||||
"AND (:productId is null or od.productSkuId = :productSkuId)")
|
||||
List<TbOrderSaleVO> querySaleOrderInfo(@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime, @Param("productId") Integer productId, @Param("productSkuId") Integer productSkuId, @Param("shopId") Integer shopId);
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.TbOrderSalesCountByDayVo(" +
|
||||
"COALESCE(CAST(SUM(CASE WHEN orders.orderType!='return' THEN info.num ELSE 0 END) as long),0), " +
|
||||
"COALESCE(CAST(SUM(CASE WHEN orders.orderType='return' THEN info.num ELSE 0 END) as long),0))" +
|
||||
@@ -145,4 +164,5 @@ public interface TbOrderDetailRepository extends JpaRepository<TbOrderDetail, In
|
||||
List<Integer> findOrderIdsByProductNameLike(@Param("productName") String productName, @Param("shop_id") String shopId,
|
||||
@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ public interface TbProductRepository extends JpaRepository<TbProduct, Integer>,
|
||||
@Query(value = "update tb_product set status = -1 where id in :productIds",nativeQuery = true)
|
||||
@Modifying
|
||||
void updateByStatus(List<Integer> productIds);
|
||||
@Query(value = "update tb_product set is_hot=1 where id = :id",nativeQuery = true)
|
||||
@Query(value = "update tb_product set is_hot=:isHot where id = :id",nativeQuery = true)
|
||||
@Modifying
|
||||
void updateIsHot(@Param("id") Integer id);
|
||||
void updateIsHot(@Param("id") Integer id,@Param("isHot")Integer isHot);
|
||||
|
||||
@Query(value = "update tb_product set is_stock=:isStock where id = :proId and shop_id=:shopId",nativeQuery = true)
|
||||
@Modifying
|
||||
@@ -58,4 +58,10 @@ public interface TbProductRepository extends JpaRepository<TbProduct, Integer>,
|
||||
|
||||
@Query("select product from TbProduct product where product.id=:id and product.shopId=:shopId")
|
||||
TbProduct selectByShopIdAndId(Integer id, String shopId);
|
||||
|
||||
@Query("select product from TbProduct product where product.shopId=:shopId")
|
||||
List<TbProduct> selectByShopId(String shopId);
|
||||
|
||||
@Query(value = "select b.* from tb_product_sku as a left join tb_product as b on a.product_id=b.id where a.id=:skuId", nativeQuery = true)
|
||||
TbProduct selectBySkuId(@Param("skuId") Integer skuId);
|
||||
}
|
||||
|
||||
@@ -63,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, CASE WHEN sku.isGrounding=1 THEN true ELSE false END as isGrounding) " +
|
||||
", pro.isDistribute, pro.isPauseSale, true, sku.warnLine, pro.lowPrice, CASE WHEN sum(sku.isGrounding) > 0 THEN true ELSE false END as isGrounding) " +
|
||||
"from " +
|
||||
"TbProduct pro " +
|
||||
"LEFT JOIN TbProductSku sku on pro.id = sku.productId " +
|
||||
|
||||
@@ -1,18 +1,3 @@
|
||||
/*
|
||||
* 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.shop;
|
||||
|
||||
import cn.ysk.cashier.pojo.shop.TbPlussShopStaff;
|
||||
@@ -40,6 +25,17 @@ public interface TbPlussShopStaffRepository extends JpaRepository<TbPlussShopSta
|
||||
@Query("update TbPlussShopStaff set password = :password , updatedAt = :lastPasswordResetTime where account = :account")
|
||||
void updatePass(String account, String password, Long lastPasswordResetTime);
|
||||
|
||||
@Modifying
|
||||
@Query("update TbPlussShopStaff set password = :password , updatedAt = :lastPasswordResetTime where account = :account and shopId=:shopId")
|
||||
void updatePassAndShopId(String account, String shopId, String password, Long lastPasswordResetTime);
|
||||
|
||||
@Query("select staff from TbPlussShopStaff as staff where staff.account = :account")
|
||||
TbPlussShopStaff queryByAccount(String account);
|
||||
|
||||
@Query("select staff from TbPlussShopStaff as staff where staff.account = :account and staff.shopId=:shopId")
|
||||
TbPlussShopStaff queryByAccount(String account,String shopId);
|
||||
|
||||
@Modifying
|
||||
@Query("update TbPlussShopStaff set name=:name where shopId = :shopId and type='master'")
|
||||
void updateNameById(String name, String shopId);
|
||||
}
|
||||
@@ -33,10 +33,12 @@ import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -404,9 +406,12 @@ public class SummaryServiceImpl implements SummaryService {
|
||||
@Override
|
||||
public void download(ShopSummaryDto summaryDto, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
// ConcurrentLinkedQueue<Map<String, Object>> list = new ConcurrentLinkedQueue();
|
||||
if(StringUtils.isBlank(summaryDto.getCateId())){
|
||||
summaryDto.setCateId(null);
|
||||
}
|
||||
|
||||
ArrayList<Integer> mergeRowIndex = new ArrayList<>();
|
||||
if (summaryDto.getType() != null && summaryDto.getType() == 1) {//金额
|
||||
Long start = 1704038400000L;
|
||||
Long end = Instant.now().toEpochMilli();
|
||||
@@ -430,23 +435,39 @@ public class SummaryServiceImpl implements SummaryService {
|
||||
summaryDto.setStartTime(DateUtil.toDate(DateUtil.fromTimeStamp(1704038400L)));
|
||||
summaryDto.setEndTime(new Date());
|
||||
}
|
||||
List<TbOrderSalesCountByDayVo> tbOrderSalesCountByDayVos = detailRepository.queryTbOrderSalesCountByDay(Integer.valueOf(summaryDto.getShopId()),summaryDto.getCateId(),summaryDto.getProName(), summaryDto.getStartTime(), summaryDto.getEndTime());
|
||||
for (TbOrderSalesCountByDayVo all : tbOrderSalesCountByDayVos) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("商品分类", all.getCateName());
|
||||
map.put("商品名称", all.getProductName());
|
||||
map.put("单 位", all.getUnitName());
|
||||
map.put("商品规格", StringUtils.isBlank(all.getProductSkuName()) ? "" : all.getProductSkuName());
|
||||
map.put("销 售 额", all.getSalesAmount());
|
||||
map.put("销 量", all.getSalesNum());
|
||||
map.put("单 价", all.getPrice());
|
||||
map.put("退 单 量", all.getRefNum());
|
||||
map.put("退 单 额", all.getRefAmount().compareTo(BigDecimal.ZERO)==0?all.getRefAmount():"-"+all.getRefAmount());
|
||||
map.put("总 量", all.getNum()-all.getRefNum());
|
||||
list.add(map);
|
||||
}
|
||||
List<TbOrderSalesCountByDayVo> tbOrderSalesCountByDayVos = detailRepository
|
||||
.queryTbOrderSalesCountByDay(Integer.valueOf(summaryDto.getShopId()),summaryDto.getCateId(),summaryDto.getProName(), summaryDto.getStartTime(), summaryDto.getEndTime());
|
||||
tbOrderSalesCountByDayVos.forEach(all -> {
|
||||
List<TbOrderSaleVO> tbOrderSaleVOS = detailRepository.querySaleOrderInfo(new Timestamp(summaryDto.getStartTime().getTime()),
|
||||
new Timestamp(summaryDto.getEndTime().getTime()), all.getProductId(), all.getProductSkuId(), Integer.valueOf(summaryDto.getShopId()));
|
||||
for (TbOrderSaleVO tbOrderSaleVO : tbOrderSaleVOS) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("商品分类", all.getCateName());
|
||||
map.put("商品名称", all.getProductName());
|
||||
map.put("单 位", all.getUnitName());
|
||||
map.put("商品规格", StringUtils.isBlank(all.getProductSkuName()) ? "" : all.getProductSkuName());
|
||||
map.put("销 售 额", all.getSalesAmount());
|
||||
map.put("销 量", all.getSalesNum());
|
||||
map.put("单 价", all.getPrice());
|
||||
map.put("退 单 量", all.getRefNum());
|
||||
map.put("退 单 额", all.getRefAmount().compareTo(BigDecimal.ZERO)==0?all.getRefAmount():"-"+all.getRefAmount());
|
||||
map.put("总 量", all.getNum()-all.getRefNum());
|
||||
map.put("订单编号", tbOrderSaleVO.getOrderNo());
|
||||
map.put("售出数量", tbOrderSaleVO.getNum());
|
||||
list.add(map);
|
||||
}
|
||||
if (!tbOrderSaleVOS.isEmpty()) {
|
||||
if (mergeRowIndex.isEmpty()) {
|
||||
mergeRowIndex.add(tbOrderSaleVOS.size());
|
||||
}else {
|
||||
mergeRowIndex.add(mergeRowIndex.get(mergeRowIndex.size() - 1) + tbOrderSaleVOS.size());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
FileUtil.downloadExcelAndMerge(list, 10, response, mergeRowIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -409,7 +409,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||
case "offline":
|
||||
tbOrderInfo.setOrderType("线下");
|
||||
break;
|
||||
case "return ":
|
||||
case "return":
|
||||
tbOrderInfo.setOrderType("退单");
|
||||
break;
|
||||
default:
|
||||
@@ -466,7 +466,6 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||
|
||||
map.put("支付类型", tbOrderInfo.getPayType());
|
||||
map.put("订单金额", tbOrderInfo.getOrderAmount());
|
||||
map.put("退单金额", tbOrderInfo.getRefundAmount());
|
||||
map.put("支付金额", tbOrderInfo.getPayAmount());
|
||||
switch (tbOrderInfo.getStatus()) {
|
||||
case "unpaid":
|
||||
@@ -485,6 +484,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||
tbOrderInfo.setStatus("申请退单中");
|
||||
break;
|
||||
case "refund":
|
||||
map.put("支付金额", "-"+tbOrderInfo.getPayAmount());
|
||||
tbOrderInfo.setStatus("退单完成");
|
||||
break;
|
||||
case "cancelled":
|
||||
|
||||
@@ -17,10 +17,7 @@ import cn.ysk.cashier.repository.shop.TbShopUnitRepository;
|
||||
import cn.ysk.cashier.service.TbProductStockOperateService;
|
||||
import cn.ysk.cashier.service.product.StockService;
|
||||
import cn.ysk.cashier.service.product.TbProductService;
|
||||
import cn.ysk.cashier.utils.CacheKey;
|
||||
import cn.ysk.cashier.utils.FileUtil;
|
||||
import cn.ysk.cashier.utils.RedisUtils;
|
||||
import cn.ysk.cashier.utils.StringUtils;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import cn.ysk.cashier.vo.StockUpdateValueVO;
|
||||
import cn.ysk.cashier.vo.StockUpdateWarnLineVO;
|
||||
import cn.ysk.cashier.vo.StockV2Vo;
|
||||
@@ -62,6 +59,7 @@ public class StockServiceImpl implements StockService {
|
||||
private final TbShopUnitRepository shopUnitRepository;
|
||||
private final TbProductStockDetailRepository tbProductStockDetailRepository;
|
||||
private final TbProductRepository tbProductRepository;
|
||||
private final WxMsgUtils wxMsgUtils;
|
||||
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
@@ -349,6 +347,15 @@ public class StockServiceImpl implements StockService {
|
||||
|
||||
Query nativeQuery = em.createNativeQuery(String.valueOf(sqlQuery));
|
||||
nativeQuery.executeUpdate();
|
||||
|
||||
TbProduct product = tbProductRepository.selectBySkuId(Integer.valueOf(updateValueVO.getTargetId()));
|
||||
TbProductSku tbProductSku = tbProductSkuRepository.findById(Integer.valueOf(updateValueVO.getTargetId())).orElse(null);
|
||||
// 推送微信操作消息
|
||||
if (product != null && tbProductSku != null) {
|
||||
wxMsgUtils.aboardOperationMsg(("0".equals(updateValueVO.getUpdateValue()) ? "关闭sku售罄: " : "开启sku售罄: ") + product.getName() + "/"+ tbProductSku.getSpecSnap());
|
||||
}else {
|
||||
log.warn("推送微信操作消息失败,未查询到商品信息,skuId: {}", updateValueVO.getTargetId());
|
||||
}
|
||||
return;
|
||||
case "stock":
|
||||
sqlQuery.append(" set is_stock = ").append(updateValueVO.getUpdateValue());
|
||||
@@ -358,6 +365,13 @@ public class StockServiceImpl implements StockService {
|
||||
break;
|
||||
case "pauseSale":
|
||||
sqlQuery.append(" set is_pause_sale = ").append(updateValueVO.getUpdateValue());
|
||||
TbProduct product1 = tbProductRepository.selectBySkuId(Integer.valueOf(updateValueVO.getTargetId()));
|
||||
// 推送微信操作消息
|
||||
if (product1 != null) {
|
||||
wxMsgUtils.aboardOperationMsg(("0".equals(updateValueVO.getUpdateValue()) ? "关闭售罄: " : "开启售罄: ") + product1.getName());
|
||||
}else {
|
||||
log.warn("推送微信操作消息失败,未查询到商品信息,skuId: {}", updateValueVO.getTargetId());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException("无效更新类型");
|
||||
@@ -393,7 +407,10 @@ public class StockServiceImpl implements StockService {
|
||||
if (tbProductSku == null) {
|
||||
throw new BadRequestException("商品不存在,skuId: " + skuId);
|
||||
}
|
||||
|
||||
TbProduct product = tbProductRepository.selectByShopIdAndId(Integer.parseInt(tbProductSku.getProductId()), String.valueOf(shopId));
|
||||
// 推送微信操作消息
|
||||
wxMsgUtils.aboardOperationMsg((isGrounding ? "上架商品: " : "下架商品: ") + product.getName());
|
||||
// 共享库存下架所有sku
|
||||
if (product.getIsDistribute().equals(1)) {
|
||||
tbProductSkuRepository.updateGroundingByProId(product.getId().toString(), isGrounding ? 1 : 0);
|
||||
|
||||
@@ -46,6 +46,7 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
|
||||
private final TbProductGroupRepository tbProductGroupRepository;
|
||||
private final TbProductGroupMapper tbProductGroupMapper;
|
||||
private final TbProductRepository tbProductRepository;
|
||||
private final WxMsgUtils wxMsgUtils;
|
||||
|
||||
@Resource
|
||||
private OnlineUserService onlineUserService;
|
||||
@@ -104,6 +105,9 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
|
||||
ValidationUtil.isNull( tbProductGroup.getId(),"TbProductGroup","id",resources.getId());
|
||||
tbProductGroup.copy(resources);
|
||||
tbProductGroupRepository.save(tbProductGroup);
|
||||
|
||||
// 推送微信操作消息
|
||||
wxMsgUtils.aboardOperationMsg((resources.getIsShow() == 0 ? "关闭分组: " : "开启分组: ") + tbProductGroup.getName());
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -224,4 +228,4 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,6 +373,7 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TbProduct save = tbProductRepository.save(product);
|
||||
if (save.getId() == null) {
|
||||
throw new BadRequestException("添加商品失败");
|
||||
@@ -381,6 +382,16 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
tbProductRepository.save(save);
|
||||
//sku
|
||||
if (resources.getSkuList() != null) {
|
||||
Integer warnLine = 0;
|
||||
List<TbProduct> productList = tbProductRepository.selectByShopId(resources.getShopId());
|
||||
if (!productList.isEmpty()) {
|
||||
TbProduct p = productList.get(0);
|
||||
List<TbProductSku> productSkus = tbProductSkuRepository.searchSku(p.getId().toString());
|
||||
if (!productSkus.isEmpty()) {
|
||||
warnLine = productSkus.get(0).getWarnLine();
|
||||
}
|
||||
}
|
||||
|
||||
List<TbProductSku> skuList = new ArrayList<>();
|
||||
for (TbProductSku sku : resources.getSkuList()) {
|
||||
sku.setProductId(String.valueOf(save.getId()));
|
||||
@@ -388,6 +399,7 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
sku.setCreatedAt(Instant.now().toEpochMilli());
|
||||
sku.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
sku.setIsGrounding(1);
|
||||
sku.setWarnLine(warnLine);
|
||||
skuList.add(sku);
|
||||
}
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuRepository.saveAll(skuList);
|
||||
@@ -509,9 +521,8 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateIsHot(Integer id, String shopId) {
|
||||
tbProductRepository.updateNullHot(shopId);
|
||||
tbProductRepository.updateIsHot(id);
|
||||
public void updateIsHot(Integer id,Integer isHot) {
|
||||
tbProductRepository.updateIsHot(id,isHot);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
@@ -193,7 +193,7 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
|
||||
// productStockDetail.setSkuId(s.getSkuId().toString());
|
||||
productStockDetail.setIsStock(s.getIsStock());//是否开启库存
|
||||
productStockDetail.setLeftNumber(s.getStockNumber()+s.getStockCount());//原库存
|
||||
productStockDetail.setSpecSnap(s.getSpecSnap());
|
||||
productStockDetail.setSpecSnap(s.getSpecSnap());
|
||||
productStockDetail.setUnitName(s.getUnitName());
|
||||
productStockDetail.setStockNumber(-Double.valueOf(s.getStockCount()));
|
||||
productStockDetail.setSourcePath("NORMAL");
|
||||
|
||||
@@ -160,6 +160,7 @@ public class TbProductStocktakinServiceImpl implements TbProductStocktakinServic
|
||||
|
||||
|
||||
round = (int) Math.floor( productSku.getStockNumber());
|
||||
productStockDetail.setSpecSnap(productSku.getSpecSnap());
|
||||
|
||||
productStockDetail.setSubType(productStocktakinDTO.getStocktakinNum() > productSku.getStockNumber() ? 1 : -1);
|
||||
stockOperate.setType(productStocktakinDTO.getStocktakinNum() > productSku.getStockNumber() ? "盘点入库" : "盘点出库");
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package cn.ysk.cashier.service.impl.shopimpl;
|
||||
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.exception.EntityExistException;
|
||||
import cn.ysk.cashier.pojo.shop.TbPlussShopStaff;
|
||||
import cn.ysk.cashier.system.domain.Dept;
|
||||
import cn.ysk.cashier.system.domain.Job;
|
||||
@@ -39,9 +40,11 @@ import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
@@ -61,6 +64,9 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
private final UserService userService;
|
||||
|
||||
// 正则表达式:(\u4e00-\u9fa5) 表示匹配一个中文字符,.* 表示匹配零个或多个任意字符
|
||||
private final Pattern pattern = Pattern.compile("[\\u4e00-\\u9fa5]");
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbPlussShopStaffQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbPlussShopStaff> page = tbPlussShopStaffRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
@@ -78,7 +84,7 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(id).orElseGet(TbPlussShopStaff::new);
|
||||
ValidationUtil.isNull(tbPlussShopStaff.getId(),"TbPlussShopStaff","id",id);
|
||||
TbPlussShopStaffDto dto = tbPlussShopStaffMapper.toDto(tbPlussShopStaff);
|
||||
UserDto userDto = userService.findByName(tbPlussShopStaff.getAccount());
|
||||
UserDto userDto = userService.findByName(tbPlussShopStaff.getShopId()+"@"+tbPlussShopStaff.getAccount());
|
||||
// dto.setUser(userDto);
|
||||
if(!CollectionUtils.isEmpty(userDto.getRoles())){
|
||||
dto.setRoleId(userDto.getRoles().stream().findFirst().get().getId());
|
||||
@@ -94,6 +100,21 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
if (!PhoneUtil.validator(resources.getPhone())){
|
||||
throw new BadRequestException("手机号格式有误");
|
||||
}
|
||||
if (userRepository.findByUsername(resources.getShopId()+"@"+resources.getAccount()) != null) {
|
||||
throw new BadRequestException("员工账号已存在");
|
||||
}
|
||||
|
||||
if (pattern.matcher(resources.getCode()).find()) {
|
||||
throw new BadRequestException("员工编号不能包含中文");
|
||||
}
|
||||
|
||||
if (resources.getRoleId()==null) {
|
||||
throw new BadRequestException("请选择角色");
|
||||
}
|
||||
|
||||
if (resources.getMaxDiscountAmount().compareTo(new BigDecimal(100000000L)) > 0) {
|
||||
throw new BadRequestException("最大优惠金额过大");
|
||||
}
|
||||
resources.setCreatedAt(Instant.now().toEpochMilli());
|
||||
|
||||
//添加收银系统后台账号
|
||||
@@ -105,7 +126,7 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
user.setPassword(passwordEncoder.encode(resources.getPassword()));
|
||||
resources.setPassword(MD5Utils.md5(resources.getPassword()));
|
||||
}
|
||||
user.setUsername(resources.getAccount());
|
||||
user.setUsername(resources.getShopId() + "@" +resources.getAccount());
|
||||
user.setNickName(resources.getName());
|
||||
user.setPhone(resources.getPhone());
|
||||
user.setEnabled(true);
|
||||
@@ -116,11 +137,7 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
|
||||
Set<Role> roles = new HashSet<>();
|
||||
Role role = new Role();
|
||||
if(resources.getRoleId()!=null){
|
||||
role.setId(resources.getRoleId());
|
||||
}else {
|
||||
role.setId(2l);
|
||||
}
|
||||
role.setId(resources.getRoleId());
|
||||
roles.add(role);
|
||||
user.setRoles(roles);
|
||||
|
||||
@@ -136,8 +153,21 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbPlussShopStaff resources) {
|
||||
if (StringUtils.isBlank(resources.getPassword())) {
|
||||
resources.setPassword(null);
|
||||
}
|
||||
|
||||
if (pattern.matcher(resources.getCode()).find()) {
|
||||
throw new BadRequestException("员工编号不能包含中文");
|
||||
}
|
||||
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(resources.getId()).orElseGet(TbPlussShopStaff::new);
|
||||
resources.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
User sysUser = userRepository.findByUsername(resources.getShopId()+"@"+tbPlussShopStaff.getAccount());
|
||||
if(!tbPlussShopStaff.getAccount().equals(resources.getAccount())){
|
||||
if (userRepository.findByUsername(resources.getShopId()+"@"+resources.getAccount()) != null) {
|
||||
throw new BadRequestException("员工账号不可重复");
|
||||
}
|
||||
}
|
||||
resources.setUpdatedAt(System.currentTimeMillis());
|
||||
ValidationUtil.isNull( tbPlussShopStaff.getId(),"TbPlussShopStaff","id",resources.getId());
|
||||
tbPlussShopStaff.copy(resources);
|
||||
if (StringUtils.isNotBlank(resources.getPassword())) {
|
||||
@@ -145,11 +175,11 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
}
|
||||
tbPlussShopStaffRepository.save(tbPlussShopStaff);
|
||||
//修改 sysUser账号
|
||||
User sysUser = userRepository.findByUsername(tbPlussShopStaff.getAccount());
|
||||
Set<Role> roles = new HashSet<>();
|
||||
Role role = new Role();
|
||||
role.setId(resources.getRoleId());
|
||||
roles.add(role);
|
||||
sysUser.setUsername(resources.getShopId()+"@"+resources.getAccount());
|
||||
sysUser.setRoles(roles);
|
||||
sysUser.setNickName(resources.getName());
|
||||
if (StringUtils.isNotBlank(resources.getPassword())) {
|
||||
@@ -173,7 +203,7 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
Set<Long> sysUserIds=new HashSet<>();
|
||||
for (Integer id : ids) {
|
||||
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(id).get();
|
||||
User sysUser = userRepository.findByUsername(tbPlussShopStaff.getAccount());
|
||||
User sysUser = userRepository.findByUsername(tbPlussShopStaff.getShopId()+"@"+tbPlussShopStaff.getAccount());
|
||||
tbPlussShopStaffRepository.deleteById(id);
|
||||
sysUserIds.add(sysUser.getId());
|
||||
}
|
||||
@@ -197,4 +227,4 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,6 +178,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
||||
User user = new User();
|
||||
user.setPassword(passwordEncoder.encode(resources.getPassword()));
|
||||
user.setUsername(resources.getAccount());
|
||||
user.setNickName(resources.getShopName());
|
||||
user.setPhone(resources.getPhone());
|
||||
user.setCreateBy("admin");
|
||||
user.setEnabled(true);
|
||||
@@ -203,6 +204,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
||||
TbPlussShopStaff tbPlussShopStaff = new TbPlussShopStaff();
|
||||
tbPlussShopStaff.setShopId(String.valueOf(save.getId()));
|
||||
tbPlussShopStaff.setType("master");
|
||||
tbPlussShopStaff.setName(resources.getShopName());
|
||||
tbPlussShopStaff.setAccount(resources.getAccount());
|
||||
tbPlussShopStaff.setPassword(MD5Utils.encrypt(resources.getPassword()));
|
||||
tbPlussShopStaff.setStatus(1);
|
||||
@@ -237,6 +239,10 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbShopInfo resources) {
|
||||
TbShopInfo tbShopInfo = tbShopInfoRepository.findById(resources.getId()).orElseGet(TbShopInfo::new);
|
||||
if (!resources.getShopName().equals(tbShopInfo.getShopName())) {
|
||||
shopStaffRepository.updateNameById(resources.getShopName(),resources.getId().toString());
|
||||
userRepository.updateNickName(resources.getAccount(),resources.getShopName());
|
||||
}
|
||||
ValidationUtil.isNull( tbShopInfo.getId(),"TbShopInfo","id",resources.getId());
|
||||
tbShopInfo.copy(resources);
|
||||
tbShopInfo.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
|
||||
@@ -85,7 +85,7 @@ public interface TbProductService {
|
||||
*/
|
||||
void download(List<TbProductDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
void updateIsHot(Integer id, String shopId);
|
||||
void updateIsHot(Integer id,Integer isStock);
|
||||
|
||||
void updateIsStock(Integer proId, String shopId, Integer isStock);
|
||||
|
||||
|
||||
@@ -1,18 +1,3 @@
|
||||
/*
|
||||
* 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.system.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -25,6 +10,9 @@ import lombok.Data;
|
||||
@Data
|
||||
public class UserPassVo {
|
||||
|
||||
//staff
|
||||
private String loginType;
|
||||
|
||||
private String oldPass;
|
||||
|
||||
private String newPass;
|
||||
|
||||
@@ -36,6 +36,7 @@ public interface RoleRepository extends JpaRepository<Role, Long>, JpaSpecificat
|
||||
* @return /
|
||||
*/
|
||||
Role findByName(String name);
|
||||
Role findByNameAndShopId(String name,Integer shopId);
|
||||
|
||||
/**
|
||||
* 删除多个角色
|
||||
|
||||
@@ -65,6 +65,10 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
|
||||
@Query(value = "update sys_user set enabled = 0 where username = ?1",nativeQuery = true)
|
||||
void upEnableByusername(String username);
|
||||
|
||||
@Modifying
|
||||
@Query(value = "update sys_user set nick_name = ?2 where username = ?1",nativeQuery = true)
|
||||
void updateNickName(String username, String nickName);
|
||||
|
||||
/**
|
||||
* 修改邮箱
|
||||
* @param username 用户名
|
||||
|
||||
@@ -1,26 +1,15 @@
|
||||
/*
|
||||
* 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.system.rest;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.ysk.cashier.config.security.security.TokenProvider;
|
||||
import cn.ysk.cashier.config.security.service.OnlineUserService;
|
||||
import cn.ysk.cashier.repository.shop.TbPlussShopStaffRepository;
|
||||
import cn.ysk.cashier.system.domain.Dept;
|
||||
import cn.ysk.cashier.system.domain.User;
|
||||
import cn.ysk.cashier.system.domain.vo.UserPassVo;
|
||||
import cn.ysk.cashier.system.service.dto.UserDto;
|
||||
import cn.ysk.cashier.system.service.dto.UserQueryCriteria;
|
||||
import cn.ysk.cashier.utils.MD5Utils;
|
||||
import cn.ysk.cashier.utils.PageUtil;
|
||||
import cn.ysk.cashier.utils.RsaUtils;
|
||||
import cn.ysk.cashier.utils.SecurityUtils;
|
||||
@@ -37,16 +26,20 @@ import cn.ysk.cashier.system.service.dto.RoleSmallDto;
|
||||
import cn.ysk.cashier.system.service.VerifyService;
|
||||
import cn.ysk.cashier.system.service.UserService;
|
||||
import cn.ysk.cashier.utils.enums.CodeEnum;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
@@ -68,6 +61,9 @@ public class UserController {
|
||||
private final DeptService deptService;
|
||||
private final RoleService roleService;
|
||||
private final VerifyService verificationCodeService;
|
||||
private final OnlineUserService onlineUserService;
|
||||
private final TbPlussShopStaffRepository shopStaffRepository;
|
||||
private final TokenProvider tokenProvider;
|
||||
|
||||
@ApiOperation("导出用户数据")
|
||||
@GetMapping(value = "/download")
|
||||
@@ -155,17 +151,27 @@ public class UserController {
|
||||
|
||||
@ApiOperation("修改密码")
|
||||
@PostMapping(value = "/updatePass")
|
||||
public ResponseEntity<Object> updateUserPass(@RequestBody UserPassVo passVo) throws Exception {
|
||||
String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getOldPass());
|
||||
String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getNewPass());
|
||||
UserDto user = userService.findByName(SecurityUtils.getCurrentUsername());
|
||||
if(!passwordEncoder.matches(oldPass, user.getPassword())){
|
||||
@Transactional
|
||||
public ResponseEntity<Object> updateUserPass(HttpServletRequest request, @RequestBody UserPassVo passVo) throws Exception {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
UserDto user = userService.findByName(currentUsername);
|
||||
String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, passVo.getOldPass());
|
||||
if (!passwordEncoder.matches(oldPass, user.getPassword())) {
|
||||
throw new BadRequestException("修改失败,旧密码错误");
|
||||
}
|
||||
if(passwordEncoder.matches(newPass, user.getPassword())){
|
||||
System.out.println(oldPass);
|
||||
if (passwordEncoder.matches(passVo.getNewPass(), user.getPassword())) {
|
||||
throw new BadRequestException("新密码不能与旧密码相同");
|
||||
}
|
||||
userService.updatePass(user.getUsername(),passwordEncoder.encode(newPass));
|
||||
String encPass = MD5Utils.encrypt( passVo.getNewPass());
|
||||
if (StringUtils.isNotBlank(passVo.getLoginType()) && passVo.getLoginType().equals("staff")) {
|
||||
String[] split = currentUsername.split("@");
|
||||
shopStaffRepository.updatePassAndShopId(split[1],split[0],encPass,System.currentTimeMillis());
|
||||
}else {
|
||||
shopStaffRepository.updatePass(currentUsername,encPass,System.currentTimeMillis());
|
||||
}
|
||||
userService.updatePass(user.getUsername(),passwordEncoder.encode(passVo.getNewPass()));
|
||||
onlineUserService.logout(tokenProvider.getToken(request));
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,8 +91,8 @@ public class RoleServiceImpl implements RoleService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(Role resources) {
|
||||
if (roleRepository.findByName(resources.getName()) != null) {
|
||||
throw new EntityExistException(Role.class, "username", resources.getName());
|
||||
if (roleRepository.findByNameAndShopId(resources.getName(),resources.getShopId()) != null) {
|
||||
throw new BadRequestException("角色已存在");
|
||||
}
|
||||
roleRepository.save(resources);
|
||||
}
|
||||
@@ -101,13 +101,12 @@ public class RoleServiceImpl implements RoleService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Role resources) {
|
||||
Role role = roleRepository.findById(resources.getId()).orElseGet(Role::new);
|
||||
ValidationUtil.isNull(role.getId(), "Role", "id", resources.getId());
|
||||
|
||||
Role role1 = roleRepository.findByName(resources.getName());
|
||||
|
||||
if (role1 != null && !role1.getId().equals(role.getId())) {
|
||||
throw new EntityExistException(Role.class, "username", resources.getName());
|
||||
if (!resources.getName().equals(role.getName())) {
|
||||
if (roleRepository.findByNameAndShopId(resources.getName(),resources.getShopId()) != null) {
|
||||
throw new BadRequestException("修改失败,角色名称不可重复");
|
||||
}
|
||||
}
|
||||
ValidationUtil.isNull(role.getId(), "Role", "id", resources.getId());
|
||||
role.setName(resources.getName());
|
||||
role.setDescription(resources.getDescription());
|
||||
role.setDataScope(resources.getDataScope());
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
package cn.ysk.cashier.utils;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopOpenId;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Slf4j
|
||||
@Component
|
||||
public class WxAccountUtil {
|
||||
@Value("${wx.ysk.appId}")
|
||||
private String appId = "wx212769170d2c6b2a";
|
||||
@Value("${wx.ysk.secrete}")
|
||||
private String secrete = "8492a7e8d55bbb1b57f5c8276ea1add0";
|
||||
@Value("${wx.ysk.operationMsgTmpId}")
|
||||
private String operationMsgTmpId ;
|
||||
|
||||
static LinkedHashMap<String,String> linkedHashMap=new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
|
||||
linkedHashMap.put("40001","获取 access_token 时 AppSecret 错误,或者 access_token 无效。请开发者认真比对 AppSecret 的正确性,或查看是否正在为恰当的公众号调用接口");
|
||||
linkedHashMap.put("40003","不合法的 OpenID ,请开发者确认 OpenID (该用户)是否已关注公众号,或是否是其他公众号的 OpenID");
|
||||
linkedHashMap.put("40014","不合法的 access_token ,请开发者认真比对 access_token 的有效性(如是否过期),或查看是否正在为恰当的公众号调用接口");
|
||||
linkedHashMap.put("40037","不合法的 template_id");
|
||||
linkedHashMap.put("43101","用户未订阅消息");
|
||||
linkedHashMap.put("43107","订阅消息能力封禁");
|
||||
linkedHashMap.put("43108","并发下发消息给同一个粉丝");
|
||||
linkedHashMap.put("45168","命中敏感词");
|
||||
linkedHashMap.put("47003","参数错误");
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// sendStockWarnMsg("13213", "31123", "234", "ojC-S6n2DDlpj52iVMoiLL0Ry4HI");
|
||||
}
|
||||
|
||||
public String getRadarQrCode(Integer shopId) {
|
||||
HashMap<String, Object> req = new HashMap<>();
|
||||
req.put("expire_seconds", 300);
|
||||
req.put("action_name", "QR_STR_SCENE");
|
||||
HashMap<Object, Object> actionInfo = new HashMap<>();
|
||||
HashMap<String, Object> scene = new HashMap<>();
|
||||
scene.put("scene_str", "msg" + shopId);
|
||||
actionInfo.put("scene", scene);
|
||||
req.put("action_info", actionInfo);
|
||||
log.info("开始获取公众号二维码, 请求数据: {}", req);
|
||||
String resp = HttpUtil.post("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + getAccessToken(), JSONObject.toJSONString(req));
|
||||
JSONObject respInfo = JSONObject.parseObject(resp);
|
||||
log.warn("获取微信公众号二维码结束,响应: {}", resp);
|
||||
if (!respInfo.containsKey("url")) {
|
||||
log.warn("获取微信公众号二维码失败,响应: {}", resp);
|
||||
throw new RuntimeException(resp);
|
||||
}
|
||||
return respInfo.getString("url");
|
||||
}
|
||||
|
||||
|
||||
public String getAccessToken() {
|
||||
String resp = HttpUtil.get(StrUtil.format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={}&secret={}", appId, secrete));
|
||||
JSONObject respInfo = JSONObject.parseObject(resp);
|
||||
if (!respInfo.containsKey("access_token")) {
|
||||
log.warn("公众号获取token失败, 响应内容: {}", resp);
|
||||
throw new RuntimeException(resp);
|
||||
}
|
||||
return respInfo.getString("access_token");
|
||||
}
|
||||
|
||||
public JSONObject sendTemplateMsg(String templateId, String toUserOpenId, Map<String, Object> data) {
|
||||
log.info("开始发送微信模板消息, 接收用户openId: {}, 消息数据: {}", toUserOpenId, data);
|
||||
String accessToken = getAccessToken();
|
||||
|
||||
JSONObject object1=new JSONObject();
|
||||
|
||||
object1.put("template_id", templateId);
|
||||
object1.put("touser", toUserOpenId);
|
||||
object1.put("data",data);
|
||||
|
||||
String response= HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
||||
log.info("微信模板消息发送成功,响应内容:{}",response);
|
||||
JSONObject resObj=JSONObject.parseObject(response);
|
||||
if(ObjectUtil.isNotEmpty(resObj)&&ObjectUtil.isNotNull(resObj)&&"0".equals(resObj.get("errcode")+"")){
|
||||
return resObj;
|
||||
}
|
||||
|
||||
throw new RuntimeException(linkedHashMap.getOrDefault(resObj.get("errcode") + "", "未知错误"));
|
||||
}
|
||||
|
||||
@Async
|
||||
public void sendOperationMsg(List<TbShopOpenId> openIds, String userName, String operationDesc) {
|
||||
openIds.forEach(item -> {
|
||||
Map<String, Object> data = new HashMap<String, Object>() {{
|
||||
put("thing19", new HashMap<String, Object>(){{
|
||||
put("value", userName);
|
||||
}});
|
||||
put("thing8", new HashMap<String, Object>(){{
|
||||
put("value", operationDesc);
|
||||
}});
|
||||
put("time21", new HashMap<String, Object>(){{
|
||||
put("value", DateUtil.format(DateUtil.date(), "yyyy-MM-dd HH:mm:ss"));
|
||||
}});
|
||||
}};
|
||||
log.info("开始发送敏感操作消息, 接收用户openId: {}, 操作用户: {}, 操作描述: {}", item.getOpenId(), userName, operationDesc);
|
||||
try {
|
||||
sendTemplateMsg(operationMsgTmpId, item.getOpenId(), data);
|
||||
}catch (Exception e) {
|
||||
log.error("发送失败, openId: {}, 响应: {}", item.getOpenId(), e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cn.ysk.cashier.utils;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopOpenId;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopOpenIdService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class WxMsgUtils {
|
||||
|
||||
private final TbShopOpenIdService tbShopOpenIdService;
|
||||
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
private final WxAccountUtil wxAccountUtil;
|
||||
|
||||
public WxMsgUtils(TbShopOpenIdService tbShopOpenIdService, RedisUtils redisUtils, WxAccountUtil wxAccountUtil) {
|
||||
this.tbShopOpenIdService = tbShopOpenIdService;
|
||||
this.redisUtils = redisUtils;
|
||||
this.wxAccountUtil = wxAccountUtil;
|
||||
}
|
||||
|
||||
public void aboardOperationMsg(String operationDesc) {
|
||||
HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||
|
||||
Object o = redisUtils.get("online-token-"+getToken(request));
|
||||
JSONObject jsonObject;
|
||||
Integer shopId;
|
||||
String nickName;
|
||||
if (o != null) {
|
||||
String jsonString = JSON.toJSONString(o);
|
||||
jsonObject = JSONObject.parseObject(jsonString);
|
||||
shopId = (Integer) jsonObject.get("shopId");
|
||||
nickName = jsonObject.get("nickName") == null ? "" : jsonObject.get("nickName").toString();
|
||||
List<TbShopOpenId> openIds = tbShopOpenIdService.lambdaQuery().eq(TbShopOpenId::getShopId, shopId).list();
|
||||
log.info("即将开始推送敏感操作消息, 接收推送openId列表: {}", openIds);
|
||||
String finalNickName = nickName;
|
||||
wxAccountUtil.sendOperationMsg(openIds, finalNickName, operationDesc);
|
||||
}else {
|
||||
log.warn("发送敏感操作预警失败,未获取到登录信息");
|
||||
}
|
||||
}
|
||||
|
||||
public String getToken(HttpServletRequest request) {
|
||||
final String requestHeader = request.getHeader("Authorization");
|
||||
if (requestHeader != null && requestHeader.startsWith("Bearer")) {
|
||||
return requestHeader.substring(7);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package cn.ysk.cashier.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TbOrderSaleVO {
|
||||
private String orderNo;
|
||||
private Integer num;
|
||||
private BigDecimal price;
|
||||
private String status;
|
||||
}
|
||||
@@ -14,6 +14,24 @@ public class TbOrderSalesCountByDayVo {
|
||||
private BigDecimal salesAmount;
|
||||
private BigDecimal refAmount;
|
||||
private Long num;
|
||||
private Integer productId;
|
||||
private Integer productSkuId;
|
||||
|
||||
public Integer getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Integer productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Integer getProductSkuId() {
|
||||
return productSkuId;
|
||||
}
|
||||
|
||||
public void setProductSkuId(Integer productSkuId) {
|
||||
this.productSkuId = productSkuId;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
@@ -116,6 +134,25 @@ public class TbOrderSalesCountByDayVo {
|
||||
count();
|
||||
}
|
||||
|
||||
public TbOrderSalesCountByDayVo(String productName, String productSkuName, String cateName,String unitName,BigDecimal price,
|
||||
Long salesNum, Long refNum, Long num, BigDecimal salesAmount, BigDecimal refAmount, Integer productId, Integer productSkuId) {
|
||||
this.productName = productName;
|
||||
this.productSkuName = productSkuName;
|
||||
this.cateName = cateName;
|
||||
this.unitName = unitName;
|
||||
this.price = price;
|
||||
this.salesNum = salesNum;
|
||||
this.refNum = refNum;
|
||||
this.salesAmount = salesAmount;
|
||||
this.refAmount = refAmount;
|
||||
this.num = num;
|
||||
this.productId = productId;
|
||||
this.productSkuId = productSkuId;
|
||||
count();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void count(){
|
||||
salesNum=salesNum-refNum;
|
||||
salesAmount=salesAmount.subtract(refAmount);
|
||||
|
||||
@@ -78,3 +78,9 @@ aliyun:
|
||||
oss:
|
||||
bucketname: cashier-oss
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
|
||||
wx:
|
||||
ysk:
|
||||
appId: wx212769170d2c6b2a
|
||||
secrete: 8492a7e8d55bbb1b57f5c8276ea1add0
|
||||
operationMsgTmpId: wFdoUG-dUT7bDRHq8bMJD9CF5TjyH9x_uJQgQByZqHg
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.ysk.cashier.mybatis.mapper.TbShopOpenIdMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="cn.ysk.cashier.mybatis.entity.TbShopOpenId">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="shop_id" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="open_id" column="open_id" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="update_time" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="type" column="type" jdbcType="TINYINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,shop_id,open_id,
|
||||
status,create_time,update_time,
|
||||
type
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -34,7 +34,6 @@ public class ${className}Controller {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询${apiAlias}")
|
||||
@ApiOperation("查询${apiAlias}")
|
||||
public ResponseEntity<Object> query${className}(${className}QueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(${changeClassName}Service.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
|
||||
Reference in New Issue
Block a user