Merge branch 'refs/heads/dev'
# Conflicts: # eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockDetailServiceImpl.java
This commit is contained in:
@@ -78,12 +78,14 @@ public class LogAspect {
|
|||||||
Object o = redisUtils.get("online-token-"+getToken(request));
|
Object o = redisUtils.get("online-token-"+getToken(request));
|
||||||
JSONObject jsonObject = null;
|
JSONObject jsonObject = null;
|
||||||
Integer shopId = null;
|
Integer shopId = null;
|
||||||
if (o!= null){
|
String nickName = "";
|
||||||
|
if (o != null) {
|
||||||
String jsonString = JSON.toJSONString(o);
|
String jsonString = JSON.toJSONString(o);
|
||||||
jsonObject = JSONObject.parseObject(jsonString);
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,6 +112,7 @@ public class LogAspect {
|
|||||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint)joinPoint, log, shopId);
|
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint)joinPoint, log, shopId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
try {
|
try {
|
||||||
return SecurityUtils.getCurrentUsername();
|
return SecurityUtils.getCurrentUsername();
|
||||||
@@ -117,6 +120,7 @@ public class LogAspect {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToken(HttpServletRequest request) {
|
public String getToken(HttpServletRequest request) {
|
||||||
final String requestHeader = request.getHeader("Authorization");
|
final String requestHeader = request.getHeader("Authorization");
|
||||||
if (requestHeader != null && requestHeader.startsWith("Bearer")) {
|
if (requestHeader != null && requestHeader.startsWith("Bearer")) {
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
// 所有类型的接口都放行
|
// 所有类型的接口都放行
|
||||||
.antMatchers(anonymousUrls.get(RequestMethodEnum.ALL.getType()).toArray(new String[0])).permitAll()
|
.antMatchers(anonymousUrls.get(RequestMethodEnum.ALL.getType()).toArray(new String[0])).permitAll()
|
||||||
.antMatchers("/auth/appletsLogin").permitAll()
|
.antMatchers("/auth/appletsLogin").permitAll()
|
||||||
|
.antMatchers("/api/tbHandover").permitAll()
|
||||||
// 所有请求都需要认证
|
// 所有请求都需要认证
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
.and().apply(securityConfigurerAdapter());
|
.and().apply(securityConfigurerAdapter());
|
||||||
|
|||||||
@@ -16,9 +16,12 @@
|
|||||||
package cn.ysk.cashier.config.security.rest;
|
package cn.ysk.cashier.config.security.rest;
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
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.config.bean.LoginCodeEnum;
|
||||||
import cn.ysk.cashier.config.security.security.TokenProvider;
|
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.pojo.shop.TbPlussShopStaff;
|
||||||
|
import cn.ysk.cashier.repository.shop.TbMerchantAccountRepository;
|
||||||
import cn.ysk.cashier.repository.shop.TbPlussShopStaffRepository;
|
import cn.ysk.cashier.repository.shop.TbPlussShopStaffRepository;
|
||||||
import cn.ysk.cashier.utils.*;
|
import cn.ysk.cashier.utils.*;
|
||||||
import com.wf.captcha.base.Captcha;
|
import com.wf.captcha.base.Captcha;
|
||||||
@@ -75,6 +78,8 @@ public class AuthorizationController {
|
|||||||
private final AuthenticationManagerBuilder authenticationManagerBuilder;
|
private final AuthenticationManagerBuilder authenticationManagerBuilder;
|
||||||
private final TbShopInfoRepository tbShopInfoRepository;
|
private final TbShopInfoRepository tbShopInfoRepository;
|
||||||
private final TbPlussShopStaffRepository staffRepository;
|
private final TbPlussShopStaffRepository staffRepository;
|
||||||
|
private final TbMerchantAccountRepository tbMerchantAccountRepository;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private LoginProperties loginProperties;
|
private LoginProperties loginProperties;
|
||||||
|
|
||||||
@@ -93,9 +98,23 @@ public class AuthorizationController {
|
|||||||
if (authUser.isChecked() && StringUtils.isBlank(authUser.getCode()) || authUser.isChecked() && !authUser.getCode().equalsIgnoreCase(code)) {
|
if (authUser.isChecked() && StringUtils.isBlank(authUser.getCode()) || authUser.isChecked() && !authUser.getCode().equalsIgnoreCase(code)) {
|
||||||
throw new BadRequestException("验证码错误");
|
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
|
//生成token
|
||||||
UsernamePasswordAuthenticationToken authenticationToken =
|
UsernamePasswordAuthenticationToken authenticationToken =
|
||||||
new UsernamePasswordAuthenticationToken(authUser.getUsername(), password);
|
new UsernamePasswordAuthenticationToken(loginpre+authUser.getUsername(), password);
|
||||||
Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
|
Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
|
||||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||||
// 生成令牌与第三方系统获取令牌方式
|
// 生成令牌与第三方系统获取令牌方式
|
||||||
@@ -104,7 +123,7 @@ public class AuthorizationController {
|
|||||||
// SecurityContextHolder.getContext().setAuthentication(authentication);
|
// SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||||
final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
|
final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
|
||||||
// TbShopInfo byAccount = tbShopInfoRepository.findByAccount(jwtUserDto.getUsername());
|
// 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")) {
|
if (tbPlussShopStaff != null && tbPlussShopStaff.getType().equals("staff")) {
|
||||||
Integer isManage = tbPlussShopStaff.getIsManage();
|
Integer isManage = tbPlussShopStaff.getIsManage();
|
||||||
if (isManage != null && isManage != 1) {
|
if (isManage != null && isManage != 1) {
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ public class AuthUserDto {
|
|||||||
@NotBlank
|
@NotBlank
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
private String merchantName;
|
||||||
|
|
||||||
|
private String loginType = "merchant";
|
||||||
|
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
private String uuid = "";
|
private String uuid = "";
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ public class SuppFlow implements Serializable {
|
|||||||
|
|
||||||
private List<ConInfos> list;
|
private List<ConInfos> list;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public class TbConCheckController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询盘点耗材")
|
|
||||||
@ApiOperation("查询盘点耗材")
|
@ApiOperation("查询盘点耗材")
|
||||||
public ResponseEntity<Object> queryTbConCheck(TbConCheckQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbConCheck(TbConCheckQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbConCheckService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbConCheckService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ public class TbConUnitController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询耗材单位添加")
|
|
||||||
@ApiOperation("查询耗材单位添加")
|
@ApiOperation("查询耗材单位添加")
|
||||||
public ResponseEntity<Object> queryTbConUnit(TbConUnitQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbConUnit(TbConUnitQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbConUnitService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbConUnitService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ public class TbConsInfoController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询耗材信息")
|
|
||||||
@ApiOperation("查询耗材信息")
|
@ApiOperation("查询耗材信息")
|
||||||
public ResponseEntity<Object> queryTbConsInfo(TbConsInfoQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbConsInfo(TbConsInfoQueryCriteria criteria, Pageable pageable){
|
||||||
pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("createTime").descending());
|
pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("createTime").descending());
|
||||||
@@ -75,6 +74,7 @@ public class TbConsInfoController {
|
|||||||
@Log("耗材出入库")
|
@Log("耗材出入库")
|
||||||
@ApiOperation("耗材出入库")
|
@ApiOperation("耗材出入库")
|
||||||
public ResponseEntity<Object> stockInOut(@Validated @RequestBody SuppFlow resources) throws Exception {
|
public ResponseEntity<Object> stockInOut(@Validated @RequestBody SuppFlow resources) throws Exception {
|
||||||
|
|
||||||
tbConsInfoService.stockInOut(resources);
|
tbConsInfoService.stockInOut(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public class TbConsInfoFlowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询耗材流水")
|
|
||||||
@ApiOperation("查询耗材流水")
|
@ApiOperation("查询耗材流水")
|
||||||
public ResponseEntity<Object> queryTbConsInfoFlow(TbConsInfoFlowQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbConsInfoFlow(TbConsInfoFlowQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbConsInfoFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbConsInfoFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public class TbConsSuppFlowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询入库记录")
|
|
||||||
@ApiOperation("查询入库记录")
|
@ApiOperation("查询入库记录")
|
||||||
public ResponseEntity<Object> queryTbConsSuppFlow(TbConsSuppFlowQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbConsSuppFlow(TbConsSuppFlowQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbConsSuppFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbConsSuppFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ public class TbConsTypeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询耗材类型")
|
|
||||||
@ApiOperation("查询耗材类型")
|
@ApiOperation("查询耗材类型")
|
||||||
public ResponseEntity<Object> queryTbConsType(TbConsTypeQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbConsType(TbConsTypeQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbConsTypeService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbConsTypeService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
|||||||
@@ -34,19 +34,11 @@ public class TbHandoverController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询查询交班记录")
|
|
||||||
@ApiOperation("查询查询交班记录")
|
@ApiOperation("查询查询交班记录")
|
||||||
public ResponseEntity<Object> queryTbHandover(TbHandoverQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbHandover(TbHandoverQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbHandoverService.queryAll(criteria,pageable),HttpStatus.OK);
|
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
|
@PutMapping
|
||||||
@Log("修改查询交班记录")
|
@Log("修改查询交班记录")
|
||||||
@ApiOperation("修改查询交班记录")
|
@ApiOperation("修改查询交班记录")
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ public class TbProskuConController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询商品规格耗材信息")
|
|
||||||
@ApiOperation("查询商品规格耗材信息")
|
@ApiOperation("查询商品规格耗材信息")
|
||||||
public ResponseEntity<Object> queryTbProskuCon(TbProskuConQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbProskuCon(TbProskuConQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbProskuConService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbProskuConService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public class ViewConInfoFlowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询获取耗材流水信息")
|
|
||||||
@ApiOperation("查询获取耗材流水信息")
|
@ApiOperation("查询获取耗材流水信息")
|
||||||
public ResponseEntity<Object> queryViewConInfoFlow(ViewConInfoFlowQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryViewConInfoFlow(ViewConInfoFlowQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(viewConInfoFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(viewConInfoFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public class ViewConSkuController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询查询耗材规格信息")
|
|
||||||
@ApiOperation("查询查询耗材规格信息")
|
@ApiOperation("查询查询耗材规格信息")
|
||||||
public ResponseEntity<Object> queryViewConSku(ViewConSkuQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryViewConSku(ViewConSkuQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(viewConSkuService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(viewConSkuService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public class ViewConsSuppFlowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询出入库记录")
|
|
||||||
@ApiOperation("查询出入库记录")
|
@ApiOperation("查询出入库记录")
|
||||||
public ResponseEntity<Object> queryViewConsSuppFlow(ViewConsSuppFlowQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryViewConsSuppFlow(ViewConsSuppFlowQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(viewConsSuppFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(viewConsSuppFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public class ViewProductSkuShopController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询商品规格信息查询")
|
|
||||||
@ApiOperation("查询商品规格信息查询")
|
@ApiOperation("查询商品规格信息查询")
|
||||||
public ResponseEntity<Object> queryViewProductSkuShop(ViewProductSkuShopQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryViewProductSkuShop(ViewProductSkuShopQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(viewProductSkuShopService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(viewProductSkuShopService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import cn.ysk.cashier.annotation.Query;
|
|||||||
public class TbHandoverQueryCriteria{
|
public class TbHandoverQueryCriteria{
|
||||||
|
|
||||||
/** 精确 */
|
/** 精确 */
|
||||||
@Query
|
@Query(type = Query.Type.BETWEEN)
|
||||||
private String tradeDay;
|
private List<String> tradeDay;
|
||||||
|
|
||||||
/** 精确 */
|
/** 精确 */
|
||||||
@Query
|
@Query
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void stockInOut(SuppFlow resources) throws Exception {
|
public void stockInOut(SuppFlow resources) throws Exception {
|
||||||
|
log.info("resources:{}",JSON.toJSONString(resources));
|
||||||
if (Objects.isNull(resources)) {
|
if (Objects.isNull(resources)) {
|
||||||
throw new Exception("参数错误");
|
throw new Exception("参数错误");
|
||||||
}
|
}
|
||||||
@@ -198,7 +199,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
|||||||
operatorSnapMap.put("account", tbShopInfo.getAccount());
|
operatorSnapMap.put("account", tbShopInfo.getAccount());
|
||||||
|
|
||||||
stockOperate.setOperatorSnap(JSON.toJSONString(operatorSnapMap));
|
stockOperate.setOperatorSnap(JSON.toJSONString(operatorSnapMap));
|
||||||
stockOperate.setRemark("");
|
stockOperate.setRemark(resources.getRemark());
|
||||||
stockOperate.setStockTime(System.currentTimeMillis());
|
stockOperate.setStockTime(System.currentTimeMillis());
|
||||||
stockOperate.setCreatedAt(System.currentTimeMillis());
|
stockOperate.setCreatedAt(System.currentTimeMillis());
|
||||||
stockOperate.setUpdatedAt(System.currentTimeMillis());
|
stockOperate.setUpdatedAt(System.currentTimeMillis());
|
||||||
|
|||||||
@@ -113,7 +113,8 @@ public class StockController {
|
|||||||
return new ResponseEntity<>(dataMap, HttpStatus.OK);
|
return new ResponseEntity<>(dataMap, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AnonymousAccess
|
|
||||||
|
@Log("商品库存:上下架商品")
|
||||||
@PutMapping("/grounding")
|
@PutMapping("/grounding")
|
||||||
@ApiOperation("上下架商品")
|
@ApiOperation("上下架商品")
|
||||||
public ResponseEntity<Object> grounding(
|
public ResponseEntity<Object> grounding(
|
||||||
@@ -140,6 +141,7 @@ public class StockController {
|
|||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Log("商品库存:修改商品状态")
|
||||||
@PutMapping("productStatus")
|
@PutMapping("productStatus")
|
||||||
public ResponseEntity<Object> updateProductStatus(@RequestBody StockUpdateValueVO updateValueVO) {
|
public ResponseEntity<Object> updateProductStatus(@RequestBody StockUpdateValueVO updateValueVO) {
|
||||||
stockService.updateProductStatus(updateValueVO);
|
stockService.updateProductStatus(updateValueVO);
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ public class TbCouponCategoryController {
|
|||||||
private final TbCouponCategoryService tbCouponCategoryService;
|
private final TbCouponCategoryService tbCouponCategoryService;
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询团购卷类别")
|
|
||||||
@ApiOperation("查询团购卷类别")
|
@ApiOperation("查询团购卷类别")
|
||||||
public ResponseEntity<Object> queryTbCouponCategory(TbCouponCategoryQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbCouponCategory(TbCouponCategoryQueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(tbCouponCategoryService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbCouponCategoryService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
|||||||
@@ -17,4 +17,5 @@ public class StockCountDTO {
|
|||||||
private String specSnap;
|
private String specSnap;
|
||||||
private Integer stockCount;
|
private Integer stockCount;
|
||||||
private Integer stockNumber;
|
private Integer stockNumber;
|
||||||
|
private String specSnap;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class TbProductSku implements Serializable {
|
|||||||
|
|
||||||
@Column(name = "`is_grounding`")
|
@Column(name = "`is_grounding`")
|
||||||
@ApiModelProperty(value = "是否上架")
|
@ApiModelProperty(value = "是否上架")
|
||||||
private Integer isGrounding = 0;
|
private Integer isGrounding;
|
||||||
|
|
||||||
public void setIsDel(Integer isDel) {
|
public void setIsDel(Integer isDel) {
|
||||||
if(isDel!=null){
|
if(isDel!=null){
|
||||||
|
|||||||
@@ -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")
|
@Query("select product from TbProduct product where product.id=:id and product.shopId=:shopId")
|
||||||
TbProduct selectByShopIdAndId(Integer id, String shopId);
|
TbProduct selectByShopIdAndId(Integer id, String shopId);
|
||||||
|
|
||||||
|
@Query("select product from TbProduct product where product.shopId=:shopId")
|
||||||
|
List<TbProduct> selectByShopId(String shopId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||||||
case "offline":
|
case "offline":
|
||||||
tbOrderInfo.setOrderType("线下");
|
tbOrderInfo.setOrderType("线下");
|
||||||
break;
|
break;
|
||||||
case "return ":
|
case "return":
|
||||||
tbOrderInfo.setOrderType("退单");
|
tbOrderInfo.setOrderType("退单");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -466,7 +466,6 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||||||
|
|
||||||
map.put("支付类型", tbOrderInfo.getPayType());
|
map.put("支付类型", tbOrderInfo.getPayType());
|
||||||
map.put("订单金额", tbOrderInfo.getOrderAmount());
|
map.put("订单金额", tbOrderInfo.getOrderAmount());
|
||||||
map.put("退单金额", tbOrderInfo.getRefundAmount());
|
|
||||||
map.put("支付金额", tbOrderInfo.getPayAmount());
|
map.put("支付金额", tbOrderInfo.getPayAmount());
|
||||||
switch (tbOrderInfo.getStatus()) {
|
switch (tbOrderInfo.getStatus()) {
|
||||||
case "unpaid":
|
case "unpaid":
|
||||||
@@ -485,6 +484,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||||||
tbOrderInfo.setStatus("申请退单中");
|
tbOrderInfo.setStatus("申请退单中");
|
||||||
break;
|
break;
|
||||||
case "refund":
|
case "refund":
|
||||||
|
map.put("支付金额", "-"+tbOrderInfo.getPayAmount());
|
||||||
tbOrderInfo.setStatus("退单完成");
|
tbOrderInfo.setStatus("退单完成");
|
||||||
break;
|
break;
|
||||||
case "cancelled":
|
case "cancelled":
|
||||||
|
|||||||
@@ -373,6 +373,9 @@ public class TbProductServiceImpl implements TbProductService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 默认开启共享库存和库存
|
||||||
|
// product.setIsDistribute(1);
|
||||||
TbProduct save = tbProductRepository.save(product);
|
TbProduct save = tbProductRepository.save(product);
|
||||||
if (save.getId() == null) {
|
if (save.getId() == null) {
|
||||||
throw new BadRequestException("添加商品失败");
|
throw new BadRequestException("添加商品失败");
|
||||||
@@ -381,12 +384,24 @@ public class TbProductServiceImpl implements TbProductService {
|
|||||||
tbProductRepository.save(save);
|
tbProductRepository.save(save);
|
||||||
//sku
|
//sku
|
||||||
if (resources.getSkuList() != null) {
|
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<>();
|
List<TbProductSku> skuList = new ArrayList<>();
|
||||||
for (TbProductSku sku : resources.getSkuList()) {
|
for (TbProductSku sku : resources.getSkuList()) {
|
||||||
sku.setProductId(String.valueOf(save.getId()));
|
sku.setProductId(String.valueOf(save.getId()));
|
||||||
sku.setShopId(save.getShopId());
|
sku.setShopId(save.getShopId());
|
||||||
sku.setCreatedAt(Instant.now().toEpochMilli());
|
sku.setCreatedAt(Instant.now().toEpochMilli());
|
||||||
sku.setUpdatedAt(Instant.now().toEpochMilli());
|
sku.setUpdatedAt(Instant.now().toEpochMilli());
|
||||||
|
sku.setIsGrounding(1);
|
||||||
|
sku.setWarnLine(warnLine);
|
||||||
skuList.add(sku);
|
skuList.add(sku);
|
||||||
}
|
}
|
||||||
List<TbProductSku> tbProductSkus = tbProductSkuRepository.saveAll(skuList);
|
List<TbProductSku> tbProductSkus = tbProductSkuRepository.saveAll(skuList);
|
||||||
@@ -476,13 +491,28 @@ public class TbProductServiceImpl implements TbProductService {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
if ("sku".equals(save.getTypeEnum())) {
|
if ("sku".equals(save.getTypeEnum())) {
|
||||||
List<Integer> collect = resources.getSkuList().stream().map(TbProductSku::getId).collect(Collectors.toList());
|
// List<Integer> collect = resources.getSkuList().stream().map(TbProductSku::getId).collect(Collectors.toList());
|
||||||
List<TbProductSku> tbProductSkus = tbProductSkuRepository.searchSku(resources.getId().toString());
|
List<TbProductSku> tbProductSkus = tbProductSkuRepository.searchSku(resources.getId().toString());
|
||||||
|
List<Integer> collect = tbProductSkus.stream().map(TbProductSku::getId).collect(Collectors.toList());
|
||||||
|
HashMap<String, TbProductSku> skuInfo = new HashMap<>();
|
||||||
for (TbProductSku productSkus : tbProductSkus) {
|
for (TbProductSku productSkus : tbProductSkus) {
|
||||||
if (!collect.contains(productSkus.getId())) {
|
skuInfo.put(productSkus.getId().toString(), productSkus);
|
||||||
tbProductSkuRepository.deleteBySkuId(productSkus.getId());
|
}
|
||||||
|
for (TbProductSku tbProductSku : resources.getSkuList()) {
|
||||||
|
if (!collect.contains(tbProductSku.getId())) {
|
||||||
|
tbProductSkuRepository.deleteBySkuId(tbProductSku.getId());
|
||||||
|
}else {
|
||||||
|
TbProductSku productSku = skuInfo.get(tbProductSku.getId().toString());
|
||||||
|
if (productSku != null) {
|
||||||
|
tbProductSku.setIsGrounding(productSku.getIsGrounding());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// for (TbProductSku productSkus : tbProductSkus) {
|
||||||
|
// if (!collect.contains(productSkus.getId())) {
|
||||||
|
// tbProductSkuRepository.deleteBySkuId(productSkus.getId());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
tbProductSkuRepository.saveAll(resources.getSkuList());
|
tbProductSkuRepository.saveAll(resources.getSkuList());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
|||||||
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(id).orElseGet(TbPlussShopStaff::new);
|
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(id).orElseGet(TbPlussShopStaff::new);
|
||||||
ValidationUtil.isNull(tbPlussShopStaff.getId(),"TbPlussShopStaff","id",id);
|
ValidationUtil.isNull(tbPlussShopStaff.getId(),"TbPlussShopStaff","id",id);
|
||||||
TbPlussShopStaffDto dto = tbPlussShopStaffMapper.toDto(tbPlussShopStaff);
|
TbPlussShopStaffDto dto = tbPlussShopStaffMapper.toDto(tbPlussShopStaff);
|
||||||
UserDto userDto = userService.findByName(tbPlussShopStaff.getAccount());
|
UserDto userDto = userService.findByName(tbPlussShopStaff.getShopId()+"@"+tbPlussShopStaff.getAccount());
|
||||||
// dto.setUser(userDto);
|
// dto.setUser(userDto);
|
||||||
if(!CollectionUtils.isEmpty(userDto.getRoles())){
|
if(!CollectionUtils.isEmpty(userDto.getRoles())){
|
||||||
dto.setRoleId(userDto.getRoles().stream().findFirst().get().getId());
|
dto.setRoleId(userDto.getRoles().stream().findFirst().get().getId());
|
||||||
@@ -115,7 +115,6 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
|||||||
if (resources.getMaxDiscountAmount().compareTo(new BigDecimal(100000000L)) > 0) {
|
if (resources.getMaxDiscountAmount().compareTo(new BigDecimal(100000000L)) > 0) {
|
||||||
throw new BadRequestException("最大优惠金额过大");
|
throw new BadRequestException("最大优惠金额过大");
|
||||||
}
|
}
|
||||||
|
|
||||||
resources.setCreatedAt(Instant.now().toEpochMilli());
|
resources.setCreatedAt(Instant.now().toEpochMilli());
|
||||||
|
|
||||||
//添加收银系统后台账号
|
//添加收银系统后台账号
|
||||||
@@ -127,7 +126,7 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
|||||||
user.setPassword(passwordEncoder.encode(resources.getPassword()));
|
user.setPassword(passwordEncoder.encode(resources.getPassword()));
|
||||||
resources.setPassword(MD5Utils.md5(resources.getPassword()));
|
resources.setPassword(MD5Utils.md5(resources.getPassword()));
|
||||||
}
|
}
|
||||||
user.setUsername(resources.getAccount());
|
user.setUsername(resources.getShopId() + "@" +resources.getAccount());
|
||||||
user.setNickName(resources.getName());
|
user.setNickName(resources.getName());
|
||||||
user.setPhone(resources.getPhone());
|
user.setPhone(resources.getPhone());
|
||||||
user.setEnabled(true);
|
user.setEnabled(true);
|
||||||
@@ -162,9 +161,9 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
|||||||
throw new BadRequestException("员工编号不能包含中文");
|
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(tbPlussShopStaff.getAccount());
|
User sysUser = userRepository.findByUsername(resources.getShopId()+"@"+tbPlussShopStaff.getAccount());
|
||||||
if(!tbPlussShopStaff.getAccount().equals(resources.getAccount())){
|
if(!tbPlussShopStaff.getAccount().equals(resources.getAccount())){
|
||||||
if (userRepository.findByUsername(resources.getAccount()) != null) {
|
if (userRepository.findByUsername(resources.getShopId()+"@"+resources.getAccount()) != null) {
|
||||||
throw new BadRequestException("员工账号不可重复");
|
throw new BadRequestException("员工账号不可重复");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,7 +179,7 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
|||||||
Role role = new Role();
|
Role role = new Role();
|
||||||
role.setId(resources.getRoleId());
|
role.setId(resources.getRoleId());
|
||||||
roles.add(role);
|
roles.add(role);
|
||||||
sysUser.setUsername(resources.getAccount());
|
sysUser.setUsername(resources.getShopId()+"@"+resources.getAccount());
|
||||||
sysUser.setRoles(roles);
|
sysUser.setRoles(roles);
|
||||||
sysUser.setNickName(resources.getName());
|
sysUser.setNickName(resources.getName());
|
||||||
if (StringUtils.isNotBlank(resources.getPassword())) {
|
if (StringUtils.isNotBlank(resources.getPassword())) {
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
|||||||
User user = new User();
|
User user = new User();
|
||||||
user.setPassword(passwordEncoder.encode(resources.getPassword()));
|
user.setPassword(passwordEncoder.encode(resources.getPassword()));
|
||||||
user.setUsername(resources.getAccount());
|
user.setUsername(resources.getAccount());
|
||||||
|
user.setNickName(resources.getShopName());
|
||||||
user.setPhone(resources.getPhone());
|
user.setPhone(resources.getPhone());
|
||||||
user.setCreateBy("admin");
|
user.setCreateBy("admin");
|
||||||
user.setEnabled(true);
|
user.setEnabled(true);
|
||||||
@@ -240,6 +241,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
|||||||
TbShopInfo tbShopInfo = tbShopInfoRepository.findById(resources.getId()).orElseGet(TbShopInfo::new);
|
TbShopInfo tbShopInfo = tbShopInfoRepository.findById(resources.getId()).orElseGet(TbShopInfo::new);
|
||||||
if (!resources.getShopName().equals(tbShopInfo.getShopName())) {
|
if (!resources.getShopName().equals(tbShopInfo.getShopName())) {
|
||||||
shopStaffRepository.updateNameById(resources.getShopName(),resources.getId().toString());
|
shopStaffRepository.updateNameById(resources.getShopName(),resources.getId().toString());
|
||||||
|
userRepository.updateNickName(resources.getAccount(),resources.getShopName());
|
||||||
}
|
}
|
||||||
ValidationUtil.isNull( tbShopInfo.getId(),"TbShopInfo","id",resources.getId());
|
ValidationUtil.isNull( tbShopInfo.getId(),"TbShopInfo","id",resources.getId());
|
||||||
tbShopInfo.copy(resources);
|
tbShopInfo.copy(resources);
|
||||||
|
|||||||
@@ -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)
|
@Query(value = "update sys_user set enabled = 0 where username = ?1",nativeQuery = true)
|
||||||
void upEnableByusername(String username);
|
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 用户名
|
* @param username 用户名
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public class ${className}Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询${apiAlias}")
|
|
||||||
@ApiOperation("查询${apiAlias}")
|
@ApiOperation("查询${apiAlias}")
|
||||||
public ResponseEntity<Object> query${className}(${className}QueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> query${className}(${className}QueryCriteria criteria, Pageable pageable){
|
||||||
return new ResponseEntity<>(${changeClassName}Service.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(${changeClassName}Service.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
|||||||
Reference in New Issue
Block a user