Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
30aac37ef2
|
|
@ -4,10 +4,12 @@ import cn.ysk.cashier.service.TbPlatformDictService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
|
@ -19,10 +21,12 @@ public class AppCenterController {
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@ApiOperation("获取应用中心列表")
|
@ApiOperation("获取应用中心列表")
|
||||||
public ResponseEntity<Object> queryBotButtonConfig(){
|
public ResponseEntity<Object> queryBotButtonConfig(@RequestParam(required = false, defaultValue = "appCenter") String type){
|
||||||
return new ResponseEntity<>(tbPlatformDictService.queryByType("appCenter"), HttpStatus.OK);
|
return new ResponseEntity<>(tbPlatformDictService.queryByType(type), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import cn.ysk.cashier.utils.ValidationUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import cn.ysk.cashier.repository.TbPlatformDictTypeRepository;
|
import cn.ysk.cashier.repository.TbPlatformDictTypeRepository;
|
||||||
import cn.ysk.cashier.service.TbPlatformDictTypeService;
|
import cn.ysk.cashier.service.TbPlatformDictTypeService;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
|
@ -31,6 +32,7 @@ public class TbPlatformDictTypeServiceImpl implements TbPlatformDictTypeService
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> queryAll(TbPlatformDictTypeQueryCriteria criteria, Pageable pageable){
|
public Map<String,Object> queryAll(TbPlatformDictTypeQueryCriteria criteria, Pageable pageable){
|
||||||
|
pageable = PageRequest.of(0,50);
|
||||||
Page<TbPlatformDictType> page = tbPlatformDictTypeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
Page<TbPlatformDictType> page = tbPlatformDictTypeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||||
return PageUtil.toPage(page.map(tbPlatformDictTypeMapper::toDto));
|
return PageUtil.toPage(page.map(tbPlatformDictTypeMapper::toDto));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,27 +104,8 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public TbPlussShopStaffDto create(TbPlussShopStaff resources) {
|
public TbPlussShopStaffDto create(TbPlussShopStaff resources) {
|
||||||
if (org.apache.commons.lang3.StringUtils.isBlank(resources.getAccount())) {
|
checkStaffParams(resources);
|
||||||
throw new BadRequestException("员工账号为空");
|
|
||||||
}
|
|
||||||
if (userRepository.findByUsername(resources.getShopId()+"@"+resources.getAccount()) != null) {
|
|
||||||
throw new BadRequestException("员工账号已存在");
|
|
||||||
}
|
|
||||||
if (!PhoneUtil.validator(resources.getPhone())){
|
|
||||||
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());
|
resources.setCreatedAt(Instant.now().toEpochMilli());
|
||||||
|
|
||||||
//添加收银系统后台账号
|
//添加收银系统后台账号
|
||||||
|
|
@ -172,9 +153,8 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||||
resources.setPassword(null);
|
resources.setPassword(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pattern.matcher(resources.getCode()).find()) {
|
checkStaffParams(resources);
|
||||||
throw new BadRequestException("员工编号不能包含中文");
|
|
||||||
}
|
|
||||||
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(resources.getId()).orElseGet(TbPlussShopStaff::new);
|
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(resources.getId()).orElseGet(TbPlussShopStaff::new);
|
||||||
User sysUser = userRepository.findByUsername(resources.getShopId()+"@"+tbPlussShopStaff.getAccount());
|
User sysUser = userRepository.findByUsername(resources.getShopId()+"@"+tbPlussShopStaff.getAccount());
|
||||||
if(!tbPlussShopStaff.getAccount().equals(resources.getAccount())){
|
if(!tbPlussShopStaff.getAccount().equals(resources.getAccount())){
|
||||||
|
|
@ -207,6 +187,33 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||||
Integer.valueOf(resources.getShopId()), resources.getId(), resources.getPermissions());
|
Integer.valueOf(resources.getShopId()), resources.getId(), resources.getPermissions());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkStaffParams(TbPlussShopStaff resources) {
|
||||||
|
if (StringUtils.isBlank(resources.getAccount())) {
|
||||||
|
throw new BadRequestException("员工账号为空");
|
||||||
|
}
|
||||||
|
if (userRepository.findByUsername(resources.getShopId()+"@"+resources.getAccount()) != null) {
|
||||||
|
throw new BadRequestException("员工账号已存在");
|
||||||
|
}
|
||||||
|
if (!PhoneUtil.validator(resources.getPhone())){
|
||||||
|
throw new BadRequestException("手机号格式有误");
|
||||||
|
}
|
||||||
|
if (tbPlussShopStaffRepository.queryByAccount(resources.getAccount(),resources.getShopId()) != 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("最大优惠金额过大");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateStatus(TbPlussShopStaff resources) {
|
public void updateStatus(TbPlussShopStaff resources) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue