Compare commits
17 Commits
630c43b1e5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| c42331c13e | |||
| dc68cda5d5 | |||
| 4fd371b8eb | |||
| b3494db4ec | |||
| a8e1379fd1 | |||
| 157d2d20c4 | |||
| c43915105c | |||
|
|
7c319a80a4 | ||
|
|
2cc4a5aeb6 | ||
|
|
bffa56a4b4 | ||
|
|
34cb3dd6ed | ||
|
|
024ac4603c | ||
|
|
3fe43484c8 | ||
|
|
5456559859 | ||
|
|
ec7b80fa8b | ||
|
|
86b6782cd7 | ||
|
|
b89ec31332 |
@@ -0,0 +1,85 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.admin;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.IFoodSpecService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodSpecVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/foodSpec")
|
||||
public class FoodSpecController extends BaseController {
|
||||
@Autowired
|
||||
private IFoodSpecService foodSpecService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 查询用
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(){
|
||||
// 填充学校id,教育局id等数据
|
||||
SysUser user = sysUserService.getUser();
|
||||
FoodSpecVO foodSpecVO = new FoodSpecVO();
|
||||
if(!user.isAdmin()){
|
||||
List<Long> deptIds = user.getDeptIdList();
|
||||
foodSpecVO.setDeptIds(deptIds);
|
||||
}
|
||||
foodSpecVO.setDelFlag(0);
|
||||
List<FoodSpecVO> list = foodSpecService.queryFoodSpecVO(foodSpecVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(FoodSpecVO foodSpecVO){
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
List<Long> deptIds = user.getDeptIdList();
|
||||
foodSpecVO.setDeptIds(deptIds);
|
||||
}
|
||||
foodSpecVO.setDelFlag(0);
|
||||
List<FoodSpecVO> list = foodSpecService.queryFoodSpecVO(foodSpecVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) FoodSpecVO foodSpecVO) {
|
||||
return foodSpecService.saveVO(foodSpecVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) FoodSpecVO foodSpecVO) {
|
||||
return foodSpecService.updateVO(foodSpecVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer foodId) {
|
||||
if(foodId == null){
|
||||
return error("未指定要删除的食材");
|
||||
}
|
||||
boolean flag = foodSpecService.removeById(foodId);
|
||||
return flag ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,12 +2,14 @@ package com.zf.foodpurchase.fdsafe.web.edu;
|
||||
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.domain.model.LoginUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.IEduService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.EduVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -25,11 +27,18 @@ import java.util.List;
|
||||
public class EduController extends BaseController {
|
||||
@Autowired
|
||||
private IEduService eduService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(EduVO eduVO){
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(eduVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
eduVO.setSchoolId(user.getSchoolId());
|
||||
eduVO.setEduId(user.getEduId());
|
||||
eduVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<EduVO> list = eduService.queryEduList(eduVO);
|
||||
return AjaxResult.success("查询成功",list);
|
||||
}
|
||||
@@ -38,13 +47,22 @@ public class EduController extends BaseController {
|
||||
public TableDataInfo pageList(EduVO eduVO){
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(eduVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
eduVO.setSchoolId(user.getSchoolId());
|
||||
eduVO.setEduId(user.getEduId());
|
||||
eduVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<EduVO> list = eduService.queryEduList(eduVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) EduVO eduVO){
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
return error("非管理员账号无法添加教育局");
|
||||
}
|
||||
return eduService.saveVO(eduVO);
|
||||
}
|
||||
|
||||
@@ -58,6 +76,10 @@ public class EduController extends BaseController {
|
||||
if(eduId == null){
|
||||
return error("未指定要删除的教育局");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
return error("非管理员账号无法删除教育局");
|
||||
}
|
||||
return eduService.removeById(eduId) ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.edu;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.IFoodService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -28,24 +31,60 @@ public class FoodController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IFoodService foodService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(FoodVO foodVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(foodVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
foodVO.setSchoolId(user.getSchoolId());
|
||||
foodVO.setEduId(user.getEduId());
|
||||
foodVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
foodVO.setDelFlag(0);
|
||||
List<FoodVO> list = foodService.queryFoodVO(foodVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/listAll")
|
||||
public AjaxResult listAll() {
|
||||
// 填充学校id,教育局id等数据
|
||||
SysUser user = sysUserService.getUser();
|
||||
FoodVO foodVO = new FoodVO();
|
||||
if(!user.isAdmin()){
|
||||
foodVO.setSchoolId(user.getSchoolId());
|
||||
foodVO.setEduId(user.getEduId());
|
||||
foodVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
foodVO.setDelFlag(0);
|
||||
List<FoodVO> list = foodService.queryFoodVO(foodVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) FoodVO foodVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.EDU.equals(accountType)){
|
||||
return error("非教育局账号无法添加食材");
|
||||
}
|
||||
}
|
||||
return foodService.saveVO(foodVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) FoodVO foodVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.EDU.equals(accountType)){
|
||||
return error("非教育局账号无法修改食材细信息");
|
||||
}
|
||||
}
|
||||
return foodService.updateVO(foodVO);
|
||||
}
|
||||
|
||||
@@ -54,6 +93,13 @@ public class FoodController extends BaseController {
|
||||
if(foodId == null){
|
||||
return error("未指定要删除的食材");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.EDU.equals(accountType)){
|
||||
return error("非教育局账号无法删除食材");
|
||||
}
|
||||
}
|
||||
boolean flag = foodService.removeById(foodId);
|
||||
return flag ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
|
||||
@@ -3,12 +3,14 @@ package com.zf.foodpurchase.fdsafe.web.edu;
|
||||
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.entity.MorningInspectionContent;
|
||||
import com.zf.foodpurchase.fdsafe.service.IMorningInspectionContentService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.MorningInspectionContentVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -29,12 +31,19 @@ public class MorningInspectionContentController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IMorningInspectionContentService morningInspectionContentService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(MorningInspectionContentVO morningInspectionContentVO){
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(morningInspectionContentVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
morningInspectionContentVO.setSchoolId(user.getSchoolId());
|
||||
morningInspectionContentVO.setEduId(user.getEduId());
|
||||
morningInspectionContentVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<MorningInspectionContentVO> list = morningInspectionContentService.queryMorningInspectionContentVO(morningInspectionContentVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.zf.foodpurchase.fdsafe.web.edu;
|
||||
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISelfInspectionContentService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SelfInspectionContentVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -27,12 +29,19 @@ import java.util.List;
|
||||
public class SelfInspectionContentController extends BaseController {
|
||||
@Autowired
|
||||
private ISelfInspectionContentService selfInspectionContentService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SelfInspectionContentVO selfInspectionContentVO){
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(selfInspectionContentVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
selfInspectionContentVO.setSchoolId(user.getSchoolId());
|
||||
selfInspectionContentVO.setEduId(user.getEduId());
|
||||
selfInspectionContentVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<SelfInspectionContentVO> list = selfInspectionContentService.querySelfInspectionContentVO(selfInspectionContentVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.edu;
|
||||
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
@@ -9,6 +11,7 @@ import com.zf.foodpurchase.fdsafe.service.ISupplierService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -29,26 +32,45 @@ public class SupplierController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISupplierService supplierService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SupplierVO supplierVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(supplierVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
List<Long> deptIds = user.getDeptIdList();
|
||||
supplierVO.setDeptIds(deptIds);
|
||||
}
|
||||
List<SupplierVO> list = supplierService.querySupplierVO(supplierVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 教育局可增
|
||||
* @param supplierVO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) SupplierVO supplierVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
return error("非管理员账号无法添加货商");
|
||||
}
|
||||
// wxImage形式
|
||||
List<WxImg> images = supplierVO.getWxLicenseImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
supplierVO.setLicenseImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
supplierVO.setLicenseImg(null);
|
||||
}
|
||||
images = supplierVO.getWxFoodLicenseImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
supplierVO.setFoodLicenseImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
supplierVO.setFoodLicenseImg(null);
|
||||
}
|
||||
return supplierService.saveVO(supplierVO);
|
||||
}
|
||||
@@ -56,14 +78,25 @@ public class SupplierController extends BaseController {
|
||||
// 接口需要划分:上架,信息编辑.
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) SupplierVO supplierVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SUPPLIER.equals(accountType)){
|
||||
return error("非供货商账号无法修改供货商信息");
|
||||
}
|
||||
}
|
||||
// wxImage形式
|
||||
List<WxImg> images = supplierVO.getWxLicenseImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
supplierVO.setLicenseImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
supplierVO.setLicenseImg(null);
|
||||
}
|
||||
images = supplierVO.getWxFoodLicenseImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
supplierVO.setFoodLicenseImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
supplierVO.setFoodLicenseImg(null);
|
||||
}
|
||||
return supplierService.updateVO(supplierVO);
|
||||
}
|
||||
@@ -78,6 +111,13 @@ public class SupplierController extends BaseController {
|
||||
if(supplierVO.getSupplierId() == null){
|
||||
return error("未指定要修改的供货商");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.EDU.equals(accountType)){
|
||||
return error("非教育局账号无法上下架供货商");
|
||||
}
|
||||
}
|
||||
SupplierVO updateStatus = new SupplierVO();
|
||||
updateStatus.setSupplierId(supplierVO.getSupplierId());
|
||||
updateStatus.setStatus(supplierVO.getStatus());
|
||||
@@ -91,6 +131,10 @@ public class SupplierController extends BaseController {
|
||||
if (supplierId == null) {
|
||||
return error("未指定要删除的供货商");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
return error("非管理员账号无法删除供货商");
|
||||
}
|
||||
boolean flag = supplierService.removeById(supplierId);
|
||||
return flag ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.merchant;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.fdsafe.entity.Browse;
|
||||
import com.zf.foodpurchase.fdsafe.service.IBrowseService;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品浏览记录表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2024-11-15
|
||||
*/
|
||||
@Api(tags = "商品浏览记录")
|
||||
@RestController
|
||||
@RequestMapping("/merchant/browse")
|
||||
public class MeBrowseController extends BaseController {
|
||||
@Autowired
|
||||
private IBrowseService browseService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
// 需要关联商品信息,关联查询.
|
||||
@ApiOperation("查询用户浏览记录")
|
||||
@GetMapping("list")
|
||||
public AjaxResult list() {
|
||||
SysUser user = sysUserService.getUser();
|
||||
Browse browse = new Browse();
|
||||
if (!user.isAdmin()) {
|
||||
browse.setMerchantId(user.getDeptId());
|
||||
}
|
||||
List<Browse> list = browseService.joinQueryList(browse);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@ApiOperation("查询用户浏览记录")
|
||||
@GetMapping("pageList")
|
||||
public TableDataInfo pageList(Browse browse) {
|
||||
startPage();
|
||||
SysUser user = sysUserService.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
browse.setMerchantId(user.getDeptId());
|
||||
}else{
|
||||
browse.setMerchantId(null);
|
||||
}
|
||||
List<Browse> list = browseService.joinQueryList(browse);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.merchant;
|
||||
|
||||
import com.zf.foodpurchase.common.constant.Constants;
|
||||
import com.zf.foodpurchase.common.constant.UserConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysDept;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.system.service.ISysDeptService;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:lilj
|
||||
* @date:2024/12/17
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("admin/merchant")
|
||||
public class MerchantController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService sysDeptService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/merchantQuery")
|
||||
public AjaxResult merchantQuery(){
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
return error("非管理员账号无法调用此接口");
|
||||
}
|
||||
|
||||
SysDept queryDept = new SysDept();
|
||||
// 只查询商户部门
|
||||
queryDept.setMerchantFlag("1");
|
||||
queryDept.setDelFlag(Constants.DEL_FLAG_NORMAL);
|
||||
queryDept.setStatus(UserConstants.DEPT_NORMAL);
|
||||
List<SysDept> depts = sysDeptService.selectDeptList(queryDept);
|
||||
return success(depts);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.merchant;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.fdsafe.entity.FoodProduct;
|
||||
import com.zf.foodpurchase.fdsafe.entity.InRepoVO;
|
||||
import com.zf.foodpurchase.fdsafe.entity.RepoRecord;
|
||||
import com.zf.foodpurchase.fdsafe.service.IFoodProductService;
|
||||
import com.zf.foodpurchase.fdsafe.service.IRepoRecordService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodProductCKVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.RepoRecordVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/merchant/repoRecord")
|
||||
public class RepoRecordController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IRepoRecordService repoRecordService;
|
||||
@Autowired
|
||||
private IFoodProductService foodProductsService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RepoRecord repoRecord)
|
||||
{
|
||||
SysUser sysUser = sysUserService.getUser();
|
||||
if(!sysUser.isAdmin()){
|
||||
repoRecord.setDeptIds(sysUser.getDeptIdList());
|
||||
}
|
||||
startPage();
|
||||
List<RepoRecordVO> list = repoRecordService.selectRepoRecordList(repoRecord);
|
||||
list.forEach(f -> {
|
||||
if(f.getStatus() != null){
|
||||
if(ObjectUtil.equal(f.getStatus(),1)){
|
||||
f.setStatusName("入库");
|
||||
} else{
|
||||
f.setStatusName("出库");
|
||||
}
|
||||
}
|
||||
if(f.getProductId() != null){
|
||||
FoodProduct products = foodProductsService.getById(f.getProductId());
|
||||
f.setFoodProducts(Arrays.asList(products));
|
||||
}
|
||||
});
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/listByProductId")
|
||||
public AjaxResult listByProductId(Long productId)
|
||||
{
|
||||
List<RepoRecordVO> list = repoRecordService.selectRepoRecordListByProductId(productId);
|
||||
list.forEach(f -> {
|
||||
if(f.getStatus() != null){
|
||||
if(ObjectUtil.equal(f.getStatus(),1)){
|
||||
f.setStatusName("入库");
|
||||
} else{
|
||||
f.setStatusName("出库");
|
||||
}
|
||||
}
|
||||
if(f.getProductId() != null){
|
||||
FoodProduct products = foodProductsService.getById(f.getProductId());
|
||||
f.setFoodProducts(Arrays.asList(products));
|
||||
}
|
||||
});
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{repoRecordId}")
|
||||
public AjaxResult getInfo(@PathVariable("repoRecordId") Long repoRecordId)
|
||||
{
|
||||
RepoRecordVO repoRecordVO = repoRecordService.selectRepoRecordByRepoRecordId(repoRecordId);
|
||||
if(repoRecordVO.getStatus() != null){
|
||||
if(ObjectUtil.equal(repoRecordVO.getStatus(),1)){
|
||||
repoRecordVO.setStatusName("入库");
|
||||
} else{
|
||||
repoRecordVO.setStatusName("出库");
|
||||
}
|
||||
}
|
||||
if(repoRecordVO.getProductId() != null){
|
||||
FoodProduct products = foodProductsService.getById(repoRecordVO.getProductId());
|
||||
if(ObjectUtil.isNotNull( products)){
|
||||
repoRecordVO.setFoodProductNum(products.getNum());
|
||||
repoRecordVO.setFoodProductName(products.getName());
|
||||
repoRecordVO.setPrice(products.getPrice());
|
||||
}
|
||||
}
|
||||
return success(repoRecordVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库
|
||||
*/
|
||||
@PostMapping("/in")
|
||||
public AjaxResult inRepo(@Validated @RequestBody List<InRepoVO> inRepoVOs)
|
||||
{
|
||||
return repoRecordService.inRepo(inRepoVOs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库
|
||||
*/
|
||||
@PostMapping("/out")
|
||||
public AjaxResult outRepo(@Validated @RequestBody List<FoodProductCKVO> foodProductCKVOs)
|
||||
{
|
||||
return repoRecordService.outRepo(foodProductCKVOs);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.merchant;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.utils.DateUtils;
|
||||
import com.zf.foodpurchase.fdsafe.entity.FoodRepo;
|
||||
import com.zf.foodpurchase.fdsafe.entity.Repository;
|
||||
import com.zf.foodpurchase.fdsafe.mapper.FoodRepoMapper;
|
||||
import com.zf.foodpurchase.fdsafe.service.IRepositoryService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.RepositoryVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓库列表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2024-11-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/merchant/repository")
|
||||
public class RepositoryController extends BaseController {
|
||||
@Autowired
|
||||
private IRepositoryService repositoryService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
@Autowired
|
||||
private FoodRepoMapper foodRepoMapper;
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(Repository repository) {
|
||||
SysUser sysUser = userService.getUser();
|
||||
if(ObjectUtil.isNotNull(sysUser)){
|
||||
if(!sysUser.isAdmin()){
|
||||
List<Long> deptIds = sysUser.getDeptIdList();
|
||||
if(CollectionUtil.isEmpty(deptIds)){
|
||||
return AjaxResult.success(new ArrayList<>());
|
||||
}
|
||||
repository.setDeptIds(deptIds);
|
||||
}else{
|
||||
repository.setMerchantId(null);
|
||||
}
|
||||
}
|
||||
List<RepositoryVO> list = repositoryService.queryRepoList(repository);
|
||||
return AjaxResult.success("查询成功", list);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(Repository repository) {
|
||||
SysUser sysUser = userService.getUser();
|
||||
if(ObjectUtil.isNotNull(sysUser)){
|
||||
if(!sysUser.isAdmin()){
|
||||
List<Long> deptIds = sysUser.getDeptIdList();
|
||||
if(CollectionUtil.isEmpty(deptIds)){
|
||||
return getDataTable(new ArrayList<>());
|
||||
}
|
||||
repository.setDeptIds(deptIds);
|
||||
}else{
|
||||
repository.setMerchantId(null);
|
||||
}
|
||||
}
|
||||
startPage();
|
||||
List<RepositoryVO> list = repositoryService.queryRepoList(repository);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/addRepo")
|
||||
public AjaxResult addRepo(@Validated @RequestBody Repository repository) {
|
||||
SysUser sysUser = userService.getUser();
|
||||
if(ObjectUtil.isNotNull(sysUser)){
|
||||
if(!sysUser.isAdmin()){
|
||||
Long deptId = sysUser.getDeptId();
|
||||
repository.setMerchantId(deptId);
|
||||
}
|
||||
}
|
||||
repository.setCreateTime(DateUtils.getNowDate());
|
||||
repository.setOperId(getUserId());
|
||||
return repositoryService.saveRepo(repository);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改前增加一步校验
|
||||
*
|
||||
* @param repository
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/modifyRepo")
|
||||
public AjaxResult modifyRepo(@Validated @RequestBody Repository repository) {
|
||||
return repositoryService.modifyRepo(repository);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
public AjaxResult delete(Long[] ids) {
|
||||
boolean flag = false;
|
||||
List<Long> list = Arrays.asList(ids);
|
||||
List<FoodRepo> foodRepos = foodRepoMapper.selectByRepoId(list);
|
||||
List<Long> newList = new ArrayList<>();
|
||||
for (Long repoId : list) {
|
||||
List<FoodRepo> matchRepos = foodRepos.stream()
|
||||
.filter(foodRepo -> repoId.longValue() == foodRepo.getRepoId())
|
||||
.collect(Collectors.toList());
|
||||
// 1.无记录 || 2.存在记录数量>0
|
||||
boolean allZero = matchRepos.isEmpty()
|
||||
|| matchRepos.stream().allMatch(foodRepo -> Objects.equals(foodRepo.getFoodProductNum(), 0));
|
||||
if(allZero){
|
||||
newList.add(repoId);
|
||||
}
|
||||
}
|
||||
if(CollectionUtil.isEmpty(newList)){
|
||||
return AjaxResult.error("存在商品数量不为0的仓库,不能删除");
|
||||
}
|
||||
flag = repositoryService.removeByIds( newList);
|
||||
return flag?AjaxResult.success("删除成功"):AjaxResult.error("删除失败");
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
@@ -11,6 +13,7 @@ import com.zf.foodpurchase.fdsafe.service.IAccompanyMealService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.AccompanyMealVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -34,31 +37,57 @@ public class AccompanyMealController extends BaseController {
|
||||
@Autowired
|
||||
private IAccompanyMealService accompanyMealService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@RequestMapping("/pageList")
|
||||
public TableDataInfo pageList(AccompanyMealVO accompanyMealVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(accompanyMealVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
accompanyMealVO.setSchoolId(user.getSchoolId());
|
||||
accompanyMealVO.setEduId(user.getEduId());
|
||||
accompanyMealVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<AccompanyMealVO> list = accompanyMealService.queryAccompanyMealVO(accompanyMealVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) AccompanyMealVO accompanyMealVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法添加陪餐记录");
|
||||
}
|
||||
}
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = accompanyMealVO.getWxAccompanyImage();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
accompanyMealVO.setAccompanyImage(ArrayStringUtils.wxImgToArray(accompanyMealVO.getWxAccompanyImage()));
|
||||
}else{
|
||||
accompanyMealVO.setAccompanyImage(null);
|
||||
}
|
||||
return accompanyMealService.saveVO(accompanyMealVO);
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) AccompanyMealVO accompanyMealVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法修改陪餐记录");
|
||||
}
|
||||
}
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = accompanyMealVO.getWxAccompanyImage();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
accompanyMealVO.setAccompanyImage(ArrayStringUtils.wxImgToArray(accompanyMealVO.getWxAccompanyImage()));
|
||||
}else{
|
||||
accompanyMealVO.setAccompanyImage(null);
|
||||
}
|
||||
return accompanyMealService.updateVO(accompanyMealVO);
|
||||
}
|
||||
@@ -68,6 +97,13 @@ public class AccompanyMealController extends BaseController {
|
||||
if(accompanyMealId == null){
|
||||
return error("请选择要删除的陪餐记录");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法删除陪餐记录");
|
||||
}
|
||||
}
|
||||
return accompanyMealService.removeWithId(accompanyMealId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
@@ -10,6 +12,7 @@ import com.zf.foodpurchase.fdsafe.service.ICattenService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.CattenVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -31,38 +34,83 @@ public class CattenController extends BaseController {
|
||||
@Autowired
|
||||
private ICattenService cattenService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@RequestMapping("/pageList")
|
||||
public TableDataInfo pageList(CattenVO cattenVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(cattenVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
cattenVO.setSchoolId(user.getSchoolId());
|
||||
cattenVO.setEduId(user.getEduId());
|
||||
cattenVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<CattenVO> list = cattenService.queryCattenVO(cattenVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 营业执照,食品许可证图片不能为空
|
||||
* @param cattenVO
|
||||
* @return
|
||||
*/
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody CattenVO cattenVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法添加食堂");
|
||||
}
|
||||
}
|
||||
// 图片校验不能为空
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = cattenVO.getWxLicenseImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
if(CollectionUtils.isEmpty(imageList)){
|
||||
return error("营业执照图片不能为空");
|
||||
}else{
|
||||
cattenVO.setLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxLicenseImg()));
|
||||
}
|
||||
|
||||
imageList = cattenVO.getWxFoodLicenseImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
if(CollectionUtils.isEmpty(imageList)){
|
||||
return error("食品许可证图片不能为空");
|
||||
}else{
|
||||
cattenVO.setFoodLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxFoodLicenseImg()));
|
||||
}
|
||||
return cattenService.saveVO(cattenVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 营业执照,食品许可证图片不能为空
|
||||
* @param cattenVO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Validated(UpdateGroup.class) @RequestBody CattenVO cattenVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法修改食堂信息");
|
||||
}
|
||||
}
|
||||
// 图片校验不能为空
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = cattenVO.getWxLicenseImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
if(CollectionUtils.isEmpty(imageList)){
|
||||
return error("营业执照图片不能为空");
|
||||
}else{
|
||||
cattenVO.setLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxLicenseImg()));
|
||||
}
|
||||
|
||||
imageList = cattenVO.getWxFoodLicenseImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
if(CollectionUtils.isEmpty(imageList)){
|
||||
return error("食品许可证图片不能为空");
|
||||
}else{
|
||||
cattenVO.setFoodLicenseImg(ArrayStringUtils.wxImgToArray(cattenVO.getWxFoodLicenseImg()));
|
||||
}
|
||||
return cattenService.updateVO(cattenVO);
|
||||
@@ -73,6 +121,13 @@ public class CattenController extends BaseController {
|
||||
if (cattenId == null) {
|
||||
return error("请选择要删除的食堂");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法删除食堂");
|
||||
}
|
||||
}
|
||||
return cattenService.removeById(cattenId) ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.mysql.cj.xdevapi.Table;
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.utils.PageUtils;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
@@ -11,6 +13,7 @@ import com.zf.foodpurchase.fdsafe.service.IDishFoodRelationService;
|
||||
import com.zf.foodpurchase.fdsafe.service.IDishService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.DishFoodRelationVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.DishVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -34,16 +37,19 @@ public class DishController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IDishFoodRelationService dishFoodRelationService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@RequestMapping("/pageList")
|
||||
public TableDataInfo pageList(DishVO dishVO) {
|
||||
List<DishVO> list = new ArrayList<>();
|
||||
// if(dishVO == null || dishVO.getSchoolId() == null){
|
||||
// return getDataTable(list);
|
||||
// }
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(dishVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
dishVO.setSchoolId(user.getSchoolId());
|
||||
dishVO.setEduId(user.getEduId());
|
||||
dishVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<DishVO> dishVOList = dishService.queryDishVO(dishVO);
|
||||
TableDataInfo tableDataInfo = getDataTable(dishVOList);
|
||||
return tableDataInfo;
|
||||
@@ -51,11 +57,25 @@ public class DishController extends BaseController {
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) DishVO dishVO) {
|
||||
return dishService.saveVO(dishVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法添加菜品信息");
|
||||
}
|
||||
}
|
||||
return dishService.saveVO(dishVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(AddGroup.class) DishVO dishVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法修改菜品信息");
|
||||
}
|
||||
}
|
||||
return dishService.updateVO(dishVO);
|
||||
}
|
||||
|
||||
@@ -64,6 +84,13 @@ public class DishController extends BaseController {
|
||||
if(dishId == null){
|
||||
return error("未指定要删除的菜品");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法删除菜品信息");
|
||||
}
|
||||
}
|
||||
boolean flag = dishService.removeById(dishId);
|
||||
return flag ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.IFoodBookService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodBookVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -28,12 +31,19 @@ public class FoodBookController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IFoodBookService foodBookService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@RequestMapping("/pageList")
|
||||
public TableDataInfo pageList(FoodBookVO foodBookVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(foodBookVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
foodBookVO.setSchoolId(user.getSchoolId());
|
||||
foodBookVO.setEduId(user.getEduId());
|
||||
foodBookVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
foodBookVO.setDelFlag(0);
|
||||
List<FoodBookVO> list = foodBookService.queryFoodBookVO(foodBookVO);
|
||||
return getDataTable(list);
|
||||
@@ -41,11 +51,25 @@ public class FoodBookController extends BaseController {
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) FoodBookVO foodBookVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法添加菜谱信息");
|
||||
}
|
||||
}
|
||||
return foodBookService.saveVO(foodBookVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) FoodBookVO foodBookVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法修改菜谱信息");
|
||||
}
|
||||
}
|
||||
return foodBookService.updateVO(foodBookVO);
|
||||
}
|
||||
|
||||
@@ -54,6 +78,13 @@ public class FoodBookController extends BaseController {
|
||||
if(bookId == null){
|
||||
return error("未指定要删除的菜谱");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法删除菜谱信息");
|
||||
}
|
||||
}
|
||||
return foodBookService.removeWithId(bookId);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
@@ -10,6 +12,7 @@ import com.zf.foodpurchase.fdsafe.service.IFoodSampleService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodSampleVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -32,31 +35,57 @@ public class FoodSampleController extends BaseController {
|
||||
@Autowired
|
||||
private IFoodSampleService foodSampleService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(FoodSampleVO foodSampleVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(foodSampleVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
foodSampleVO.setSchoolId(user.getSchoolId());
|
||||
foodSampleVO.setEduId(user.getEduId());
|
||||
foodSampleVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<FoodSampleVO> list = foodSampleService.queryFoodSampleVO(foodSampleVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) FoodSampleVO foodSampleVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法添加留样记录");
|
||||
}
|
||||
}
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = foodSampleVO.getWxSaveImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
foodSampleVO.setSaveImg(ArrayStringUtils.wxImgToArray(imageList));
|
||||
}else{
|
||||
return error("留样图片不能为空");
|
||||
}
|
||||
return foodSampleService.saveVO(foodSampleVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) FoodSampleVO foodSampleVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法修改留样记录");
|
||||
}
|
||||
}
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = foodSampleVO.getWxSaveImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
foodSampleVO.setSaveImg(ArrayStringUtils.wxImgToArray(imageList));
|
||||
}else{
|
||||
return error("留样图片不能为空");
|
||||
}
|
||||
return foodSampleService.updateVO(foodSampleVO);
|
||||
}
|
||||
@@ -66,6 +95,13 @@ public class FoodSampleController extends BaseController {
|
||||
if(sampleId == null){
|
||||
return error("未指定要删除的留样记录");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法删除留样记录");
|
||||
}
|
||||
}
|
||||
return foodSampleService.deleteWithId(sampleId);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.IMorningCheckInService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.MorningCheckInVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.xml.ws.soap.Addressing;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -29,22 +31,44 @@ public class MorningCheckInController extends BaseController {
|
||||
@Autowired
|
||||
private IMorningCheckInService morningCheckInService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(MorningCheckInVO morningCheckInVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(morningCheckInVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
morningCheckInVO.setSchoolId(user.getSchoolId());
|
||||
morningCheckInVO.setEduId(user.getEduId());
|
||||
morningCheckInVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<MorningCheckInVO> list = morningCheckInService.queryMorningCheckInVO(morningCheckInVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult save(@RequestBody @Validated(AddGroup.class) MorningCheckInVO morningCheckInVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法添加晨检记录");
|
||||
}
|
||||
}
|
||||
return morningCheckInService.saveVO(morningCheckInVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) MorningCheckInVO morningCheckInVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法修改晨检记录");
|
||||
}
|
||||
}
|
||||
return morningCheckInService.updateVO(morningCheckInVO);
|
||||
}
|
||||
|
||||
@@ -53,6 +77,13 @@ public class MorningCheckInController extends BaseController {
|
||||
if(checkInId == null){
|
||||
return error("未指定要删除的晨检登记记录");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法删除晨检记录");
|
||||
}
|
||||
}
|
||||
return morningCheckInService.removewithId(checkInId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
@@ -16,6 +18,7 @@ import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.MorningInspectionDetailVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.MorningTableHeaderVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.apache.commons.math3.analysis.function.Add;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -43,6 +46,9 @@ public class MorningInspectionDetailController extends BaseController {
|
||||
@Autowired
|
||||
private IMorningInspectionContentService morningInspectionContentService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/getTableHearder")
|
||||
public AjaxResult getTableHearder(Integer eduId){
|
||||
// eduId后面根据token获取账号信息动态获取
|
||||
@@ -51,7 +57,12 @@ public class MorningInspectionDetailController extends BaseController {
|
||||
if(eduId == null){
|
||||
// 填充学校id,教育局id等数据
|
||||
CommonVO commonVO=new CommonVO();
|
||||
dealCommonVO(commonVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
commonVO.setSchoolId(user.getSchoolId());
|
||||
commonVO.setEduId(user.getEduId());
|
||||
commonVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
eduId = commonVO.getEduId();
|
||||
}
|
||||
list =morningInspectionContentService.getTableHearder(eduId);
|
||||
@@ -82,20 +93,38 @@ public class MorningInspectionDetailController extends BaseController {
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated({AddGroup.class}) MorningInspectionDetailVO morningInspectionDetailVO){
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法添加晨检明细记录");
|
||||
}
|
||||
}
|
||||
// wxImage形式
|
||||
List<WxImg> images = morningInspectionDetailVO.getWxAbnormalImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
morningInspectionDetailVO.setAbnormalImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
morningInspectionDetailVO.setAbnormalImg(null);
|
||||
}
|
||||
return morningInspectionDetailService.saveVO(morningInspectionDetailVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated({UpdateGroup.class}) MorningInspectionDetailVO morningInspectionDetailVO){
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法修改晨检明细记录");
|
||||
}
|
||||
}
|
||||
// wxImage形式
|
||||
List<WxImg> images = morningInspectionDetailVO.getWxAbnormalImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
morningInspectionDetailVO.setAbnormalImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
morningInspectionDetailVO.setAbnormalImg(null);
|
||||
}
|
||||
return morningInspectionDetailService.updateVO(morningInspectionDetailVO);
|
||||
}
|
||||
@@ -105,6 +134,13 @@ public class MorningInspectionDetailController extends BaseController {
|
||||
if(morningDetailId == null){
|
||||
return error("未指定要删除的晨检明细");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法删除晨检明细记录");
|
||||
}
|
||||
}
|
||||
return morningInspectionDetailService.deleteWithId(morningDetailId);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
@@ -10,6 +12,7 @@ import com.zf.foodpurchase.fdsafe.service.IRubbishDealService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.RubbishDealVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -32,31 +35,57 @@ public class RubbishDealController extends BaseController {
|
||||
@Autowired
|
||||
private IRubbishDealService rubbishDealService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(RubbishDealVO rubbishDealVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(rubbishDealVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
rubbishDealVO.setSchoolId(user.getSchoolId());
|
||||
rubbishDealVO.setEduId(user.getEduId());
|
||||
rubbishDealVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<RubbishDealVO> list = rubbishDealService.queryRubbishDealVO(rubbishDealVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody RubbishDealVO rubbishDealVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法添加餐余垃圾处理记录");
|
||||
}
|
||||
}
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = rubbishDealVO.getWxDealImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
rubbishDealVO.setDealImg(ArrayStringUtils.wxImgToArray(rubbishDealVO.getWxDealImg()));
|
||||
}else{
|
||||
rubbishDealVO.setDealImg(null);
|
||||
}
|
||||
return rubbishDealService.saveVO(rubbishDealVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Validated(UpdateGroup.class) @RequestBody RubbishDealVO rubbishDealVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法修改餐余垃圾处理记录");
|
||||
}
|
||||
}
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = rubbishDealVO.getWxDealImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
rubbishDealVO.setDealImg(ArrayStringUtils.wxImgToArray(rubbishDealVO.getWxDealImg()));
|
||||
}else{
|
||||
rubbishDealVO.setDealImg(null);
|
||||
}
|
||||
return rubbishDealService.updateVO(rubbishDealVO);
|
||||
}
|
||||
@@ -66,6 +95,13 @@ public class RubbishDealController extends BaseController {
|
||||
if(dealId == null){
|
||||
return error("请选择要删除的厨余垃圾处理记录");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法删除餐余垃圾处理记录");
|
||||
}
|
||||
}
|
||||
return rubbishDealService.deleteWithId(dealId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.exception.ServiceException;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolCartItemService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolCartItemVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -28,11 +33,25 @@ public class SchoolCartItemController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISchoolCartItemService schoolCartItemService;
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SchoolCartItemVO schoolCartItemVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(schoolCartItemVO);
|
||||
SysUser user = userService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
List<Long> deptIds = user.getDeptIdList();
|
||||
schoolCartItemVO.setDeptIds(deptIds);
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
// throw new ServiceException("非学校账号无法查询购物车信息");
|
||||
// 返回空的数据
|
||||
List<SchoolCartItemVO> list = new ArrayList<>();
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
List<SchoolCartItemVO> list = schoolCartItemService.querySchoolCartItemVO(schoolCartItemVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.utils.DateUtils;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -26,18 +29,32 @@ public class SchoolController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISchoolService schoolService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SchoolVO schoolVO){
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(schoolVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
schoolVO.setSchoolId(user.getSchoolId());
|
||||
schoolVO.setEduId(user.getEduId());
|
||||
schoolVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<SchoolVO> list = schoolService.querySchoolList(schoolVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) SchoolVO schoolVO){
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.EDU.equals(accountType)){
|
||||
return error("非教育局账号无法添加学校");
|
||||
}
|
||||
}
|
||||
return schoolService.saveVO(schoolVO);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
@@ -10,11 +11,13 @@ import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolOrderItemService;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolOrderService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.*;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -35,16 +38,59 @@ public class SchoolOrderController extends BaseController {
|
||||
@Autowired
|
||||
private ISchoolOrderItemService schoolOrderItemService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
|
||||
@GetMapping("/supplierPageList")
|
||||
public TableDataInfo supplierPageList(SchoolOrderVO schoolOrderVO) {
|
||||
startPage();
|
||||
SysUser user = userService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
List<Long> deptIds = user.getDeptIdList();
|
||||
schoolOrderVO.setDeptIds(deptIds);
|
||||
}
|
||||
List<SchoolOrderVO> list = schoolOrderService.querySupplierOrderVO(schoolOrderVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/schoolPageList")
|
||||
public TableDataInfo schoolPageList(SchoolOrderVO schoolOrderVO) {
|
||||
startPage();
|
||||
SysUser user = userService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
List<Long> deptIds = user.getDeptIdList();
|
||||
schoolOrderVO.setDeptIds(deptIds);
|
||||
}
|
||||
List<SchoolOrderVO> list = schoolOrderService.querySchoolOrderVO(schoolOrderVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SchoolOrderVO schoolOrderVO) {
|
||||
SysUser user = userService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
List<Long> deptIds = user.getDeptIdList();
|
||||
schoolOrderVO.setDeptIds(deptIds);
|
||||
}
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(schoolOrderVO);
|
||||
List<SchoolOrderVO> list = schoolOrderService.querySchoolOrderVO(schoolOrderVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/schoolList")
|
||||
public AjaxResult schoolList() {
|
||||
SchoolOrderVO schoolOrderVO = new SchoolOrderVO();
|
||||
schoolOrderVO.setOrderStatus(3);
|
||||
SysUser user = userService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
List<Long> deptIds = user.getDeptIdList();
|
||||
schoolOrderVO.setDeptIds(deptIds);
|
||||
}
|
||||
List<SchoolOrderVO> list = schoolOrderService.querySchoolOrderVO(schoolOrderVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交订单:
|
||||
* 1.校验:商品有效性校验,订单金额校验
|
||||
@@ -57,9 +103,9 @@ public class SchoolOrderController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/submitOrder")
|
||||
public AjaxResult submitOrder(@RequestBody @Valid SchoolSubmitOrderVO submitOrderVO) {
|
||||
SysUser user = getLoginUser().getUser();
|
||||
SysUser user = userService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =getLoginUser().getUser().getAccountType();
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法提交订单");
|
||||
}
|
||||
@@ -73,9 +119,9 @@ public class SchoolOrderController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/cancelOrder")
|
||||
public AjaxResult cancelOrder(@RequestBody @Valid SchoolCancelOrderVO cancelOrderVO) {
|
||||
SysUser user = getLoginUser().getUser();
|
||||
SysUser user = userService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =getLoginUser().getUser().getAccountType();
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法取消订单");
|
||||
}
|
||||
@@ -88,9 +134,9 @@ public class SchoolOrderController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/updateOrderRemark")
|
||||
public AjaxResult updateOrderRemark(@RequestBody @Valid SchoolModifyOrderRemarkVO remarkVO) {
|
||||
SysUser user = getLoginUser().getUser();
|
||||
SysUser user = userService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =getLoginUser().getUser().getAccountType();
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法修改订单备注");
|
||||
}
|
||||
@@ -113,16 +159,43 @@ public class SchoolOrderController extends BaseController {
|
||||
* 供货商接单
|
||||
*/
|
||||
@GetMapping("/supplierAcceptOrder")
|
||||
public AjaxResult supplierAcceptOrder(@Validated SupplierAcceptOrderVO supplierAcceptOrderVO) {
|
||||
public AjaxResult supplierAcceptOrder(String orderNo) {
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(supplierAcceptOrderVO);
|
||||
SysUser user = getLoginUser().getUser();
|
||||
SysUser user = userService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =getLoginUser().getUser().getAccountType();
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SUPPLIER.equals(accountType)){
|
||||
return error("非供货商账号无法接单");
|
||||
}
|
||||
}
|
||||
return schoolOrderService.supplierAcceptOrder(supplierAcceptOrderVO);
|
||||
return schoolOrderService.supplierAcceptOrder(orderNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单详情
|
||||
* @param orderNo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryOrderMsg")
|
||||
public AjaxResult queryOrderMsg(String orderNo) {
|
||||
SchoolOrderVO schoolOrderVO = new SchoolOrderVO();
|
||||
schoolOrderVO.setOrderNo(orderNo);
|
||||
List<SchoolOrderVO> list = schoolOrderService.querySchoolOrderVO(schoolOrderVO);
|
||||
if(CollectionUtil.isEmpty( list)){
|
||||
return error("订单不存在");
|
||||
}
|
||||
SchoolOrderVO schoolOrder = list.get(0);
|
||||
SchoolOrderItemVO schoolOrderItemVO = new SchoolOrderItemVO();
|
||||
schoolOrderItemVO.setOrderNo(orderNo);
|
||||
List<SchoolOrderItemVO> itemList = schoolOrderItemService.querySchoolOrderItemVO(schoolOrderItemVO);
|
||||
schoolOrder.setSchoolOrderItemVOList(itemList);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/signOrder")
|
||||
public AjaxResult signOrder(@RequestBody SchoolOrderVO schoolOrderVO) {
|
||||
|
||||
return schoolOrderService.signOrder(schoolOrderVO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,13 @@ package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.fdsafe.entity.SchoolOrderItem;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolOrderItemService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.ProductCountVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolOrderItemVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -28,11 +31,18 @@ import java.util.List;
|
||||
public class SchoolOrderItemController extends BaseController {
|
||||
@Autowired
|
||||
private ISchoolOrderItemService schoolOrderItemService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SchoolOrderItemVO schoolOrderItemVO) {
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(schoolOrderItemVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
schoolOrderItemVO.setSchoolId(user.getSchoolId());
|
||||
schoolOrderItemVO.setEduId(user.getEduId());
|
||||
schoolOrderItemVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<SchoolOrderItemVO> list = schoolOrderItemService.querySchoolOrderItemVO(schoolOrderItemVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
@@ -41,7 +51,12 @@ public class SchoolOrderItemController extends BaseController {
|
||||
public TableDataInfo pageList(SchoolOrderItemVO schoolOrderItemVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(schoolOrderItemVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
schoolOrderItemVO.setSchoolId(user.getSchoolId());
|
||||
schoolOrderItemVO.setEduId(user.getEduId());
|
||||
schoolOrderItemVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<SchoolOrderItemVO> list = schoolOrderItemService.querySchoolOrderItemVO(schoolOrderItemVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.zf.foodpurchase.fdsafe.vo.RefundCheckVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.RefundItemAddUpdateVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolRefundItemVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolRefundVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -42,12 +43,20 @@ public class SchoolRefundController extends BaseController {
|
||||
@Autowired
|
||||
private ISchoolRefundService schoolRefundService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
// 查询接口,根据退款总单号查询
|
||||
@GetMapping("/querySchoolRefund")
|
||||
public TableDataInfo querySchoolRefund(SchoolRefundVO schoolRefundVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(schoolRefundVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
schoolRefundVO.setSchoolId(user.getSchoolId());
|
||||
schoolRefundVO.setEduId(user.getEduId());
|
||||
schoolRefundVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<SchoolRefundVO> schoolRefunds = schoolRefundService.querySchoolRefund(schoolRefundVO);
|
||||
return getDataTable(schoolRefunds);
|
||||
}
|
||||
@@ -73,9 +82,9 @@ public class SchoolRefundController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/addRefundItem")
|
||||
public AjaxResult addRefundItem(@RequestBody @Validated(AddGroup.class) RefundItemAddUpdateVO refundItemAddUpdateVO) {
|
||||
SysUser user = getLoginUser().getUser();
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =getLoginUser().getUser().getAccountType();
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法创建退货单");
|
||||
}
|
||||
@@ -88,9 +97,9 @@ public class SchoolRefundController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/updateRefundItem")
|
||||
public AjaxResult updateRefundItem(@RequestBody @Validated(UpdateGroup.class) RefundItemAddUpdateVO refundItemAddUpdateVO) {
|
||||
SysUser user = getLoginUser().getUser();
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =getLoginUser().getUser().getAccountType();
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法修改退货单");
|
||||
}
|
||||
@@ -103,9 +112,9 @@ public class SchoolRefundController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/checkSchoolRefund")
|
||||
public AjaxResult checkSchoolRefund(@RequestBody @Valid RefundCheckVO checkVO) {
|
||||
SysUser user = getLoginUser().getUser();
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =getLoginUser().getUser().getAccountType();
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SUPPLIER.equals(accountType)){
|
||||
return error("非供货商账号无法审核退货单");
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.constant.OrderStatusConstants;
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolOrderService;
|
||||
@@ -12,6 +14,7 @@ import com.zf.foodpurchase.fdsafe.vo.SchoolOrderVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolSettleCheckVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolSettleSubmitVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolSettleVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -35,14 +38,20 @@ public class SchoolSettleController extends BaseController {
|
||||
@Autowired
|
||||
private ISchoolSettleService schoolSettleService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 查询可结算订单
|
||||
*/
|
||||
@GetMapping("/queryCanSettleOrder")
|
||||
public TableDataInfo queryCanSettleOrder(SchoolOrderVO schoolOrderVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(schoolOrderVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
List<Long> deptIds = user.getDeptIdList();
|
||||
schoolOrderVO.setDeptIds(deptIds);
|
||||
}
|
||||
schoolOrderVO.setOrderSettleStatus(OrderStatusConstants.CAN_SETTLEMENT);
|
||||
List<SchoolOrderVO> list = schoolOrderService.querySchoolOrderVO(schoolOrderVO);
|
||||
return getDataTable(list);
|
||||
@@ -53,6 +62,13 @@ public class SchoolSettleController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/submitSettle")
|
||||
public AjaxResult submitSettle(@RequestBody @Valid SchoolSettleSubmitVO submitVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法发起订单结算");
|
||||
}
|
||||
}
|
||||
return schoolSettleService.submitSettle(submitVO);
|
||||
}
|
||||
|
||||
@@ -61,6 +77,13 @@ public class SchoolSettleController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/checkSettle")
|
||||
public AjaxResult checkSettle(@RequestBody @Valid SchoolSettleCheckVO checkVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.EDU.equals(accountType)){
|
||||
return error("非教育局账号无法发起订单结算");
|
||||
}
|
||||
}
|
||||
return schoolSettleService.checkSettle(checkVO);
|
||||
}
|
||||
|
||||
@@ -72,6 +95,13 @@ public class SchoolSettleController extends BaseController {
|
||||
if(StringUtils.isEmpty(settleNo)){
|
||||
return AjaxResult.warn("结算单号不能为空");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法更新结算单状态");
|
||||
}
|
||||
}
|
||||
return schoolSettleService.updateSettlePayStatus(settleNo);
|
||||
}
|
||||
|
||||
@@ -83,6 +113,13 @@ public class SchoolSettleController extends BaseController {
|
||||
if(StringUtils.isEmpty(settleNo)){
|
||||
return AjaxResult.warn("结算单号不能为空");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SUPPLIER.equals(accountType)){
|
||||
return error("非供货商账号无法确认收款");
|
||||
}
|
||||
}
|
||||
return schoolSettleService.updateSettleConfirmStatus(settleNo);
|
||||
}
|
||||
|
||||
@@ -92,8 +129,12 @@ public class SchoolSettleController extends BaseController {
|
||||
@GetMapping("/querySettleList")
|
||||
public TableDataInfo querySettleList(SchoolSettleVO settleVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(settleVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
settleVO.setSchoolId(user.getSchoolId());
|
||||
settleVO.setEduId(user.getEduId());
|
||||
settleVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<SchoolSettleVO> list = schoolSettleService.qeurySettleVO(settleVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
@@ -14,6 +16,7 @@ import com.zf.foodpurchase.fdsafe.service.ISchoolStaffService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolStaffVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -36,32 +39,57 @@ import java.util.List;
|
||||
public class SchoolStaffController extends BaseController {
|
||||
@Autowired
|
||||
private ISchoolStaffService schoolStaffService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SchoolStaffVO schoolStaffVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(schoolStaffVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
schoolStaffVO.setSchoolId(user.getSchoolId());
|
||||
schoolStaffVO.setEduId(user.getEduId());
|
||||
schoolStaffVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<SchoolStaffVO> list = schoolStaffService.querySchoolStaffVO(schoolStaffVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody SchoolStaffVO schoolStaffVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法添加食堂人员");
|
||||
}
|
||||
}
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = schoolStaffVO.getWxHealthCertImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
schoolStaffVO.setHealthCertImg(ArrayStringUtils.wxImgToArray(schoolStaffVO.getWxHealthCertImg()));
|
||||
}else{
|
||||
return error("健康证图片不能为空");
|
||||
}
|
||||
return schoolStaffService.saveVO(schoolStaffVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Validated(UpdateGroup.class) @RequestBody SchoolStaffVO schoolStaffVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法修改食堂人员信息");
|
||||
}
|
||||
}
|
||||
// wxImage形式
|
||||
List<WxImg> imageList = schoolStaffVO.getWxHealthCertImg();
|
||||
if(!CollectionUtils.isEmpty(imageList)){
|
||||
schoolStaffVO.setHealthCertImg(ArrayStringUtils.wxImgToArray(schoolStaffVO.getWxHealthCertImg()));
|
||||
}else{
|
||||
return error("健康证图片不能为空");
|
||||
}
|
||||
return schoolStaffService.updateVO(schoolStaffVO);
|
||||
}
|
||||
@@ -71,6 +99,13 @@ public class SchoolStaffController extends BaseController {
|
||||
if (staffId == null) {
|
||||
return error("请选择要删除的学校人员");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法删除学校人员");
|
||||
}
|
||||
}
|
||||
boolean flag = schoolStaffService.removeById(staffId);
|
||||
return flag ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
@@ -11,6 +13,7 @@ import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SelfInspectionDetailVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SelfInspectionRecordVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -32,18 +35,32 @@ public class SelfInspectionRecordController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISelfInspectionRecordService selfInspectionRecordService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SelfInspectionRecordVO selfInspectionRecordVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(selfInspectionRecordVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
selfInspectionRecordVO.setSchoolId(user.getSchoolId());
|
||||
selfInspectionRecordVO.setEduId(user.getEduId());
|
||||
selfInspectionRecordVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<SelfInspectionRecordVO> list = selfInspectionRecordService.querySelfInspectionRecordVO(selfInspectionRecordVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) SelfInspectionRecordVO selfInspectionRecordVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法添加监督自查记录");
|
||||
}
|
||||
}
|
||||
// wxImage形式
|
||||
List<SelfInspectionDetailVO> selfInspectionDetailVOList = selfInspectionRecordVO.getSelfInspectionDetailVOList();
|
||||
if(!CollectionUtils.isEmpty(selfInspectionDetailVOList)){
|
||||
@@ -51,6 +68,8 @@ public class SelfInspectionRecordController extends BaseController {
|
||||
List<WxImg> images = selfInspectionDetailVO.getWxAbnormalImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
selfInspectionDetailVO.setAbnormalImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
selfInspectionDetailVO.setAbnormalImg(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,6 +78,13 @@ public class SelfInspectionRecordController extends BaseController {
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) SelfInspectionRecordVO selfInspectionRecordVO) {
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法修改监督自查记录");
|
||||
}
|
||||
}
|
||||
// wxImage形式
|
||||
List<SelfInspectionDetailVO> selfInspectionDetailVOList = selfInspectionRecordVO.getSelfInspectionDetailVOList();
|
||||
if(!CollectionUtils.isEmpty(selfInspectionDetailVOList)){
|
||||
@@ -66,6 +92,8 @@ public class SelfInspectionRecordController extends BaseController {
|
||||
List<WxImg> images = selfInspectionDetailVO.getWxAbnormalImg();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
selfInspectionDetailVO.setAbnormalImg(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
selfInspectionDetailVO.setAbnormalImg(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,6 +105,13 @@ public class SelfInspectionRecordController extends BaseController {
|
||||
if(selfRecordId == null){
|
||||
return error("未指定要删除的自检记录");
|
||||
}
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法删除监督自查记录");
|
||||
}
|
||||
}
|
||||
return selfInspectionRecordService.deleteWithId(selfRecordId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.entity.WxAppUser;
|
||||
import com.zf.foodpurchase.fdsafe.service.IWxAppUserService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxAppUserViewVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -27,11 +28,13 @@ public class WxAppUserController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWxAppUserService wxAppUserService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(WxAppUserViewVO wxAppUserViewVO) {
|
||||
startPage();
|
||||
SysUser loginUser = getLoginUser().getUser();
|
||||
SysUser loginUser = sysUserService.getUser();
|
||||
if (!loginUser.isAdmin()) {
|
||||
wxAppUserViewVO.setAccountType(loginUser.getAccountType());
|
||||
wxAppUserViewVO.setDeptId(loginUser.getDeptId().intValue());
|
||||
@@ -42,7 +45,7 @@ public class WxAppUserController extends BaseController {
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) WxAppUserViewVO wxAppUserViewVO) {
|
||||
SysUser loginUser = getLoginUser().getUser();
|
||||
SysUser loginUser = sysUserService.getUser();
|
||||
if (!loginUser.isAdmin()) {
|
||||
wxAppUserViewVO.setAccountType(loginUser.getAccountType());
|
||||
wxAppUserViewVO.setDeptId(loginUser.getDeptId().intValue());
|
||||
@@ -71,7 +74,7 @@ public class WxAppUserController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) WxAppUserViewVO wxAppUserViewVO) {
|
||||
SysUser loginUser = getLoginUser().getUser();
|
||||
SysUser loginUser = sysUserService.getUser();
|
||||
if (!loginUser.isAdmin()) {
|
||||
wxAppUserViewVO.setAccountType(loginUser.getAccountType());
|
||||
wxAppUserViewVO.setDeptId(loginUser.getDeptId().intValue());
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.supplier;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.zf.foodpurchase.common.constant.WxAPPAccountConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.CheckGroup;
|
||||
@@ -10,8 +13,10 @@ import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.entity.FoodProduct;
|
||||
import com.zf.foodpurchase.fdsafe.service.IFoodProductService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.RestTemplateUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodProductCKVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodProductVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.ReferencePriceVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -32,11 +37,16 @@ public class FoodProductController extends BaseController {
|
||||
@Autowired
|
||||
private IFoodProductService foodProductService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(FoodProductVO foodProductVO) {
|
||||
SysUser user = userService.getUser();
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(foodProductVO);
|
||||
if(!user.isAdmin()){
|
||||
foodProductVO.setDeptIds(user.getDeptIdList());
|
||||
}
|
||||
foodProductVO.setDelFlag(0);
|
||||
List<FoodProductVO> list = foodProductService.queryFoodProductVO(foodProductVO);
|
||||
return getDataTable(list);
|
||||
@@ -45,32 +55,44 @@ public class FoodProductController extends BaseController {
|
||||
/**
|
||||
* 供货商发布商品
|
||||
*/
|
||||
@PostMapping("/supplierAdd")
|
||||
public AjaxResult supplierAdd(@RequestBody @Validated(AddGroup.class) FoodProductVO foodProductVO) {
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) FoodProductVO foodProductVO) {
|
||||
return foodProductService.supplierAdd(foodProductVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 供货商修改商品
|
||||
*/
|
||||
@PostMapping("/supplierUpdate")
|
||||
public AjaxResult supplierUpdate(@RequestBody @Validated(UpdateGroup.class) FoodProductVO foodProductVO) {
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) FoodProductVO foodProductVO) {
|
||||
return foodProductService.supplierUpdate(foodProductVO);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteLogic")
|
||||
public AjaxResult deleteLogic(Long foodProductId) {
|
||||
return foodProductService.supplierDelete(foodProductId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 教育局审核商品
|
||||
*/
|
||||
@PostMapping("/eduCheck")
|
||||
public AjaxResult eduCheck(@RequestBody @Validated(CheckGroup.class) FoodProductVO foodProductVO) {
|
||||
SysUser user = userService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.EDU.equals(accountType)){
|
||||
return error("非教育局账号无法审核商品");
|
||||
}
|
||||
}
|
||||
return foodProductService.eduCheck(foodProductVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品信息
|
||||
*/
|
||||
@GetMapping("/supplierDelete")
|
||||
public AjaxResult supplierDelete(Long foodProductId) {
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Long foodProductId) {
|
||||
if(foodProductId == null){
|
||||
return error("商品id不能为空");
|
||||
}
|
||||
@@ -86,4 +108,10 @@ public class FoodProductController extends BaseController {
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/pageCKList")
|
||||
public TableDataInfo pageCKList(Integer repoId) {
|
||||
List<FoodProductCKVO> list = foodProductService.pageCKList(repoId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.zf.foodpurchase.fdsafe.vo.SchoolDeliveryVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryAddUpdateVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -35,11 +36,19 @@ public class SupplierDeliveryController extends BaseController {
|
||||
@Autowired
|
||||
private ISupplierDeliveryService supplierDeliveryService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SupplierDeliveryVO supplierDeliveryVO){
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
dealCommonVO(supplierDeliveryVO);
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
supplierDeliveryVO.setSchoolId(user.getSchoolId());
|
||||
supplierDeliveryVO.setEduId(user.getEduId());
|
||||
supplierDeliveryVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<SupplierDeliveryVO> list = supplierDeliveryService.querySupplierDeliveryVO(supplierDeliveryVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@@ -51,9 +60,9 @@ public class SupplierDeliveryController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/addOrderDelivery")
|
||||
public AjaxResult addOrderDelivery(@RequestBody @Validated(AddGroup.class) SupplierDeliveryAddUpdateVO deliveryAddVO){
|
||||
SysUser user = getLoginUser().getUser();
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =getLoginUser().getUser().getAccountType();
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SUPPLIER.equals(accountType)){
|
||||
return error("非供货商账号无法添加送货单");
|
||||
}
|
||||
@@ -63,9 +72,9 @@ public class SupplierDeliveryController extends BaseController {
|
||||
|
||||
@PostMapping("/supplierUpdateDelivery")
|
||||
public AjaxResult supplierUpdateDelivery(@RequestBody @Validated(UpdateGroup.class) SupplierDeliveryAddUpdateVO supplierDeliveryVO){
|
||||
SysUser user = getLoginUser().getUser();
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =getLoginUser().getUser().getAccountType();
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SUPPLIER.equals(accountType)){
|
||||
return error("非供货商账号无法修改送货单");
|
||||
}
|
||||
@@ -75,9 +84,9 @@ public class SupplierDeliveryController extends BaseController {
|
||||
|
||||
@PostMapping("/schoolSignDelivery")
|
||||
public AjaxResult schoolUpdateDelivery(@RequestBody @Validated(UpdateGroup.class) SchoolDeliveryVO schoolDeliveryVO){
|
||||
SysUser user = getLoginUser().getUser();
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =getLoginUser().getUser().getAccountType();
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SCHOOL.equals(accountType)){
|
||||
return error("非学校账号无法签收送货单");
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryItemUpdateVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryItemVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxImg;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -33,10 +34,19 @@ public class SupplierDeliveryItemController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISupplierDeliveryItemService supplierDeliveryItemService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SupplierDeliveryItemVO supplierDeliveryItemVO) {
|
||||
startPage();
|
||||
// 填充学校id,教育局id等数据
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
supplierDeliveryItemVO.setSchoolId(user.getSchoolId());
|
||||
supplierDeliveryItemVO.setEduId(user.getEduId());
|
||||
supplierDeliveryItemVO.setSupplierId(user.getSupplierId());
|
||||
}
|
||||
List<SupplierDeliveryItemVO> list = supplierDeliveryItemService.querySupplierDeliveryItemVO(supplierDeliveryItemVO);
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
list.forEach(item -> {
|
||||
@@ -54,9 +64,9 @@ public class SupplierDeliveryItemController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) SupplierDeliveryItemUpdateVO supplierDeliveryItemUpdateVO) {
|
||||
SysUser user = getLoginUser().getUser();
|
||||
SysUser user = sysUserService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
Integer accountType =getLoginUser().getUser().getAccountType();
|
||||
Integer accountType =user.getAccountType();
|
||||
if(!WxAPPAccountConstants.SUPPLIER.equals(accountType)){
|
||||
return error("非供货商账号无法修改子送货单信息");
|
||||
}
|
||||
@@ -65,6 +75,8 @@ public class SupplierDeliveryItemController extends BaseController {
|
||||
List<WxImg> images = supplierDeliveryItemUpdateVO.getWxCheckReportImage();
|
||||
if(!CollectionUtils.isEmpty( images)){
|
||||
supplierDeliveryItemUpdateVO.setCheckReportImage(ArrayStringUtils.wxImgToArray(images));
|
||||
}else{
|
||||
supplierDeliveryItemUpdateVO.setCheckReportImage(null);
|
||||
}
|
||||
return supplierDeliveryItemService.updateVO(supplierDeliveryItemUpdateVO);
|
||||
}
|
||||
|
||||
@@ -1,170 +0,0 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.common;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.zf.foodpurchase.common.config.RuoYiConfig;
|
||||
import com.zf.foodpurchase.common.constant.Constants;
|
||||
import com.zf.foodpurchase.common.constant.UserConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.LoginWxUser;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.User;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.WxAppUserVO;
|
||||
import com.zf.foodpurchase.common.core.domain.model.WxAppLoginBody;
|
||||
import com.zf.foodpurchase.common.core.domain.model.WxAppLoginUser;
|
||||
import com.zf.foodpurchase.common.exception.ServiceException;
|
||||
import com.zf.foodpurchase.common.exception.user.UserPasswordNotMatchException;
|
||||
import com.zf.foodpurchase.common.utils.MessageUtils;
|
||||
import com.zf.foodpurchase.common.utils.SecurityUtils;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.common.utils.file.FileUploadUtils;
|
||||
import com.zf.foodpurchase.common.utils.file.MimeTypeUtils;
|
||||
import com.zf.foodpurchase.fdsafe.entity.WxAppUser;
|
||||
import com.zf.foodpurchase.fdsafe.service.IWxAppUserService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.WxAppUserViewVO;
|
||||
import com.zf.foodpurchase.framework.manager.AsyncManager;
|
||||
import com.zf.foodpurchase.framework.manager.factory.AsyncFactory;
|
||||
import com.zf.foodpurchase.framework.web.service.WxAppLoginService;
|
||||
import com.zf.foodpurchase.framework.web.service.WxAppTokenService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author:lilj
|
||||
* @date:2025/5/12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/userLogin")
|
||||
public class WxAppUserLoginController extends BaseController {
|
||||
@Autowired
|
||||
private IWxAppUserService wxAppUserService;
|
||||
|
||||
@Autowired
|
||||
private WxAppTokenService wxAppTokenService;
|
||||
|
||||
@Autowired
|
||||
private WxAppLoginService wxAppLoginService;
|
||||
private WxAppUserVO loginWxUser;
|
||||
|
||||
@PostMapping("/login")
|
||||
public AjaxResult login(@RequestBody @Valid WxAppLoginBody wxAppLoginBody) {
|
||||
String token = wxAppLoginService.login(wxAppLoginBody);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
@GetMapping("/getCurrentUser")
|
||||
public AjaxResult getCurrentUser() {
|
||||
WxAppLoginUser loginWxUser = getWxAppLoginUser();
|
||||
WxAppUserVO user = loginWxUser.getUser();
|
||||
AjaxResult response = success("查询成功");
|
||||
response.put("user", user);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 可修改项:用户密码,昵称,头像,性别
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updateUser")
|
||||
public AjaxResult updateUser(@RequestBody WxAppUserViewVO user) {
|
||||
if (user == null || user.getId() == null) {
|
||||
return error("用户id不能为空");
|
||||
}
|
||||
LambdaUpdateWrapper<WxAppUser> updateWrapper = new LambdaUpdateWrapper<WxAppUser>();
|
||||
updateWrapper.eq(WxAppUser::getId, user.getId());
|
||||
updateWrapper.set(WxAppUser::getNickname, user.getNickname());
|
||||
updateWrapper.set(WxAppUser::getRealName, user.getRealName());
|
||||
updateWrapper.set(WxAppUser::getAvatarUrl, user.getAvatarUrl());
|
||||
updateWrapper.set(WxAppUser::getGender, user.getGender());
|
||||
updateWrapper.set(WxAppUser::getUpdateTime, new Date());
|
||||
boolean isUpdate = wxAppUserService.update(updateWrapper);
|
||||
if (!isUpdate) {
|
||||
return error("修改失败");
|
||||
}
|
||||
WxAppUserVO newUser = wxAppUserService.getUserVOById(user.getId());
|
||||
WxAppLoginUser loginUser = getWxAppLoginUser();
|
||||
// 设置部门名称
|
||||
WxAppUserVO oldUser = loginUser.getUser();
|
||||
newUser.setDeptName(oldUser.getDeptName());
|
||||
loginUser.setUser(newUser);
|
||||
|
||||
wxAppTokenService.setLoginWxAppUser(loginUser);
|
||||
return isUpdate ? success("修改成功") : error("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户密码
|
||||
*/
|
||||
@PostMapping("/updateUserPassword")
|
||||
public AjaxResult updateUserPassword(@RequestBody WxAppUserViewVO user) {
|
||||
if (user == null || user.getId() == null) {
|
||||
return error("用户id不能为空");
|
||||
}
|
||||
pwdCheck(user.getNewPassword());
|
||||
WxAppUser old = wxAppUserService.getById(user.getId());
|
||||
if (old == null) {
|
||||
return error("用户不存在");
|
||||
}
|
||||
// 校验密码是否正确
|
||||
boolean isMatch = SecurityUtils.matchesPassword(user.getPassword(), old.getPassword());
|
||||
if (!isMatch) {
|
||||
throw new ServiceException("原密码有误");
|
||||
}
|
||||
|
||||
WxAppUser updateUser = new WxAppUser();
|
||||
updateUser.setId(user.getId());
|
||||
updateUser.setPassword(SecurityUtils.encryptPassword(user.getNewPassword()));
|
||||
boolean isUpdate = wxAppUserService.updateById(updateUser);
|
||||
return isUpdate ? success("密码修改成功") : error("密码修改失败");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/logout")
|
||||
public AjaxResult logout() {
|
||||
WxAppLoginUser wxAppLoginUser = getWxAppLoginUser();
|
||||
if (wxAppLoginUser != null) {
|
||||
String token = wxAppLoginUser.getToken();
|
||||
wxAppTokenService.delLoginWxAppUser(token);
|
||||
}
|
||||
return AjaxResult.success("退出登录成功");
|
||||
}
|
||||
|
||||
public void pwdCheck(String userPwd) {
|
||||
if (StringUtils.isBlank(userPwd)) {
|
||||
throw new ServiceException("新密码不能为空");
|
||||
}
|
||||
// 密码如果不在指定范围内 错误
|
||||
if (userPwd.length() < UserConstants.PASSWORD_MIN_LENGTH
|
||||
|| userPwd.length() > UserConstants.PASSWORD_MAX_LENGTH) {
|
||||
throw new ServiceException("新密码位数应大于" + UserConstants.PASSWORD_MIN_LENGTH + ",小于" + UserConstants.PASSWORD_MAX_LENGTH + "位");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信头像上传
|
||||
*/
|
||||
@PostMapping(value = "/avatar", produces = "application/json;charset=UTF-8")
|
||||
public AjaxResult avatar(MultipartFile file) throws Exception {
|
||||
if (!file.isEmpty()) {
|
||||
WxAppLoginUser loginWxUser = getWxAppLoginUser();
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// D:/ruoyi/wxprofile/avatar
|
||||
String avatar = FileUploadUtils.upload(filePath, file, MimeTypeUtils.IMAGE_EXTENSION);
|
||||
|
||||
avatar = RuoYiConfig.getImagePrefix() + avatar;
|
||||
return AjaxResult.success().put("avatarUrl", avatar);
|
||||
}
|
||||
return error("上传图片异常");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -39,6 +39,13 @@ public class SysDeptController extends BaseController
|
||||
return success(depts);
|
||||
}
|
||||
|
||||
@GetMapping("/listSuppliers")
|
||||
public AjaxResult listSuppliers()
|
||||
{
|
||||
List<SysDept> depts = deptService.selectSuppliers();
|
||||
return success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门列表(排除节点)
|
||||
*/
|
||||
|
||||
@@ -63,12 +63,7 @@ public class SysLoginController {
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public AjaxResult login(@RequestBody LoginBody loginBody) {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// 生成令牌
|
||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||
loginBody.getUuid());
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
return loginService.login(loginBody.getTenantId(), loginBody.getUsername(), loginBody.getPassword());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -63,6 +63,20 @@ public class SysUserController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("查询仓库管理员列表")
|
||||
@GetMapping("/listRepoUsers")
|
||||
public AjaxResult listRepoUsers()
|
||||
{
|
||||
SysUser sysUser = userService.getUser();
|
||||
SysUser user = new SysUser();
|
||||
if(!sysUser.isAdmin()){
|
||||
List<Long> deptIds = sysUser.getDeptIdList();
|
||||
user.setDeptIdList(deptIds);
|
||||
}
|
||||
List<SysUser> list = userService.listRepoUsers(user);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
||||
@PostMapping("/export")
|
||||
|
||||
@@ -9,16 +9,9 @@ spring:
|
||||
# url: jdbc:mysql://localhost:3306/zf_shopping_mall?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: root
|
||||
# password: root123456
|
||||
url: jdbc:mysql://125.46.39.9:3306/zf_school_food?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://39.165.209.170:3307/zf_school_food?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: wXn*QFs_6aNvFq@qDr.gPYsfBL-XN_o2
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
password: zheng_wXn_fan*QFs_6aNvFq@keji_qDr.gPYsfBL
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
|
||||
@@ -26,7 +26,7 @@ server:
|
||||
port: 8090
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
context-path: /schoolfood
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
@@ -79,9 +79,15 @@ spring:
|
||||
redis:
|
||||
# host: localhost
|
||||
# port: 6379
|
||||
host: 125.46.39.9
|
||||
database: 11
|
||||
password: zhengfan999
|
||||
# 地址
|
||||
host: 39.165.209.170
|
||||
# 端口,默认为6379 服务器密码:zhengfan999
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password: zheng_wXn_fan*QFs_6aNvFq@keji_qDr.gPYsfBL
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
|
||||
@@ -11,6 +11,7 @@ public interface OrderStatusConstants {
|
||||
public static final Integer DELIVERING = 2;
|
||||
public static final Integer COMPLETED = 3;
|
||||
public static final Integer CANCELED = 4;
|
||||
public static final Integer INREPO = 5;
|
||||
|
||||
// 订单是否可参与结算
|
||||
public static final Integer CAN_SETTLEMENT = 1;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.zf.foodpurchase.common.constant;
|
||||
|
||||
/**
|
||||
* 租户常量信息
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
public interface TenantConstants {
|
||||
|
||||
/**
|
||||
* 超级管理员ID
|
||||
*/
|
||||
Long SUPER_ADMIN_ID = 1L;
|
||||
|
||||
/**
|
||||
* 超级管理员角色 roleKey
|
||||
*/
|
||||
String SUPER_ADMIN_ROLE_KEY = "super_admin";
|
||||
|
||||
/**
|
||||
* 租户管理员角色 roleKey
|
||||
*/
|
||||
String TENANT_ADMIN_ROLE_KEY = "tenant_admin";
|
||||
|
||||
/**
|
||||
* 租户管理员角色名称
|
||||
*/
|
||||
String TENANT_ADMIN_ROLE_NAME = "租户管理员";
|
||||
|
||||
/**
|
||||
* 默认租户ID
|
||||
*/
|
||||
String DEFAULT_TENANT_ID = "000000";
|
||||
|
||||
}
|
||||
@@ -25,6 +25,10 @@ public class SysDept extends BaseEntity
|
||||
/** 父商户ID */
|
||||
private Long parentId;
|
||||
|
||||
private String tenantId;
|
||||
|
||||
private String isTenant;
|
||||
|
||||
/** 祖级列表 */
|
||||
private String ancestors;
|
||||
|
||||
@@ -235,11 +239,29 @@ public class SysDept extends BaseEntity
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public String getIsTenant() {
|
||||
return isTenant;
|
||||
}
|
||||
|
||||
public void setIsTenant(String isTenant) {
|
||||
this.isTenant = isTenant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("deptId", getDeptId())
|
||||
.append("parentId", getParentId())
|
||||
.append("tenantId", getTenantId())
|
||||
.append("isTenant", getIsTenant())
|
||||
.append("ancestors", getAncestors())
|
||||
.append("deptName", getDeptName())
|
||||
.append("orderNum", getOrderNum())
|
||||
|
||||
@@ -35,6 +35,8 @@ public class SysRole extends BaseEntity
|
||||
@Excel(name = "角色排序")
|
||||
private Integer roleSort;
|
||||
|
||||
private String tenantId;
|
||||
|
||||
/** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */
|
||||
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
|
||||
private String dataScope;
|
||||
@@ -219,6 +221,14 @@ public class SysRole extends BaseEntity
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@@ -226,6 +236,7 @@ public class SysRole extends BaseEntity
|
||||
.append("roleName", getRoleName())
|
||||
.append("roleKey", getRoleKey())
|
||||
.append("roleSort", getRoleSort())
|
||||
.append("tenantId", getTenantId())
|
||||
.append("dataScope", getDataScope())
|
||||
.append("menuCheckStrictly", isMenuCheckStrictly())
|
||||
.append("deptCheckStrictly", isDeptCheckStrictly())
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.zf.foodpurchase.common.core.domain.entity;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 租户业务对象 sys_tenant
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysTenantBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@NotNull(message = "id不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
@NotBlank(message = "联系人不能为空")
|
||||
private String contactUserName;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@NotBlank(message = "联系电话不能为空")
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
||||
@NotBlank(message = "企业名称不能为空")
|
||||
private String companyName;
|
||||
|
||||
/**
|
||||
* 用户名(创建系统用户)
|
||||
*/
|
||||
@NotBlank(message = "用户名不能为空")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 密码(创建系统用户)
|
||||
*/
|
||||
@NotBlank(message = "密码不能为空")
|
||||
// @Pattern(regexp = RegexConstants.PASSWORD, message = "{user.password.format.valid}", groups = { AddGroup.class })
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 统一社会信用代码
|
||||
*/
|
||||
private String licenseNumber;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 域名
|
||||
*/
|
||||
private String domain;
|
||||
|
||||
/**
|
||||
* 企业简介
|
||||
*/
|
||||
private String intro;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 租户套餐编号
|
||||
*/
|
||||
@NotNull(message = "租户套餐不能为空")
|
||||
private Long packageId;
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private Date expireTime;
|
||||
|
||||
/**
|
||||
* 用户数量(-1不限制)
|
||||
*/
|
||||
private Long accountCount;
|
||||
|
||||
/**
|
||||
* 租户状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.zf.foodpurchase.common.core.domain.entity;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 租户套餐业务对象 sys_tenant_package
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysTenantPackageBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 租户套餐id
|
||||
*/
|
||||
private Long packageId;
|
||||
|
||||
/**
|
||||
* 套餐名称
|
||||
*/
|
||||
private String packageName;
|
||||
|
||||
/**
|
||||
* 关联菜单id
|
||||
*/
|
||||
private Long[] menuIds;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 菜单树选择项是否关联显示
|
||||
*/
|
||||
private Boolean menuCheckStrictly;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.zf.foodpurchase.common.core.domain.entity;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 租户视图对象 sys_tenant
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
@Data
|
||||
public class SysTenantVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
private String contactUserName;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
||||
private String companyName;
|
||||
|
||||
/**
|
||||
* 统一社会信用代码
|
||||
*/
|
||||
private String licenseNumber;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 域名
|
||||
*/
|
||||
private String domain;
|
||||
|
||||
/**
|
||||
* 企业简介
|
||||
*/
|
||||
private String intro;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 租户套餐编号
|
||||
*/
|
||||
private Long packageId;
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private Date expireTime;
|
||||
|
||||
/**
|
||||
* 用户数量(-1不限制)
|
||||
*/
|
||||
private Long accountCount;
|
||||
|
||||
/**
|
||||
* 租户状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
private Long deptId;
|
||||
|
||||
private Long createDept;
|
||||
}
|
||||
@@ -29,6 +29,16 @@ public class SysUser extends BaseEntity {
|
||||
@Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 学校id
|
||||
*/
|
||||
private Integer organiId;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
@@ -149,6 +159,9 @@ public class SysUser extends BaseEntity {
|
||||
private Integer eduId;
|
||||
private String deptName;
|
||||
|
||||
private List<Long> roleIdList;
|
||||
private List<Long> deptIdList;
|
||||
|
||||
public Integer getSchoolId() {
|
||||
return schoolId;
|
||||
}
|
||||
@@ -369,10 +382,44 @@ public class SysUser extends BaseEntity {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public Integer getOrganiId() {
|
||||
return organiId;
|
||||
}
|
||||
|
||||
public void setOrganiId(Integer organiId) {
|
||||
this.organiId = organiId;
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public List<Long> getRoleIdList() {
|
||||
return roleIdList;
|
||||
}
|
||||
|
||||
public void setRoleIdList(List<Long> roleIdList) {
|
||||
this.roleIdList = roleIdList;
|
||||
}
|
||||
|
||||
public List<Long> getDeptIdList() {
|
||||
return deptIdList;
|
||||
}
|
||||
|
||||
public void setDeptIdList(List<Long> deptIdList) {
|
||||
this.deptIdList = deptIdList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("userId", getUserId())
|
||||
.append("organiId", getOrganiId())
|
||||
.append("tenantId", getTenantId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("userName", getUserName())
|
||||
.append("nickName", getNickName())
|
||||
|
||||
@@ -7,6 +7,9 @@ package com.zf.foodpurchase.common.core.domain.model;
|
||||
*/
|
||||
public class LoginBody
|
||||
{
|
||||
|
||||
private String tenantId;
|
||||
/**
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@@ -66,4 +69,12 @@ public class LoginBody
|
||||
{
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.zf.foodpurchase.common.utils.ServletUtils;
|
||||
|
||||
/**
|
||||
* 表格数据处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class TableSupport
|
||||
@@ -40,9 +40,10 @@ public class TableSupport
|
||||
*/
|
||||
public static PageDomain getPageDomain()
|
||||
{
|
||||
// 如果没有传分页参数,增大默认分页大小
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
|
||||
pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
|
||||
pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 100000));
|
||||
pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
|
||||
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
|
||||
pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE));
|
||||
|
||||
@@ -271,4 +271,14 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||
System.out.println(getStartOfDay(now).getTime());
|
||||
}
|
||||
|
||||
public static String getShortYearMonth(Date date) {
|
||||
String dateTime = DateFormatUtils.format(date, "yyMM");
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public static String getShortYearMonthDay(Date date) {
|
||||
String dateTime = DateFormatUtils.format(date, "yyMMdd");
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.zf.foodpurchase.common.utils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class PageResult implements Serializable {
|
||||
|
||||
private Integer pageIndex;//当前页
|
||||
private Integer pages;//总页数
|
||||
private Long totles;//总条数
|
||||
private List result; //结果集
|
||||
|
||||
public Integer getPageIndex() {
|
||||
return pageIndex;
|
||||
}
|
||||
|
||||
public void setPageIndex(Integer pageIndex) {
|
||||
this.pageIndex = pageIndex;
|
||||
}
|
||||
|
||||
public Integer getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(Integer pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
public Long getTotles() {
|
||||
return totles;
|
||||
}
|
||||
|
||||
public void setTotles(Long totles) {
|
||||
this.totles = totles;
|
||||
}
|
||||
|
||||
public List getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(List result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
package com.zf.foodpurchase.common.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import com.zf.foodpurchase.common.constant.Constants;
|
||||
import com.zf.foodpurchase.common.core.text.StrFormatter;
|
||||
@@ -681,4 +678,28 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static List<Long> commaStrToLongList(String str) {
|
||||
// 1. 处理空值/空字符串:直接返回空集合,避免NPE
|
||||
if (str == null || str.trim().isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 2. 拆分+清理空格+转换为Long+收集为List
|
||||
return Arrays.asList(str.split(",")) // 按逗号拆分字符串为数组
|
||||
.stream() // 转为流处理
|
||||
.map(String::trim) // 去除每个元素的前后空格(处理" 4 , 5 "的情况)
|
||||
.filter(s -> !s.isEmpty()) // 过滤拆分后空字符串(比如",,6"拆分出的空元素)
|
||||
.map(Long::valueOf) // 字符串转Long(非数字会抛NumberFormatException)
|
||||
.collect(Collectors.toList()); // 收集为List<Long>
|
||||
}
|
||||
|
||||
public static String formatNumTwo(int num) {
|
||||
return String.format("%02d", num);
|
||||
}
|
||||
|
||||
public static String formatNumThree(int num) {
|
||||
return String.format("%03d", num);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.zf.foodpurchase.framework.config;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.zf.foodpurchase.framework.service.ClientUserDetailsService;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.authentication.InternalAuthenticationServiceException;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsPasswordService;
|
||||
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
public class ClientLoginAuthProvider extends AbstractUserDetailsAuthenticationProvider {
|
||||
|
||||
|
||||
private static final String USER_NOT_FOUND_PASSWORD = "userNotFoundPassword";
|
||||
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
/**
|
||||
* The password used to perform {@link PasswordEncoder#matches(CharSequence, String)}
|
||||
* on when the user is not found to avoid SEC-2056. This is necessary, because some
|
||||
* {@link PasswordEncoder} implementations will short circuit if the password is not
|
||||
* in a valid format.
|
||||
*/
|
||||
private volatile String userNotFoundEncodedPassword;
|
||||
|
||||
private ClientUserDetailsService userDetailsService;
|
||||
|
||||
private UserDetailsPasswordService userDetailsPasswordService;
|
||||
|
||||
public ClientLoginAuthProvider(ClientUserDetailsService clientUserDetailsService) {
|
||||
this.userDetailsService = clientUserDetailsService;
|
||||
setPasswordEncoder(PasswordEncoderFactories.createDelegatingPasswordEncoder());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void additionalAuthenticationChecks(UserDetails userDetails,
|
||||
UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
|
||||
if (authentication.getCredentials() == null) {
|
||||
this.logger.debug("Failed to authenticate since no credentials provided");
|
||||
throw new BadCredentialsException(this.messages
|
||||
.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
|
||||
}
|
||||
String presentedPassword = authentication.getCredentials().toString();
|
||||
if (!this.passwordEncoder.matches(presentedPassword, userDetails.getPassword())) {
|
||||
this.logger.debug("Failed to authenticate since password does not match stored value");
|
||||
throw new BadCredentialsException(this.messages
|
||||
.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doAfterPropertiesSet() {
|
||||
Assert.notNull(this.userDetailsService, "A UserDetailsService must be set");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
|
||||
CustomUsernamePasswordAuthenticationToken auth = (CustomUsernamePasswordAuthenticationToken) authentication;
|
||||
|
||||
//多个参数
|
||||
UserDetails loadedUser = userDetailsService.loadUserByUsername(username,auth.getTenantId());
|
||||
|
||||
if (loadedUser == null) {
|
||||
throw new InternalAuthenticationServiceException(
|
||||
"UserDetailsService returned null, which is an interface contract violation");
|
||||
}
|
||||
return loadedUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Authentication createSuccessAuthentication(Object principal, Authentication authentication,
|
||||
UserDetails user) {
|
||||
boolean upgradeEncoding = this.userDetailsPasswordService != null
|
||||
&& this.passwordEncoder.upgradeEncoding(user.getPassword());
|
||||
if (upgradeEncoding) {
|
||||
String presentedPassword = authentication.getCredentials().toString();
|
||||
String newPassword = this.passwordEncoder.encode(presentedPassword);
|
||||
user = this.userDetailsPasswordService.updatePassword(user, newPassword);
|
||||
}
|
||||
return super.createSuccessAuthentication(principal, authentication, user);
|
||||
}
|
||||
|
||||
private void prepareTimingAttackProtection() {
|
||||
if (this.userNotFoundEncodedPassword == null) {
|
||||
this.userNotFoundEncodedPassword = this.passwordEncoder.encode(USER_NOT_FOUND_PASSWORD);
|
||||
}
|
||||
}
|
||||
|
||||
private void mitigateAgainstTimingAttack(UsernamePasswordAuthenticationToken authentication) {
|
||||
if (authentication.getCredentials() != null) {
|
||||
String presentedPassword = authentication.getCredentials().toString();
|
||||
this.passwordEncoder.matches(presentedPassword, this.userNotFoundEncodedPassword);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the PasswordEncoder instance to be used to encode and validate passwords. If
|
||||
* not set, the password will be compared using
|
||||
* {@link PasswordEncoderFactories#createDelegatingPasswordEncoder()}
|
||||
* @param passwordEncoder must be an instance of one of the {@code PasswordEncoder}
|
||||
* types.
|
||||
*/
|
||||
public void setPasswordEncoder(PasswordEncoder passwordEncoder) {
|
||||
Assert.notNull(passwordEncoder, "passwordEncoder cannot be null");
|
||||
this.passwordEncoder = passwordEncoder;
|
||||
this.userNotFoundEncodedPassword = null;
|
||||
}
|
||||
|
||||
protected PasswordEncoder getPasswordEncoder() {
|
||||
return this.passwordEncoder;
|
||||
}
|
||||
|
||||
public void setUserDetailsService(ClientUserDetailsService userDetailsService) {
|
||||
this.userDetailsService = userDetailsService;
|
||||
}
|
||||
|
||||
protected ClientUserDetailsService getUserDetailsService() {
|
||||
return this.userDetailsService;
|
||||
}
|
||||
|
||||
public void setUserDetailsPasswordService(UserDetailsPasswordService userDetailsPasswordService) {
|
||||
this.userDetailsPasswordService = userDetailsPasswordService;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.zf.foodpurchase.framework.config;
|
||||
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
|
||||
public class CustomUsernamePasswordAuthenticationToken extends UsernamePasswordAuthenticationToken {
|
||||
private final String tenantId;
|
||||
|
||||
public CustomUsernamePasswordAuthenticationToken(Object principal, Object credentials, String tenantId) {
|
||||
super(principal, credentials);
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zf.foodpurchase.framework.config;
|
||||
|
||||
import com.zf.foodpurchase.framework.service.ClientUserDetailsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -9,8 +10,12 @@ import org.springframework.http.HttpMethod;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.ProviderManager;
|
||||
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
@@ -23,28 +28,15 @@ import com.zf.foodpurchase.framework.security.filter.JwtAuthenticationTokenFilte
|
||||
import com.zf.foodpurchase.framework.security.handle.AuthenticationEntryPointImpl;
|
||||
import com.zf.foodpurchase.framework.security.handle.LogoutSuccessHandlerImpl;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* spring security配置
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableMethodSecurity(prePostEnabled = true, securedEnabled = true)
|
||||
@Configuration
|
||||
public class SecurityConfig
|
||||
{
|
||||
/**
|
||||
* 自定义用户认证逻辑
|
||||
*/
|
||||
@Autowired
|
||||
@Qualifier("userDetailsServiceImpl")
|
||||
private UserDetailsService userDetailsService;
|
||||
|
||||
/**
|
||||
* 自定义微信小程序/APP认证逻辑类
|
||||
*/
|
||||
@Autowired
|
||||
@Qualifier("wxAppUserDetailsService")
|
||||
private UserDetailsService wxAppUserDetailsService;
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
|
||||
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
/**
|
||||
* 认证失败处理类
|
||||
@@ -75,31 +67,22 @@ public class SecurityConfig
|
||||
*/
|
||||
@Autowired
|
||||
private PermitAllUrlProperties permitAllUrl;
|
||||
/**
|
||||
* 身份验证实现
|
||||
*/
|
||||
@Bean("authenticationManager")
|
||||
@Primary
|
||||
public AuthenticationManager authenticationManager()
|
||||
{
|
||||
DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();
|
||||
daoAuthenticationProvider.setUserDetailsService(userDetailsService);
|
||||
daoAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder());
|
||||
AuthenticationManager manager=new ProviderManager(daoAuthenticationProvider);
|
||||
return manager;
|
||||
|
||||
|
||||
@Resource
|
||||
private ClientUserDetailsService clientUserDetailsService;
|
||||
|
||||
@Bean
|
||||
public ClientLoginAuthProvider clientLoginAuthProvider(){
|
||||
ClientLoginAuthProvider provider = new ClientLoginAuthProvider(clientUserDetailsService);
|
||||
provider.setPasswordEncoder(bCryptPasswordEncoder());
|
||||
return provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* wxApp登录身份验证实现
|
||||
*/
|
||||
@Bean("wxAppAuthenticationManager")
|
||||
public AuthenticationManager wxAppAuthenticationManager()
|
||||
{
|
||||
DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();
|
||||
daoAuthenticationProvider.setUserDetailsService(wxAppUserDetailsService);
|
||||
daoAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder());
|
||||
AuthenticationManager manager=new ProviderManager(daoAuthenticationProvider);
|
||||
return manager;
|
||||
@Bean
|
||||
@Override
|
||||
public AuthenticationManager authenticationManagerBean() throws Exception {
|
||||
return super.authenticationManagerBean();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,49 +100,45 @@ public class SecurityConfig
|
||||
* rememberMe | 允许通过remember-me登录的用户访问
|
||||
* authenticated | 用户登录后可访问
|
||||
*/
|
||||
@Bean
|
||||
protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception
|
||||
{
|
||||
return httpSecurity
|
||||
// CSRF禁用,因为不使用session
|
||||
.csrf(csrf -> csrf.disable())
|
||||
// 禁用HTTP响应标头
|
||||
.headers((headersCustomizer) -> {
|
||||
headersCustomizer.cacheControl(cache -> cache.disable()).frameOptions(options -> options.sameOrigin());
|
||||
})
|
||||
// 认证失败处理类
|
||||
.exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
|
||||
// 基于token,所以不需要session
|
||||
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||
// 注解标记允许匿名访问的url
|
||||
.authorizeHttpRequests((requests) -> {
|
||||
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
|
||||
@Override
|
||||
protected void configure(HttpSecurity httpSecurity) throws Exception {
|
||||
|
||||
// 注解标记允许匿名访问的url
|
||||
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = httpSecurity.authorizeRequests();
|
||||
permitAllUrl.getUrls().forEach(url -> registry.antMatchers(url).permitAll());
|
||||
|
||||
httpSecurity
|
||||
// CSRF禁用,因为不使用session
|
||||
.csrf().disable()
|
||||
// 认证失败处理类
|
||||
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
|
||||
// 基于token,所以不需要session
|
||||
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
|
||||
// 过滤请求
|
||||
.authorizeRequests()
|
||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||
requests.antMatchers("/login", "/register", "/captchaImage","/wx/user/mockLogin","/wx/user/login","/wxapp/userLogin/login").permitAll()
|
||||
// 静态资源,可匿名访问
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||
// 微信静态资源访问不被拦截
|
||||
.antMatchers("/wx/static/**","/wx/payApi/").permitAll()
|
||||
// 部分接口开放,不受权限访问限制
|
||||
.antMatchers("/wx/area/**").permitAll()
|
||||
// 微信体验功能,部分接口权限放开
|
||||
// 首页查询商品查询,轮播图查询,类别查询,按类别查询商品接口
|
||||
.antMatchers("/wx/products/indexProducts","/wx/dict/type/product_category","/wx/products/category","/wx/carousel/list").permitAll()
|
||||
// 临时放开权限校验,共开发测试使用
|
||||
// .antMatchers("/wx/**").permitAll()
|
||||
.antMatchers("/wx/payApi/**").permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated();
|
||||
})
|
||||
// 添加Logout filter
|
||||
.logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler))
|
||||
// 添加JWT filter
|
||||
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class)
|
||||
// 添加CORS filter
|
||||
.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class)
|
||||
.addFilterBefore(corsFilter, LogoutFilter.class)
|
||||
.build();
|
||||
.antMatchers("/login", "/register", "/captchaImage","/wx/user/mockLogin","/wx/user/login","/wxapp/userLogin/login").permitAll()
|
||||
// 静态资源,可匿名访问
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||
// 微信静态资源访问不被拦截
|
||||
.antMatchers("/wx/static/**","/wx/payApi/").permitAll()
|
||||
// 部分接口开放,不受权限访问限制
|
||||
.antMatchers("/wx/area/**").permitAll()
|
||||
// 微信体验功能,部分接口权限放开
|
||||
// 首页查询商品查询,轮播图查询,类别查询,按类别查询商品接口
|
||||
.antMatchers("/wx/products/indexProducts","/wx/dict/type/product_category","/wx/products/category","/wx/carousel/list", "/common/upload").permitAll()
|
||||
// 临时放开权限校验,共开发测试使用
|
||||
// .antMatchers("/wx/**").permitAll()
|
||||
.antMatchers("/wx/payApi/**").permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated();
|
||||
// 添加Logout filter
|
||||
httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);
|
||||
// 添加JWT filter
|
||||
httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
|
||||
httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,4 +149,11 @@ public class SecurityConfig
|
||||
{
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
// auth.inMemoryAuthentication().passwordEncoder(bCryptPasswordEncoder());
|
||||
//auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
|
||||
auth.authenticationProvider(clientLoginAuthProvider());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.zf.foodpurchase.framework.service;
|
||||
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
|
||||
public interface ClientUserDetailsService {
|
||||
UserDetails loadUserByUsername(String username, String tenantId) throws UsernameNotFoundException;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.zf.foodpurchase.framework.service.impl;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.domain.model.LoginUser;
|
||||
import com.zf.foodpurchase.common.enums.UserStatus;
|
||||
import com.zf.foodpurchase.common.exception.ServiceException;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.framework.web.service.SysPasswordService;
|
||||
import com.zf.foodpurchase.framework.web.service.SysPermissionService;
|
||||
import com.zf.foodpurchase.system.mapper.SysDeptMapper;
|
||||
import com.zf.foodpurchase.system.mapper.SysRoleDeptMapper;
|
||||
import com.zf.foodpurchase.system.mapper.SysUserMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zf.foodpurchase.framework.service.ClientUserDetailsService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service("clientUserDetailsService")
|
||||
public class ClientUserDetailsServiceImpl implements ClientUserDetailsService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ClientUserDetailsServiceImpl.class);
|
||||
|
||||
@Resource
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
private SysRoleDeptMapper roleDeptMapper;
|
||||
|
||||
@Autowired
|
||||
private SysDeptMapper deptMapper;
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String username, String tenantId) throws UsernameNotFoundException {
|
||||
// 此处即可自定义查询用户
|
||||
SysUser user = sysUserMapper.selectUserByUserNameAndTenantId(username,tenantId);
|
||||
if (StringUtils.isNull(user))
|
||||
{
|
||||
log.info("登录用户:{} 不存在.", username);
|
||||
throw new ServiceException("登录用户:" + username + " 不存在");
|
||||
}
|
||||
else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
|
||||
{
|
||||
log.info("登录用户:{} 已被删除.", username);
|
||||
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
||||
}
|
||||
else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
|
||||
{
|
||||
log.info("登录用户:{} 已被停用.", username);
|
||||
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
|
||||
}
|
||||
|
||||
passwordService.validate(user);
|
||||
|
||||
return createLoginUser(user);
|
||||
}
|
||||
|
||||
public UserDetails createLoginUser(SysUser user)
|
||||
{
|
||||
return new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user));
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.http.HttpMessage;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
@@ -24,6 +25,8 @@ import com.zf.foodpurchase.common.exception.ServiceException;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.common.utils.html.EscapeUtil;
|
||||
|
||||
import java.sql.DataTruncation;
|
||||
|
||||
/**
|
||||
* 全局异常处理器
|
||||
*
|
||||
@@ -34,6 +37,31 @@ public class GlobalExceptionHandler
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
||||
|
||||
/**
|
||||
* JSON入参序列化异常HttpMessageNotReadableException
|
||||
*/
|
||||
/**
|
||||
* 权限校验异常
|
||||
*/
|
||||
@ExceptionHandler(HttpMessageNotReadableException.class)
|
||||
public AjaxResult handleHttpMessageNotReadableException(HttpMessageNotReadableException e, HttpServletRequest request)
|
||||
{
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',JSON入参序列化异常'{}'", requestURI, e.getMessage());
|
||||
return AjaxResult.error(HttpStatus.ERROR, "系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据库异常处理:DataTruncation
|
||||
*/
|
||||
@ExceptionHandler(DataIntegrityViolationException.class)
|
||||
public AjaxResult handleDataIntegrityViolationException(DataIntegrityViolationException e, HttpServletRequest request)
|
||||
{
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',数据库异常'{}'", requestURI, e.getMessage());
|
||||
return AjaxResult.error(HttpStatus.ERROR, "系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限校验异常
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.zf.foodpurchase.framework.web.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.zf.foodpurchase.common.constant.CacheConstants;
|
||||
import com.zf.foodpurchase.common.constant.Constants;
|
||||
import com.zf.foodpurchase.common.constant.UserConstants;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysTenantVo;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.domain.model.LoginUser;
|
||||
import com.zf.foodpurchase.common.core.redis.RedisCache;
|
||||
@@ -12,10 +15,12 @@ import com.zf.foodpurchase.common.utils.DateUtils;
|
||||
import com.zf.foodpurchase.common.utils.MessageUtils;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.common.utils.ip.IpUtils;
|
||||
import com.zf.foodpurchase.framework.config.CustomUsernamePasswordAuthenticationToken;
|
||||
import com.zf.foodpurchase.framework.manager.AsyncManager;
|
||||
import com.zf.foodpurchase.framework.manager.factory.AsyncFactory;
|
||||
import com.zf.foodpurchase.framework.security.context.AuthenticationContextHolder;
|
||||
import com.zf.foodpurchase.system.service.ISysConfigService;
|
||||
import com.zf.foodpurchase.system.service.ISysTenantService;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -26,6 +31,9 @@ import org.springframework.security.core.Authentication;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 登录校验方法
|
||||
@@ -39,7 +47,6 @@ public class SysLoginService
|
||||
private TokenService tokenService;
|
||||
|
||||
@Resource
|
||||
@Qualifier("authenticationManager")
|
||||
private AuthenticationManager authenticationManager;
|
||||
|
||||
@Autowired
|
||||
@@ -51,26 +58,39 @@ public class SysLoginService
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private ISysTenantService tenantService;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @param code 验证码
|
||||
* @param uuid 唯一标识
|
||||
* @return 结果
|
||||
*/
|
||||
public String login(String username, String password, String code, String uuid)
|
||||
public AjaxResult login(String tenantId, String username, String password)
|
||||
{
|
||||
// 验证码校验
|
||||
validateCaptcha(username, code, uuid);
|
||||
//validateCaptcha(username, code, uuid);
|
||||
// 登录前置校验
|
||||
loginPreCheck(username, password);
|
||||
//loginPreCheck(username, password);
|
||||
if (StringUtils.isBlank(tenantId)) {
|
||||
return AjaxResult.error("请选择租户");
|
||||
}
|
||||
SysTenantVo tenant = tenantService.queryByTenantId(tenantId);
|
||||
if (ObjectUtil.isNull(tenant)) {
|
||||
return AjaxResult.error("租户不存在");
|
||||
} else if ("1".equals(tenant.getStatus())) {
|
||||
return AjaxResult.error("租户已停用");
|
||||
} else if (ObjectUtil.isNotNull(tenant.getExpireTime())
|
||||
&& new Date().after(tenant.getExpireTime())) {
|
||||
return AjaxResult.error("租户已过期");
|
||||
}
|
||||
// 用户验证
|
||||
Authentication authentication = null;
|
||||
try
|
||||
{
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
|
||||
CustomUsernamePasswordAuthenticationToken authenticationToken = new CustomUsernamePasswordAuthenticationToken(username, password,tenantId);
|
||||
AuthenticationContextHolder.setContext(authenticationToken);
|
||||
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
||||
authentication = authenticationManager.authenticate(authenticationToken);
|
||||
@@ -96,7 +116,12 @@ public class SysLoginService
|
||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||
recordLoginInfo(loginUser.getUserId());
|
||||
// 生成token
|
||||
return tokenService.createToken(loginUser);
|
||||
String token = tokenService.createToken(loginUser);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(Constants.TOKEN, token);
|
||||
map.put("userId",loginUser.getUserId());
|
||||
return AjaxResult.success(map);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
package com.zf.foodpurchase.framework.web.service;
|
||||
|
||||
import com.zf.foodpurchase.common.constant.CacheConstants;
|
||||
import com.zf.foodpurchase.common.constant.Constants;
|
||||
import com.zf.foodpurchase.common.constant.UserConstants;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.WxAppUserVO;
|
||||
import com.zf.foodpurchase.common.core.domain.model.LoginUser;
|
||||
import com.zf.foodpurchase.common.core.domain.model.WxAppLoginBody;
|
||||
import com.zf.foodpurchase.common.core.domain.model.WxAppLoginUser;
|
||||
import com.zf.foodpurchase.common.core.redis.RedisCache;
|
||||
import com.zf.foodpurchase.common.exception.ServiceException;
|
||||
import com.zf.foodpurchase.common.exception.user.*;
|
||||
import com.zf.foodpurchase.common.utils.DateUtils;
|
||||
import com.zf.foodpurchase.common.utils.MessageUtils;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.common.utils.ip.IpUtils;
|
||||
import com.zf.foodpurchase.fdsafe.entity.WxAppUser;
|
||||
import com.zf.foodpurchase.fdsafe.service.IWxAppUserService;
|
||||
import com.zf.foodpurchase.framework.manager.AsyncManager;
|
||||
import com.zf.foodpurchase.framework.manager.factory.AsyncFactory;
|
||||
import com.zf.foodpurchase.framework.security.context.AuthenticationContextHolder;
|
||||
import com.zf.foodpurchase.system.service.ISysConfigService;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 登录校验方法
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
public class WxAppLoginService
|
||||
{
|
||||
@Autowired
|
||||
private WxAppTokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("wxAppAuthenticationManager")
|
||||
private AuthenticationManager authenticationManager;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private IWxAppUserService wxAppUserService;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @param wxAppLoginBody 登录对象
|
||||
* @return 结果
|
||||
*/
|
||||
public String login(WxAppLoginBody wxAppLoginBody)
|
||||
{
|
||||
String username = wxAppLoginBody.getUsername();
|
||||
String password = wxAppLoginBody.getPassword();
|
||||
// 验证码校验
|
||||
// validateCaptcha(username, code, uuid);
|
||||
// 登录前置校验
|
||||
loginPreCheck(username, password);
|
||||
// 用户验证
|
||||
Authentication authentication = null;
|
||||
try
|
||||
{
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
|
||||
AuthenticationContextHolder.setContext(authenticationToken);
|
||||
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
||||
authentication = authenticationManager.authenticate(authenticationToken);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e instanceof BadCredentialsException)
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
}
|
||||
else
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
AuthenticationContextHolder.clearContext();
|
||||
}
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||
WxAppLoginUser loginUser = (WxAppLoginUser) authentication.getPrincipal();
|
||||
recordLoginInfo(loginUser.getUserId());
|
||||
// 生成token
|
||||
return tokenService.createWxAppToken(loginUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验验证码
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param code 验证码
|
||||
* @param uuid 唯一标识
|
||||
* @return 结果
|
||||
*/
|
||||
public void validateCaptcha(String username, String code, String uuid)
|
||||
{
|
||||
boolean captchaEnabled = configService.selectCaptchaEnabled();
|
||||
if (captchaEnabled)
|
||||
{
|
||||
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
|
||||
String captcha = redisCache.getCacheObject(verifyKey);
|
||||
if (captcha == null)
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
|
||||
throw new CaptchaExpireException();
|
||||
}
|
||||
redisCache.deleteObject(verifyKey);
|
||||
if (!code.equalsIgnoreCase(captcha))
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
|
||||
throw new CaptchaException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录前置校验
|
||||
* @param username 用户名
|
||||
* @param password 用户密码
|
||||
*/
|
||||
public void loginPreCheck(String username, String password)
|
||||
{
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password))
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("not.null")));
|
||||
throw new UserNotExistsException();
|
||||
}
|
||||
// 密码如果不在指定范围内 错误
|
||||
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|
||||
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH)
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
}
|
||||
// 用户名不在指定范围内 错误
|
||||
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|
||||
|| username.length() > UserConstants.USERNAME_MAX_LENGTH)
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
}
|
||||
// IP黑名单校验
|
||||
String blackStr = configService.selectConfigByKey("sys.login.blackIPList");
|
||||
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr()))
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("login.blocked")));
|
||||
throw new BlackListException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录登录信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
public void recordLoginInfo(Long userId)
|
||||
{
|
||||
WxAppUser user = new WxAppUser();
|
||||
user.setId(userId);
|
||||
user.setLoginTime(DateUtils.getNowDate());
|
||||
user.setLoginIp(IpUtils.getIpAddr());
|
||||
user.setUpdateTime(DateUtils.getNowDate());
|
||||
wxAppUserService.updateById(user);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -85,8 +83,9 @@ public class AccompanyMeal implements Serializable {
|
||||
private String feedBack;
|
||||
|
||||
/**
|
||||
* 陪餐照片
|
||||
* 陪餐照片: 为空时也会进行更新
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String accompanyImage;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品浏览记录表
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2024-11-15
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("browse")
|
||||
public class Browse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String nickName;
|
||||
|
||||
@NotNull(message="商家id不能为空")
|
||||
@TableField("merchant_id")
|
||||
private Long merchantId;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String merchantName;
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@NotNull(message="商品id不能为空")
|
||||
@TableField("product_id")
|
||||
private Long productId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 浏览开始时间
|
||||
*/
|
||||
@NotNull(message="浏览开始时间不能为空")
|
||||
@TableField("start_time")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 浏览结束时间
|
||||
*/
|
||||
@NotNull(message="浏览结束时间不能为空")
|
||||
@TableField("end_time")
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 浏览时间,单位:秒
|
||||
*/
|
||||
@TableField("remain_time")
|
||||
private Long remainTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("create_time")
|
||||
// @JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
// @JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date queryBeginTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
// @JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date queryEndTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.zf.foodpurchase.common.annotation.Excel;
|
||||
import com.zf.foodpurchase.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 商户轮播图对象 carousel
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
public class Carousel extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 一组轮播图id */
|
||||
@Excel(name = "一组轮播图id ")
|
||||
private Long carouselId;
|
||||
|
||||
/** 商户id */
|
||||
private Long merchantId;
|
||||
|
||||
|
||||
/** 商户名称 */
|
||||
private String merchantName;
|
||||
|
||||
/** 轮播图片url */
|
||||
@Excel(name = "轮播图片url")
|
||||
@NotBlank(message = "图片不能为空")
|
||||
private String carouselIamges;
|
||||
|
||||
public String getMerchantName() {
|
||||
return merchantName;
|
||||
}
|
||||
|
||||
public void setMerchantName(String merchantName) {
|
||||
this.merchantName = merchantName;
|
||||
}
|
||||
|
||||
public void setCarouselId(Long carouselId)
|
||||
{
|
||||
this.carouselId = carouselId;
|
||||
}
|
||||
|
||||
public Long getCarouselId()
|
||||
{
|
||||
return carouselId;
|
||||
}
|
||||
public void setMerchantId(Long merchantId)
|
||||
{
|
||||
this.merchantId = merchantId;
|
||||
}
|
||||
|
||||
public Long getMerchantId()
|
||||
{
|
||||
return merchantId;
|
||||
}
|
||||
public void setCarouselIamges(String carouselIamges)
|
||||
{
|
||||
this.carouselIamges = carouselIamges;
|
||||
}
|
||||
|
||||
public String getCarouselIamges()
|
||||
{
|
||||
return carouselIamges;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("carouselId", getCarouselId())
|
||||
.append("merchantId", getMerchantId())
|
||||
.append("carouselIamges", getCarouselIamges())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
/**
|
||||
* @author:lilj
|
||||
* @date:2024/12/24
|
||||
*/
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 级联数据结构
|
||||
*/
|
||||
@Data
|
||||
public class Cascade {
|
||||
|
||||
private String label;
|
||||
private Integer value;
|
||||
|
||||
private List<Cascade> children;
|
||||
}
|
||||
@@ -38,7 +38,11 @@ public class FoodProduct implements Serializable {
|
||||
* 食材id
|
||||
*/
|
||||
private Integer foodId;
|
||||
|
||||
private String num;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
@@ -54,6 +58,23 @@ public class FoodProduct implements Serializable {
|
||||
*/
|
||||
private Integer eduId;
|
||||
|
||||
/**
|
||||
* 食材分类信息
|
||||
*/
|
||||
private Integer typeId;
|
||||
@TableField(exist = false)
|
||||
private String typeLabel;
|
||||
|
||||
// 单位信息
|
||||
private Integer unitId;
|
||||
@TableField(exist = false)
|
||||
private String unitLabel;
|
||||
|
||||
// 单位信息
|
||||
private Integer specId;
|
||||
@TableField(exist = false)
|
||||
private String specLabel;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@@ -90,4 +111,8 @@ public class FoodProduct implements Serializable {
|
||||
* 有效标志
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
private Long deptId;
|
||||
|
||||
private String imageUrl;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FoodProductMaterial {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long foodProductId;
|
||||
private Integer foodId;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FoodRepo {
|
||||
|
||||
private Integer id;
|
||||
private Integer foodProductId;
|
||||
private Integer repoId;
|
||||
private Integer foodProductNum;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-17
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class FoodSpec implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 食材规格/单位id
|
||||
*/
|
||||
@TableId(value = "spec_id", type = IdType.AUTO)
|
||||
private Integer specId;
|
||||
|
||||
/**
|
||||
* 食材规格
|
||||
*/
|
||||
private String specLabel;
|
||||
|
||||
/**
|
||||
* 0 正常 1 停用
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Data
|
||||
public class InRepoVO {
|
||||
/**
|
||||
* 子订单编号
|
||||
*/
|
||||
private String orderItemNo;
|
||||
|
||||
/**
|
||||
* 学校id
|
||||
*/
|
||||
private Integer schoolId;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 教育局id
|
||||
*/
|
||||
private Integer eduId;
|
||||
|
||||
/**
|
||||
* 供货商id
|
||||
*/
|
||||
private Integer supplierId;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Integer foodProductId;
|
||||
|
||||
/**
|
||||
* 食材名称
|
||||
*/
|
||||
private String foodName;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 购买量
|
||||
*/
|
||||
private Integer productNum;
|
||||
|
||||
/**
|
||||
* 食材类别id
|
||||
*/
|
||||
private Integer typeId;
|
||||
|
||||
/**
|
||||
* 规格类型id
|
||||
*/
|
||||
private Integer unitId;
|
||||
|
||||
/**
|
||||
* 子订单状态:0 待接单;1 已接单;2 配送中;3 已完成;4 已取消
|
||||
*/
|
||||
private Integer orderItemStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 订单项备注,来源与购物车备注
|
||||
*/
|
||||
private String orderItemRemark;
|
||||
/**
|
||||
* 食材ID
|
||||
*/
|
||||
private Integer foodId;
|
||||
|
||||
private Integer refundNum;
|
||||
|
||||
private Integer repoId;
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 物流订单信息
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2024-11-20
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class LogisticsInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 订单项id
|
||||
*/
|
||||
@TableField("out_trade_no")
|
||||
@NotBlank(message = "订单号不能为空")
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* 物流公司名称
|
||||
*/
|
||||
@TableField("logistics_company")
|
||||
@NotBlank(message = "物流公司名称不能为空")
|
||||
private String logisticsCompany;
|
||||
|
||||
/**
|
||||
* 快递单号
|
||||
*/
|
||||
@TableField("tracking_no")
|
||||
@NotBlank(message = "快递单号不能为空")
|
||||
private String trackingNo;
|
||||
|
||||
/**
|
||||
* 快递状态
|
||||
*/
|
||||
@TableField("status")
|
||||
@NotNull(message = "快递状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 快递当前位置
|
||||
*/
|
||||
@TableField("current_location")
|
||||
@NotBlank(message = "快递当前位置不能为空")
|
||||
private String currentLocation;
|
||||
|
||||
/**
|
||||
* 发货位置
|
||||
*/
|
||||
@TableField("start_location")
|
||||
@NotBlank(message = "发货位置不能为空")
|
||||
private String startLocation;
|
||||
|
||||
/**
|
||||
* 收货位置
|
||||
*/
|
||||
@TableField("end_location")
|
||||
private String endLocation;
|
||||
|
||||
/**
|
||||
* 预计抵达时间
|
||||
*/
|
||||
@TableField("expected_delivery_date")
|
||||
private Date expectedDeliveryDate;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
@TableField("merchant_id")
|
||||
private Long merchantId;
|
||||
|
||||
@TableField(exist = false )
|
||||
private String merchantName;
|
||||
|
||||
/**
|
||||
* 小程序用户id
|
||||
*/
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
|
||||
@TableField(exist = false )
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 创建/更改物流信息人员id(商家/管理员)
|
||||
*/
|
||||
@TableField("oper_id")
|
||||
private Long operId;
|
||||
|
||||
@TableField("del_flag")
|
||||
private String delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String operName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Date beginTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 发货时间
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Date sendTime;
|
||||
|
||||
/**
|
||||
* 签收时间:
|
||||
* 根据orderItem是否增加签收时间来判断是否放开注释
|
||||
*/
|
||||
// @TableField(exist = false)
|
||||
// private Date signTime;
|
||||
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -56,8 +54,9 @@ public class MorningInspectionDetail implements Serializable {
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 问题照片
|
||||
* 问题照片:为null也修改
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String abnormalImg;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 订单明细表
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2024-11-26
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class OrderItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 订单项
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 微信用户标识
|
||||
*/
|
||||
@TableField("openid")
|
||||
private String openid;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 微信支付订单号
|
||||
*/
|
||||
@TableField("transaction_id")
|
||||
private String transactionId;
|
||||
|
||||
/**
|
||||
* 微信合单商户订单号
|
||||
*/
|
||||
@TableField("combine_out_trade_no")
|
||||
private String combineOutTradeNo;
|
||||
|
||||
/**
|
||||
* 子单商户订单号
|
||||
*/
|
||||
@TableField("out_trade_no")
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* 父订单号
|
||||
*/
|
||||
@TableField("order_id")
|
||||
private Integer orderId;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@TableField("product_id")
|
||||
private Integer productId;
|
||||
|
||||
/**
|
||||
* 商户id
|
||||
*/
|
||||
@TableField("merchant_id")
|
||||
private Long merchantId;
|
||||
|
||||
@TableField("merchant_name")
|
||||
private String merchantName;
|
||||
|
||||
/**
|
||||
* 规格JSON,[{规格类型:规格值},{规格类型:规格值}]
|
||||
*/
|
||||
@TableField("spec_str")
|
||||
private String specStr;
|
||||
|
||||
@TableField("spec_values")
|
||||
private String specValueIds;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@TableField("product_name")
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
@TableField("price")
|
||||
private Integer price;
|
||||
|
||||
/**
|
||||
* 购买类型:0 人民币购买;1 积分兑换
|
||||
*/
|
||||
@TableField("buy_type")
|
||||
private String buyType;
|
||||
|
||||
/**
|
||||
* 兑换所需积分
|
||||
*/
|
||||
@TableField("integral")
|
||||
private Integer integral;
|
||||
|
||||
/**
|
||||
* 购买数量
|
||||
*/
|
||||
@TableField("quantity")
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 商品url,用来订单中展示商品的缩略图
|
||||
*/
|
||||
@TableField("product_pic_url")
|
||||
private String productPicUrl;
|
||||
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
@TableField("pay_time")
|
||||
private Date payTime;
|
||||
|
||||
/**
|
||||
* 发货时间
|
||||
*/
|
||||
@TableField("send_time")
|
||||
private Date sendTime;
|
||||
|
||||
/**
|
||||
* 交易成交时间
|
||||
*/
|
||||
@TableField("finish_time")
|
||||
private Date finishTime;
|
||||
|
||||
|
||||
/**
|
||||
* 订单创建时间
|
||||
*/
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 订单更新时间
|
||||
*/
|
||||
@TableField(value = "update_time", fill = FieldFill.UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 订单状态:0 未支付;1 支付成功; 2 超时关闭; 3 用户取消; 4 已发货; 5 运输中; 6 已签收; 7 交易结束; 8 退款中;9 已退款; 10 退款异常; 11 物流异常
|
||||
*/
|
||||
@TableField("order_status")
|
||||
private Integer orderStatus;
|
||||
|
||||
/**
|
||||
* 是否逻辑删除
|
||||
逻辑删除:0 正常;1 已删除
|
||||
*/
|
||||
@TableField("del_flag")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 商品规格id
|
||||
*/
|
||||
@TableField("product_spec_id")
|
||||
private Integer productSpecId;
|
||||
|
||||
@TableField("product_description")
|
||||
private String productDescription;
|
||||
|
||||
@TableField("return_integral")
|
||||
private Integer returnIntegral;
|
||||
|
||||
@TableField("mchid")
|
||||
private String mchid;
|
||||
|
||||
@TableField("user_address_id")
|
||||
private Integer userAddressId;
|
||||
|
||||
@TableField("area_code")
|
||||
private String areaCode;
|
||||
|
||||
@TableField("detail_address")
|
||||
private String detailAddress;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String showAddress;
|
||||
|
||||
@TableField("phone_number")
|
||||
private String phoneNumber;
|
||||
|
||||
@TableField("logistics_id")
|
||||
private Integer logisticsId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private LogisticsInfo logisticsInfo;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String nickName;
|
||||
|
||||
@TableField("recp_name")
|
||||
private String recpName;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.zf.foodpurchase.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class RepoRecord extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请日期
|
||||
*/
|
||||
private Date applyDate;
|
||||
|
||||
/**
|
||||
* 商户id
|
||||
*/
|
||||
private Integer supplierId;
|
||||
|
||||
/**
|
||||
* 类型id
|
||||
*/
|
||||
private Integer categoryId;
|
||||
|
||||
/**
|
||||
* 仓库id
|
||||
*/
|
||||
private Integer repoId;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Integer productId;
|
||||
|
||||
/**
|
||||
* 商品数量
|
||||
*/
|
||||
private Integer productNum;
|
||||
|
||||
/**
|
||||
* 商品总价,单位:分
|
||||
*/
|
||||
private BigDecimal totalCost;
|
||||
|
||||
/**
|
||||
* 出入库状态 1:入库, 0:出库
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
private String productName;
|
||||
|
||||
private Date startTime;
|
||||
|
||||
private Date endTime;
|
||||
|
||||
private String orderNo;
|
||||
|
||||
private Long deptId;
|
||||
|
||||
private List<Long> deptIds;
|
||||
|
||||
private Long operId;
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓库列表
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2024-11-20
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class Repository implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@TableField("repo_name")
|
||||
private String repoName;
|
||||
/**
|
||||
* 所属商户id
|
||||
*/
|
||||
@TableField("merchant_id")
|
||||
private Long merchantId;
|
||||
|
||||
|
||||
/**
|
||||
* 所属商户名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String merchantName;
|
||||
|
||||
/**
|
||||
* 区划编码
|
||||
*/
|
||||
// @NotNull(message = "所属区划不能为空")
|
||||
@TableField("area_code")
|
||||
private String areaCode;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
@TableField("detail_address")
|
||||
private String detailAddress;
|
||||
|
||||
/**
|
||||
* 是否是默认仓库:0 否 1 是
|
||||
*/
|
||||
@TableField("default_repo")
|
||||
private String defaultRepo;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 操作人
|
||||
*/
|
||||
@TableField("oper_id")
|
||||
private Long operId;
|
||||
|
||||
@TableField
|
||||
private Long manager;
|
||||
|
||||
@TableField
|
||||
private String repoNum;
|
||||
|
||||
@TableField
|
||||
private Integer orderNum;
|
||||
@TableField(exist = false)
|
||||
private List<Long> deptIds;
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -64,8 +62,9 @@ public class RubbishDeal implements Serializable {
|
||||
private String recycleCompany;
|
||||
|
||||
/**
|
||||
* 回收图片
|
||||
* 回收图片,为空时也会更新
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String dealImg;
|
||||
|
||||
/**
|
||||
|
||||
@@ -110,4 +110,10 @@ public class SchoolOrder implements Serializable {
|
||||
* 订单是否可参与结算:0 不可结算;1 可结算
|
||||
*/
|
||||
private Integer orderSettleStatus;
|
||||
|
||||
private String signPerson;
|
||||
|
||||
private Date signTime;
|
||||
|
||||
private String signImage;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class SchoolOrderItem implements Serializable {
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Long foodProductId;
|
||||
private Integer foodProductId;
|
||||
|
||||
/**
|
||||
* 食材名称
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -53,8 +51,9 @@ public class SelfInspectionDetail implements Serializable {
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 问题图片
|
||||
* 问题图片:为null也更新
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String abnormalImg;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -64,13 +62,15 @@ public class Supplier implements Serializable {
|
||||
private String concatPhone;
|
||||
|
||||
/**
|
||||
* 营业执照照片
|
||||
* 营业执照照片:为null也进行更新
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String licenseImg;
|
||||
|
||||
/**
|
||||
* 食品经营许可证照片
|
||||
* 食品经营许可证照片:为null也进行更新
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String foodLicenseImg;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -64,8 +62,9 @@ public class SupplierDeliveryItem implements Serializable {
|
||||
private String inImage;
|
||||
|
||||
/**
|
||||
* 检测报告图片
|
||||
* 检测报告图片:为null时也进行更新
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String checkReportImage;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.zf.foodpurchase.fdsafe.entity;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class XhCreate {
|
||||
|
||||
private Integer id;
|
||||
private Integer deptNum;
|
||||
private Long deptId;
|
||||
private String timeStr;
|
||||
private Integer xh;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.zf.foodpurchase.fdsafe.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zf.foodpurchase.fdsafe.entity.Browse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品浏览记录表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2024-11-15
|
||||
*/
|
||||
public interface BrowseMapper extends BaseMapper<Browse> {
|
||||
|
||||
List<Browse> joinQueryList(Browse browse);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.zf.foodpurchase.fdsafe.mapper;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.fdsafe.entity.Carousel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商户轮播图Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
public interface CarouselMapper
|
||||
{
|
||||
/**
|
||||
* 查询商户轮播图
|
||||
*
|
||||
* @param carouselId 商户轮播图主键
|
||||
* @return 商户轮播图
|
||||
*/
|
||||
public Carousel selectCarouselByCarouselId(Long carouselId);
|
||||
|
||||
/**
|
||||
* 查询商户轮播图列表
|
||||
*
|
||||
* @param carousel 商户轮播图
|
||||
* @return 商户轮播图集合
|
||||
*/
|
||||
public List<Carousel> selectCarouselList(Carousel carousel);
|
||||
|
||||
/**
|
||||
* 新增商户轮播图
|
||||
*
|
||||
* @param carousel 商户轮播图
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCarousel(Carousel carousel);
|
||||
|
||||
/**
|
||||
* 修改商户轮播图
|
||||
*
|
||||
* @param carousel 商户轮播图
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCarousel(Carousel carousel);
|
||||
|
||||
/**
|
||||
* 删除商户轮播图
|
||||
*
|
||||
* @param carouselId 商户轮播图主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCarouselByCarouselId(Long carouselId);
|
||||
|
||||
/**
|
||||
* 批量删除商户轮播图
|
||||
*
|
||||
* @param carouselIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCarouselByCarouselIds(Long[] carouselIds);
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.zf.foodpurchase.fdsafe.mapper;
|
||||
|
||||
import com.zf.foodpurchase.fdsafe.entity.FoodProduct;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodProductCKVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodProductVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -17,4 +18,6 @@ import java.util.List;
|
||||
public interface FoodProductMapper extends BaseMapper<FoodProduct> {
|
||||
|
||||
List<FoodProductVO> queryFoodProductVO(FoodProductVO foodProductVO);
|
||||
List<FoodProductCKVO> pageCKList(Integer repoId);
|
||||
void updateDelFlag(Long foodProductId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.zf.foodpurchase.fdsafe.mapper;
|
||||
|
||||
import com.zf.foodpurchase.fdsafe.entity.FoodRepo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface FoodRepoMapper {
|
||||
|
||||
int insert(FoodRepo foodRepo);
|
||||
int update(FoodRepo foodRepo);
|
||||
FoodRepo selectByProductIdAndRepoId(@Param("productId") Long productId, @Param("repoId") Long repoId);
|
||||
|
||||
List<FoodRepo> selectByRepoId(@Param("repoIds") List<Long> repoIds);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zf.foodpurchase.fdsafe.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zf.foodpurchase.fdsafe.entity.FoodSpec;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodSpecVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-17
|
||||
*/
|
||||
public interface FoodSpecMapper extends BaseMapper<FoodSpec> {
|
||||
|
||||
List<FoodSpecVO> queryFoodSpecVO(FoodSpecVO foodSpecVO);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zf.foodpurchase.fdsafe.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zf.foodpurchase.fdsafe.entity.RepoRecord;
|
||||
import com.zf.foodpurchase.fdsafe.vo.RepoRecordVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface RepoRecordMapper extends BaseMapper<RepoRecord> {
|
||||
|
||||
public int insertRepoRecord(RepoRecord repoRecord);
|
||||
|
||||
public RepoRecordVO selectRepoRecordByRepoRecordId(@Param("repoRecordId") Long repoRecordId);
|
||||
|
||||
public List<RepoRecordVO> selectRepoRecordList(@Param("productName") String productName, @Param("status") Integer status, @Param("repoId") Integer repoId, @Param("startTime") Date startTime, @Param("endTime") Date endTime,@Param("deptIds") List<Long> deptIds);
|
||||
|
||||
public List<RepoRecordVO> selectRepoRecordListByProductId(Long productId);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zf.foodpurchase.fdsafe.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zf.foodpurchase.fdsafe.entity.Repository;
|
||||
import com.zf.foodpurchase.fdsafe.vo.RepositoryVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓库列表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2024-11-20
|
||||
*/
|
||||
public interface RepositoryMapper extends BaseMapper<Repository> {
|
||||
|
||||
List<RepositoryVO> queryRepoList(Repository queryRepository);
|
||||
}
|
||||
@@ -2,7 +2,9 @@ package com.zf.foodpurchase.fdsafe.mapper;
|
||||
|
||||
import com.zf.foodpurchase.fdsafe.entity.SchoolOrderItem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zf.foodpurchase.fdsafe.vo.ProductCountVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolOrderItemVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,4 +19,5 @@ import java.util.List;
|
||||
public interface SchoolOrderItemMapper extends BaseMapper<SchoolOrderItem> {
|
||||
|
||||
List<SchoolOrderItemVO> querySchoolOrderItemVO(SchoolOrderItemVO schoolOrderItemVO);
|
||||
|
||||
}
|
||||
|
||||
@@ -16,5 +16,9 @@ import java.util.List;
|
||||
*/
|
||||
public interface SchoolOrderMapper extends BaseMapper<SchoolOrder> {
|
||||
|
||||
List<SchoolOrderVO> querySupplierOrderVO(SchoolOrderVO schoolOrderVO);
|
||||
|
||||
List<SchoolOrderVO> querySchoolOrderVO(SchoolOrderVO schoolOrderVO);
|
||||
|
||||
int signOrder(SchoolOrderVO schoolOrderVO);
|
||||
}
|
||||
|
||||
@@ -17,4 +17,6 @@ import java.util.List;
|
||||
public interface SupplierMapper extends BaseMapper<Supplier> {
|
||||
|
||||
List<SupplierVO> querySupplierVO(SupplierVO supplierVO);
|
||||
|
||||
Integer selectMaxId();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.zf.foodpurchase.fdsafe.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zf.foodpurchase.fdsafe.entity.XhCreate;
|
||||
import com.zf.foodpurchase.fdsafe.vo.XhCreateVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 食材表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-17
|
||||
*/
|
||||
public interface XhMapper {
|
||||
|
||||
XhCreate queryXhCreate(XhCreateVO xhCreateVO);
|
||||
|
||||
int insertXhCreate(XhCreate xhCreate);
|
||||
|
||||
int updateXhCreate(XhCreate xhCreate);
|
||||
|
||||
int selectMaxDeptNum();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.zf.foodpurchase.fdsafe.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zf.foodpurchase.fdsafe.entity.Browse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品浏览记录表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2024-11-15
|
||||
*/
|
||||
public interface IBrowseService extends IService<Browse> {
|
||||
|
||||
List<Browse> joinQueryList(Browse browse);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.zf.foodpurchase.fdsafe.service;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.fdsafe.entity.Carousel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商户轮播图Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
public interface ICarouselService
|
||||
{
|
||||
/**
|
||||
* 查询商户轮播图
|
||||
*
|
||||
* @param carouselId 商户轮播图主键
|
||||
* @return 商户轮播图
|
||||
*/
|
||||
public Carousel selectCarouselByCarouselId(Long carouselId);
|
||||
|
||||
/**
|
||||
* 查询商户轮播图列表
|
||||
*
|
||||
* @param carousel 商户轮播图
|
||||
* @return 商户轮播图集合
|
||||
*/
|
||||
public List<Carousel> selectCarouselList(Carousel carousel);
|
||||
|
||||
/**
|
||||
* 新增商户轮播图
|
||||
*
|
||||
* @param carousel 商户轮播图
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCarousel(Carousel carousel);
|
||||
|
||||
/**
|
||||
* 修改商户轮播图
|
||||
*
|
||||
* @param carousel 商户轮播图
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCarousel(Carousel carousel);
|
||||
|
||||
/**
|
||||
* 批量删除商户轮播图
|
||||
*
|
||||
* @param carouselIds 需要删除的商户轮播图主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCarouselByCarouselIds(Long[] carouselIds);
|
||||
|
||||
/**
|
||||
* 删除商户轮播图信息
|
||||
*
|
||||
* @param carouselId 商户轮播图主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCarouselByCarouselId(Long carouselId);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.zf.foodpurchase.fdsafe.service;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.fdsafe.entity.FoodProduct;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodProductCKVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodProductVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -23,5 +24,9 @@ public interface IFoodProductService extends IService<FoodProduct> {
|
||||
|
||||
AjaxResult supplierUpdate(FoodProductVO foodProductVO);
|
||||
|
||||
AjaxResult supplierDelete(Long foodProductId);
|
||||
|
||||
AjaxResult eduCheck(FoodProductVO foodProductVO);
|
||||
|
||||
List<FoodProductCKVO> pageCKList(Integer repoId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.zf.foodpurchase.fdsafe.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.fdsafe.entity.FoodSpec;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodSpecVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-17
|
||||
*/
|
||||
public interface IFoodSpecService extends IService<FoodSpec> {
|
||||
|
||||
List<FoodSpecVO> queryFoodSpecVO(FoodSpecVO foodSpecVO);
|
||||
|
||||
AjaxResult saveVO(FoodSpecVO foodSpecVO);
|
||||
|
||||
AjaxResult updateVO(FoodSpecVO foodSpecVO);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.zf.foodpurchase.fdsafe.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.fdsafe.entity.InRepoVO;
|
||||
import com.zf.foodpurchase.fdsafe.entity.RepoRecord;
|
||||
import com.zf.foodpurchase.fdsafe.entity.SchoolOrderItem;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodProductCKVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.RepoRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IRepoRecordService extends IService<RepoRecord> {
|
||||
|
||||
AjaxResult inRepo(List<InRepoVO> inRepoVOs);
|
||||
|
||||
AjaxResult outRepo(List<FoodProductCKVO> foodProductCKVOs);
|
||||
|
||||
RepoRecordVO selectRepoRecordByRepoRecordId(Long repoRecordId);
|
||||
|
||||
List<RepoRecordVO> selectRepoRecordList(RepoRecord repoRecord);
|
||||
|
||||
List<RepoRecordVO> selectRepoRecordListByProductId(Long productId);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.zf.foodpurchase.fdsafe.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.fdsafe.entity.Repository;
|
||||
import com.zf.foodpurchase.fdsafe.vo.ProductCountVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.RepositoryVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓库列表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2024-11-20
|
||||
*/
|
||||
public interface IRepositoryService extends IService<Repository> {
|
||||
|
||||
List<RepositoryVO> queryRepoList(Repository quryRepository);
|
||||
|
||||
AjaxResult saveRepo(Repository repository);
|
||||
|
||||
AjaxResult modifyRepo(Repository repository);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.zf.foodpurchase.fdsafe.service;
|
||||
import com.zf.foodpurchase.fdsafe.entity.SchoolOrder;
|
||||
import com.zf.foodpurchase.fdsafe.entity.SchoolOrderItem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.ProductCountVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolOrderItemVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,6 +18,8 @@ import java.util.List;
|
||||
*/
|
||||
public interface ISchoolOrderService extends IService<SchoolOrder> {
|
||||
|
||||
List<SchoolOrderVO> querySupplierOrderVO(SchoolOrderVO schoolOrderVO);
|
||||
|
||||
List<SchoolOrderVO> querySchoolOrderVO(SchoolOrderVO schoolOrderVO);
|
||||
|
||||
AjaxResult submitOrder(@Valid SchoolSubmitOrderVO submitOrderVO);
|
||||
@@ -26,9 +28,11 @@ public interface ISchoolOrderService extends IService<SchoolOrder> {
|
||||
|
||||
AjaxResult updateOrderRemark(@Valid SchoolModifyOrderRemarkVO remarkVO);
|
||||
|
||||
AjaxResult supplierAcceptOrder(SupplierAcceptOrderVO supplierAcceptOrderVO);
|
||||
AjaxResult supplierAcceptOrder(String orderNo);
|
||||
|
||||
boolean updateOrderStatus(SchoolOrder schoolOrder);
|
||||
|
||||
public boolean updateOrderSettleStatus(List<String> orderNos, Integer orderSettleStatus);
|
||||
|
||||
AjaxResult signOrder(SchoolOrderVO schoolOrderVO);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.zf.foodpurchase.fdsafe.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zf.foodpurchase.fdsafe.entity.Browse;
|
||||
import com.zf.foodpurchase.fdsafe.service.IBrowseService;
|
||||
import com.zf.foodpurchase.fdsafe.mapper.BrowseMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品浏览记录表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2024-11-15
|
||||
*/
|
||||
@Service
|
||||
public class BrowseServiceImpl extends ServiceImpl<BrowseMapper, Browse> implements IBrowseService {
|
||||
@Autowired
|
||||
private BrowseMapper browseMapper;
|
||||
|
||||
@Override
|
||||
public List<Browse> joinQueryList(Browse browse) {
|
||||
return browseMapper.joinQueryList(browse);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.zf.foodpurchase.fdsafe.service.impl;
|
||||
|
||||
import com.zf.foodpurchase.common.utils.DateUtils;
|
||||
import com.zf.foodpurchase.fdsafe.entity.Carousel;
|
||||
import com.zf.foodpurchase.fdsafe.mapper.CarouselMapper;
|
||||
import com.zf.foodpurchase.fdsafe.service.ICarouselService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商户轮播图Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
@Service
|
||||
public class CarouselServiceImpl implements ICarouselService
|
||||
{
|
||||
@Autowired
|
||||
private CarouselMapper carouselMapper;
|
||||
|
||||
/**
|
||||
* 查询商户轮播图
|
||||
*
|
||||
* @param carouselId 商户轮播图主键
|
||||
* @return 商户轮播图
|
||||
*/
|
||||
@Override
|
||||
public Carousel selectCarouselByCarouselId(Long carouselId)
|
||||
{
|
||||
return carouselMapper.selectCarouselByCarouselId(carouselId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商户轮播图列表
|
||||
*
|
||||
* @param carousel 商户轮播图
|
||||
* @return 商户轮播图
|
||||
*/
|
||||
@Override
|
||||
public List<Carousel> selectCarouselList(Carousel carousel)
|
||||
{
|
||||
return carouselMapper.selectCarouselList(carousel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商户轮播图
|
||||
*
|
||||
* @param carousel 商户轮播图
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCarousel(Carousel carousel)
|
||||
{
|
||||
carousel.setCreateTime(DateUtils.getNowDate());
|
||||
return carouselMapper.insertCarousel(carousel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商户轮播图
|
||||
*
|
||||
* @param carousel 商户轮播图
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCarousel(Carousel carousel)
|
||||
{
|
||||
carousel.setUpdateTime(DateUtils.getNowDate());
|
||||
return carouselMapper.updateCarousel(carousel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商户轮播图
|
||||
*
|
||||
* @param carouselIds 需要删除的商户轮播图主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCarouselByCarouselIds(Long[] carouselIds)
|
||||
{
|
||||
return carouselMapper.deleteCarouselByCarouselIds(carouselIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商户轮播图信息
|
||||
*
|
||||
* @param carouselId 商户轮播图主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCarouselByCarouselId(Long carouselId)
|
||||
{
|
||||
return carouselMapper.deleteCarouselByCarouselId(carouselId);
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class FoodBookServiceImpl extends ServiceImpl<FoodBookMapper, FoodBook> i
|
||||
foodBookVO.setDishIdList(dishIdList);
|
||||
LambdaQueryWrapper<Dish> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(Dish::getDishId, split);
|
||||
queryWrapper.last("or del_flag = 1");
|
||||
queryWrapper.last("or (del_flag = 1 and dish_id in ("+ids+"))" );
|
||||
List<Dish> dishList = dishService.list(queryWrapper);
|
||||
String names = dishList.stream().map(Dish::getDishName).reduce((a, b) -> a + "," + b).get();
|
||||
foodBookVO.setDishNames(names);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user