Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
SongZhang 2024-08-01 13:35:07 +08:00
commit 3b8cbdee6e
30 changed files with 110 additions and 48 deletions

View 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 {

View File

@ -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")) {

View File

@ -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());

View File

@ -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,23 @@ public class AuthorizationController {
if (authUser.isChecked() && StringUtils.isBlank(authUser.getCode()) || authUser.isChecked() && !authUser.getCode().equalsIgnoreCase(code)) {
throw new BadRequestException("验证码错误");
}
String loginpre="";
// 判断是否是员工登录
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() + "@";
}
//生成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 +123,17 @@ 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 = 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();
//校验商户商户激活是否到期未激活

View File

@ -33,6 +33,10 @@ public class AuthUserDto {
@NotBlank
private String password;
private String merchantName;
private String loginType = "merchant";
private String code;
private String uuid = "";

View File

@ -25,6 +25,8 @@ public class SuppFlow implements Serializable {
private List<ConInfos> list;
private String remark;
@Data

View File

@ -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);

View File

@ -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);

View File

@ -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());
@ -75,6 +74,7 @@ public class TbConsInfoController {
@Log("耗材出入库")
@ApiOperation("耗材出入库")
public ResponseEntity<Object> stockInOut(@Validated @RequestBody SuppFlow resources) throws Exception {
tbConsInfoService.stockInOut(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -34,19 +34,11 @@ public class TbHandoverController {
}
@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("修改查询交班记录")

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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("参数错误");
}
@ -197,7 +199,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());
@ -255,7 +257,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 +273,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("错误操作类型");
}

View File

@ -113,7 +113,8 @@ public class StockController {
return new ResponseEntity<>(dataMap, HttpStatus.OK);
}
@AnonymousAccess
@Log("商品库存:上下架商品")
@PutMapping("/grounding")
@ApiOperation("上下架商品")
public ResponseEntity<Object> grounding(
@ -140,6 +141,7 @@ public class StockController {
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("商品库存:修改商品状态")
@PutMapping("productStatus")
public ResponseEntity<Object> updateProductStatus(@RequestBody StockUpdateValueVO updateValueVO) {
stockService.updateProductStatus(updateValueVO);

View File

@ -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);

View File

@ -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" +

View File

@ -58,4 +58,8 @@ 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);
}

View File

@ -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":

View File

@ -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);

View File

@ -40,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;
/**
@ -62,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);
@ -95,6 +100,21 @@ 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("请选择角色");
}
if (resources.getMaxDiscountAmount().compareTo(new BigDecimal(100000000L)) > 0) {
throw new BadRequestException("最大优惠金额过大");
}
resources.setCreatedAt(Instant.now().toEpochMilli());
//添加收银系统后台账号
@ -106,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);
@ -117,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);
@ -130,9 +146,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,14 +156,18 @@ 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());
User sysUser = userRepository.findByUsername(resources.getShopId()+"@"+tbPlussShopStaff.getAccount());
if(!tbPlussShopStaff.getAccount().equals(resources.getAccount())){
if (userRepository.findByUsername(resources.getAccount()) != null) {
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())) {
@ -162,7 +179,7 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
Role role = new Role();
role.setId(resources.getRoleId());
roles.add(role);
sysUser.setUsername(resources.getAccount());
sysUser.setUsername(resources.getShopId()+"@"+resources.getAccount());
sysUser.setRoles(roles);
sysUser.setNickName(resources.getName());
if (StringUtils.isNotBlank(resources.getPassword())) {
@ -210,4 +227,4 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
}
FileUtil.downloadExcel(list, response);
}
}
}

View File

@ -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);
@ -240,6 +241,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
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);

View File

@ -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 用户名

View File

@ -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);