日志记录
This commit is contained in:
@@ -80,7 +80,7 @@ public class TbVersionServiceImpl implements TbVersionService {
|
||||
public void update(TbVersion resources) {
|
||||
TbVersion tbVersion = tbVersionRepository.findById(resources.getId()).orElseGet(TbVersion::new);
|
||||
ValidationUtil.isNull(tbVersion.getId(), "TbVersion", "id", resources.getId());
|
||||
redisUtils.del5(tbVersion.getSource() + "_VERSION:" + tbVersion.getType() + ":" + tbVersion.getVersion());
|
||||
redisUtils.del(tbVersion.getSource() + "_VERSION:" + tbVersion.getType() + ":" + tbVersion.getVersion());
|
||||
tbVersion.copy(resources);
|
||||
tbVersion.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
tbVersionRepository.save(tbVersion);
|
||||
|
||||
@@ -303,6 +303,7 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
//套餐内容
|
||||
if (!resources.getGroupSnap().isEmpty()) {
|
||||
product.setGroupSnap(ListUtil.JSONArrayChangeString(resources.getGroupSnap()));
|
||||
product.setIsCombo(1);
|
||||
}
|
||||
TbProduct save = tbProductRepository.save(product);
|
||||
|
||||
|
||||
@@ -13,26 +13,26 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopInfo.shopRegister.service.impl;
|
||||
package cn.ysk.cashier.service.impl.shopimpl;
|
||||
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.shopInfo.shopRegister.domain.TbMerchantRegister;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import cn.ysk.cashier.dto.shop.TbMerchantRegisterDto;
|
||||
import cn.ysk.cashier.dto.shop.TbMerchantRegisterQueryCriteria;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mapper.shop.TbMerchantRegisterMapper;
|
||||
import cn.ysk.cashier.pojo.shop.TbMerchantRegister;
|
||||
import cn.ysk.cashier.repository.shop.TbMerchantRegisterRepository;
|
||||
import cn.ysk.cashier.service.shop.TbMerchantRegisterService;
|
||||
import cn.ysk.cashier.utils.ValidationUtil;
|
||||
import cn.ysk.cashier.utils.FileUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.modules.shopInfo.shopRegister.repository.TbMerchantRegisterRepository;
|
||||
import me.zhengjie.modules.shopInfo.shopRegister.service.TbMerchantRegisterService;
|
||||
import me.zhengjie.modules.shopInfo.shopRegister.service.dto.TbMerchantRegisterDto;
|
||||
import me.zhengjie.modules.shopInfo.shopRegister.service.dto.TbMerchantRegisterQueryCriteria;
|
||||
import me.zhengjie.modules.shopInfo.shopRegister.service.mapstruct.TbMerchantRegisterMapper;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
import cn.ysk.cashier.utils.PageUtil;
|
||||
import cn.ysk.cashier.utils.QueryHelp;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
|
||||
@@ -17,6 +17,13 @@ package cn.ysk.cashier.service.impl.shopimpl;
|
||||
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.pojo.shop.TbPlussShopStaff;
|
||||
import cn.ysk.cashier.system.domain.Dept;
|
||||
import cn.ysk.cashier.system.domain.Job;
|
||||
import cn.ysk.cashier.system.domain.Role;
|
||||
import cn.ysk.cashier.system.domain.User;
|
||||
import cn.ysk.cashier.system.repository.UserRepository;
|
||||
import cn.ysk.cashier.system.service.UserService;
|
||||
import cn.ysk.cashier.system.service.dto.UserDto;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import cn.ysk.cashier.repository.shop.TbPlussShopStaffRepository;
|
||||
@@ -24,18 +31,16 @@ import cn.ysk.cashier.service.shop.TbPlussShopStaffService;
|
||||
import cn.ysk.cashier.dto.shop.TbPlussShopStaffDto;
|
||||
import cn.ysk.cashier.dto.shop.TbPlussShopStaffQueryCriteria;
|
||||
import cn.ysk.cashier.mapper.shop.TbPlussShopStaffMapper;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
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.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
@@ -50,6 +55,10 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
private final TbPlussShopStaffRepository tbPlussShopStaffRepository;
|
||||
private final TbPlussShopStaffMapper tbPlussShopStaffMapper;
|
||||
|
||||
private final UserRepository userRepository;
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
private final UserService userService;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbPlussShopStaffQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbPlussShopStaff> page = tbPlussShopStaffRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
@@ -66,7 +75,10 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
public TbPlussShopStaffDto findById(Integer id) {
|
||||
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(id).orElseGet(TbPlussShopStaff::new);
|
||||
ValidationUtil.isNull(tbPlussShopStaff.getId(),"TbPlussShopStaff","id",id);
|
||||
return tbPlussShopStaffMapper.toDto(tbPlussShopStaff);
|
||||
TbPlussShopStaffDto dto = tbPlussShopStaffMapper.toDto(tbPlussShopStaff);
|
||||
UserDto userDto = userService.findByName(tbPlussShopStaff.getAccount());
|
||||
dto.setUser(userDto);
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,7 +89,31 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
}
|
||||
resources.setPassword(MD5Utils.md5("123456"));
|
||||
resources.setCreatedAt(Instant.now().toEpochMilli());
|
||||
resources.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
|
||||
//添加收银系统后台账号
|
||||
User user = new User();
|
||||
user.setPassword(passwordEncoder.encode(resources.getPassword()));
|
||||
user.setUsername(resources.getAccount());
|
||||
user.setNickName(resources.getName());
|
||||
user.setPhone(resources.getPhone());
|
||||
user.setEnabled(true);
|
||||
|
||||
Dept dept = new Dept();
|
||||
dept.setId(18L);
|
||||
user.setDept(dept);
|
||||
|
||||
Set<Role> roles = new HashSet<>();
|
||||
Role role = new Role();
|
||||
role.setId(2L);
|
||||
roles.add(role);
|
||||
user.setRoles(roles);
|
||||
|
||||
Set<Job> jobs = new HashSet<>();
|
||||
Job job = new Job();
|
||||
job.setId(10L);
|
||||
jobs.add(job);
|
||||
user.setJobs(jobs);
|
||||
userRepository.save(user);
|
||||
return tbPlussShopStaffMapper.toDto(tbPlussShopStaffRepository.save(resources));
|
||||
}
|
||||
|
||||
@@ -85,17 +121,32 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbPlussShopStaff resources) {
|
||||
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(resources.getId()).orElseGet(TbPlussShopStaff::new);
|
||||
resources.setUpdatedAt(tbPlussShopStaff.getUpdatedAt());
|
||||
resources.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
ValidationUtil.isNull( tbPlussShopStaff.getId(),"TbPlussShopStaff","id",resources.getId());
|
||||
tbPlussShopStaff.copy(resources);
|
||||
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.setRoles(roles);
|
||||
sysUser.setNickName(resources.getName());
|
||||
sysUser.setPhone(resources.getPhone());
|
||||
userRepository.save(sysUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Integer[] ids) {
|
||||
Set<Long> sysUserIds=new HashSet<>();
|
||||
for (Integer id : ids) {
|
||||
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(id).get();
|
||||
User sysUser = userRepository.findByUsername(tbPlussShopStaff.getAccount());
|
||||
tbPlussShopStaffRepository.deleteById(id);
|
||||
sysUserIds.add(sysUser.getId());
|
||||
}
|
||||
userService.delete(sysUserIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
package cn.ysk.cashier.service.impl.shopimpl;
|
||||
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.controller.shop.TbPrintMachine;
|
||||
import cn.ysk.cashier.pojo.shop.TbPrintMachine;
|
||||
import cn.ysk.cashier.dto.shop.PrintMachineDto;
|
||||
import cn.ysk.cashier.utils.FileUtil;
|
||||
import cn.ysk.cashier.utils.ListUtil;
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package cn.ysk.cashier.service.shop;
|
||||
|
||||
import cn.ysk.cashier.dto.shop.TbCouponCategoryDto;
|
||||
import cn.ysk.cashier.dto.shop.TbCouponCategoryQueryCriteria;
|
||||
import cn.ysk.cashier.mapper.shop.TbCouponCategoryMapper;
|
||||
import cn.ysk.cashier.pojo.shop.TbCouponCategory;
|
||||
import cn.ysk.cashier.repository.shop.TbCouponCategoryRepository;
|
||||
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 org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbCouponCategoryService {
|
||||
private final TbCouponCategoryRepository tbCouponCategoryRepository;
|
||||
private final TbCouponCategoryMapper tbCouponCategoryMapper;
|
||||
|
||||
|
||||
public Map<String,Object> queryAll(TbCouponCategoryQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbCouponCategory> page = tbCouponCategoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(tbCouponCategoryMapper::toDto));
|
||||
}
|
||||
|
||||
|
||||
public List<TbCouponCategoryDto> queryAll(TbCouponCategoryQueryCriteria criteria){
|
||||
return tbCouponCategoryMapper.toDto(tbCouponCategoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public TbCouponCategoryDto findById(Integer id) {
|
||||
TbCouponCategory tbCouponCategory = tbCouponCategoryRepository.findById(id).orElseGet(TbCouponCategory::new);
|
||||
ValidationUtil.isNull(tbCouponCategory.getId(),"TbCouponCategory","id",id);
|
||||
return tbCouponCategoryMapper.toDto(tbCouponCategory);
|
||||
}
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbCouponCategoryDto create(TbCouponCategory resources) {
|
||||
resources.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
return tbCouponCategoryMapper.toDto(tbCouponCategoryRepository.save(resources));
|
||||
}
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbCouponCategory resources) {
|
||||
TbCouponCategory tbCouponCategory = tbCouponCategoryRepository.findById(resources.getId()).orElseGet(TbCouponCategory::new);
|
||||
ValidationUtil.isNull( tbCouponCategory.getId(),"TbCouponCategory","id",resources.getId());
|
||||
tbCouponCategory.copy(resources);
|
||||
tbCouponCategory.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||
tbCouponCategoryRepository.save(tbCouponCategory);
|
||||
}
|
||||
|
||||
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
tbCouponCategoryRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void download(List<TbCouponCategoryDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbCouponCategoryDto tbCouponCategory : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("分类名称", tbCouponCategory.getName());
|
||||
map.put(" createTime", tbCouponCategory.getCreateTime());
|
||||
map.put(" updateTime", tbCouponCategory.getUpdateTime());
|
||||
map.put("0:不展示;1:展示;", tbCouponCategory.getStatus());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package cn.ysk.cashier.service.shop;
|
||||
|
||||
import cn.ysk.cashier.controller.shop.TbPrintMachine;
|
||||
import cn.ysk.cashier.pojo.shop.TbPrintMachine;
|
||||
import cn.ysk.cashier.dto.shop.PrintMachineDto;
|
||||
import cn.ysk.cashier.dto.shop.TbPrintMachineDto;
|
||||
import cn.ysk.cashier.dto.shop.TbPrintMachineQueryCriteria;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.ysk.cashier.service.shop;
|
||||
|
||||
import cn.ysk.cashier.dto.shop.TbPurchaseNoticeDto;
|
||||
import cn.ysk.cashier.mapper.shop.TbPurchaseNoticeMapper;
|
||||
import cn.ysk.cashier.pojo.shop.TbPurchaseNotice;
|
||||
import cn.ysk.cashier.repository.shop.TbPurchaseNoticeRepository;
|
||||
import cn.ysk.cashier.utils.ValidationUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbPurchaseNoticeService{
|
||||
|
||||
private final TbPurchaseNoticeRepository tbPurchaseNoticeRepository;
|
||||
private final TbPurchaseNoticeMapper tbPurchaseNoticeMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbPurchaseNoticeDto create(TbPurchaseNotice resources) {
|
||||
return tbPurchaseNoticeMapper.toDto(tbPurchaseNoticeRepository.save(resources));
|
||||
}
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbPurchaseNotice resources) {
|
||||
TbPurchaseNotice tbPurchaseNotice = tbPurchaseNoticeRepository.findById(resources.getId()).orElseGet(TbPurchaseNotice::new);
|
||||
ValidationUtil.isNull( tbPurchaseNotice.getId(),"TbPurchaseNotice","id",resources.getId());
|
||||
tbPurchaseNotice.copy(resources);
|
||||
tbPurchaseNoticeRepository.save(tbPurchaseNotice);
|
||||
}
|
||||
|
||||
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
tbPurchaseNoticeRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user