Merge branch 'feature' of https://gitee.com/liuyingfang/cashier-admin into feature

# Conflicts:
#	eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbShopCategoryQueryCriteria.java
#	eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbShopCategoryServiceImpl.java
This commit is contained in:
liuyingfang
2024-03-11 09:11:04 +08:00
14 changed files with 270 additions and 158 deletions

View File

@@ -1,6 +1,5 @@
package cn.ysk.cashier.config;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.utils.FastJsonUtils;
import cn.ysk.cashier.utils.SpringContextHolder;
import lombok.extern.slf4j.Slf4j;
@@ -11,8 +10,6 @@ import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
@@ -26,8 +23,6 @@ import java.util.Map;
@Component
@Slf4j
public class AppApiMethodAspect {
// @Pointcut("execution(public * cn.ysk.cashier.controller.*.*(..))")
@Pointcut("execution(public * (" +
"cn.ysk.cashier.controller.* " +
"|| cn.ysk.cashier.controller.*.* " +
@@ -62,26 +57,31 @@ public class AppApiMethodAspect {
FastJsonUtils.toJSONString(result)
);
return result;
} catch (BadRequestException e) {
log.error("\n>>>>>>{} {}\n>>>>>>{}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
, req.getMethod(), req.getRequestURL(), req.getRemoteAddr(),
FastJsonUtils.toJSONString(params),
e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(e.getMessage());
} catch (Throwable e) {
if(StringUtils.isBlank(e.getMessage())){
} catch (RuntimeException e) {
if (StringUtils.isBlank(e.getMessage())) {
log.error("\n>>>>>>{} {}\n>>>>>>{}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
, req.getMethod(), req.getRequestURL(), req.getRemoteAddr(),
FastJsonUtils.toJSONString(params),
e);
}else{
} else {
log.error("\n>>>>>>{} {}\n>>>>>>{}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
, req.getMethod(), req.getRequestURL(), req.getRemoteAddr(),
FastJsonUtils.toJSONString(params),
e.getMessage());
}
ResponseEntity<String> body = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage());
return body;
throw e;
} catch (Error e) {
log.error("\n>>>>>>{} {}\n>>>>>>{}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
, req.getMethod(), req.getRequestURL(), req.getRemoteAddr(),
FastJsonUtils.toJSONString(params),
e);
throw e;
} catch (Throwable e) {
log.error("\n>>>>>>{} {}\n>>>>>>{}\n>>>>>>Request: {}\n>>>>>>Exception: {}"
, req.getMethod(), req.getRequestURL(), req.getRemoteAddr(),
FastJsonUtils.toJSONString(params),
e);
throw new RuntimeException(e);
}
}
}

View File

@@ -18,6 +18,7 @@ package cn.ysk.cashier.config.security.rest;
import cn.hutool.core.util.IdUtil;
import cn.ysk.cashier.config.security.config.bean.LoginCodeEnum;
import cn.ysk.cashier.config.security.security.TokenProvider;
import cn.ysk.cashier.utils.*;
import com.wf.captcha.base.Captcha;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -37,10 +38,6 @@ import cn.ysk.cashier.config.security.service.dto.JwtUserDto;
import cn.ysk.cashier.config.security.service.OnlineUserService;
import cn.ysk.cashier.pojo.shop.TbShopInfo;
import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
import cn.ysk.cashier.utils.RsaUtils;
import cn.ysk.cashier.utils.RedisUtils;
import cn.ysk.cashier.utils.SecurityUtils;
import cn.ysk.cashier.utils.StringUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;

View File

@@ -17,18 +17,22 @@ package cn.ysk.cashier.controller.order;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.dto.order.TbOrderInfoDto;
import cn.ysk.cashier.dto.order.TbOrderInfoQueryCriteria;
import cn.ysk.cashier.pojo.order.TbOrderInfo;
import cn.ysk.cashier.service.order.TbOrderInfoService;
import cn.ysk.cashier.dto.order.TbOrderInfoQueryCriteria;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.vo.TbOrderPayCountVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
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;
import java.io.IOException;
import java.util.List;
/**
* @website https://eladmin.vip
@@ -50,13 +54,20 @@ public class TbOrderInfoController {
tbOrderInfoService.download(tbOrderInfoService.queryAll(criteria), response);
}
@GetMapping
@PostMapping("/date")
@Log("查询订单")
@ApiOperation("查询订单")
public ResponseEntity<Object> queryTbOrderInfo(TbOrderInfoQueryCriteria criteria, Pageable pageable){
public ResponseEntity<Object> queryTbOrderInfo(@RequestBody TbOrderInfoQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbOrderInfoService.queryAll(criteria,pageable),HttpStatus.OK);
}
@GetMapping("/payCount")
@Log("通过shopId查询支付统计")
@ApiOperation("通过shopId查询支付统计")
public List<TbOrderPayCountVo> queryTbOrderPayCount(String shopId){
return tbOrderInfoService.queryTbOrderPayCount(shopId);
}
@GetMapping("/{id}")
@Log("通过Id查询订单")
@ApiOperation("通过Id查询订单")

View File

@@ -46,7 +46,6 @@ public class TbProductStockDetailController {
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbProductStockDetail:list')")
public void exportTbProductStockDetail(HttpServletResponse response, TbProductStockDetailQueryCriteria criteria) throws IOException {
tbProductStockDetailService.download(tbProductStockDetailService.queryAll(criteria), response);
}
@@ -54,7 +53,6 @@ public class TbProductStockDetailController {
@GetMapping
@Log("查询/product/Stock")
@ApiOperation("查询/product/Stock")
@PreAuthorize("@el.check('tbProductStockDetail:list')")
public ResponseEntity<Object> queryTbProductStockDetail(TbProductStockDetailQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbProductStockDetailService.queryAll(criteria,pageable),HttpStatus.OK);
}
@@ -80,7 +78,6 @@ public class TbProductStockDetailController {
@PostMapping
@Log("新增/product/Stock")
@ApiOperation("新增/product/Stock")
@PreAuthorize("@el.check('tbProductStockDetail:add')")
public ResponseEntity<Object> createTbProductStockDetail(@Validated @RequestBody TbProductStockDetail resources){
return new ResponseEntity<>(tbProductStockDetailService.create(resources),HttpStatus.CREATED);
}
@@ -88,7 +85,6 @@ public class TbProductStockDetailController {
@PutMapping
@Log("修改/product/Stock")
@ApiOperation("修改/product/Stock")
@PreAuthorize("@el.check('tbProductStockDetail:edit')")
public ResponseEntity<Object> updateTbProductStockDetail(@Validated @RequestBody TbProductStockDetail resources){
tbProductStockDetailService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
@@ -97,7 +93,6 @@ public class TbProductStockDetailController {
@DeleteMapping
@Log("删除/product/Stock")
@ApiOperation("删除/product/Stock")
@PreAuthorize("@el.check('tbProductStockDetail:del')")
public ResponseEntity<Object> deleteTbProductStockDetail(@RequestBody Long[] ids) {
tbProductStockDetailService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);

View File

@@ -16,26 +16,30 @@
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbShopInfo;
import cn.ysk.cashier.service.shop.TbShopInfoService;
import cn.ysk.cashier.config.security.security.TokenProvider;
import cn.ysk.cashier.config.security.service.OnlineUserService;
import cn.ysk.cashier.dto.shop.TbShopInfoDto;
import cn.ysk.cashier.dto.shop.TbShopInfoQueryCriteria;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.pojo.shop.TbShopInfo;
import cn.ysk.cashier.service.shop.TbShopInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
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;
import javax.servlet.http.HttpServletRequest;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2023-11-07
**/
@Slf4j
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/list管理")
@@ -43,6 +47,8 @@ import javax.servlet.http.HttpServletResponse;
public class TbShopInfoController {
private final TbShopInfoService tbShopInfoService;
private final OnlineUserService onlineUserService;
private final TokenProvider tokenProvider;
// @Log("导出数据")
// @ApiOperation("导出数据")
@@ -75,6 +81,16 @@ public class TbShopInfoController {
return new ResponseEntity<>(tbShopInfoService.create(resources),HttpStatus.CREATED);
}
@ApiOperation("修改商户密码")
@PostMapping(value = "/shop/upPass")
public ResponseEntity<Object> upShopPass(HttpServletRequest request, @RequestBody String username,String password) throws Exception {
tbShopInfoService.upShopPass(username,password);
//根据token踢出用户
// onlineUserService.logout(tokenProvider.getToken(request));
log.info("修改商户密码成功。");
return new ResponseEntity<>(HttpStatus.OK);
}
@PutMapping
@Log("修改/shop/list")
@ApiOperation("修改/shop/list")

View File

@@ -0,0 +1,38 @@
/*
* 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.order;
import cn.ysk.cashier.pojo.order.TbOrderInfo;
import cn.ysk.cashier.vo.TbOrderPayCountVo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-02
**/
public interface TbOrderPayCountRepository extends JpaRepository<TbOrderInfo, Integer> {
@Query("SELECT new cn.ysk.cashier.vo.TbOrderPayCountVo(info.payType, SUM(info.amount)) " +
"FROM TbOrderInfo info " +
"WHERE info.shopId = :shopId " +
"GROUP BY info.payType")
List<TbOrderPayCountVo> queryTbOrderPayCount(@Param("shopId")String shopId);
}

View File

@@ -18,6 +18,8 @@ package cn.ysk.cashier.repository.shop;
import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
/**
* @website https://eladmin.vip
@@ -25,4 +27,15 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @date 2024-02-08
**/
public interface TbMerchantAccountRepository extends JpaRepository<TbMerchantAccount, Integer>, JpaSpecificationExecutor<TbMerchantAccount> {
/**
* 修改密码
* @param account 用户名
* @param password 密码
* @param lastPasswordResetTime 更新时间
* @param lastPasswordResetTime /
*/
@Modifying
@Query(value = "update tb_merchant_account set password = ?2 , updated_at = ?3 where account = ?1",nativeQuery = true)
void updatePass(String account, String password, Long lastPasswordResetTime);
}

View File

@@ -18,6 +18,8 @@ package cn.ysk.cashier.repository.shop;
import cn.ysk.cashier.pojo.shop.TbPlussShopStaff;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
/**
* @website https://eladmin.vip
@@ -25,4 +27,16 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @date 2024-03-01
**/
public interface TbPlussShopStaffRepository extends JpaRepository<TbPlussShopStaff, Integer>, JpaSpecificationExecutor<TbPlussShopStaff> {
/**
* 修改密码
* @param account 用户名
* @param password 密码
* @param lastPasswordResetTime 更新时间
* @param lastPasswordResetTime /
*/
@Modifying
// @Query(value = "update tb_pluss_shop_staff set password = ?2 , updated_at = ?3 where account = ?1",nativeQuery = true)
@Query("update TbPlussShopStaff set password = :password , updatedAt = :lastPasswordResetTime where account = :account")
void updatePass(String account, String password, Long lastPasswordResetTime);
}

View File

@@ -1,18 +1,18 @@
/*
* 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.
*/
* 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.service.impl.order;
import cn.ysk.cashier.dto.order.TbOrderInfoDto;
@@ -22,9 +22,11 @@ import cn.ysk.cashier.pojo.order.TbOrderDetail;
import cn.ysk.cashier.pojo.order.TbOrderInfo;
import cn.ysk.cashier.repository.order.TbOrderDetailRepository;
import cn.ysk.cashier.repository.order.TbOrderInfoRepository;
import cn.ysk.cashier.repository.order.TbOrderPayCountRepository;
import cn.ysk.cashier.service.order.TbOrderInfoService;
import cn.ysk.cashier.utils.*;
import cn.ysk.cashier.vo.TbOrderInfoVo;
import cn.ysk.cashier.vo.TbOrderPayCountVo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.Page;
@@ -38,11 +40,11 @@ import java.util.*;
import java.util.stream.Collectors;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author lyf
* @date 2024-03-02
**/
* @author lyf
* @website https://eladmin.vip
* @description 服务实现
* @date 2024-03-02
**/
@Service
@RequiredArgsConstructor
public class TbOrderInfoServiceImpl implements TbOrderInfoService {
@@ -51,12 +53,15 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
private final TbOrderInfoMapper tbOrderInfoMapper;
private final TbOrderDetailRepository tbOrderDetailRepository;
private final TbOrderPayCountRepository tbOrderPayCountRepository;
@Override
public Map<String,Object> queryAll(TbOrderInfoQueryCriteria criteria, Pageable pageable){
Page<TbOrderInfo> page = tbOrderInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
public Map<String, Object> queryAll(TbOrderInfoQueryCriteria criteria, Pageable pageable) {
Page<TbOrderInfo> page = tbOrderInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
List<TbOrderInfoVo> orderInfoVoList = new ArrayList<>();
for (TbOrderInfo tbOrderInfo : page.getContent()) {
TbOrderInfoVo orderInfoVo=new TbOrderInfoVo();
TbOrderInfoVo orderInfoVo = new TbOrderInfoVo();
List<TbOrderDetail> details = tbOrderDetailRepository.searchDetailByOrderId(tbOrderInfo.getId());
orderInfoVo.setDetailList(details);
BeanUtils.copyProperties(tbOrderInfo, orderInfoVo);
@@ -66,7 +71,12 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
}
@Override
public List<TbOrderInfoDto> queryAll(TbOrderInfoQueryCriteria criteria){
public List<TbOrderPayCountVo> queryTbOrderPayCount(String shopId) {
return tbOrderPayCountRepository.queryTbOrderPayCount(shopId);
}
@Override
public List<TbOrderInfoDto> queryAll(TbOrderInfoQueryCriteria criteria) {
List<TbOrderInfoDto> dto = tbOrderInfoMapper.toDto(tbOrderInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
for (TbOrderInfoDto tbOrderInfo : dto) {
List<TbOrderDetail> details = tbOrderDetailRepository.searchDetailByOrderId(tbOrderInfo.getId());
@@ -79,7 +89,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
@Transactional
public TbOrderInfoDto findById(Integer id) {
TbOrderInfo tbOrderInfo = tbOrderInfoRepository.findById(id).orElseGet(TbOrderInfo::new);
ValidationUtil.isNull(tbOrderInfo.getId(),"TbOrderInfo","id",id);
ValidationUtil.isNull(tbOrderInfo.getId(), "TbOrderInfo", "id", id);
TbOrderInfoDto dto = tbOrderInfoMapper.toDto(tbOrderInfo);
List<TbOrderDetail> details = tbOrderDetailRepository.searchDetailByOrderId(tbOrderInfo.getId());
dto.setDetailList(details);
@@ -96,7 +106,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
@Transactional(rollbackFor = Exception.class)
public void update(TbOrderInfo resources) {
TbOrderInfo tbOrderInfo = tbOrderInfoRepository.findById(resources.getId()).orElseGet(TbOrderInfo::new);
ValidationUtil.isNull( tbOrderInfo.getId(),"TbOrderInfo","id",resources.getId());
ValidationUtil.isNull(tbOrderInfo.getId(), "TbOrderInfo", "id", resources.getId());
tbOrderInfo.copy(resources);
tbOrderInfoRepository.save(tbOrderInfo);
}
@@ -112,9 +122,9 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
public void download(List<TbOrderInfoDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbOrderInfoDto tbOrderInfo : all) {
Map<String,Object> map = new LinkedHashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("订单编号", tbOrderInfo.getOrderNo());
switch (tbOrderInfo.getOrderType()){
switch (tbOrderInfo.getOrderType()) {
case "cash":
tbOrderInfo.setOrderType("收银");
break;
@@ -128,7 +138,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
tbOrderInfo.setOrderType("退单");
break;
default:
tbOrderInfo.setOrderType(tbOrderInfo.getOrderType()+"未知订单类型");
tbOrderInfo.setOrderType(tbOrderInfo.getOrderType() + "未知订单类型");
break;
}
map.put("订单类型", tbOrderInfo.getOrderType());
@@ -146,7 +156,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
tbOrderInfo.setSendType("堂食");
break;
default:
tbOrderInfo.setSendType(tbOrderInfo.getSendType()+"未知送货类型");
tbOrderInfo.setSendType(tbOrderInfo.getSendType() + "未知送货类型");
break;
}
map.put("发货类型", tbOrderInfo.getSendType());
@@ -193,12 +203,12 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
tbOrderInfo.setStatus("激活订单");
break;
default:
tbOrderInfo.setStatus(tbOrderInfo.getStatus()+"未知订单状态");
tbOrderInfo.setStatus(tbOrderInfo.getStatus() + "未知订单状态");
break;
}
map.put("状态", tbOrderInfo.getStatus());
map.put("创建日期", DateUtil.timeStampFormatyMdHms(tbOrderInfo.getCreatedAt()));
map.put("备注", tbOrderInfo.getRemark());
map.put("创建日期", DateUtil.timeStampFormatyMdHms(tbOrderInfo.getCreatedAt()));
map.put("备注", tbOrderInfo.getRemark());
//
// map.put("商户结算金额", tbOrderInfo.getSettlementAmount());
// map.put("包装费", tbOrderInfo.getPackFee());

View File

@@ -15,41 +15,44 @@
*/
package cn.ysk.cashier.service.impl.shopimpl;
import cn.ysk.cashier.config.security.security.TokenProvider;
import cn.ysk.cashier.config.security.service.UserCacheManager;
import cn.ysk.cashier.dto.shop.TbShopInfoDto;
import cn.ysk.cashier.dto.shop.TbShopInfoQueryCriteria;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.pojo.product.TbShopCategory;
import cn.ysk.cashier.exception.EntityNotFoundException;
import cn.ysk.cashier.mapper.shop.TbShopInfoMapper;
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.pojo.shop.TbShopInfo;
import cn.ysk.cashier.pojo.shop.TbMerchantRegister;
import cn.ysk.cashier.pojo.shop.TbPlussShopStaff;
import cn.ysk.cashier.pojo.shop.TbShopInfo;
import cn.ysk.cashier.repository.shop.TbMerchantAccountRepository;
import cn.ysk.cashier.repository.shop.TbMerchantRegisterRepository;
import cn.ysk.cashier.repository.shop.TbPlussShopStaffRepository;
import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
import cn.ysk.cashier.service.shop.TbShopInfoService;
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.utils.*;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
import cn.ysk.cashier.service.shop.TbShopInfoService;
import cn.ysk.cashier.dto.shop.TbShopInfoDto;
import cn.ysk.cashier.dto.shop.TbShopInfoQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbShopInfoMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
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.*;
import java.io.IOException;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.Instant;
import java.util.*;
/**
* @website https://eladmin.vip
@@ -69,6 +72,11 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
private final UserRepository userRepository;
private final UserService userService;
private final UserCacheManager userCacheManager;
private final TokenProvider tokenProvider;
private final TbMerchantRegisterRepository merchantRegisterRepository;
private final PasswordEncoder passwordEncoder;
@@ -213,6 +221,19 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
return tbShopInfoMapper.toDto(new TbShopInfo());
}
@Override
@Transactional
public void upShopPass(String username,String password){
User user = userRepository.findByUsername(username);
if (user == null) {
throw new EntityNotFoundException(User.class, "username", username);
}
String encPass = MD5Utils.encrypt(password);
shopStaffRepository.updatePass(username,encPass,System.currentTimeMillis());
merchantAccountRepository.updatePass(username,encPass,System.currentTimeMillis());
userService.updatePass(username,passwordEncoder.encode(passwordEncoder.encode(password)));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbShopInfo resources) {

View File

@@ -15,14 +15,16 @@
*/
package cn.ysk.cashier.service.order;
import cn.ysk.cashier.pojo.order.TbOrderInfo;
import cn.ysk.cashier.dto.order.TbOrderInfoDto;
import cn.ysk.cashier.dto.order.TbOrderInfoQueryCriteria;
import cn.ysk.cashier.pojo.order.TbOrderInfo;
import cn.ysk.cashier.vo.TbOrderPayCountVo;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* @website https://eladmin.vip
@@ -40,6 +42,13 @@ public interface TbOrderInfoService {
*/
Map<String,Object> queryAll(TbOrderInfoQueryCriteria criteria, Pageable pageable);
/**
* 根据支付类型统计
* @param shopId shopId
* @return TbOrderPayCountVo
*/
List<TbOrderPayCountVo> queryTbOrderPayCount(String shopId);
/**
* 查询所有数据不分页
* @param criteria 条件参数

View File

@@ -62,6 +62,8 @@ public interface TbShopInfoService {
*/
TbShopInfoDto create(TbShopInfoDto resources);
void upShopPass(String username,String password) throws Exception ;
/**
* 编辑
* @param resources /

View File

@@ -0,0 +1,44 @@
package cn.ysk.cashier.vo;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class TbOrderPayCountVo{
private String payType;
private BigDecimal payAmount;
// 构造函数,参数名需要与查询中的别名一致
public TbOrderPayCountVo(String payType, BigDecimal payAmount) {
this.payType = payType;
this.payAmount = payAmount;
}
// Getter和Setter方法
public String getPayType() {
return payType;
}
public void setPayType(String payType) {
this.payType = payType;
}
public BigDecimal getPayAmount() {
return payAmount;
}
public void setPayAmount(BigDecimal payAmount) {
this.payAmount = payAmount;
}
// toString方法用于简单的打印信息可根据需要添加
@Override
public String toString() {
return "TbOrderPayCountVo{" +
"payType='" + payType + '\'' +
", payAmount=" + payAmount +
'}';
}
}