Merge branch 'master' of https://codeup.aliyun.com/bsdtec/biz-api-cloud
# Conflicts: # pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletStrideMapper.java
This commit is contained in:
commit
51465b7e5b
27 files changed
+538
-22
No files matched your search
+23
-13
@@ -27,6 +27,7 @@ import com.bsd.pjcloud.app.service.AppUserService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.thirdparty.api.feign.RemoterThirdPartyAuthService;
|
||||
import com.bsd.pjcloud.thirdparty.dto.SHJNSSODTO;
|
||||
import com.bsd.pjcloud.thirdparty.dto.ZZDUserDTO;
|
||||
import com.bsd.pjcloud.thirdparty.entity.ThirdPartyUserEntity;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
@@ -34,6 +35,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.seata.spring.annotation.GlobalTransactional;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -51,7 +54,7 @@ import java.util.Map;
|
||||
/**
|
||||
* app用户表
|
||||
*
|
||||
* @author aeizzz
|
||||
* @author zjf
|
||||
* @date 2022-12-07 09:52:03
|
||||
*/
|
||||
@RestController
|
||||
@@ -178,23 +181,29 @@ public class AppUserAutoLoginController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 诗画sdk获取参数
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
// @PostMapping("/shjnsso")
|
||||
// @Inner(value = false)
|
||||
// @Operation(summary = "诗画江南单点登录")
|
||||
// public R shjnsso(@RequestBody @Valid SHJNSSOReqVO shjnsso) {
|
||||
// ZZDUserDTO zzdUserDTO=ssoApi.shjnsso(shjnsso.getAccountId(),shjnsso.getSessionId());
|
||||
// ZZDUserDTO.Ext ext = zzdUserDTO.getExt();
|
||||
// String mobile = zzdUserDTO.getMobile();
|
||||
// AdminUserRespDTO userByMobileOrEmployeeCode = adminUserApi.getUserByMobileOrEmployeeCode(null, mobile);
|
||||
// if(userByMobileOrEmployeeCode!=null){
|
||||
// return createTokenAfterLoginSuccess(userByMobileOrEmployeeCode.getId(), mobile, LoginLogTypeEnum.LOGIN_SSO);
|
||||
// }
|
||||
@PostMapping("/shjnsso")
|
||||
@Inner(value = false)
|
||||
@Operation(summary = "诗画江南单点登录")
|
||||
public R shjnsso(@RequestBody @Valid SHJNSSODTO shjnsso) {
|
||||
R rdata = remoterThirdPartyAuthService.shjnsso(shjnsso.getAccountId(), shjnsso.getSessionId());
|
||||
ZZDUserDTO zzdUserDTO = (ZZDUserDTO) rdata.getData();
|
||||
ZZDUserDTO.Ext ext = zzdUserDTO.getExt();
|
||||
String mobile = zzdUserDTO.getMobile();
|
||||
R<List<SysUser>> rListSysUser = remoteUserService.getUserByMobileOrEmployeeCode(null, mobile);
|
||||
List<SysUser> sysUsers = rListSysUser.getData();
|
||||
if(!CollectionUtils.isEmpty(sysUsers)){
|
||||
//登录成功生成token
|
||||
UserTokenDTO userTokenDTO = new UserTokenDTO();
|
||||
userTokenDTO.setSysUser(sysUsers.get(0));
|
||||
remoteTokenService.generateToken(userTokenDTO);
|
||||
}
|
||||
// log.info("用户不存在,尝试创建用户");
|
||||
// CreateUserDto createUserDto = new CreateUserDto();
|
||||
// createUserDto.setUsername(zzdUserDTO.getUsername());
|
||||
@@ -207,7 +216,8 @@ public class AppUserAutoLoginController {
|
||||
// AdminUserRespDTO adminUserRespDTONew=adminUserApi.createSysUser(createUserDto);
|
||||
// log.info("创建用户成功,用户id为:{}",adminUserRespDTONew.getId());
|
||||
// return createTokenAfterLoginSuccess(adminUserRespDTONew.getId(), mobile, LoginLogTypeEnum.LOGIN_SSO);
|
||||
// }
|
||||
return R.failed("不存在用户");
|
||||
}
|
||||
|
||||
|
||||
@Inner(value = false)
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2018-2025, pjcloud All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: pjcloud
|
||||
*
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.canteen.api.feign;
|
||||
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author zjf
|
||||
* @date 2018/6/22
|
||||
*/
|
||||
@FeignClient(contextId = "remoteCanteenCategoryService", value = ServiceNameConstants.CANTEEN_SERVICE)
|
||||
public interface RemoteCanteenCategoryService {
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有的菜品分类
|
||||
* @param categoryType 餐段类型,1早餐 2中 3晚餐 不传默认所有
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/canteenCategory/getAllSimple")
|
||||
R getAllSimple(@RequestParam(value = "categoryType",required = false) String categoryType);
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2018-2025, pjcloud All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: pjcloud
|
||||
*
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.canteen.api.feign;
|
||||
|
||||
|
||||
import com.bsd.pjcloud.canteen.dto.CanteenSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @author zjf
|
||||
* @date 2018/6/22
|
||||
*/
|
||||
@FeignClient(contextId = "remoteCanteenSpuService", value = ServiceNameConstants.CANTEEN_SERVICE)
|
||||
public interface RemoteCanteenSpuService {
|
||||
|
||||
|
||||
/**
|
||||
* 获取菜品列表
|
||||
* @param categoryId 不填默认查全部
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/canteenSpu/ad/getCanteenSpuList")
|
||||
R getCanteenSpuList(@RequestParam(value = "categoryId",required = false)String categoryId);
|
||||
|
||||
|
||||
/**
|
||||
* 扣减菜品库存
|
||||
* @param updateStockReqDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/canteenSpu/ad/updateSkuStock")
|
||||
R getAllSimple(@RequestBody CanteenSpuUpdateStockReqDTO updateStockReqDTO);
|
||||
|
||||
}
|
||||
+1
-1
@@ -7,7 +7,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ml
|
||||
* 菜品下拉框主页展示
|
||||
* 后台每日菜谱菜品下拉框
|
||||
*/
|
||||
@Data
|
||||
public class DailyMenuAll {
|
||||
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.bsd.pjcloud.canteen.vo;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Schema(description = "安卓机在线点餐获取菜品信息")
|
||||
public class ADCanteenSpuListVO {
|
||||
|
||||
|
||||
/**
|
||||
* 商品 SPU 编号,自增
|
||||
*/
|
||||
@Schema(description="商品 SPU 编号,自增")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@Schema(description="商品名称")
|
||||
private String name;
|
||||
|
||||
|
||||
/**
|
||||
* 商品分类编号
|
||||
*/
|
||||
@Schema(description="商品分类编号")
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 商品封面图
|
||||
*/
|
||||
@Schema(description="商品封面图")
|
||||
private String picUrl;
|
||||
|
||||
|
||||
/**
|
||||
* 商品价格,单位使用:分
|
||||
*/
|
||||
@Schema(description="商品价格,单位使用:分")
|
||||
private Integer price;
|
||||
|
||||
|
||||
/**
|
||||
* 市场价,单位使用:分
|
||||
*/
|
||||
@Schema(description="市场价,单位使用:分")
|
||||
private Integer marketPrice;
|
||||
|
||||
|
||||
/**
|
||||
* 库存
|
||||
*/
|
||||
@Schema(description="库存")
|
||||
private Integer stock;
|
||||
|
||||
|
||||
/**
|
||||
* 商品销量
|
||||
*/
|
||||
@Schema(description="商品销量")
|
||||
private Integer salesCount;
|
||||
|
||||
|
||||
/**
|
||||
* 商户编号
|
||||
*/
|
||||
@Schema(description="商户编号")
|
||||
private Long merchantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Schema(description="部门id")
|
||||
private Long deptId;
|
||||
|
||||
|
||||
}
|
||||
+2
-2
@@ -134,8 +134,8 @@ public class CanteenCategoryController {
|
||||
public R getAllSimple(@RequestParam(value = "categoryType",required = false)String categoryType) {
|
||||
LambdaQueryWrapper<CanteenCategoryEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.orderByAsc(CanteenCategoryEntity::getSort);
|
||||
wrapper.eq(StringUtils.isNotEmpty(categoryType),CanteenCategoryEntity::getCategoryType,categoryType);
|
||||
List<CanteenCategoryEntity> list = canteenCategoryService.list(wrapper);
|
||||
wrapper.apply(StringUtils.isNotEmpty(categoryType),"FIND_IN_SET({0}, your_column_name)",categoryType);
|
||||
List<CanteenCategoryEntity> list = canteenCategoryService.listScope(wrapper);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
||||
+11
@@ -131,8 +131,19 @@ public class CanteenSpuController {
|
||||
// --------------APP-----------------
|
||||
|
||||
|
||||
/**
|
||||
* 获取菜品列表
|
||||
* @param categoryId 分类编号,不传默认查询全部
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/ad/getCanteenSpuList")
|
||||
public R getCanteenSpuList(@RequestParam(value = "categoryId",required = false)String categoryId){
|
||||
return canteenSpuService.getCanteenSpuList(categoryId);
|
||||
}
|
||||
|
||||
@PostMapping("/ad/updateSkuStock")
|
||||
@SysLog("更新菜品库存")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_edit')" )
|
||||
public R updateSkuStock(@RequestBody CanteenSpuUpdateStockReqDTO updateStockReqDTO){
|
||||
return canteenSpuService.updateSkuStock(updateStockReqDTO);
|
||||
}
|
||||
|
||||
+10
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CanteenCategoryService extends IService<CanteenCategoryEntity> {
|
||||
|
||||
|
||||
@@ -15,4 +17,12 @@ public interface CanteenCategoryService extends IService<CanteenCategoryEntity>
|
||||
* @return
|
||||
*/
|
||||
Page<CanteenCategoryEntity> selectPageByScope(Page page, LambdaQueryWrapper<CanteenCategoryEntity> wrapper);
|
||||
|
||||
|
||||
/**
|
||||
* 获取菜品分类
|
||||
* @param wrapper
|
||||
* @return
|
||||
*/
|
||||
List<CanteenCategoryEntity> listScope(LambdaQueryWrapper<CanteenCategoryEntity> wrapper);
|
||||
}
|
||||
+7
@@ -27,4 +27,11 @@ public interface CanteenSpuService extends IService<CanteenSpuEntity> {
|
||||
*/
|
||||
R updateSkuStock(CanteenSpuUpdateStockReqDTO updateStockReqDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 根据菜品分类id获取菜品信息
|
||||
* @param categoryId
|
||||
* @return
|
||||
*/
|
||||
R getCanteenSpuList(String categoryId);
|
||||
}
|
||||
+5
@@ -26,4 +26,9 @@ public class CanteenCategoryServiceImpl extends ServiceImpl<CanteenCategoryMappe
|
||||
|
||||
return baseMapper.selectPageByScope(page,wrapper,DataScope.of());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CanteenCategoryEntity> listScope(LambdaQueryWrapper<CanteenCategoryEntity> wrapper) {
|
||||
return baseMapper.selectListByScope(wrapper,DataScope.of());
|
||||
}
|
||||
}
|
||||
+11
@@ -8,12 +8,15 @@ import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenSpuMapper;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenDailyMenuService;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenSpuService;
|
||||
import com.bsd.pjcloud.canteen.vo.ADCanteenSpuListVO;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -51,6 +54,14 @@ public class CanteenSpuServiceImpl extends ServiceImpl<CanteenSpuMapper, Canteen
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getCanteenSpuList(String categoryId) {
|
||||
List<CanteenSpuEntity> canteenSpuEntities = baseMapper.selectListByScope(new LambdaQueryWrapper<CanteenSpuEntity>()
|
||||
.eq(StringUtils.isNotEmpty(categoryId), CanteenSpuEntity::getCategoryId, categoryId),DataScope.of());
|
||||
List<ADCanteenSpuListVO> bean = BeanUtils.toBean(canteenSpuEntities, ADCanteenSpuListVO.class);
|
||||
return R.ok(bean);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+10
@@ -67,6 +67,16 @@ public interface ServiceNameConstants {
|
||||
*/
|
||||
String CANTEEN_SERVICE = "pjcloud-canteen-biz";
|
||||
|
||||
/**
|
||||
* 超市服务
|
||||
*/
|
||||
String SUPERMARKET_SERVICE = "pjcloud-supermarket-biz";
|
||||
|
||||
/**
|
||||
* 超市erp服务
|
||||
*/
|
||||
String SUPERMARKET_ERP_SERVICE = "pjcloud-supermarket-erp-biz";
|
||||
|
||||
/**
|
||||
* 钱包模块
|
||||
*/
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.bsd.pjcloud.supermarket.api.feign;
|
||||
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @author zjf
|
||||
* @date 2018/6/22
|
||||
*/
|
||||
@FeignClient(contextId = "remoteSupermarketCategoryServic", value = ServiceNameConstants.SUPERMARKET_SERVICE)
|
||||
public interface RemoteSupermarketCategoryService {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有的分类
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/supermarketCategory/simpleAll")
|
||||
R getSimpleAll();
|
||||
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2018-2025, pjcloud All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: pjcloud
|
||||
*
|
||||
*/
|
||||
|
||||
package com.bsd.pjcloud.supermarket.api.feign;
|
||||
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zjf
|
||||
* @date 2018/6/22
|
||||
*/
|
||||
@FeignClient(contextId = "remoteSupermarketSpuService", value = ServiceNameConstants.SUPERMARKET_SERVICE)
|
||||
public interface RemoteSupermarketSpuService {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.bsd.pjcloud.supermarket.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品 SKU 更新库存 Request DTO
|
||||
*
|
||||
* @author LeeYan9
|
||||
* @since 2022-08-26
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SupermarketSpuUpdateStockReqDTO {
|
||||
|
||||
/**
|
||||
* 商品 SKU
|
||||
*/
|
||||
@NotNull(message = "商品 SPU 不能为空")
|
||||
private List<Item> items;
|
||||
|
||||
@Data
|
||||
public static class Item {
|
||||
|
||||
/**
|
||||
* 商品 SKU 编号
|
||||
*/
|
||||
@NotNull(message = "商品 SPU 编号不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 库存变化数量
|
||||
*
|
||||
* 正数:增加库存
|
||||
* 负数:扣减库存
|
||||
*/
|
||||
@NotNull(message = "库存变化数量不能为空")
|
||||
private Integer incrCount;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -123,7 +123,7 @@ public class SupermarketCategoryController {
|
||||
|
||||
|
||||
/**
|
||||
* 下拉查询
|
||||
* 获取所有分类
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "下拉查询")
|
||||
|
||||
+39
-3
@@ -8,8 +8,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SupermarketAuxiliaryCodeEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SupermarketSpuEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SupermarketUnitEntity;
|
||||
import com.bsd.pjcloud.supermarket.service.SupermarketAuxiliaryCodeService;
|
||||
import com.bsd.pjcloud.supermarket.service.SupermarketSpuService;
|
||||
import com.bsd.pjcloud.supermarket.service.SupermarketUnitService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -21,7 +27,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 商品spu
|
||||
@@ -38,6 +43,10 @@ public class SupermarketSpuController {
|
||||
|
||||
private final SupermarketSpuService supermarketSpuService;
|
||||
|
||||
private final SupermarketUnitService supermarketUnitService;
|
||||
|
||||
private final SupermarketAuxiliaryCodeService supermarketAuxiliaryCodeService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
@@ -52,7 +61,7 @@ public class SupermarketSpuController {
|
||||
wrapper.eq(StrUtil.isNotBlank(supermarketSpu.getProductCode()),SupermarketSpuEntity::getProductCode,supermarketSpu.getProductCode());
|
||||
wrapper.eq(StrUtil.isNotBlank(supermarketSpu.getBarcode()),SupermarketSpuEntity::getBarcode,supermarketSpu.getBarcode());
|
||||
wrapper.eq(StrUtil.isNotBlank(supermarketSpu.getProductName()),SupermarketSpuEntity::getProductName,supermarketSpu.getProductName());
|
||||
return R.ok(supermarketSpuService.page(page, wrapper));
|
||||
return R.ok(supermarketSpuService.pageScope(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +74,14 @@ public class SupermarketSpuController {
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')" )
|
||||
public R getById(@PathVariable("id" ) Long id) {
|
||||
return R.ok(supermarketSpuService.getById(id));
|
||||
SupermarketSpuEntity supermarketSpuEntity = supermarketSpuService.getById(id);
|
||||
List<SupermarketUnitEntity> list = supermarketUnitService.list(new LambdaQueryWrapper<SupermarketUnitEntity>().eq(SupermarketUnitEntity::getSpuId, id));
|
||||
supermarketSpuEntity.setSupermarketUnitEntityList(list);
|
||||
supermarketSpuEntity.setSupermarketAuxiliaryCodeEntityList(
|
||||
supermarketAuxiliaryCodeService.list(new LambdaQueryWrapper<SupermarketAuxiliaryCodeEntity>().eq(SupermarketAuxiliaryCodeEntity::getSpuId, id))
|
||||
);
|
||||
|
||||
return R.ok(supermarketSpuEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,6 +94,7 @@ public class SupermarketSpuController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_add')" )
|
||||
public R save(@RequestBody SupermarketSpuEntity supermarketSpu) {
|
||||
supermarketSpu.setDeptId(SecurityUtils.getUser().getDeptId());
|
||||
return supermarketSpuService.saveSpu(supermarketSpu);
|
||||
}
|
||||
|
||||
@@ -120,4 +137,23 @@ public class SupermarketSpuController {
|
||||
public List<SupermarketSpuEntity> export(SupermarketSpuEntity supermarketSpu,Long[] ids) {
|
||||
return supermarketSpuService.list(Wrappers.lambdaQuery(supermarketSpu).in(ArrayUtil.isNotEmpty(ids), SupermarketSpuEntity::getId, ids));
|
||||
}
|
||||
|
||||
@PostMapping("/ad/updateSpuStock")
|
||||
@SysLog("更新商品库存")
|
||||
public R updateSkuStock(@RequestBody SupermarketSpuUpdateStockReqDTO updateStockReqDTO){
|
||||
return supermarketSpuService.updateSpuStock(updateStockReqDTO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
* @param supermarketSpu 商品spu
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "条件查询所有" , description = "条件查询所有" )
|
||||
@GetMapping("/selectListAll" )
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')" )
|
||||
public R getSupermarketSpuPage(@ParameterObject SupermarketSpuEntity supermarketSpu) {
|
||||
return R.ok(supermarketSpuService.selectListAllScope(supermarketSpu));
|
||||
}
|
||||
}
|
||||
+3
@@ -119,4 +119,7 @@ public class SupermarketUnitController {
|
||||
public List<SupermarketUnitEntity> export(SupermarketUnitEntity supermarketUnit,Long[] ids) {
|
||||
return supermarketUnitService.list(Wrappers.lambdaQuery(supermarketUnit).in(ArrayUtil.isNotEmpty(ids), SupermarketUnitEntity::getId, ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+4
@@ -309,6 +309,10 @@ public class SupermarketSpuEntity extends Model<SupermarketSpuEntity> {
|
||||
@Schema(description="租户编号")
|
||||
private Long tenantId;
|
||||
|
||||
|
||||
@Schema(description = "销量")
|
||||
private Integer salesCount;
|
||||
|
||||
@Schema(description = "辅助条码集合对象")
|
||||
@TableField(exist = false)
|
||||
private List<SupermarketAuxiliaryCodeEntity> supermarketAuxiliaryCodeEntityList;
|
||||
|
||||
+24
@@ -1,5 +1,6 @@
|
||||
package com.bsd.pjcloud.supermarket.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.supermarket.entity.SupermarketSpuEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -8,4 +9,27 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
public interface SupermarketSpuMapper extends PjcloudBaseMapper<SupermarketSpuEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 更新商品 SPU 库存
|
||||
*
|
||||
* @param id 商品 SPU 编号
|
||||
* @param incrCount 增加的库存数量
|
||||
*/
|
||||
default int updateStock(Long id, Integer incrCount) {
|
||||
// 拼接 SQL
|
||||
if (incrCount == 0) {
|
||||
return 0;
|
||||
}
|
||||
String sql;
|
||||
if (incrCount > 0) {
|
||||
sql = " stock = stock + " + incrCount + ", sales_count = sales_count - " + incrCount;
|
||||
} else {
|
||||
sql = " stock = stock - " + Math.abs(incrCount) + ", sales_count = sales_count + " + Math.abs(incrCount);
|
||||
}
|
||||
// 执行更新
|
||||
LambdaUpdateWrapper<SupermarketSpuEntity> updateWrapper = new LambdaUpdateWrapper<SupermarketSpuEntity>()
|
||||
.setSql(sql)
|
||||
.eq(SupermarketSpuEntity::getId, id);
|
||||
return update(null, updateWrapper);
|
||||
}
|
||||
}
|
||||
+27
@@ -1,7 +1,10 @@
|
||||
package com.bsd.pjcloud.supermarket.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SupermarketSpuEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -16,4 +19,28 @@ public interface SupermarketSpuService extends IService<SupermarketSpuEntity> {
|
||||
|
||||
|
||||
Object removeSpuBatchByIds(ArrayList<Long> list);
|
||||
|
||||
|
||||
/**
|
||||
* 更新商品库存
|
||||
* @param updateStockReqDTO
|
||||
* @return
|
||||
*/
|
||||
R updateSpuStock(SupermarketSpuUpdateStockReqDTO updateStockReqDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param wrapper
|
||||
* @return
|
||||
*/
|
||||
Object pageScope(Page page, LambdaQueryWrapper<SupermarketSpuEntity> wrapper);
|
||||
|
||||
/**
|
||||
* 根据条件查询所有数据,app/收银机接口
|
||||
* @param supermarketSpu
|
||||
* @return
|
||||
*/
|
||||
Object selectListAllScope(SupermarketSpuEntity supermarketSpu);
|
||||
}
|
||||
+1
@@ -5,4 +5,5 @@ import com.bsd.pjcloud.supermarket.entity.SupermarketUnitEntity;
|
||||
|
||||
public interface SupermarketUnitService extends IService<SupermarketUnitEntity> {
|
||||
|
||||
|
||||
}
|
||||
+32
@@ -1,8 +1,11 @@
|
||||
package com.bsd.pjcloud.supermarket.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SupermarketAuxiliaryCodeEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SupermarketSpuEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SupermarketUnitEntity;
|
||||
@@ -106,4 +109,33 @@ public class SupermarketSpuServiceImpl extends ServiceImpl<SupermarketSpuMapper,
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public R updateSpuStock(SupermarketSpuUpdateStockReqDTO updateStockReqDTO) {
|
||||
// 更新 SKU 库存
|
||||
updateStockReqDTO.getItems().forEach(item -> {
|
||||
int i = baseMapper.updateStock(item.getId(), item.getIncrCount());
|
||||
if (item.getIncrCount() < 0) {
|
||||
if (i == 0) {
|
||||
R.failed("商品库存不足");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object pageScope(Page page, LambdaQueryWrapper<SupermarketSpuEntity> wrapper) {
|
||||
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object selectListAllScope(SupermarketSpuEntity supermarketSpu) {
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+1
@@ -50,5 +50,6 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result property="salesCount" column="sales_count"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+4
@@ -44,6 +44,10 @@ public interface RemoterThirdPartyAuthService {
|
||||
R zzdsso(@RequestParam("token") String token);
|
||||
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/thirdPartyOAth2/zzd/shjnsso")
|
||||
R shjnsso(@RequestParam("accountId") String accountId,@RequestParam("sessionId") String sessionId);
|
||||
|
||||
/**
|
||||
* 根据钉钉号查询第三方表里面是否有这个人,也就是浙政钉总体系人员表
|
||||
* @param employeeCode
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SHJNSSODTO {
|
||||
|
||||
@NotNull(message = "账号id不能为空")
|
||||
private String accountId;
|
||||
|
||||
@NotNull(message = "会员id不能为空")
|
||||
private String sessionId;
|
||||
}
|
||||
+9
-2
@@ -26,8 +26,15 @@ public class ThirdPartyOAth2Cotroller {
|
||||
|
||||
@Operation(summary = "浙政钉token" )
|
||||
@GetMapping("/zzd/sso" )
|
||||
public R getThirdPartyDeptPage(@RequestParam("token")String token) {
|
||||
public R getThirdPartyzzdsso(@RequestParam("token")String token) {
|
||||
return R.ok(thirdPartyOAuth2Service.getZZDUserInfo(token));
|
||||
|
||||
}
|
||||
|
||||
@Operation(summary = "诗画token" )
|
||||
@GetMapping("/sh/sso" )
|
||||
public R getThirdPartyshsso(@RequestParam("accountId") String accountId,@RequestParam("sessionId") String sessionId) {
|
||||
return R.ok(thirdPartyOAuth2Service.shjnsso(accountId,sessionId));
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user