From aee7e1fa0fec879b8053b0c5d40ab820dc3f2ef2 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 26 Jul 2024 14:21:07 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/shopimpl/TbPlussShopStaffServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java index 0fb4aecb..7fa1082a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java @@ -136,7 +136,11 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService { @Override @Transactional(rollbackFor = Exception.class) public void update(TbPlussShopStaff resources) { + if (StringUtils.isBlank(resources.getPassword())) { + resources.setPassword(null); + } TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(resources.getId()).orElseGet(TbPlussShopStaff::new); + User sysUser = userRepository.findByUsername(tbPlussShopStaff.getAccount()); resources.setUpdatedAt(Instant.now().toEpochMilli()); ValidationUtil.isNull( tbPlussShopStaff.getId(),"TbPlussShopStaff","id",resources.getId()); tbPlussShopStaff.copy(resources); @@ -145,11 +149,11 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService { } tbPlussShopStaffRepository.save(tbPlussShopStaff); //修改 sysUser账号 - User sysUser = userRepository.findByUsername(tbPlussShopStaff.getAccount()); Set roles = new HashSet<>(); Role role = new Role(); role.setId(resources.getRoleId()); roles.add(role); + sysUser.setUsername(resources.getAccount()); sysUser.setRoles(roles); sysUser.setNickName(resources.getName()); if (StringUtils.isNotBlank(resources.getPassword())) { From 0d81d6ea5ad9491e28e3493ea2bde8af2b03016c Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 26 Jul 2024 14:32:39 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E8=B4=A6=E6=88=B7=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/shopimpl/TbPlussShopStaffServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java index 7fa1082a..007deca3 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java @@ -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; @@ -129,6 +130,9 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService { job.setId(10L); jobs.add(job); user.setJobs(jobs); + if (userRepository.findByUsername(user.getUsername()) != null) { + throw new EntityExistException(User.class, "username", user.getUsername()); + } userRepository.save(user); return tbPlussShopStaffMapper.toDto(tbPlussShopStaffRepository.save(resources)); } From e592d5503da13a9b51f2f360c713df257a0dcce4 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 26 Jul 2024 14:36:15 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E5=91=98=E5=B7=A5=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/shopimpl/TbPlussShopStaffServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java index 007deca3..66035b40 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java @@ -131,7 +131,7 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService { jobs.add(job); user.setJobs(jobs); if (userRepository.findByUsername(user.getUsername()) != null) { - throw new EntityExistException(User.class, "username", user.getUsername()); + throw new BadRequestException("员工账号已存在"); } userRepository.save(user); return tbPlussShopStaffMapper.toDto(tbPlussShopStaffRepository.save(resources)); From 5dff4105e646a1f01f1ed97fbb441bb50fef849c Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 26 Jul 2024 15:32:24 +0800 Subject: [PATCH 04/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=20=E5=91=98?= =?UTF-8?q?=E5=B7=A5=E8=B4=A6=E6=88=B7=E4=B8=8D=E5=8F=AF=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/shopimpl/TbPlussShopStaffServiceImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java index 66035b40..38880845 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java @@ -145,6 +145,11 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService { } TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(resources.getId()).orElseGet(TbPlussShopStaff::new); User sysUser = userRepository.findByUsername(tbPlussShopStaff.getAccount()); + if(tbPlussShopStaff.getAccount().equals(resources.getAccount())){ + if (userRepository.findByUsername(resources.getAccount()) != null) { + throw new BadRequestException("员工账号不可重复"); + } + } resources.setUpdatedAt(Instant.now().toEpochMilli()); ValidationUtil.isNull( tbPlussShopStaff.getId(),"TbPlussShopStaff","id",resources.getId()); tbPlussShopStaff.copy(resources); From 80e666126c49ce528101a93e44082335dda58f21 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 26 Jul 2024 15:35:51 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=20=E5=91=98?= =?UTF-8?q?=E5=B7=A5=E8=B4=A6=E6=88=B7=E4=B8=8D=E5=8F=AF=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/shopimpl/TbPlussShopStaffServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java index 38880845..9a702986 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java @@ -145,7 +145,7 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService { } TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(resources.getId()).orElseGet(TbPlussShopStaff::new); User sysUser = userRepository.findByUsername(tbPlussShopStaff.getAccount()); - if(tbPlussShopStaff.getAccount().equals(resources.getAccount())){ + if(!tbPlussShopStaff.getAccount().equals(resources.getAccount())){ if (userRepository.findByUsername(resources.getAccount()) != null) { throw new BadRequestException("员工账号不可重复"); } From 92e743cb8f66c15c34bce0a7c2eda54d1f889204 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 26 Jul 2024 16:47:01 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E5=95=86=E5=AE=B6=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E8=B4=A6=E5=8F=B7=20=E9=BB=98=E8=AE=A4=E4=B8=BA?= =?UTF-8?q?=E5=BA=97=E9=93=BA=E5=90=8D=E7=A7=B0=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=97=B6=20=E8=AF=A5=E5=BA=97=E9=93=BA=E7=9A=84=20Master?= =?UTF-8?q?=E5=91=98=E5=B7=A5=20=E5=90=8D=E7=A7=B0=E4=B8=80=E5=BE=8B?= =?UTF-8?q?=E4=B8=BA=E5=BA=97=E9=93=BA=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/repository/shop/TbPlussShopStaffRepository.java | 6 ++++++ .../service/impl/shopimpl/TbShopInfoServiceImpl.java | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbPlussShopStaffRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbPlussShopStaffRepository.java index 8675952b..b7d4a6a5 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbPlussShopStaffRepository.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbPlussShopStaffRepository.java @@ -21,6 +21,8 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; +import java.util.List; + /** * @website https://eladmin.vip * @author lyf @@ -42,4 +44,8 @@ public interface TbPlussShopStaffRepository extends JpaRepository Date: Mon, 29 Jul 2024 10:32:06 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/cons/service/dto/TbHandoverQueryCriteria.java | 2 ++ .../ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbHandoverQueryCriteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbHandoverQueryCriteria.java index 8cc0d25a..aae144bb 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbHandoverQueryCriteria.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbHandoverQueryCriteria.java @@ -26,4 +26,6 @@ public class TbHandoverQueryCriteria{ /** 精确 */ @Query private String merchantName; + + } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java index 92efc32a..8bd53ce1 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java @@ -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; @@ -255,7 +256,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { purveyorTransact.setType("cons_in"); object.put("number",conInfos.getStockNumber()); - } else { + } else if("out".equals(resources.getType())) { stockOperate.setSubType(-1); info.setStockNumber(info.getStockNumber().subtract(conInfos.getStockNumber())); suppFlow.setBalance(info.getStockNumber().subtract(info.getStockConsume()).subtract(conInfos.getStockNumber())); @@ -271,6 +272,8 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { purveyorTransact.setWaitAmount((resources.getAccountsPayable().subtract(resources.getActualPayment())).negate()); purveyorTransact.setType("cons_out"); object.put("number",conInfos.getStockNumber()); + }else { + throw new BadRequestException("错误操作类型"); } From 02167b163a5f4cb13f920189a5d3f35e78f9d2e8 Mon Sep 17 00:00:00 2001 From: GYJ <1157756119@qq.com> Date: Mon, 29 Jul 2024 11:29:18 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E5=91=98=E5=B7=A5bug=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/ysk/cashier/utils/PhoneUtil.java | 2 +- .../shopimpl/TbPlussShopStaffServiceImpl.java | 33 +++++++++++++------ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/eladmin-common/src/main/java/cn/ysk/cashier/utils/PhoneUtil.java b/eladmin-common/src/main/java/cn/ysk/cashier/utils/PhoneUtil.java index eef0e174..44850719 100644 --- a/eladmin-common/src/main/java/cn/ysk/cashier/utils/PhoneUtil.java +++ b/eladmin-common/src/main/java/cn/ysk/cashier/utils/PhoneUtil.java @@ -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 { diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java index 9a702986..ae69db0f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java @@ -43,6 +43,7 @@ import org.springframework.util.CollectionUtils; import java.time.Instant; import java.util.*; import java.io.IOException; +import java.util.regex.Pattern; import javax.servlet.http.HttpServletResponse; /** @@ -62,6 +63,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 queryAll(TbPlussShopStaffQueryCriteria criteria, Pageable pageable){ Page page = tbPlussShopStaffRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); @@ -95,6 +99,18 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService { if (!PhoneUtil.validator(resources.getPhone())){ throw new BadRequestException("手机号格式有误"); } + if (userRepository.findByUsername(resources.getAccount()) != null) { + throw new BadRequestException("员工账号已存在"); + } + + if (pattern.matcher(resources.getCode()).find()) { + throw new BadRequestException("员工编号不能包含中文"); + } + + if (resources.getRoleId()==null) { + throw new BadRequestException("请选择角色"); + } + resources.setCreatedAt(Instant.now().toEpochMilli()); //添加收银系统后台账号 @@ -117,11 +133,7 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService { Set 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); @@ -130,9 +142,6 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService { job.setId(10L); jobs.add(job); user.setJobs(jobs); - if (userRepository.findByUsername(user.getUsername()) != null) { - throw new BadRequestException("员工账号已存在"); - } userRepository.save(user); return tbPlussShopStaffMapper.toDto(tbPlussShopStaffRepository.save(resources)); } @@ -143,6 +152,10 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService { 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); User sysUser = userRepository.findByUsername(tbPlussShopStaff.getAccount()); if(!tbPlussShopStaff.getAccount().equals(resources.getAccount())){ @@ -150,7 +163,7 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService { throw new BadRequestException("员工账号不可重复"); } } - resources.setUpdatedAt(Instant.now().toEpochMilli()); + resources.setUpdatedAt(System.currentTimeMillis()); ValidationUtil.isNull( tbPlussShopStaff.getId(),"TbPlussShopStaff","id",resources.getId()); tbPlussShopStaff.copy(resources); if (StringUtils.isNotBlank(resources.getPassword())) { @@ -210,4 +223,4 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService { } FileUtil.downloadExcel(list, response); } -} \ No newline at end of file +} From cb7246d5faeaad1012a1a16e9a259bb3bff35fb0 Mon Sep 17 00:00:00 2001 From: GYJ <1157756119@qq.com> Date: Mon, 29 Jul 2024 11:47:45 +0800 Subject: [PATCH 09/14] =?UTF-8?q?=E5=88=A4=E6=96=AD=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E6=AD=A3=E5=88=99=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/shopimpl/TbPlussShopStaffServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java index ae69db0f..9859983d 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java @@ -64,7 +64,7 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService { private final UserService userService; // 正则表达式:(\u4e00-\u9fa5) 表示匹配一个中文字符,.* 表示匹配零个或多个任意字符 - private final Pattern pattern = Pattern.compile(".*(\\u4e00-\\u9fa5).*"); + private final Pattern pattern = Pattern.compile("[\\u4e00-\\u9fa5]"); @Override public Map queryAll(TbPlussShopStaffQueryCriteria criteria, Pageable pageable){ From 08f3f8b5e07a0cd74057055f2fef19a074977de6 Mon Sep 17 00:00:00 2001 From: GYJ <1157756119@qq.com> Date: Mon, 29 Jul 2024 13:26:38 +0800 Subject: [PATCH 10/14] =?UTF-8?q?=E5=91=98=E5=B7=A5=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/security/rest/AuthorizationController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/config/security/rest/AuthorizationController.java b/eladmin-system/src/main/java/cn/ysk/cashier/config/security/rest/AuthorizationController.java index a2ffbffe..3080fe98 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/config/security/rest/AuthorizationController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/config/security/rest/AuthorizationController.java @@ -110,6 +110,11 @@ public class AuthorizationController { 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(); //校验商户商户激活是否到期(未激活) From 68ed64849acb4ddc1b0a247484f23f38fb1aae2e Mon Sep 17 00:00:00 2001 From: GYJ <1157756119@qq.com> Date: Mon, 29 Jul 2024 14:54:32 +0800 Subject: [PATCH 11/14] =?UTF-8?q?=E5=91=98=E5=B7=A5=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/shopimpl/TbPlussShopStaffServiceImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java index 9859983d..1691e564 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbPlussShopStaffServiceImpl.java @@ -40,6 +40,7 @@ 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; @@ -111,6 +112,10 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService { throw new BadRequestException("请选择角色"); } + if (resources.getMaxDiscountAmount().compareTo(new BigDecimal(100000000L)) > 0) { + throw new BadRequestException("最大优惠金额过大"); + } + resources.setCreatedAt(Instant.now().toEpochMilli()); //添加收银系统后台账号 From d8aaeff99771ae7357d5a90f2bef844521824abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=89=9B=E5=8F=89=E9=97=AA=E9=97=AA?= <18322780655@163.com> Date: Mon, 29 Jul 2024 17:23:21 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=87=BA=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/ysk/cashier/cons/domain/SuppFlow.java | 2 ++ .../cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/SuppFlow.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/SuppFlow.java index e7f333fb..30993bbf 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/SuppFlow.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/SuppFlow.java @@ -25,6 +25,8 @@ public class SuppFlow implements Serializable { private List list; + private String remark; + @Data diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java index 8bd53ce1..8e22c2df 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java @@ -198,7 +198,7 @@ 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()); From 0aa0bcda771f698fa6ebf6db3cdc4dfa9cd4df53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=89=9B=E5=8F=89=E9=97=AA=E9=97=AA?= <18322780655@163.com> Date: Mon, 29 Jul 2024 17:38:11 +0800 Subject: [PATCH 13/14] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=87=BA=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/ysk/cashier/cons/rest/TbConsInfoController.java | 1 + .../cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java | 1 + 2 files changed, 2 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/TbConsInfoController.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/TbConsInfoController.java index 4c7a5062..01fa4199 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/TbConsInfoController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/TbConsInfoController.java @@ -75,6 +75,7 @@ public class TbConsInfoController { @Log("耗材出入库") @ApiOperation("耗材出入库") public ResponseEntity stockInOut(@Validated @RequestBody SuppFlow resources) throws Exception { + tbConsInfoService.stockInOut(resources); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java index 8e22c2df..acdb3836 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java @@ -175,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("参数错误"); } From 820237d63e4e3390b668a46df5bd1f28821cc140 Mon Sep 17 00:00:00 2001 From: GYJ <1157756119@qq.com> Date: Tue, 30 Jul 2024 11:29:31 +0800 Subject: [PATCH 14/14] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=95=86=E5=93=81=20?= =?UTF-8?q?=E5=A1=AB=E5=85=85=E9=A2=84=E8=AD=A6=E5=80=BC=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/product/TbProductRepository.java | 4 ++++ .../impl/productimpl/TbProductServiceImpl.java | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/product/TbProductRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/product/TbProductRepository.java index aa50c29b..01e2ae64 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/product/TbProductRepository.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/repository/product/TbProductRepository.java @@ -58,4 +58,8 @@ public interface TbProductRepository extends JpaRepository, @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 selectByShopId(String shopId); + } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java index 566b0e5b..9e181f3d 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java @@ -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 productList = tbProductRepository.selectByShopId(resources.getShopId()); + if (!productList.isEmpty()) { + TbProduct p = productList.get(0); + List productSkus = tbProductSkuRepository.searchSku(p.getId().toString()); + if (!productSkus.isEmpty()) { + warnLine = productSkus.get(0).getWarnLine(); + } + } + List 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 tbProductSkus = tbProductSkuRepository.saveAll(skuList);