全量提交
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package com.zf.foodpurchase;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
@EnableScheduling
|
||||
@EnableAspectJAutoProxy
|
||||
public class RuoYiApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
SpringApplication.run(RuoYiApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n" +
|
||||
" | (_,_).' __ ___(_ o _)' \n" +
|
||||
" | |\\ \\ | || |(_,_)' \n" +
|
||||
" | | \\ `' /| `-' / \n" +
|
||||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.zf.foodpurchase;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
/**
|
||||
* web容器中进行部署
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class RuoYiServletInitializer extends SpringBootServletInitializer
|
||||
{
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||
{
|
||||
return application.sources(RuoYiApplication.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
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.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.IFoodTypeService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodTypeVO;
|
||||
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("/foodType")
|
||||
public class FoodTypeController extends BaseController {
|
||||
@Autowired
|
||||
private IFoodTypeService foodTypeServcie;
|
||||
|
||||
/**
|
||||
* 查询用
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(){
|
||||
FoodTypeVO foodTypeVO = new FoodTypeVO();
|
||||
foodTypeVO.setStatus(0);
|
||||
List<FoodTypeVO> list = foodTypeServcie.queryFoodTypeVO(foodTypeVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(FoodTypeVO foodTypeVO){
|
||||
startPage();
|
||||
List<FoodTypeVO> list = foodTypeServcie.queryFoodTypeVO(foodTypeVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) FoodTypeVO foodTypeVO){
|
||||
return foodTypeServcie.saveVO(foodTypeVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class)FoodTypeVO foodTypeVO){
|
||||
return foodTypeServcie.updateVO(foodTypeVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer unitId){
|
||||
if(unitId == null){
|
||||
return error("未指定要删除的类别");
|
||||
}
|
||||
boolean flag = foodTypeServcie.removeById(unitId);
|
||||
return flag ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
// 食材
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
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.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.IFoodUnitService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodUnitVO;
|
||||
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("/foodUnit")
|
||||
public class FoodUnitController extends BaseController {
|
||||
@Autowired
|
||||
private IFoodUnitService foodUnitService;
|
||||
|
||||
/**
|
||||
* 查询用
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(){
|
||||
FoodUnitVO foodUnitVO = new FoodUnitVO();
|
||||
foodUnitVO.setStatus(0);
|
||||
foodUnitVO.setDelFlag(0);
|
||||
List list = foodUnitService.queryFoodUnitVO(foodUnitVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(FoodUnitVO foodUnitVO){
|
||||
startPage();
|
||||
foodUnitVO.setDelFlag(0);
|
||||
List<FoodUnitVO> list = foodUnitService.queryFoodUnitVO(foodUnitVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) FoodUnitVO foodUnitVO){
|
||||
return foodUnitService.saveVO(foodUnitVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) FoodUnitVO foodUnitVO){
|
||||
return foodUnitService.updateVO(foodUnitVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer unitId){
|
||||
if(unitId == null){
|
||||
return error("未指定要删除的食材规格/单位");
|
||||
}
|
||||
boolean flag = foodUnitService.removeById(unitId);
|
||||
return flag ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
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.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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:lilj
|
||||
* @date:2025/4/10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/edu")
|
||||
public class EduController extends BaseController {
|
||||
@Autowired
|
||||
private IEduService eduService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(EduVO eduVO){
|
||||
List<EduVO> list = eduService.queryEduList(eduVO);
|
||||
return AjaxResult.success("查询成功",list);
|
||||
}
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(EduVO eduVO){
|
||||
startPage();
|
||||
List<EduVO> list = eduService.queryEduList(eduVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) EduVO eduVO){
|
||||
return eduService.saveVO(eduVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) EduVO eduVO){
|
||||
return eduService.updateVO(eduVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer eduId){
|
||||
if(eduId == null){
|
||||
return error("未指定要删除的教育局");
|
||||
}
|
||||
return eduService.removeById(eduId) ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
//晨检内容 Morning inspection contents
|
||||
// 晨检记录:
|
||||
// 晨检详情:
|
||||
// 自检内容:Self-check content
|
||||
|
||||
//标准
|
||||
@@ -0,0 +1,59 @@
|
||||
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.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 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("/food")
|
||||
public class FoodController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IFoodService foodService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(FoodVO foodVO) {
|
||||
startPage();
|
||||
foodVO.setDelFlag(0);
|
||||
List<FoodVO> list = foodService.queryFoodVO(foodVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) FoodVO foodVO) {
|
||||
return foodService.saveVO(foodVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) FoodVO foodVO) {
|
||||
return foodService.updateVO(foodVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer foodId) {
|
||||
if(foodId == null){
|
||||
return error("未指定要删除的食材");
|
||||
}
|
||||
boolean flag = foodService.removeById(foodId);
|
||||
return flag ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
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.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 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-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/morningInspectionContent")
|
||||
public class MorningInspectionContentController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IMorningInspectionContentService morningInspectionContentService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(MorningInspectionContentVO morningInspectionContentVO){
|
||||
startPage();
|
||||
List<MorningInspectionContentVO> list = morningInspectionContentService.queryMorningInspectionContentVO(morningInspectionContentVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) MorningInspectionContentVO morningInspectionContentVO){
|
||||
return morningInspectionContentService.saveVO(morningInspectionContentVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) MorningInspectionContentVO morningInspectionContentVO){
|
||||
return morningInspectionContentService.updateVO(morningInspectionContentVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer inspectionId){
|
||||
if (inspectionId == null){
|
||||
return error("未指定要删除的晨检项");
|
||||
}
|
||||
return morningInspectionContentService.deleteWithId(inspectionId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
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.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 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-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/selfInspectionContent")
|
||||
public class SelfInspectionContentController extends BaseController {
|
||||
@Autowired
|
||||
private ISelfInspectionContentService selfInspectionContentService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SelfInspectionContentVO selfInspectionContentVO){
|
||||
startPage();
|
||||
List<SelfInspectionContentVO> list = selfInspectionContentService.querySelfInspectionContentVO(selfInspectionContentVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) SelfInspectionContentVO selfInspectionContentVO){
|
||||
return selfInspectionContentService.saveVO(selfInspectionContentVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) SelfInspectionContentVO selfInspectionContentVO){
|
||||
return selfInspectionContentService.updateVO(selfInspectionContentVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer selfInspectionId){
|
||||
if(selfInspectionId == null){
|
||||
return AjaxResult.error("未指定要删除的自检内容");
|
||||
}
|
||||
boolean flag= selfInspectionContentService.removeById(selfInspectionId);
|
||||
return flag ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
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.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISupplierService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierVO;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:lilj
|
||||
* @date:2025/4/18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/supplier")
|
||||
public class SupplierController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISupplierService supplierService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SupplierVO supplierVO) {
|
||||
startPage();
|
||||
List<SupplierVO> list = supplierService.querySupplierVO(supplierVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) SupplierVO supplierVO) {
|
||||
return supplierService.saveVO(supplierVO);
|
||||
}
|
||||
|
||||
// 接口需要划分:上架,信息编辑.
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) SupplierVO supplierVO) {
|
||||
return supplierService.updateVO(supplierVO);
|
||||
}
|
||||
|
||||
|
||||
// 接口需要划分:上架,信息编辑.
|
||||
@PostMapping("/updateStatus")
|
||||
public AjaxResult updateStatus(@RequestBody SupplierVO supplierVO) {
|
||||
if(supplierVO.getStatus() == null){
|
||||
return error("未指定要修改的供货商状态");
|
||||
}
|
||||
if(supplierVO.getSupplierId() == null){
|
||||
return error("未指定要修改的供货商");
|
||||
}
|
||||
SupplierVO updateStatus = new SupplierVO();
|
||||
updateStatus.setSupplierId(supplierVO.getSupplierId());
|
||||
updateStatus.setStatus(supplierVO.getStatus());
|
||||
return supplierService.updateVO(updateStatus);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('supplier:delete')")
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer supplierId) {
|
||||
// 权限处理.
|
||||
if (supplierId == null) {
|
||||
return error("未指定要删除的供货商");
|
||||
}
|
||||
boolean flag = supplierService.removeById(supplierId);
|
||||
return flag ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
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.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.entity.AccompanyMeal;
|
||||
import com.zf.foodpurchase.fdsafe.service.IAccompanyMealService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.AccompanyMealVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/accompanyMeal")
|
||||
public class AccompanyMealController extends BaseController {
|
||||
@Autowired
|
||||
private IAccompanyMealService accompanyMealService;
|
||||
|
||||
@RequestMapping("/pageList")
|
||||
public TableDataInfo pageList(AccompanyMealVO accompanyMealVO) {
|
||||
startPage();
|
||||
List<AccompanyMealVO> list = accompanyMealService.queryAccompanyMealVO(accompanyMealVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) AccompanyMealVO accompanyMealVO) {
|
||||
return accompanyMealService.saveVO(accompanyMealVO);
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) AccompanyMealVO accompanyMealVO) {
|
||||
return accompanyMealService.updateVO(accompanyMealVO);
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public AjaxResult delete(Integer accompanyMealId) {
|
||||
if(accompanyMealId == null){
|
||||
return error("请选择要删除的陪餐记录");
|
||||
}
|
||||
return accompanyMealService.removeWithId(accompanyMealId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.ICattenService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.CattenVO;
|
||||
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-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/catten")
|
||||
public class CattenController extends BaseController {
|
||||
@Autowired
|
||||
private ICattenService cattenService;
|
||||
|
||||
@RequestMapping("/pageList")
|
||||
public TableDataInfo pageList(CattenVO cattenVO) {
|
||||
startPage();
|
||||
List<CattenVO> list = cattenService.queryCattenVO(cattenVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody CattenVO cattenVO) {
|
||||
return cattenService.saveVO(cattenVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Validated(UpdateGroup.class) @RequestBody CattenVO cattenVO) {
|
||||
return cattenService.updateVO(cattenVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer cattenId) {
|
||||
if(cattenId == null){
|
||||
return error("请选择要删除的食堂");
|
||||
}
|
||||
return cattenService.removeById(cattenId) ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.mysql.cj.xdevapi.Table;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.utils.PageUtils;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
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 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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜品表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dish")
|
||||
public class DishController extends BaseController {
|
||||
@Autowired
|
||||
private IDishService dishService;
|
||||
|
||||
@Autowired
|
||||
private IDishFoodRelationService dishFoodRelationService;
|
||||
|
||||
@RequestMapping("/pageList")
|
||||
public TableDataInfo pageList(DishVO dishVO) {
|
||||
List<DishVO> list = new ArrayList<>();
|
||||
if(dishVO == null || dishVO.getSchoolId() == null){
|
||||
return getDataTable(list);
|
||||
}
|
||||
startPage();
|
||||
List<DishVO> dishVOList = dishService.queryDishVO(dishVO);
|
||||
TableDataInfo tableDataInfo = getDataTable(dishVOList);
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) DishVO dishVO) {
|
||||
return dishService.saveVO(dishVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(AddGroup.class) DishVO dishVO) {
|
||||
return dishService.updateVO(dishVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer dishId) {
|
||||
if(dishId == null){
|
||||
return error("未指定要删除的菜品");
|
||||
}
|
||||
boolean flag = dishService.removeById(dishId);
|
||||
return flag ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
public AjaxResult detail(Integer dishId){
|
||||
List<DishFoodRelationVO> dishFoodRelationVOList = dishFoodRelationService.detail(dishId);
|
||||
return AjaxResult.success(dishFoodRelationVOList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.fdsafe.service.IDishFoodRelationService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.DishFoodRelationVO;
|
||||
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 2025-04-18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dishFoodRelation")
|
||||
public class DishFoodRelationController {
|
||||
@Autowired
|
||||
private IDishFoodRelationService dishFoodRelationService;
|
||||
|
||||
// @GetMapping("/detail")
|
||||
// public AjaxResult detail(Integer dishId){
|
||||
// List<DishFoodRelationVO> dishFoodRelationVOList = dishFoodRelationService.detail(dishId);
|
||||
// return AjaxResult.success(dishFoodRelationVOList);
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/list")
|
||||
// public AjaxResult list(DishFoodRelationVO dishFoodRelationVO){
|
||||
// List<DishFoodRelationVO> dishFoodRelationVOList = dishFoodRelationService.queryRelationVO(dishFoodRelationVO);
|
||||
// return AjaxResult.success(dishFoodRelationVOList);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
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.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 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-19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/foodBook")
|
||||
public class FoodBookController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IFoodBookService foodBookService;
|
||||
|
||||
@RequestMapping("/pageList")
|
||||
public TableDataInfo pageList(FoodBookVO foodBookVO) {
|
||||
startPage();
|
||||
foodBookVO.setDelFlag(0);
|
||||
List<FoodBookVO> list = foodBookService.queryFoodBookVO(foodBookVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) FoodBookVO foodBookVO) {
|
||||
return foodBookService.saveVO(foodBookVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) FoodBookVO foodBookVO) {
|
||||
return foodBookService.updateVO(foodBookVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Long bookId) {
|
||||
if(bookId == null){
|
||||
return error("未指定要删除的菜谱");
|
||||
}
|
||||
return foodBookService.removeWithId(bookId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
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.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.IFoodSampleService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodSampleVO;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/foodSample")
|
||||
public class FoodSampleController extends BaseController {
|
||||
@Autowired
|
||||
private IFoodSampleService foodSampleService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(FoodSampleVO foodSampleVO) {
|
||||
startPage();
|
||||
List<FoodSampleVO> list = foodSampleService.queryFoodSampleVO(foodSampleVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) FoodSampleVO foodSampleVO) {
|
||||
return foodSampleService.saveVO(foodSampleVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) FoodSampleVO foodSampleVO) {
|
||||
return foodSampleService.updateVO(foodSampleVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Long sampleId) {
|
||||
if(sampleId == null){
|
||||
return error("未指定要删除的留样记录");
|
||||
}
|
||||
return foodSampleService.deleteWithId(sampleId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
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.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 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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/morningCheckIn")
|
||||
public class MorningCheckInController extends BaseController {
|
||||
@Autowired
|
||||
private IMorningCheckInService morningCheckInService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(MorningCheckInVO morningCheckInVO) {
|
||||
startPage();
|
||||
List<MorningCheckInVO> list = morningCheckInService.queryMorningCheckInVO(morningCheckInVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult save(@RequestBody @Validated(AddGroup.class) MorningCheckInVO morningCheckInVO) {
|
||||
return morningCheckInService.saveVO(morningCheckInVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) MorningCheckInVO morningCheckInVO) {
|
||||
return morningCheckInService.updateVO(morningCheckInVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Long checkInId) {
|
||||
if(checkInId == null){
|
||||
return error("未指定要删除的晨检登记记录");
|
||||
}
|
||||
return morningCheckInService.removewithId(checkInId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
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.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.entity.MorningInspectionDetail;
|
||||
import com.zf.foodpurchase.fdsafe.mapper.MorningCheckInMapper;
|
||||
import com.zf.foodpurchase.fdsafe.service.IMorningInspectionContentService;
|
||||
import com.zf.foodpurchase.fdsafe.service.IMorningInspectionDetailService;
|
||||
import com.zf.foodpurchase.fdsafe.service.impl.MorningInspectionContentServiceImpl;
|
||||
import com.zf.foodpurchase.fdsafe.vo.MorningInspectionDetailVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.MorningTableHeaderVO;
|
||||
import org.apache.commons.math3.analysis.function.Add;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/morningInspectionDetail")
|
||||
public class MorningInspectionDetailController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IMorningInspectionDetailService morningInspectionDetailService;
|
||||
|
||||
@Autowired
|
||||
private IMorningInspectionContentService morningInspectionContentService;
|
||||
|
||||
@GetMapping("/getTableHearder")
|
||||
public AjaxResult getTableHearder(Integer eduId){
|
||||
// eduId后面根据token获取账号信息动态获取
|
||||
// Integer eduId = 1;
|
||||
List<MorningTableHeaderVO> list =new ArrayList<>();
|
||||
if(eduId == null){
|
||||
return success(list);
|
||||
}
|
||||
list =morningInspectionContentService.getTableHearder(eduId);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(MorningInspectionDetailVO morningInspectionDetailVO){
|
||||
startPage();
|
||||
List<MorningInspectionDetailVO> list = morningInspectionDetailService.queryMorningInspectionDetailVO(morningInspectionDetailVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据晨检项id查询晨检明细
|
||||
* @param checkInId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public AjaxResult detail(Long checkInId){
|
||||
if(checkInId == null){
|
||||
return error("未指定要查询的晨检记录");
|
||||
}
|
||||
List<MorningInspectionDetailVO> list = morningInspectionDetailService.getByCheckInId(checkInId);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated({AddGroup.class}) MorningInspectionDetailVO morningInspectionDetailVO){
|
||||
return morningInspectionDetailService.saveVO(morningInspectionDetailVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated({UpdateGroup.class}) MorningInspectionDetailVO morningInspectionDetailVO){
|
||||
return morningInspectionDetailService.updateVO(morningInspectionDetailVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Long morningDetailId){
|
||||
if(morningDetailId == null){
|
||||
return error("未指定要删除的晨检明细");
|
||||
}
|
||||
return morningInspectionDetailService.deleteWithId(morningDetailId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
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.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.IRubbishDealService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.RubbishDealVO;
|
||||
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-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rubbishDeal")
|
||||
public class RubbishDealController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IRubbishDealService rubbishDealService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(RubbishDealVO rubbishDealVO) {
|
||||
startPage();
|
||||
List<RubbishDealVO> list = rubbishDealService.queryRubbishDealVO(rubbishDealVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody RubbishDealVO rubbishDealVO) {
|
||||
return rubbishDealService.saveVO(rubbishDealVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Validated(UpdateGroup.class) @RequestBody RubbishDealVO rubbishDealVO) {
|
||||
return rubbishDealService.updateVO(rubbishDealVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer dealId) {
|
||||
if(dealId == null){
|
||||
return error("请选择要删除的厨余垃圾处理记录");
|
||||
}
|
||||
return rubbishDealService.deleteWithId(dealId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
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.page.TableDataInfo;
|
||||
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 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-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/schoolCartItem")
|
||||
public class SchoolCartItemController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISchoolCartItemService schoolCartItemService;
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SchoolCartItemVO schoolCartItemVO) {
|
||||
startPage();
|
||||
List<SchoolCartItemVO> list = schoolCartItemService.querySchoolCartItemVO(schoolCartItemVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) SchoolCartItemVO schoolCartItemVO) {
|
||||
if(schoolCartItemVO == null){
|
||||
return error("未指定要添加的购物项");
|
||||
}
|
||||
return schoolCartItemService.saveVO(schoolCartItemVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup .class) SchoolCartItemVO schoolCartItemVO) {
|
||||
if(schoolCartItemVO == null || schoolCartItemVO.getCartItemId() == null){
|
||||
return error("未指定要修改的购物项");
|
||||
}
|
||||
return schoolCartItemService.updateVO(schoolCartItemVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Long cartItemId) {
|
||||
if(cartItemId == null){
|
||||
return error("未指定要删除的购物项");
|
||||
}
|
||||
boolean result = schoolCartItemService.removeById(cartItemId);
|
||||
return result ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
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.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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:lilj
|
||||
* @date:2025/4/10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/school")
|
||||
public class SchoolController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISchoolService schoolService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SchoolVO schoolVO){
|
||||
startPage();
|
||||
List<SchoolVO> list = schoolService.querySchoolList(schoolVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) SchoolVO schoolVO){
|
||||
return schoolService.saveVO(schoolVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) SchoolVO schoolVO){
|
||||
return schoolService.updateVO(schoolVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer schoolId){
|
||||
if(schoolId == null){
|
||||
return error("未指定要删除的学校");
|
||||
}
|
||||
return schoolService.removeById(schoolId) ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
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.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolOrderItemService;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolOrderService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.*;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/schoolOrder")
|
||||
public class SchoolOrderController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISchoolOrderService schoolOrderService;
|
||||
|
||||
@Autowired
|
||||
private ISchoolOrderItemService schoolOrderItemService;
|
||||
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SchoolOrderVO schoolOrderVO) {
|
||||
startPage();
|
||||
List<SchoolOrderVO> list = schoolOrderService.querySchoolOrderVO(schoolOrderVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交订单:
|
||||
* 1.校验:商品有效性校验,订单金额校验
|
||||
* 2.订单入库:订单表,订单详情表,购物车表
|
||||
* 3.订单入库成功后,删除购物车项
|
||||
* @param submitOrderVO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/submitOrder")
|
||||
public AjaxResult submitOrder(@RequestBody @Valid SchoolSubmitOrderVO submitOrderVO) {
|
||||
return schoolOrderService.submitOrder(submitOrderVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
*/
|
||||
@PostMapping("/cancelOrder")
|
||||
public AjaxResult cancelOrder(@RequestBody @Valid SchoolCancelOrderVO cancelOrderVO) {
|
||||
return schoolOrderService.cancelOrder(cancelOrderVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单备注修改
|
||||
*/
|
||||
@PostMapping("/updateOrderRemark")
|
||||
public AjaxResult updateOrderRemark(@RequestBody @Valid SchoolModifyOrderRemarkVO remarkVO) {
|
||||
return schoolOrderService.updateOrderRemark(remarkVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单子项查询
|
||||
*/
|
||||
@GetMapping("/queryOrderItem")
|
||||
public AjaxResult queryOrderItem(String orderNo) {
|
||||
SchoolOrderItemVO schoolOrderVO = new SchoolOrderItemVO();
|
||||
schoolOrderVO.setOrderNo(orderNo);
|
||||
List<SchoolOrderItemVO> list = schoolOrderItemService.querySchoolOrderItemVO(schoolOrderVO);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 供货商接单
|
||||
*/
|
||||
@GetMapping("/supplierAcceptOrder")
|
||||
public AjaxResult supplierAcceptOrder(@Validated SupplierAcceptOrderVO supplierAcceptOrderVO) {
|
||||
return schoolOrderService.supplierAcceptOrder(supplierAcceptOrderVO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
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.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.fdsafe.entity.SchoolOrderItem;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolOrderItemService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolOrderItemVO;
|
||||
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 2025-04-24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/schoolOrderItem")
|
||||
public class SchoolOrderItemController extends BaseController {
|
||||
@Autowired
|
||||
private ISchoolOrderItemService schoolOrderItemService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SchoolOrderItemVO schoolOrderItemVO) {
|
||||
List<SchoolOrderItemVO> list = schoolOrderItemService.querySchoolOrderItemVO(schoolOrderItemVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SchoolOrderItemVO schoolOrderItemVO) {
|
||||
startPage();
|
||||
List<SchoolOrderItemVO> list = schoolOrderItemService.querySchoolOrderItemVO(schoolOrderItemVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
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.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.entity.SchoolRefund;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolRefundItemService;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolRefundService;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolService;
|
||||
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 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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/schoolRefund")
|
||||
public class SchoolRefundController extends BaseController {
|
||||
@Autowired
|
||||
private ISchoolRefundItemService schoolRefundItemService;
|
||||
|
||||
@Autowired
|
||||
private ISchoolRefundService schoolRefundService;
|
||||
|
||||
// 查询接口,根据退款总单号查询
|
||||
@GetMapping("/querySchoolRefund")
|
||||
public TableDataInfo querySchoolRefund(SchoolRefundVO schoolRefundVO) {
|
||||
startPage();
|
||||
List<SchoolRefundVO> schoolRefunds = schoolRefundService.querySchoolRefund(schoolRefundVO);
|
||||
return getDataTable(schoolRefunds);
|
||||
}
|
||||
|
||||
// 查询详情
|
||||
@GetMapping("/querySchoolRefundDetail")
|
||||
public AjaxResult querySchoolRefundDetail(String refundNo) {
|
||||
if(StringUtils.isBlank(refundNo)){
|
||||
return AjaxResult.success(new ArrayList<>());
|
||||
}
|
||||
List<SchoolRefundItemVO> refundItems = schoolRefundItemService.queryRefundItem(refundNo);
|
||||
return AjaxResult.success(refundItems);
|
||||
}
|
||||
|
||||
/**
|
||||
* 几个字段:
|
||||
* 1.子单编号
|
||||
* 2.退货原因
|
||||
* 3.退货数量
|
||||
* @param refundItemAddUpdateVO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addRefundItem")
|
||||
public AjaxResult addRefundItem(@RequestBody @Validated(AddGroup.class) RefundItemAddUpdateVO refundItemAddUpdateVO) {
|
||||
return schoolRefundItemService.addRefundItem(refundItemAddUpdateVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改退款项
|
||||
*/
|
||||
@PostMapping("/updateRefundItem")
|
||||
public AjaxResult updateRefundItem(@RequestBody @Validated(UpdateGroup.class) RefundItemAddUpdateVO refundItemAddUpdateVO) {
|
||||
return schoolRefundItemService.updateRefundItem(refundItemAddUpdateVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退货单审核
|
||||
*/
|
||||
@PostMapping("/checkSchoolRefund")
|
||||
public AjaxResult checkSchoolRefund(@RequestBody @Valid RefundCheckVO checkVO) {
|
||||
return schoolRefundService.checkSchoolRefund(checkVO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/schoolRefundItem")
|
||||
public class SchoolRefundItemController {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.constant.OrderStatusConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolOrderService;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolSettleService;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 结算单 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-05-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/schoolSettle")
|
||||
public class SchoolSettleController extends BaseController {
|
||||
@Autowired
|
||||
private ISchoolOrderService schoolOrderService;
|
||||
|
||||
@Autowired
|
||||
private ISchoolSettleService schoolSettleService;
|
||||
|
||||
/**
|
||||
* 查询可结算订单
|
||||
*/
|
||||
@GetMapping("/queryCanSettleOrder")
|
||||
public TableDataInfo queryCanSettleOrder(SchoolOrderVO schoolOrderVO) {
|
||||
startPage();
|
||||
schoolOrderVO.setOrderSettleStatus(OrderStatusConstants.CAN_SETTLEMENT);
|
||||
List<SchoolOrderVO> list = schoolOrderService.querySchoolOrderVO(schoolOrderVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起订单结算
|
||||
*/
|
||||
@PostMapping("/submitSettle")
|
||||
public AjaxResult submitSettle(@RequestBody @Valid SchoolSettleSubmitVO submitVO) {
|
||||
return schoolSettleService.submitSettle(submitVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单结算审核
|
||||
*/
|
||||
@PostMapping("/checkSettle")
|
||||
public AjaxResult checkSettle(@RequestBody @Valid SchoolSettleCheckVO checkVO) {
|
||||
return schoolSettleService.checkSettle(checkVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 学校结算单支付状态更新
|
||||
*/
|
||||
@GetMapping("/updateSettlePayStatus")
|
||||
public AjaxResult updateSettlePayStatus(String settleNo) {
|
||||
if(StringUtils.isEmpty(settleNo)){
|
||||
return AjaxResult.warn("结算单号不能为空");
|
||||
}
|
||||
return schoolSettleService.updateSettlePayStatus(settleNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 供货商结算单收款确认
|
||||
*/
|
||||
@GetMapping("/updateSettleConfirmStatus")
|
||||
public AjaxResult updateSettleConfirmStatus(String settleNo) {
|
||||
if(StringUtils.isEmpty(settleNo)){
|
||||
return AjaxResult.warn("结算单号不能为空");
|
||||
}
|
||||
return schoolSettleService.updateSettleConfirmStatus(settleNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 结算单查询接口
|
||||
*/
|
||||
@GetMapping("/querySettleList")
|
||||
public TableDataInfo querySettleList(SchoolSettleVO settleVO) {
|
||||
startPage();
|
||||
List<SchoolSettleVO> list = schoolSettleService.qeurySettleVO(settleVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
|
||||
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.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
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.ISchoolStaffService;
|
||||
import com.zf.foodpurchase.fdsafe.utils.ArrayStringUtils;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolStaffVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/schoolStaff")
|
||||
public class SchoolStaffController extends BaseController {
|
||||
@Autowired
|
||||
private ISchoolStaffService schoolStaffService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SchoolStaffVO schoolStaffVO) {
|
||||
startPage();
|
||||
List<SchoolStaffVO> list = schoolStaffService.querySchoolStaffVO(schoolStaffVO);
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
list.forEach(item->{
|
||||
item.setHealthCertImg(ArrayStringUtils.stringToArray(item.getHealthCertImgStr()));
|
||||
});
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody SchoolStaffVO schoolStaffVO) {
|
||||
return schoolStaffService.saveVO(schoolStaffVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Validated(UpdateGroup.class) @RequestBody SchoolStaffVO schoolStaffVO) {
|
||||
return schoolStaffService.updateVO(schoolStaffVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer staffId) {
|
||||
if(staffId == null){
|
||||
return error("请选择要删除的学校人员");
|
||||
}
|
||||
boolean flag = schoolStaffService.removeById(staffId);
|
||||
return flag ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
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.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.entity.SchoolType;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolTypeService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolTypeVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:lilj
|
||||
* @date:2025/4/11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/schoolType")
|
||||
public class SchoolTypeController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISchoolTypeService schoolTypeService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SchoolTypeVO schoolTypeVO){
|
||||
List<SchoolTypeVO> list = schoolTypeService.querySchoolTypeVO(schoolTypeVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SchoolTypeVO schoolTypeVO){
|
||||
startPage();
|
||||
List<SchoolTypeVO> list = schoolTypeService.querySchoolTypeVO(schoolTypeVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody SchoolTypeVO schoolTypeVO){
|
||||
return schoolTypeService.saveVO(schoolTypeVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Validated(UpdateGroup.class) @RequestBody SchoolTypeVO schoolTypeVO){
|
||||
return schoolTypeService.updateVO(schoolTypeVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer schoolTypeId){
|
||||
boolean flag = schoolTypeService.removeById(schoolTypeId);
|
||||
return flag ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.school;
|
||||
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISelfInspectionDetailService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SelfInspectionDetailVO;
|
||||
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:2025/4/16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/selfInspectionDetail")
|
||||
public class SelfInspectionDetailController {
|
||||
|
||||
@Autowired
|
||||
private ISelfInspectionDetailService selfInspectionDetailService;
|
||||
|
||||
@GetMapping("/getDetail")
|
||||
public AjaxResult getDetail(Long selfRecordId){
|
||||
List<SelfInspectionDetailVO> list = selfInspectionDetailService.getDetail(selfRecordId);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
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.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISelfInspectionRecordService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SelfInspectionDetailVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SelfInspectionRecordVO;
|
||||
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-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/selfInspectionRecord")
|
||||
public class SelfInspectionRecordController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISelfInspectionRecordService selfInspectionRecordService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SelfInspectionRecordVO selfInspectionRecordVO) {
|
||||
startPage();
|
||||
List<SelfInspectionRecordVO> list = selfInspectionRecordService.querySelfInspectionRecordVO(selfInspectionRecordVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) SelfInspectionRecordVO selfInspectionRecordVO) {
|
||||
return selfInspectionRecordService.saveVO(selfInspectionRecordVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) SelfInspectionRecordVO selfInspectionRecordVO) {
|
||||
return selfInspectionRecordService.updateVO(selfInspectionRecordVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Long selfRecordId) {
|
||||
if(selfRecordId == null){
|
||||
return error("未指定要删除的自检记录");
|
||||
}
|
||||
return selfInspectionRecordService.deleteWithId(selfRecordId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
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.domain.model.LoginUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.utils.SecurityUtils;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:lilj
|
||||
* @date:2025/5/13
|
||||
*/
|
||||
@RequestMapping("/wxAppUser")
|
||||
@RestController
|
||||
public class WxAppUserController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWxAppUserService wxAppUserService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(WxAppUserViewVO wxAppUserViewVO) {
|
||||
startPage();
|
||||
SysUser loginUser = getLoginUser().getUser();
|
||||
if (!loginUser.isAdmin()) {
|
||||
wxAppUserViewVO.setAccountType(loginUser.getAccountType());
|
||||
wxAppUserViewVO.setDeptId(loginUser.getDeptId().intValue());
|
||||
}
|
||||
List<WxAppUserViewVO> list = wxAppUserService.pageList(wxAppUserViewVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) WxAppUserViewVO wxAppUserViewVO) {
|
||||
SysUser loginUser = getLoginUser().getUser();
|
||||
if (!loginUser.isAdmin()) {
|
||||
wxAppUserViewVO.setAccountType(loginUser.getAccountType());
|
||||
wxAppUserViewVO.setDeptId(loginUser.getDeptId().intValue());
|
||||
} else {
|
||||
if (wxAppUserViewVO.getAccountType() == null) {
|
||||
return error("请指定用户类型");
|
||||
}
|
||||
if (wxAppUserViewVO.getDeptId() == null) {
|
||||
return error("请指定用户所属部门");
|
||||
}
|
||||
}
|
||||
wxAppUserViewVO.setPassword(SecurityUtils.encryptPassword(wxAppUserViewVO.getPassword()));
|
||||
return wxAppUserService.saveVO(wxAppUserViewVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项:
|
||||
* 昵称
|
||||
* 姓名
|
||||
* 头像
|
||||
* 性别
|
||||
* 状态
|
||||
* 部门
|
||||
* @param wxAppUserViewVO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) WxAppUserViewVO wxAppUserViewVO) {
|
||||
SysUser loginUser = getLoginUser().getUser();
|
||||
if (!loginUser.isAdmin()) {
|
||||
wxAppUserViewVO.setAccountType(loginUser.getAccountType());
|
||||
wxAppUserViewVO.setDeptId(loginUser.getDeptId().intValue());
|
||||
}
|
||||
return wxAppUserService.updateVO(wxAppUserViewVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Long id) {
|
||||
if(id == null){
|
||||
return error("请指定要删除的用户");
|
||||
}
|
||||
return wxAppUserService.removeById(id) ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.supplier;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.CheckGroup;
|
||||
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.FoodProductVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.ReferencePriceVO;
|
||||
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-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/foodProduct")
|
||||
public class FoodProductController extends BaseController {
|
||||
@Autowired
|
||||
private IFoodProductService foodProductService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(FoodProductVO foodProductVO) {
|
||||
startPage();
|
||||
foodProductVO.setDelFlag(0);
|
||||
List<FoodProductVO> list = foodProductService.queryFoodProductVO(foodProductVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 供货商发布商品
|
||||
*/
|
||||
@PostMapping("/supplierAdd")
|
||||
public AjaxResult supplierAdd(@RequestBody @Validated(AddGroup.class) FoodProductVO foodProductVO) {
|
||||
return foodProductService.supplierAdd(foodProductVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 供货商修改商品
|
||||
*/
|
||||
@PostMapping("/supplierUpdate")
|
||||
public AjaxResult supplierUpdate(@RequestBody @Validated(UpdateGroup.class) FoodProductVO foodProductVO) {
|
||||
return foodProductService.supplierUpdate(foodProductVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 教育局审核商品
|
||||
*/
|
||||
@PostMapping("/eduCheck")
|
||||
public AjaxResult eduCheck(@RequestBody @Validated(CheckGroup.class) FoodProductVO foodProductVO) {
|
||||
return foodProductService.eduCheck(foodProductVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品信息
|
||||
*/
|
||||
@GetMapping("/supplierDelete")
|
||||
public AjaxResult supplierDelete(Long foodProductId) {
|
||||
if(foodProductId == null){
|
||||
return error("商品id不能为空");
|
||||
}
|
||||
return foodProductService.removeById(foodProductId) ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品参考价
|
||||
*/
|
||||
@GetMapping("/referPrice")
|
||||
public AjaxResult referPrice(String categoryName, String productName) {
|
||||
List<ReferencePriceVO> list = RestTemplateUtils.getReferencePrice(categoryName, productName);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.supplier;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
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.ISupplierDeliveryService;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISupplierService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolDeliveryVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryAddUpdateVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryVO;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* 送货单暂时不提供删除功能
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/supplierDelivery")
|
||||
public class SupplierDeliveryController extends BaseController {
|
||||
@Autowired
|
||||
private ISupplierDeliveryService supplierDeliveryService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SupplierDeliveryVO supplierDeliveryVO){
|
||||
startPage();
|
||||
List<SupplierDeliveryVO> list = supplierDeliveryService.querySupplierDeliveryVO(supplierDeliveryVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/addOrderDelivery")
|
||||
public AjaxResult addOrderDelivery(@RequestBody @Validated(AddGroup.class) SupplierDeliveryAddUpdateVO deliveryAddVO){
|
||||
return supplierDeliveryService.addOrderDelivery(deliveryAddVO);
|
||||
}
|
||||
|
||||
@PostMapping("/supplierUpdateDelivery")
|
||||
public AjaxResult supplierUpdateDelivery(@RequestBody @Validated(UpdateGroup.class) SupplierDeliveryAddUpdateVO supplierDeliveryVO){
|
||||
return supplierDeliveryService.supplierUpdateDelivery(supplierDeliveryVO);
|
||||
}
|
||||
|
||||
@PostMapping("/schoolSignDelivery")
|
||||
public AjaxResult schoolUpdateDelivery(@RequestBody @Validated(UpdateGroup.class) SchoolDeliveryVO schoolDeliveryVO){
|
||||
return supplierDeliveryService.schoolUpdateDelivery(schoolDeliveryVO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.supplier;
|
||||
|
||||
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISupplierDeliveryItemService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryItemUpdateVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryItemVO;
|
||||
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-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/supplierDeliveryItem")
|
||||
public class SupplierDeliveryItemController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISupplierDeliveryItemService supplierDeliveryItemService;
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(SupplierDeliveryItemVO supplierDeliveryItemVO) {
|
||||
startPage();
|
||||
List<SupplierDeliveryItemVO> list = supplierDeliveryItemService.querySupplierDeliveryItemVO(supplierDeliveryItemVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) SupplierDeliveryItemUpdateVO supplierDeliveryItemUpdateVO) {
|
||||
return supplierDeliveryItemService.updateVO(supplierDeliveryItemUpdateVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.zf.foodpurchase.fdsafe.web.test;
|
||||
|
||||
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 org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author:lilj
|
||||
* @date:2025/4/10
|
||||
*/
|
||||
@RequestMapping("/testQuery")
|
||||
@RestController
|
||||
public class TestQueryController extends BaseController {
|
||||
|
||||
@GetMapping("/getUser")
|
||||
public AjaxResult getUser(){
|
||||
LoginUser loginUser = getLoginUser();
|
||||
System.out.println(loginUser);
|
||||
SysUser user = loginUser.getUser();
|
||||
System.out.println(user);
|
||||
// 用account_type结合deptId作为查询用户关联单位的信息.
|
||||
return AjaxResult.success(loginUser);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.common;
|
||||
|
||||
import com.zf.foodpurchase.common.config.RuoYiConfig;
|
||||
import com.zf.foodpurchase.common.constant.Constants;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.common.utils.file.FileUploadUtils;
|
||||
import com.zf.foodpurchase.common.utils.file.FileUtils;
|
||||
import com.zf.foodpurchase.framework.config.ServerConfig;
|
||||
import com.zf.foodpurchase.web.controller.common.CommonController;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:lilj
|
||||
* @date:2025/5/20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/common")
|
||||
public class WxAppCommonController {
|
||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
|
||||
private static final String FILE_DELIMETER = ",";
|
||||
|
||||
/**
|
||||
* 通用下载请求
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
@GetMapping("/download")
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(fileName))
|
||||
{
|
||||
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||
}
|
||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||
String filePath = RuoYiConfig.getDownloadPath() + fileName;
|
||||
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||
if (delete)
|
||||
{
|
||||
FileUtils.deleteFile(filePath);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求(单个)
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
// String url = serverConfig.getUrl() + fileName;
|
||||
String url = RuoYiConfig.getImagePrefix() + fileName;
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", url);
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求(多个)
|
||||
*/
|
||||
@PostMapping("/uploads")
|
||||
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
List<String> urls = new ArrayList<String>();
|
||||
List<String> fileNames = new ArrayList<String>();
|
||||
List<String> newFileNames = new ArrayList<String>();
|
||||
List<String> originalFilenames = new ArrayList<String>();
|
||||
for (MultipartFile file : files)
|
||||
{
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
urls.add(url);
|
||||
fileNames.add(fileName);
|
||||
newFileNames.add(FileUtils.getName(fileName));
|
||||
originalFilenames.add(file.getOriginalFilename());
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
|
||||
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
|
||||
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
|
||||
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地资源通用下载
|
||||
*/
|
||||
@GetMapping("/download/resource")
|
||||
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||
throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(resource))
|
||||
{
|
||||
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||
}
|
||||
// 本地资源路径
|
||||
String localPath = RuoYiConfig.getProfile();
|
||||
// 数据库资源地址
|
||||
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
|
||||
// 下载名称
|
||||
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
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();
|
||||
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("上传图片异常");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
import com.zf.foodpurchase.common.core.domain.model.WxAppLoginUser;
|
||||
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.WxAppUser;
|
||||
import com.zf.foodpurchase.fdsafe.service.IAccompanyMealService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.AccompanyMealVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/accompanyMeal")
|
||||
public class WxAppAccompanyMealController extends BaseController {
|
||||
@Autowired
|
||||
private IAccompanyMealService accompanyMealService;
|
||||
|
||||
@RequestMapping("/list")
|
||||
public AjaxResult list(AccompanyMealVO accompanyMealVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
accompanyMealVO.setSchoolId(userVO.getSchoolId());
|
||||
List<AccompanyMealVO> list = accompanyMealService.queryAccompanyMealVO(accompanyMealVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) AccompanyMealVO accompanyMealVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
accompanyMealVO.setSchoolId(userVO.getSchoolId());
|
||||
return accompanyMealService.saveVO(accompanyMealVO);
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) AccompanyMealVO accompanyMealVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
accompanyMealVO.setSchoolId(userVO.getSchoolId());
|
||||
return accompanyMealService.updateVO(accompanyMealVO);
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public AjaxResult delete(Integer accompanyMealId) {
|
||||
if (accompanyMealId == null) {
|
||||
return error("请选择要删除的陪餐记录");
|
||||
}
|
||||
return accompanyMealService.removeWithId(accompanyMealId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
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.ICattenService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.CattenVO;
|
||||
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-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/catten")
|
||||
public class WxAppCattenController extends BaseController {
|
||||
@Autowired
|
||||
private ICattenService cattenService;
|
||||
|
||||
@RequestMapping("/list")
|
||||
public AjaxResult list(CattenVO cattenVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
cattenVO.setSchoolId(userVO.getSchoolId());
|
||||
List<CattenVO> list = cattenService.queryCattenVO(cattenVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody CattenVO cattenVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
cattenVO.setSchoolId(userVO.getSchoolId());
|
||||
return cattenService.saveVO(cattenVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Validated(UpdateGroup.class) @RequestBody CattenVO cattenVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
cattenVO.setSchoolId(userVO.getSchoolId());
|
||||
return cattenService.updateVO(cattenVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer cattenId) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
if(cattenId == null){
|
||||
return error("请选择要删除的食堂");
|
||||
}
|
||||
return cattenService.removeById(cattenId) ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
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.ISupplierDeliveryItemService;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISupplierDeliveryService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolDeliveryVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryAddUpdateVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryItemVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 送货单暂时不提供删除功能
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/delivery")
|
||||
public class WxAppDeliveryController extends BaseController {
|
||||
@Autowired
|
||||
private ISupplierDeliveryService supplierDeliveryService;
|
||||
|
||||
@Autowired
|
||||
private ISupplierDeliveryItemService supplierDeliveryItemService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SupplierDeliveryVO supplierDeliveryVO){
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
supplierDeliveryVO.setSchoolId(userVO.getSchoolId());
|
||||
List<SupplierDeliveryVO> list = supplierDeliveryService.querySupplierDeliveryVO(supplierDeliveryVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/schoolSignDelivery")
|
||||
public AjaxResult schoolUpdateDelivery(@RequestBody @Validated(UpdateGroup.class) SchoolDeliveryVO schoolDeliveryVO){
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
schoolDeliveryVO.setSchoolId(userVO.getSchoolId());
|
||||
return supplierDeliveryService.schoolUpdateDelivery(schoolDeliveryVO);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/itemList")
|
||||
public AjaxResult itemList(SupplierDeliveryItemVO supplierDeliveryItemVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
supplierDeliveryItemVO.setSchoolId(userVO.getSchoolId());
|
||||
List<SupplierDeliveryItemVO> list = supplierDeliveryItemService.querySupplierDeliveryItemVO(supplierDeliveryItemVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
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.IDishFoodRelationService;
|
||||
import com.zf.foodpurchase.fdsafe.service.IDishService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.DishFoodRelationVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.DishVO;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜品表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/dish")
|
||||
public class WxAppDishController extends BaseController {
|
||||
@Autowired
|
||||
private IDishService dishService;
|
||||
|
||||
@Autowired
|
||||
private IDishFoodRelationService dishFoodRelationService;
|
||||
|
||||
@RequestMapping("/list")
|
||||
public AjaxResult list(DishVO dishVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if (userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())) {
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
dishVO.setSchoolId(userVO.getSchoolId());
|
||||
List<DishVO> dishVOList = dishService.queryDishVO(dishVO);
|
||||
return AjaxResult.success(dishVOList);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) DishVO dishVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if (userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())) {
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
dishVO.setSchoolId(userVO.getSchoolId());
|
||||
return dishService.saveVO(dishVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) DishVO dishVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if (userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())) {
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
dishVO.setSchoolId(userVO.getSchoolId());
|
||||
return dishService.updateVO(dishVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer dishId) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if (userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())) {
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
if (dishId == null) {
|
||||
return error("未指定要删除的菜品");
|
||||
}
|
||||
boolean flag = dishService.removeById(dishId);
|
||||
return flag ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
public AjaxResult detail(Integer dishId) {
|
||||
List<DishFoodRelationVO> dishFoodRelationVOList = dishFoodRelationService.detail(dishId);
|
||||
return AjaxResult.success(dishFoodRelationVOList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
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 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-19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/foodBook")
|
||||
public class WxAppFoodBookController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IFoodBookService foodBookService;
|
||||
|
||||
@RequestMapping("/list")
|
||||
public AjaxResult list(FoodBookVO foodBookVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if (userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())) {
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
foodBookVO.setSchoolId(userVO.getSchoolId());
|
||||
foodBookVO.setDelFlag(0);
|
||||
List<FoodBookVO> list = foodBookService.queryFoodBookVO(foodBookVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) FoodBookVO foodBookVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if (userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())) {
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
foodBookVO.setSchoolId(userVO.getSchoolId());
|
||||
return foodBookService.saveVO(foodBookVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) FoodBookVO foodBookVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if (userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())) {
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
foodBookVO.setSchoolId(userVO.getSchoolId());
|
||||
return foodBookService.updateVO(foodBookVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Long bookId) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if (userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())) {
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
if(bookId == null){
|
||||
return error("未指定要删除的菜谱");
|
||||
}
|
||||
return foodBookService.removeWithId(bookId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.fdsafe.service.IFoodProductService;
|
||||
import com.zf.foodpurchase.fdsafe.service.IFoodTypeService;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISupplierService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodProductVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodTypeVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SupplierVO;
|
||||
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:2025/5/16
|
||||
*/
|
||||
@RequestMapping("/wxapp/foodProduct")
|
||||
@RestController
|
||||
public class WxAppFoodProductController extends BaseController {
|
||||
@Autowired
|
||||
private IFoodProductService foodProductService;
|
||||
|
||||
@Autowired
|
||||
private IFoodTypeService foodTypeServcie;
|
||||
|
||||
@Autowired
|
||||
private ISupplierService supplierService;
|
||||
|
||||
@GetMapping("/supplierList")
|
||||
public AjaxResult list(SupplierVO supplierVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
supplierVO.setEduId(userVO.getEduId());
|
||||
List<SupplierVO> list = supplierService.querySupplierVO(supplierVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/foodTypeList")
|
||||
public AjaxResult list(){
|
||||
FoodTypeVO foodTypeVO = new FoodTypeVO();
|
||||
foodTypeVO.setStatus(0);
|
||||
List<FoodTypeVO> list = foodTypeServcie.queryFoodTypeVO(foodTypeVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(FoodProductVO foodProductVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
foodProductVO.setEduId(userVO.getEduId());
|
||||
foodProductVO.setDelFlag(0);
|
||||
List<FoodProductVO> list = foodProductService.queryFoodProductVO(foodProductVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
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.IFoodSampleService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.FoodSampleVO;
|
||||
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-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/foodSample")
|
||||
public class WxAppFoodSampleController extends BaseController {
|
||||
@Autowired
|
||||
private IFoodSampleService foodSampleService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(FoodSampleVO foodSampleVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
foodSampleVO.setSchoolId(userVO.getSchoolId());
|
||||
List<FoodSampleVO> list = foodSampleService.queryFoodSampleVO(foodSampleVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) FoodSampleVO foodSampleVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
foodSampleVO.setSchoolId(userVO.getSchoolId());
|
||||
return foodSampleService.saveVO(foodSampleVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) FoodSampleVO foodSampleVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
foodSampleVO.setSchoolId(userVO.getSchoolId());
|
||||
return foodSampleService.updateVO(foodSampleVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Long sampleId) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
if(sampleId == null){
|
||||
return error("未指定要删除的留样记录");
|
||||
}
|
||||
return foodSampleService.deleteWithId(sampleId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
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 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-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/morningCheckIn")
|
||||
public class WxAppMorningCheckInController extends BaseController {
|
||||
@Autowired
|
||||
private IMorningCheckInService morningCheckInService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult pageList(MorningCheckInVO morningCheckInVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
morningCheckInVO.setSchoolId(userVO.getSchoolId());
|
||||
List<MorningCheckInVO> list = morningCheckInService.queryMorningCheckInVO(morningCheckInVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult save(@RequestBody @Validated(AddGroup.class) MorningCheckInVO morningCheckInVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
morningCheckInVO.setSchoolId(userVO.getSchoolId());
|
||||
return morningCheckInService.saveVO(morningCheckInVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) MorningCheckInVO morningCheckInVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
morningCheckInVO.setSchoolId(userVO.getSchoolId());
|
||||
return morningCheckInService.updateVO(morningCheckInVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Long checkInId) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
if(checkInId == null){
|
||||
return error("未指定要删除的晨检登记记录");
|
||||
}
|
||||
return morningCheckInService.removewithId(checkInId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
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.IMorningInspectionContentService;
|
||||
import com.zf.foodpurchase.fdsafe.service.IMorningInspectionDetailService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.MorningInspectionDetailVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.MorningTableHeaderVO;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/morningInspectionDetail")
|
||||
public class WxAppMorningInspectionDetailController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IMorningInspectionDetailService morningInspectionDetailService;
|
||||
|
||||
@Autowired
|
||||
private IMorningInspectionContentService morningInspectionContentService;
|
||||
|
||||
@GetMapping("/getTableHearder")
|
||||
public AjaxResult getTableHearder(){
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
Integer eduId = userVO.getEduId();
|
||||
List<MorningTableHeaderVO> list =new ArrayList<>();
|
||||
if(eduId == null){
|
||||
return success(list);
|
||||
}
|
||||
list =morningInspectionContentService.getTableHearder(eduId);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult pageList(MorningInspectionDetailVO morningInspectionDetailVO){
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
List<MorningInspectionDetailVO> list = morningInspectionDetailService.queryMorningInspectionDetailVO(morningInspectionDetailVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据晨检项id查询晨检明细
|
||||
* @param checkInId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public AjaxResult detail(Long checkInId){
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
if(checkInId == null){
|
||||
return error("未指定要查询的晨检记录");
|
||||
}
|
||||
List<MorningInspectionDetailVO> list = morningInspectionDetailService.getByCheckInId(checkInId);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated({AddGroup.class}) MorningInspectionDetailVO morningInspectionDetailVO){
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
return morningInspectionDetailService.saveVO(morningInspectionDetailVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated({UpdateGroup.class}) MorningInspectionDetailVO morningInspectionDetailVO){
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
return morningInspectionDetailService.updateVO(morningInspectionDetailVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Long morningDetailId){
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
if(morningDetailId == null){
|
||||
return error("未指定要删除的晨检明细");
|
||||
}
|
||||
return morningInspectionDetailService.deleteWithId(morningDetailId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
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.IRubbishDealService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.RubbishDealVO;
|
||||
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-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/rubbishDeal")
|
||||
public class WxAppRubbishDealController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IRubbishDealService rubbishDealService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(RubbishDealVO rubbishDealVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
rubbishDealVO.setSchoolId(userVO.getSchoolId());
|
||||
List<RubbishDealVO> list = rubbishDealService.queryRubbishDealVO(rubbishDealVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody RubbishDealVO rubbishDealVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
rubbishDealVO.setSchoolId(userVO.getSchoolId());
|
||||
return rubbishDealService.saveVO(rubbishDealVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Validated(UpdateGroup.class) @RequestBody RubbishDealVO rubbishDealVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
rubbishDealVO.setSchoolId(userVO.getSchoolId());
|
||||
return rubbishDealService.updateVO(rubbishDealVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer dealId) {
|
||||
if(dealId == null){
|
||||
return error("请选择要删除的厨余垃圾处理记录");
|
||||
}
|
||||
return rubbishDealService.deleteWithId(dealId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
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.ISchoolCartItemService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolCartItemVO;
|
||||
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-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/schoolCartItem")
|
||||
public class WxAppSchoolCartItemController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISchoolCartItemService schoolCartItemService;
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SchoolCartItemVO schoolCartItemVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
schoolCartItemVO.setSchoolId(userVO.getSchoolId());
|
||||
List<SchoolCartItemVO> list = schoolCartItemService.querySchoolCartItemVO(schoolCartItemVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) SchoolCartItemVO schoolCartItemVO) {
|
||||
if(schoolCartItemVO == null){
|
||||
return error("未指定要添加的购物项");
|
||||
}
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
schoolCartItemVO.setSchoolId(userVO.getSchoolId());
|
||||
return schoolCartItemService.saveVO(schoolCartItemVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup .class) SchoolCartItemVO schoolCartItemVO) {
|
||||
if(schoolCartItemVO == null || schoolCartItemVO.getCartItemId() == null){
|
||||
return error("未指定要修改的购物项");
|
||||
}
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
schoolCartItemVO.setSchoolId(userVO.getSchoolId());
|
||||
return schoolCartItemService.updateVO(schoolCartItemVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Long cartItemId) {
|
||||
if(cartItemId == null){
|
||||
return error("未指定要删除的购物项");
|
||||
}
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
boolean result = schoolCartItemService.removeById(cartItemId);
|
||||
return result ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
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 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.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/schoolOrder")
|
||||
public class WxAppSchoolOrderController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISchoolOrderService schoolOrderService;
|
||||
|
||||
@Autowired
|
||||
private ISchoolOrderItemService schoolOrderItemService;
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SchoolOrderVO schoolOrderVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
schoolOrderVO.setSchoolId(userVO.getSchoolId());
|
||||
List<SchoolOrderVO> list = schoolOrderService.querySchoolOrderVO(schoolOrderVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交订单:
|
||||
* 1.校验:商品有效性校验,订单金额校验
|
||||
* 2.订单入库:订单表,订单详情表,购物车表
|
||||
* 3.订单入库成功后,删除购物车项
|
||||
* @param submitOrderVO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/submitOrder")
|
||||
public AjaxResult submitOrder(@RequestBody @Valid SchoolSubmitOrderVO submitOrderVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
return schoolOrderService.submitOrder(submitOrderVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
*/
|
||||
@PostMapping("/cancelOrder")
|
||||
public AjaxResult cancelOrder(@RequestBody @Valid SchoolCancelOrderVO cancelOrderVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
return schoolOrderService.cancelOrder(cancelOrderVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单备注修改
|
||||
*/
|
||||
@PostMapping("/updateOrderRemark")
|
||||
public AjaxResult updateOrderRemark(@RequestBody @Valid SchoolModifyOrderRemarkVO remarkVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
return schoolOrderService.updateOrderRemark(remarkVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单子项查询
|
||||
*/
|
||||
@GetMapping("/queryOrderItem")
|
||||
public AjaxResult queryOrderItem(String orderNo) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
SchoolOrderItemVO schoolOrderVO = new SchoolOrderItemVO();
|
||||
schoolOrderVO.setOrderNo(orderNo);
|
||||
List<SchoolOrderItemVO> list = schoolOrderItemService.querySchoolOrderItemVO(schoolOrderVO);
|
||||
return success(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.common.valigroud.AddGroup;
|
||||
import com.zf.foodpurchase.common.valigroud.UpdateGroup;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolOrderItemService;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolRefundItemService;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolRefundService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.*;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lilj
|
||||
* @since 2025-04-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/schoolRefund")
|
||||
public class WxAppSchoolRefundController extends BaseController {
|
||||
@Autowired
|
||||
private ISchoolRefundItemService schoolRefundItemService;
|
||||
|
||||
@Autowired
|
||||
private ISchoolRefundService schoolRefundService;
|
||||
|
||||
@Autowired
|
||||
private ISchoolOrderItemService schoolOrderItemService;
|
||||
|
||||
@GetMapping("/orderItemList")
|
||||
public AjaxResult orderItemList(SchoolOrderItemVO schoolOrderItemVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
schoolOrderItemVO.setSchoolId(userVO.getSchoolId());
|
||||
List<SchoolOrderItemVO> list = schoolOrderItemService.querySchoolOrderItemVO(schoolOrderItemVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
// 查询接口,根据退款总单号查询
|
||||
@GetMapping("/querySchoolRefund")
|
||||
public AjaxResult querySchoolRefund(SchoolRefundVO schoolRefundVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
schoolRefundVO.setSchoolId(userVO.getSchoolId());
|
||||
List<SchoolRefundVO> schoolRefunds = schoolRefundService.querySchoolRefund(schoolRefundVO);
|
||||
return AjaxResult.success(schoolRefunds);
|
||||
}
|
||||
|
||||
// 查询详情
|
||||
@GetMapping("/querySchoolRefundDetail")
|
||||
public AjaxResult querySchoolRefundDetail(String refundNo) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
if(StringUtils.isBlank(refundNo)){
|
||||
return AjaxResult.success(new ArrayList<>());
|
||||
}
|
||||
List<SchoolRefundItemVO> refundItems = schoolRefundItemService.queryRefundItem(refundNo);
|
||||
return AjaxResult.success(refundItems);
|
||||
}
|
||||
|
||||
/**
|
||||
* 几个字段:
|
||||
* 1.子单编号
|
||||
* 2.退货原因
|
||||
* 3.退货数量
|
||||
* @param refundItemAddUpdateVO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addRefundItem")
|
||||
public AjaxResult addRefundItem(@RequestBody @Validated(AddGroup.class) RefundItemAddUpdateVO refundItemAddUpdateVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
return schoolRefundItemService.addRefundItem(refundItemAddUpdateVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改退款项
|
||||
*/
|
||||
@PostMapping("/updateRefundItem")
|
||||
public AjaxResult updateRefundItem(@RequestBody @Validated(UpdateGroup.class) RefundItemAddUpdateVO refundItemAddUpdateVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
return schoolRefundItemService.updateRefundItem(refundItemAddUpdateVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退货单审核
|
||||
*/
|
||||
@PostMapping("/checkSchoolRefund")
|
||||
public AjaxResult checkSchoolRefund(@RequestBody @Valid RefundCheckVO checkVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
return schoolRefundService.checkSchoolRefund(checkVO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
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.ISchoolStaffService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SchoolStaffVO;
|
||||
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-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/schoolStaff")
|
||||
public class WxAppSchoolStaffController extends BaseController {
|
||||
@Autowired
|
||||
private ISchoolStaffService schoolStaffService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SchoolStaffVO schoolStaffVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
schoolStaffVO.setSchoolId(userVO.getSchoolId());
|
||||
List<SchoolStaffVO> list = schoolStaffService.querySchoolStaffVO(schoolStaffVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@Validated(AddGroup.class) @RequestBody SchoolStaffVO schoolStaffVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
schoolStaffVO.setSchoolId(userVO.getSchoolId());
|
||||
return schoolStaffService.saveVO(schoolStaffVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Validated(UpdateGroup.class) @RequestBody SchoolStaffVO schoolStaffVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
schoolStaffVO.setSchoolId(userVO.getSchoolId());
|
||||
return schoolStaffService.updateVO(schoolStaffVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Integer staffId) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
if(staffId == null){
|
||||
return error("请选择要删除的学校人员");
|
||||
}
|
||||
boolean flag = schoolStaffService.removeById(staffId);
|
||||
return flag ? success("删除成功") : error("删除失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.zf.foodpurchase.fdsafe.wxapp.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.WxAppUserVO;
|
||||
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.service.ISelfInspectionDetailService;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISelfInspectionRecordService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SelfInspectionContentVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SelfInspectionDetailVO;
|
||||
import com.zf.foodpurchase.fdsafe.vo.SelfInspectionRecordVO;
|
||||
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-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxapp/selfInspectionRecord")
|
||||
public class WxAppSelfInspectionRecordController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISelfInspectionRecordService selfInspectionRecordService;
|
||||
|
||||
@Autowired
|
||||
private ISelfInspectionDetailService selfInspectionDetailService;
|
||||
|
||||
@Autowired
|
||||
private ISelfInspectionContentService selfInspectionContentService;
|
||||
|
||||
@GetMapping("/inspectionContents")
|
||||
public AjaxResult inspectionContents(SelfInspectionContentVO selfInspectionContentVO){
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
selfInspectionContentVO.setEduId(userVO.getEduId());
|
||||
List<SelfInspectionContentVO> list = selfInspectionContentService.querySelfInspectionContentVO(selfInspectionContentVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SelfInspectionRecordVO selfInspectionRecordVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
selfInspectionRecordVO.setSchoolId(userVO.getSchoolId());
|
||||
List<SelfInspectionRecordVO> list = selfInspectionRecordService.querySelfInspectionRecordVO(selfInspectionRecordVO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(AddGroup.class) SelfInspectionRecordVO selfInspectionRecordVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
selfInspectionRecordVO.setSchoolId(userVO.getSchoolId());
|
||||
selfInspectionRecordVO.setEduId(userVO.getEduId());
|
||||
return selfInspectionRecordService.saveVO(selfInspectionRecordVO);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody @Validated(UpdateGroup.class) SelfInspectionRecordVO selfInspectionRecordVO) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
selfInspectionRecordVO.setSchoolId(userVO.getSchoolId());
|
||||
return selfInspectionRecordService.updateVO(selfInspectionRecordVO);
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(Long selfRecordId) {
|
||||
WxAppUserVO userVO = getWxAppLoginUser().getUser();
|
||||
if(userVO == null || !WxAPPAccountConstants.SCHOOL.equals(userVO.getAccountType())){
|
||||
return AjaxResult.error("非学校人员账号无法操作");
|
||||
}
|
||||
if(selfRecordId == null){
|
||||
return error("未指定要删除的自检记录");
|
||||
}
|
||||
return selfInspectionRecordService.deleteWithId(selfRecordId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/getDetail")
|
||||
public AjaxResult getDetail(Long selfRecordId){
|
||||
List<SelfInspectionDetailVO> list = selfInspectionDetailService.getDetail(selfRecordId);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.zf.foodpurchase.web.controller.common;
|
||||
|
||||
import com.google.code.kaptcha.Producer;
|
||||
import com.zf.foodpurchase.common.config.RuoYiConfig;
|
||||
import com.zf.foodpurchase.common.constant.CacheConstants;
|
||||
import com.zf.foodpurchase.common.constant.Constants;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.redis.RedisCache;
|
||||
import com.zf.foodpurchase.common.utils.sign.Base64;
|
||||
import com.zf.foodpurchase.common.utils.uuid.IdUtils;
|
||||
import com.zf.foodpurchase.system.service.ISysConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.FastByteArrayOutputStream;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 验证码操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class CaptchaController
|
||||
{
|
||||
@Resource(name = "captchaProducer")
|
||||
private Producer captchaProducer;
|
||||
|
||||
@Resource(name = "captchaProducerMath")
|
||||
private Producer captchaProducerMath;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
/**
|
||||
* 生成验证码
|
||||
*/
|
||||
@GetMapping("/captchaImage")
|
||||
public AjaxResult getCode(HttpServletResponse response) throws IOException
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
boolean captchaEnabled = configService.selectCaptchaEnabled();
|
||||
ajax.put("captchaEnabled", captchaEnabled);
|
||||
if (!captchaEnabled)
|
||||
{
|
||||
return ajax;
|
||||
}
|
||||
|
||||
// 保存验证码信息
|
||||
String uuid = IdUtils.simpleUUID();
|
||||
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
|
||||
|
||||
String capStr = null, code = null;
|
||||
BufferedImage image = null;
|
||||
|
||||
// 生成验证码
|
||||
String captchaType = RuoYiConfig.getCaptchaType();
|
||||
if ("math".equals(captchaType))
|
||||
{
|
||||
String capText = captchaProducerMath.createText();
|
||||
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||
image = captchaProducerMath.createImage(capStr);
|
||||
}
|
||||
else if ("char".equals(captchaType))
|
||||
{
|
||||
capStr = code = captchaProducer.createText();
|
||||
image = captchaProducer.createImage(capStr);
|
||||
}
|
||||
|
||||
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||
// 转换流信息写出
|
||||
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
||||
try
|
||||
{
|
||||
ImageIO.write(image, "jpg", os);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
ajax.put("uuid", uuid);
|
||||
ajax.put("img", Base64.encode(os.toByteArray()));
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.zf.foodpurchase.web.controller.common;
|
||||
|
||||
import com.zf.foodpurchase.common.config.RuoYiConfig;
|
||||
import com.zf.foodpurchase.common.constant.Constants;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.common.utils.file.FileUploadUtils;
|
||||
import com.zf.foodpurchase.common.utils.file.FileUtils;
|
||||
import com.zf.foodpurchase.framework.config.ServerConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通用请求处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/common")
|
||||
public class CommonController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
|
||||
private static final String FILE_DELIMETER = ",";
|
||||
|
||||
/**
|
||||
* 通用下载请求
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
@GetMapping("/download")
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(fileName))
|
||||
{
|
||||
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||
}
|
||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||
String filePath = RuoYiConfig.getDownloadPath() + fileName;
|
||||
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||
if (delete)
|
||||
{
|
||||
FileUtils.deleteFile(filePath);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求(单个)
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
// String url = serverConfig.getUrl() + fileName;
|
||||
String url = RuoYiConfig.getImagePrefix() + fileName;
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", url);
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求(多个)
|
||||
*/
|
||||
@PostMapping("/uploads")
|
||||
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
List<String> urls = new ArrayList<String>();
|
||||
List<String> fileNames = new ArrayList<String>();
|
||||
List<String> newFileNames = new ArrayList<String>();
|
||||
List<String> originalFilenames = new ArrayList<String>();
|
||||
for (MultipartFile file : files)
|
||||
{
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
urls.add(url);
|
||||
fileNames.add(fileName);
|
||||
newFileNames.add(FileUtils.getName(fileName));
|
||||
originalFilenames.add(file.getOriginalFilename());
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
|
||||
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
|
||||
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
|
||||
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地资源通用下载
|
||||
*/
|
||||
@GetMapping("/download/resource")
|
||||
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||
throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(resource))
|
||||
{
|
||||
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||
}
|
||||
// 本地资源路径
|
||||
String localPath = RuoYiConfig.getProfile();
|
||||
// 数据库资源地址
|
||||
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
|
||||
// 下载名称
|
||||
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.zf.foodpurchase.web.controller.monitor;
|
||||
|
||||
import com.zf.foodpurchase.common.constant.CacheConstants;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.system.domain.SysCache;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisCallback;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 缓存监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/cache")
|
||||
public class CacheController
|
||||
{
|
||||
@Autowired
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
private final static List<SysCache> caches = new ArrayList<SysCache>();
|
||||
{
|
||||
caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
|
||||
caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
|
||||
caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
|
||||
caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
|
||||
caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
|
||||
caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
|
||||
caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping()
|
||||
public AjaxResult getInfo() throws Exception
|
||||
{
|
||||
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
|
||||
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
|
||||
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
|
||||
|
||||
Map<String, Object> result = new HashMap<>(3);
|
||||
result.put("info", info);
|
||||
result.put("dbSize", dbSize);
|
||||
|
||||
List<Map<String, String>> pieList = new ArrayList<>();
|
||||
commandStats.stringPropertyNames().forEach(key -> {
|
||||
Map<String, String> data = new HashMap<>(2);
|
||||
String property = commandStats.getProperty(key);
|
||||
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
|
||||
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
|
||||
pieList.add(data);
|
||||
});
|
||||
result.put("commandStats", pieList);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping("/getNames")
|
||||
public AjaxResult cache()
|
||||
{
|
||||
return AjaxResult.success(caches);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping("/getKeys/{cacheName}")
|
||||
public AjaxResult getCacheKeys(@PathVariable String cacheName)
|
||||
{
|
||||
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
||||
return AjaxResult.success(new TreeSet<>(cacheKeys));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping("/getValue/{cacheName}/{cacheKey}")
|
||||
public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
|
||||
{
|
||||
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
|
||||
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
|
||||
return AjaxResult.success(sysCache);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@DeleteMapping("/clearCacheName/{cacheName}")
|
||||
public AjaxResult clearCacheName(@PathVariable String cacheName)
|
||||
{
|
||||
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
||||
redisTemplate.delete(cacheKeys);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@DeleteMapping("/clearCacheKey/{cacheKey}")
|
||||
public AjaxResult clearCacheKey(@PathVariable String cacheKey)
|
||||
{
|
||||
redisTemplate.delete(cacheKey);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@DeleteMapping("/clearCacheAll")
|
||||
public AjaxResult clearCacheAll()
|
||||
{
|
||||
Collection<String> cacheKeys = redisTemplate.keys("*");
|
||||
redisTemplate.delete(cacheKeys);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.zf.foodpurchase.web.controller.monitor;
|
||||
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.framework.web.domain.Server;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 服务器监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/server")
|
||||
public class ServerController
|
||||
{
|
||||
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
||||
@GetMapping()
|
||||
public AjaxResult getInfo() throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
server.copyTo();
|
||||
return AjaxResult.success(server);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.zf.foodpurchase.web.controller.monitor;
|
||||
|
||||
import com.zf.foodpurchase.common.annotation.Log;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.enums.BusinessType;
|
||||
import com.zf.foodpurchase.common.utils.poi.ExcelUtil;
|
||||
import com.zf.foodpurchase.framework.web.service.SysPasswordService;
|
||||
import com.zf.foodpurchase.system.domain.SysLogininfor;
|
||||
import com.zf.foodpurchase.system.service.ISysLogininforService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统访问记录
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/logininfor")
|
||||
public class SysLogininforController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysLogininforService logininforService;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysLogininfor logininfor)
|
||||
{
|
||||
startPage();
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysLogininfor logininfor)
|
||||
{
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||
util.exportExcel(response, list, "登录日志");
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{infoIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] infoIds)
|
||||
{
|
||||
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
logininforService.cleanLogininfor();
|
||||
return success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
|
||||
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/unlock/{userName}")
|
||||
public AjaxResult unlock(@PathVariable("userName") String userName)
|
||||
{
|
||||
passwordService.clearLoginRecordCache(userName);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.zf.foodpurchase.web.controller.monitor;
|
||||
|
||||
import com.zf.foodpurchase.common.annotation.Log;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.enums.BusinessType;
|
||||
import com.zf.foodpurchase.common.utils.poi.ExcelUtil;
|
||||
import com.zf.foodpurchase.system.domain.SysOperLog;
|
||||
import com.zf.foodpurchase.system.service.ISysOperLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志记录
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/operlog")
|
||||
public class SysOperlogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysOperLogService operLogService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysOperLog operLog)
|
||||
{
|
||||
startPage();
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysOperLog operLog)
|
||||
{
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||
util.exportExcel(response, list, "操作日志");
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/{operIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] operIds)
|
||||
{
|
||||
return toAjax(operLogService.deleteOperLogByIds(operIds));
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
operLogService.cleanOperLog();
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.zf.foodpurchase.web.controller.monitor;
|
||||
|
||||
import com.zf.foodpurchase.common.annotation.Log;
|
||||
import com.zf.foodpurchase.common.constant.CacheConstants;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.model.LoginUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.core.redis.RedisCache;
|
||||
import com.zf.foodpurchase.common.enums.BusinessType;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.system.domain.SysUserOnline;
|
||||
import com.zf.foodpurchase.system.service.ISysUserOnlineService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 在线用户监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/online")
|
||||
public class SysUserOnlineController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserOnlineService userOnlineService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(String ipaddr, String userName)
|
||||
{
|
||||
Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
||||
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
||||
for (String key : keys)
|
||||
{
|
||||
LoginUser user = redisCache.getCacheObject(key);
|
||||
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(ipaddr))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
||||
}
|
||||
else
|
||||
{
|
||||
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
|
||||
}
|
||||
}
|
||||
Collections.reverse(userOnlineList);
|
||||
userOnlineList.removeAll(Collections.singleton(null));
|
||||
return getDataTable(userOnlineList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 强退用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@DeleteMapping("/{tokenId}")
|
||||
public AjaxResult forceLogout(@PathVariable String tokenId)
|
||||
{
|
||||
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.zf.foodpurchase.web.controller.system;
|
||||
|
||||
import com.zf.foodpurchase.common.annotation.Log;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.enums.BusinessType;
|
||||
import com.zf.foodpurchase.common.utils.poi.ExcelUtil;
|
||||
import com.zf.foodpurchase.system.domain.SysConfig;
|
||||
import com.zf.foodpurchase.system.service.ISysConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参数配置 信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/config")
|
||||
public class SysConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
/**
|
||||
* 获取参数配置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysConfig config)
|
||||
{
|
||||
startPage();
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysConfig config)
|
||||
{
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||
util.exportExcel(response, list, "参数数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:query')")
|
||||
@GetMapping(value = "/{configId}")
|
||||
public AjaxResult getInfo(@PathVariable Long configId)
|
||||
{
|
||||
return success(configService.selectConfigById(configId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数键名查询参数值
|
||||
*/
|
||||
@GetMapping(value = "/configKey/{configKey}")
|
||||
public AjaxResult getConfigKey(@PathVariable String configKey)
|
||||
{
|
||||
return success(configService.selectConfigByKey(configKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
||||
{
|
||||
if (!configService.checkConfigKeyUnique(config))
|
||||
{
|
||||
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setCreateBy(getUsername());
|
||||
return toAjax(configService.insertConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:edit')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
||||
{
|
||||
if (!configService.checkConfigKeyUnique(config))
|
||||
{
|
||||
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setUpdateBy(getUsername());
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{configIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] configIds)
|
||||
{
|
||||
configService.deleteConfigByIds(configIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新参数缓存
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
configService.resetConfigCache();
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.zf.foodpurchase.web.controller.system;
|
||||
|
||||
import com.zf.foodpurchase.common.annotation.Log;
|
||||
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.enums.BusinessType;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.system.service.ISysDeptService;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dept")
|
||||
public class SysDeptController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
/**
|
||||
* 获取部门列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SysDept dept)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||
return success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门列表(排除节点)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@GetMapping("/list/exclude/{deptId}")
|
||||
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
||||
return success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:query')")
|
||||
@GetMapping(value = "/{deptId}")
|
||||
public AjaxResult getInfo(@PathVariable Long deptId)
|
||||
{
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
return success(deptService.selectDeptById(deptId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:add')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDept dept)
|
||||
{
|
||||
if (!deptService.checkDeptNameUnique(dept))
|
||||
{
|
||||
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
dept.setCreateBy(getUsername());
|
||||
return toAjax(deptService.insertDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改部门
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDept dept)
|
||||
{
|
||||
Long deptId = dept.getDeptId();
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
if (!deptService.checkDeptNameUnique(dept))
|
||||
{
|
||||
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
else if (dept.getParentId().equals(deptId))
|
||||
{
|
||||
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||
}
|
||||
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
|
||||
{
|
||||
return error("该部门包含未停用的子部门!");
|
||||
}
|
||||
dept.setUpdateBy(getUsername());
|
||||
return toAjax(deptService.updateDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deptId}")
|
||||
public AjaxResult remove(@PathVariable Long deptId)
|
||||
{
|
||||
if (deptService.hasChildByDeptId(deptId))
|
||||
{
|
||||
return warn("存在下级部门,不允许删除");
|
||||
}
|
||||
if (deptService.checkDeptExistUser(deptId))
|
||||
{
|
||||
return warn("部门存在用户,不允许删除");
|
||||
}
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
return toAjax(deptService.deleteDeptById(deptId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.zf.foodpurchase.web.controller.system;
|
||||
|
||||
import com.zf.foodpurchase.common.annotation.Log;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysDictData;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.enums.BusinessType;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.common.utils.poi.ExcelUtil;
|
||||
import com.zf.foodpurchase.system.service.ISysDictDataService;
|
||||
import com.zf.foodpurchase.system.service.ISysDictTypeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/data")
|
||||
public class SysDictDataController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDictData dictData)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysDictData dictData)
|
||||
{
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||
util.exportExcel(response, list, "字典数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典数据详细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictCode}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictCode)
|
||||
{
|
||||
return success(dictDataService.selectDictDataById(dictCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据信息
|
||||
*/
|
||||
@GetMapping(value = "/type/{dictType}")
|
||||
public AjaxResult dictType(@PathVariable String dictType)
|
||||
{
|
||||
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||
if (StringUtils.isNull(data))
|
||||
{
|
||||
data = new ArrayList<SysDictData>();
|
||||
}
|
||||
return success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDictData dict)
|
||||
{
|
||||
dict.setCreateBy(getUsername());
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
|
||||
{
|
||||
dict.setUpdateBy(getUsername());
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictCodes}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||
{
|
||||
dictDataService.deleteDictDataByIds(dictCodes);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.zf.foodpurchase.web.controller.system;
|
||||
|
||||
import com.zf.foodpurchase.common.annotation.Log;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysDictType;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.enums.BusinessType;
|
||||
import com.zf.foodpurchase.common.utils.poi.ExcelUtil;
|
||||
import com.zf.foodpurchase.system.service.ISysDictTypeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/type")
|
||||
public class SysDictTypeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDictType dictType)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysDictType dictType)
|
||||
{
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||
util.exportExcel(response, list, "字典类型");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典类型详细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictId}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictId)
|
||||
{
|
||||
return success(dictTypeService.selectDictTypeById(dictId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
||||
{
|
||||
if (!dictTypeService.checkDictTypeUnique(dict))
|
||||
{
|
||||
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setCreateBy(getUsername());
|
||||
return toAjax(dictTypeService.insertDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
||||
{
|
||||
if (!dictTypeService.checkDictTypeUnique(dict))
|
||||
{
|
||||
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setUpdateBy(getUsername());
|
||||
return toAjax(dictTypeService.updateDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictIds)
|
||||
{
|
||||
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新字典缓存
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
dictTypeService.resetDictCache();
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||
return success(dictTypes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.zf.foodpurchase.web.controller.system;
|
||||
|
||||
import com.zf.foodpurchase.common.config.RuoYiConfig;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class SysIndexController
|
||||
{
|
||||
/** 系统基础配置 */
|
||||
@Autowired
|
||||
private RuoYiConfig ruoyiConfig;
|
||||
|
||||
/**
|
||||
* 访问首页,提示语
|
||||
*/
|
||||
@RequestMapping("/")
|
||||
public String index()
|
||||
{
|
||||
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.zf.foodpurchase.web.controller.system;
|
||||
|
||||
import com.zf.foodpurchase.common.constant.AccountConstants;
|
||||
import com.zf.foodpurchase.common.constant.Constants;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysMenu;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.domain.model.AccountVO;
|
||||
import com.zf.foodpurchase.common.core.domain.model.LoginBody;
|
||||
import com.zf.foodpurchase.common.core.domain.model.LoginUser;
|
||||
import com.zf.foodpurchase.common.utils.SecurityUtils;
|
||||
import com.zf.foodpurchase.fdsafe.entity.School;
|
||||
import com.zf.foodpurchase.fdsafe.entity.Supplier;
|
||||
import com.zf.foodpurchase.fdsafe.service.IEduService;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISchoolService;
|
||||
import com.zf.foodpurchase.fdsafe.service.ISupplierService;
|
||||
import com.zf.foodpurchase.framework.web.service.SysLoginService;
|
||||
import com.zf.foodpurchase.framework.web.service.SysPermissionService;
|
||||
import com.zf.foodpurchase.framework.web.service.TokenService;
|
||||
import com.zf.foodpurchase.system.service.ISysMenuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class SysLoginController {
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private ISchoolService schoolService;
|
||||
|
||||
@Autowired
|
||||
private IEduService eduService;
|
||||
|
||||
@Autowired
|
||||
private ISupplierService supplierService;
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
* @param loginBody 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@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 用户信息
|
||||
*/
|
||||
@GetMapping("getInfo")
|
||||
public AjaxResult getInfo() {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
SysUser user = loginUser.getUser();
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
// 权限集合
|
||||
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||
if (!loginUser.getPermissions().equals(permissions)) {
|
||||
loginUser.setPermissions(permissions);
|
||||
tokenService.refreshToken(loginUser);
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", roles);
|
||||
ajax.put("permissions", permissions);
|
||||
AccountVO accountVO = new AccountVO();
|
||||
accountVO.setAccountType(user.getAccountType());
|
||||
if (user.getAccountType() != null) {
|
||||
if (AccountConstants.SYSTEM_USER.equals(user.getAccountType())) {
|
||||
accountVO.setAccountType(AccountConstants.SYSTEM_USER);
|
||||
}
|
||||
|
||||
// 学校用户处理
|
||||
else if (AccountConstants.SCHOOL.equals(user.getAccountType())) {
|
||||
accountVO.setSchoolId(user.getAccountDeptId());
|
||||
School school = schoolService.getById(user.getAccountDeptId());
|
||||
if(school != null){
|
||||
accountVO.setEduId(school.getEduId());
|
||||
}
|
||||
}
|
||||
|
||||
// 企业用户处理
|
||||
else if (AccountConstants.SUPPLIER.equals(user.getAccountType())) {
|
||||
accountVO.setSupplierId(user.getAccountDeptId());
|
||||
Supplier supplier = supplierService.getById(user.getAccountDeptId());
|
||||
if(supplier != null){
|
||||
accountVO.setEduId(supplier.getEduId());
|
||||
}
|
||||
}
|
||||
|
||||
// 教育局用户处理
|
||||
else if (AccountConstants.EDU.equals(user.getAccountType())) {
|
||||
accountVO.setEduId(user.getAccountDeptId());
|
||||
}
|
||||
else if(AccountConstants.MERCHANT.equals(user.getAccountType())){
|
||||
accountVO.setAccountType(AccountConstants.MERCHANT);
|
||||
}
|
||||
|
||||
}
|
||||
ajax.put("account", accountVO);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取路由信息
|
||||
*
|
||||
* @return 路由信息
|
||||
*/
|
||||
@GetMapping("getRouters")
|
||||
public AjaxResult getRouters() {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
||||
return AjaxResult.success(menuService.buildMenus(menus));
|
||||
}
|
||||
}
|
||||
|
||||
// 退款金额
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.zf.foodpurchase.web.controller.system;
|
||||
|
||||
import com.zf.foodpurchase.common.annotation.Log;
|
||||
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.SysMenu;
|
||||
import com.zf.foodpurchase.common.enums.BusinessType;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.system.service.ISysMenuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/menu")
|
||||
public class SysMenuController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SysMenu menu)
|
||||
{
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||
return success(menus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜单编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:query')")
|
||||
@GetMapping(value = "/{menuId}")
|
||||
public AjaxResult getInfo(@PathVariable Long menuId)
|
||||
{
|
||||
return success(menuService.selectMenuById(menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单下拉树列表
|
||||
*/
|
||||
@GetMapping("/treeselect")
|
||||
public AjaxResult treeselect(SysMenu menu)
|
||||
{
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||
return success(menuService.buildMenuTreeSelect(menus));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载对应角色菜单列表树
|
||||
*/
|
||||
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
|
||||
{
|
||||
List<SysMenu> menus = menuService.selectMenuList(getUserId());
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
||||
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:add')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysMenu menu)
|
||||
{
|
||||
if (!menuService.checkMenuNameUnique(menu))
|
||||
{
|
||||
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||
{
|
||||
return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
menu.setCreateBy(getUsername());
|
||||
return toAjax(menuService.insertMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
|
||||
{
|
||||
if (!menuService.checkMenuNameUnique(menu))
|
||||
{
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||
{
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
else if (menu.getMenuId().equals(menu.getParentId()))
|
||||
{
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||
}
|
||||
menu.setUpdateBy(getUsername());
|
||||
return toAjax(menuService.updateMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{menuId}")
|
||||
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
||||
{
|
||||
if (menuService.hasChildByMenuId(menuId))
|
||||
{
|
||||
return warn("存在子菜单,不允许删除");
|
||||
}
|
||||
if (menuService.checkMenuExistRole(menuId))
|
||||
{
|
||||
return warn("菜单已分配,不允许删除");
|
||||
}
|
||||
return toAjax(menuService.deleteMenuById(menuId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.zf.foodpurchase.web.controller.system;
|
||||
|
||||
import com.zf.foodpurchase.common.annotation.Log;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.enums.BusinessType;
|
||||
import com.zf.foodpurchase.system.domain.SysNotice;
|
||||
import com.zf.foodpurchase.system.service.ISysNoticeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公告 信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/notice")
|
||||
public class SysNoticeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
/**
|
||||
* 获取通知公告列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysNotice notice)
|
||||
{
|
||||
startPage();
|
||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据通知公告编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:query')")
|
||||
@GetMapping(value = "/{noticeId}")
|
||||
public AjaxResult getInfo(@PathVariable Long noticeId)
|
||||
{
|
||||
return success(noticeService.selectNoticeById(noticeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:add')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysNotice notice)
|
||||
{
|
||||
notice.setCreateBy(getUsername());
|
||||
return toAjax(noticeService.insertNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
|
||||
{
|
||||
notice.setUpdateBy(getUsername());
|
||||
return toAjax(noticeService.updateNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{noticeIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] noticeIds)
|
||||
{
|
||||
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.zf.foodpurchase.web.controller.system;
|
||||
|
||||
import com.zf.foodpurchase.common.annotation.Log;
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.enums.BusinessType;
|
||||
import com.zf.foodpurchase.common.utils.poi.ExcelUtil;
|
||||
import com.zf.foodpurchase.system.domain.SysPost;
|
||||
import com.zf.foodpurchase.system.service.ISysPostService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/post")
|
||||
public class SysPostController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
/**
|
||||
* 获取岗位列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysPost post)
|
||||
{
|
||||
startPage();
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:post:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysPost post)
|
||||
{
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||
util.exportExcel(response, list, "岗位数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:query')")
|
||||
@GetMapping(value = "/{postId}")
|
||||
public AjaxResult getInfo(@PathVariable Long postId)
|
||||
{
|
||||
return success(postService.selectPostById(postId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:add')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysPost post)
|
||||
{
|
||||
if (!postService.checkPostNameUnique(post))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (!postService.checkPostCodeUnique(post))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setCreateBy(getUsername());
|
||||
return toAjax(postService.insertPost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:edit')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysPost post)
|
||||
{
|
||||
if (!postService.checkPostNameUnique(post))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (!postService.checkPostCodeUnique(post))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setUpdateBy(getUsername());
|
||||
return toAjax(postService.updatePost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:remove')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{postIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] postIds)
|
||||
{
|
||||
return toAjax(postService.deletePostByIds(postIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<SysPost> posts = postService.selectPostAll();
|
||||
return success(posts);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.zf.foodpurchase.web.controller.system;
|
||||
|
||||
import com.zf.foodpurchase.common.annotation.Log;
|
||||
import com.zf.foodpurchase.common.config.RuoYiConfig;
|
||||
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.enums.BusinessType;
|
||||
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.framework.web.service.TokenService;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 个人信息 业务处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/user/profile")
|
||||
public class SysProfileController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
@GetMapping
|
||||
public AjaxResult profile()
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser user = loginUser.getUser();
|
||||
AjaxResult ajax = AjaxResult.success(user);
|
||||
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
||||
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult updateProfile(@RequestBody SysUser user)
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser currentUser = loginUser.getUser();
|
||||
currentUser.setNickName(user.getNickName());
|
||||
currentUser.setEmail(user.getEmail());
|
||||
currentUser.setPhonenumber(user.getPhonenumber());
|
||||
currentUser.setSex(user.getSex());
|
||||
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
|
||||
{
|
||||
return error("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
|
||||
{
|
||||
return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
if (userService.updateUserProfile(currentUser) > 0)
|
||||
{
|
||||
// 更新缓存用户信息
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
}
|
||||
return error("修改个人信息异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePwd")
|
||||
public AjaxResult updatePwd(String oldPassword, String newPassword)
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String userName = loginUser.getUsername();
|
||||
String password = loginUser.getPassword();
|
||||
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
||||
{
|
||||
return error("修改密码失败,旧密码错误");
|
||||
}
|
||||
if (SecurityUtils.matchesPassword(newPassword, password))
|
||||
{
|
||||
return error("新密码不能与旧密码相同");
|
||||
}
|
||||
newPassword = SecurityUtils.encryptPassword(newPassword);
|
||||
if (userService.resetUserPwd(userName, newPassword) > 0)
|
||||
{
|
||||
// 更新缓存用户密码
|
||||
loginUser.getUser().setPassword(newPassword);
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
}
|
||||
return error("修改密码异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 头像上传
|
||||
*/
|
||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/avatar")
|
||||
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
|
||||
{
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String avatar = FileUploadUtils.upload(RuoYiConfig.getUploadPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
|
||||
avatar =RuoYiConfig.getImagePrefix()+ avatar;
|
||||
if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("imgUrl", avatar);
|
||||
// 更新缓存用户头像
|
||||
loginUser.getUser().setAvatar(avatar);
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
return error("上传图片异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.zf.foodpurchase.web.controller.system;
|
||||
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.AjaxResult;
|
||||
import com.zf.foodpurchase.common.core.domain.model.RegisterBody;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.framework.web.service.SysRegisterService;
|
||||
import com.zf.foodpurchase.system.service.ISysConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 注册验证
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class SysRegisterController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private SysRegisterService registerService;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@PostMapping("/register")
|
||||
public AjaxResult register(@RequestBody RegisterBody user)
|
||||
{
|
||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
||||
{
|
||||
return error("当前系统没有开启注册功能!");
|
||||
}
|
||||
String msg = registerService.register(user);
|
||||
return StringUtils.isEmpty(msg) ? success() : error(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
package com.zf.foodpurchase.web.controller.system;
|
||||
|
||||
import com.zf.foodpurchase.common.annotation.Log;
|
||||
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.SysRole;
|
||||
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.enums.BusinessType;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.common.utils.poi.ExcelUtil;
|
||||
import com.zf.foodpurchase.framework.web.service.SysPermissionService;
|
||||
import com.zf.foodpurchase.framework.web.service.TokenService;
|
||||
import com.zf.foodpurchase.system.domain.SysUserRole;
|
||||
import com.zf.foodpurchase.system.service.ISysDeptService;
|
||||
import com.zf.foodpurchase.system.service.ISysRoleService;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/role")
|
||||
public class SysRoleController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysRole role)
|
||||
{
|
||||
startPage();
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:role:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysRole role)
|
||||
{
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
||||
util.exportExcel(response, list, "角色数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping(value = "/{roleId}")
|
||||
public AjaxResult getInfo(@PathVariable Long roleId)
|
||||
{
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return success(roleService.selectRoleById(roleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:add')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysRole role)
|
||||
{
|
||||
if (!roleService.checkRoleNameUnique(role))
|
||||
{
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (!roleService.checkRoleKeyUnique(role))
|
||||
{
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setCreateBy(getUsername());
|
||||
return toAjax(roleService.insertRole(role));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
if (!roleService.checkRoleNameUnique(role))
|
||||
{
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (!roleService.checkRoleKeyUnique(role))
|
||||
{
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setUpdateBy(getUsername());
|
||||
|
||||
if (roleService.updateRole(role) > 0)
|
||||
{
|
||||
// 更新缓存用户权限
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
|
||||
{
|
||||
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
||||
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
||||
tokenService.setLoginUser(loginUser);
|
||||
}
|
||||
return success();
|
||||
}
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存数据权限
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/dataScope")
|
||||
public AjaxResult dataScope(@RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
return toAjax(roleService.authDataScope(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
role.setUpdateBy(getUsername());
|
||||
return toAjax(roleService.updateRoleStatus(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:remove')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{roleIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] roleIds)
|
||||
{
|
||||
return toAjax(roleService.deleteRoleByIds(roleIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色选择框列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
return success(roleService.selectRoleAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询已分配用户角色列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/authUser/allocatedList")
|
||||
public TableDataInfo allocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectAllocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未分配用户角色列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/authUser/unallocatedList")
|
||||
public TableDataInfo unallocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消授权用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancel")
|
||||
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUser(userRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量取消授权用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancelAll")
|
||||
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量选择用户授权
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/selectAll")
|
||||
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
||||
{
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对应角色部门树列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping(value = "/deptTree/{roleId}")
|
||||
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||
ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
package com.zf.foodpurchase.web.controller.system;
|
||||
|
||||
import com.zf.foodpurchase.common.annotation.Log;
|
||||
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.SysRole;
|
||||
import com.zf.foodpurchase.common.core.domain.entity.SysUser;
|
||||
import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.enums.BusinessType;
|
||||
import com.zf.foodpurchase.common.utils.SecurityUtils;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import com.zf.foodpurchase.common.utils.poi.ExcelUtil;
|
||||
import com.zf.foodpurchase.system.service.ISysDeptService;
|
||||
import com.zf.foodpurchase.system.service.ISysPostService;
|
||||
import com.zf.foodpurchase.system.service.ISysRoleService;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "web用户信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/user")
|
||||
public class SysUserController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
@ApiOperation("查询系统列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysUser user)
|
||||
{
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
util.exportExcel(response, list, "用户数据");
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:import')")
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||
{
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||
String operName = getUsername();
|
||||
String message = userService.importUser(userList, updateSupport, operName);
|
||||
return success(message);
|
||||
}
|
||||
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response)
|
||||
{
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
util.importTemplateExcel(response, "用户数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||
@GetMapping(value = { "/", "/{userId}" })
|
||||
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
if (StringUtils.isNotNull(userId))
|
||||
{
|
||||
userService.checkUserDataScope(userId);
|
||||
SysUser sysUser = userService.selectUserById(userId);
|
||||
ajax.put(AjaxResult.DATA_TAG, sysUser);
|
||||
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
||||
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
||||
}
|
||||
List<SysRole> roles = roleService.selectRoleAll();
|
||||
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
ajax.put("posts", postService.selectPostAll());
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:add')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysUser user)
|
||||
{
|
||||
deptService.checkDeptDataScope(user.getDeptId());
|
||||
roleService.checkRoleDataScope(user.getRoleIds());
|
||||
if (!userService.checkUserNameUnique(user))
|
||||
{
|
||||
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
||||
{
|
||||
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
||||
{
|
||||
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setCreateBy(getUsername());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
deptService.checkDeptDataScope(user.getDeptId());
|
||||
roleService.checkRoleDataScope(user.getRoleIds());
|
||||
if (!userService.checkUserNameUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setUpdateBy(getUsername());
|
||||
return toAjax(userService.updateUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:remove')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{userIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] userIds)
|
||||
{
|
||||
if (ArrayUtils.contains(userIds, getUserId()))
|
||||
{
|
||||
return error("当前用户不能删除");
|
||||
}
|
||||
return toAjax(userService.deleteUserByIds(userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/resetPwd")
|
||||
public AjaxResult resetPwd(@RequestBody SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
user.setUpdateBy(getUsername());
|
||||
return toAjax(userService.resetPwd(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setUpdateBy(getUsername());
|
||||
return toAjax(userService.updateUserStatus(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户编号获取授权角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||
@GetMapping("/authRole/{userId}")
|
||||
public AjaxResult authRole(@PathVariable("userId") Long userId)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
SysUser user = userService.selectUserById(userId);
|
||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authRole")
|
||||
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
|
||||
{
|
||||
userService.checkUserDataScope(userId);
|
||||
roleService.checkRoleDataScope(roleIds);
|
||||
userService.insertUserAuth(userId, roleIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门树列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||
@GetMapping("/deptTree")
|
||||
public AjaxResult deptTree(SysDept dept)
|
||||
{
|
||||
return success(deptService.selectDeptTreeList(dept));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package com.zf.foodpurchase.web.controller.tool;
|
||||
|
||||
import com.zf.foodpurchase.common.core.controller.BaseController;
|
||||
import com.zf.foodpurchase.common.core.domain.R;
|
||||
import com.zf.foodpurchase.common.utils.StringUtils;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* swagger 用户测试方法
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api("用户信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/test/user")
|
||||
public class TestController extends BaseController
|
||||
{
|
||||
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
|
||||
{
|
||||
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
|
||||
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户列表")
|
||||
@GetMapping("/list")
|
||||
public R<List<UserEntity>> userList()
|
||||
{
|
||||
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
|
||||
return R.ok(userList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户详细")
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
|
||||
@GetMapping("/{userId}")
|
||||
public R<UserEntity> getUser(@PathVariable Integer userId)
|
||||
{
|
||||
if (!users.isEmpty() && users.containsKey(userId))
|
||||
{
|
||||
return R.ok(users.get(userId));
|
||||
}
|
||||
else
|
||||
{
|
||||
return R.fail("用户不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("新增用户")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
|
||||
})
|
||||
@PostMapping("/save")
|
||||
public R<String> save(UserEntity user)
|
||||
{
|
||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||
{
|
||||
return R.fail("用户ID不能为空");
|
||||
}
|
||||
users.put(user.getUserId(), user);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("更新用户")
|
||||
@PutMapping("/update")
|
||||
public R<String> update(@RequestBody UserEntity user)
|
||||
{
|
||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||
{
|
||||
return R.fail("用户ID不能为空");
|
||||
}
|
||||
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
||||
{
|
||||
return R.fail("用户不存在");
|
||||
}
|
||||
users.remove(user.getUserId());
|
||||
users.put(user.getUserId(), user);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户信息")
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
|
||||
@DeleteMapping("/{userId}")
|
||||
public R<String> delete(@PathVariable Integer userId)
|
||||
{
|
||||
if (!users.isEmpty() && users.containsKey(userId))
|
||||
{
|
||||
users.remove(userId);
|
||||
return R.ok();
|
||||
}
|
||||
else
|
||||
{
|
||||
return R.fail("用户不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ApiModel(value = "UserEntity", description = "用户实体")
|
||||
class UserEntity
|
||||
{
|
||||
@ApiModelProperty("用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty("用户名称")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty("用户密码")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty("用户手机")
|
||||
private String mobile;
|
||||
|
||||
public UserEntity()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public UserEntity(Integer userId, String username, String password, String mobile)
|
||||
{
|
||||
this.userId = userId;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public Integer getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getMobile()
|
||||
{
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile)
|
||||
{
|
||||
this.mobile = mobile;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.zf.foodpurchase.web.core.config;
|
||||
|
||||
import com.zf.foodpurchase.common.config.RuoYiConfig;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.*;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Swagger2的接口配置
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
public class SwaggerConfig
|
||||
{
|
||||
/** 系统基础配置 */
|
||||
@Autowired
|
||||
private RuoYiConfig ruoyiConfig;
|
||||
|
||||
/** 是否开启swagger */
|
||||
@Value("${swagger.enabled}")
|
||||
private boolean enabled;
|
||||
|
||||
/** 设置请求的统一前缀 */
|
||||
@Value("${swagger.pathMapping}")
|
||||
private String pathMapping;
|
||||
|
||||
/**
|
||||
* 创建API
|
||||
*/
|
||||
@Bean
|
||||
public Docket createRestApi()
|
||||
{
|
||||
return new Docket(DocumentationType.OAS_30)
|
||||
// 是否启用Swagger
|
||||
.enable(enabled)
|
||||
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
||||
.apiInfo(apiInfo())
|
||||
// 设置哪些接口暴露给Swagger展示
|
||||
.select()
|
||||
// 扫描所有有注解的api,用这种方式更灵活
|
||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
// 扫描指定包中的swagger注解
|
||||
// .apis(RequestHandlerSelectors.basePackage("com.zf.foodpurchase.project.tool.swagger"))
|
||||
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
/* 设置安全模式,swagger可以设置访问token */
|
||||
.securitySchemes(securitySchemes())
|
||||
.securityContexts(securityContexts())
|
||||
.pathMapping(pathMapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||
*/
|
||||
private List<SecurityScheme> securitySchemes()
|
||||
{
|
||||
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
|
||||
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
|
||||
return apiKeyList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全上下文
|
||||
*/
|
||||
private List<SecurityContext> securityContexts()
|
||||
{
|
||||
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||
securityContexts.add(
|
||||
SecurityContext.builder()
|
||||
.securityReferences(defaultAuth())
|
||||
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
|
||||
.build());
|
||||
return securityContexts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认的安全上引用
|
||||
*/
|
||||
private List<SecurityReference> defaultAuth()
|
||||
{
|
||||
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||
authorizationScopes[0] = authorizationScope;
|
||||
List<SecurityReference> securityReferences = new ArrayList<>();
|
||||
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
|
||||
return securityReferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加摘要信息
|
||||
*/
|
||||
private ApiInfo apiInfo()
|
||||
{
|
||||
// 用ApiInfoBuilder进行定制
|
||||
return new ApiInfoBuilder()
|
||||
// 设置标题
|
||||
.title("标题:若依管理系统_接口文档")
|
||||
// 描述
|
||||
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||
// 作者信息
|
||||
.contact(new Contact(ruoyiConfig.getName(), null, null))
|
||||
// 版本
|
||||
.version("版本号:" + ruoyiConfig.getVersion())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
restart.include.json=/com.alibaba.fastjson2.*.jar
|
||||
28
fp-admin/src/main/resources/apiclient_key.pem
Normal file
28
fp-admin/src/main/resources/apiclient_key.pem
Normal file
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDnSAKI8sea8p+d
|
||||
OBVPWlZmxqJfPbdhzZxdI5Kx1j5SJNZwXWtr43/giw38pwzSlBI+bubBcYlkFTI0
|
||||
guigMZO/yueb1mZChaY/JG1vsT02Ubj0xkVvBwKNbYS48NEpZhK61Mia09R4n1iH
|
||||
1vip9kt8J6Zrx+xIqwmuCNWigyivGrvY9AdevCNlNSVdHVOZUJiJ6UGtvVmgZb0u
|
||||
RTwBzfkjnwTgEcsrZMmF15nFubFsyJLyF/zY4NhrISc8H/rbjgleqa8ybYL26iTS
|
||||
gfPCXe4U9f8fNFF2bSA06GTiB2R93q2B0zHeUYrpgF4XOGlIAqH+Ea4Vn+aOj6I0
|
||||
pduh03idAgMBAAECggEBAJ+4SB/hYd1szrPZhkXtwhtp87pIObtuLhzYMzdjGFjM
|
||||
HdctfMDeNHKSNU+U4bMPFOZO2kcfLF2Ukb5X5WSzuDBMZNRnJOmtuJiEhJsM0JQR
|
||||
reREhLDfK3EWAAFkNV4corSpu/vIbEP87zuoRsPBVnHgQ/rM7y1kCORKL5bycwcw
|
||||
5BI4xhULKAu14LEcDL3+xDJo39w+WCFlxuP+6Bs7+vIeavs+AC3TJkA4kg2nyWd3
|
||||
W07xPjHl64f17icqsFhuFZ+VuSf5CAgQGWDbC7BHqRkDStUDSiiUiFushouKCLdK
|
||||
MpA0x4ogb2ZwfZDRhZHiLNAGe4QovYCcXWBydzuT0WECgYEA828Bo1JAHE5kdnsO
|
||||
E9+enH/yMcOKTRnuYPiXsFXNvqofc5tZiXJmVE/+EKv7LFmtUA6qqKC7FDek8TpP
|
||||
SkfXmSDAgfM6AdzT0YoHH23FRVewnFMEYumtogXsXJTyI5siBSJp16s9Rn/YwESt
|
||||
JqjW5+9Ck1dkU+UJCZ4lOw4HeGkCgYEA8zho2BKQTh3P/xcFcoTcunVZpRayVkHM
|
||||
g8Ef6RGGo4vM1oshQLvXyPqCmhAIf6j71I9WPqUwjmeGyaR7Hir0dbgTCm2fJPFW
|
||||
lxAvgbCISxEPz10RYBcR2umMSlJLfZfhqv1CyfU4vfCTbdOimgsz2039E3oLTbzg
|
||||
eDe/mdzu2BUCgYEAleKjf4wFLWiXMtxRrqrhXjrpRPrBDPgKbmqh+1DZfawB8YyV
|
||||
dKublg4qwNkjrgsJS2G8cleE2M3qIR1l9LaHaSFhZqH79WmigkIaYJ+V9zwm4hm7
|
||||
eaun3TsIbXjIHmRGbiLiSIiHEgFl0/x1IHiU2fnXZCFLBNzg06ssAVCCCQECgYA1
|
||||
4BfxTONkOlxZgAr33BBcySPLWuS0EK0xvjTIVtaBIbWFDJqYEUPyQ/NsFwMa7B6k
|
||||
bf/HrqW71ZjYz7Np8k/mR5kIJVIsR71Lhw1O6AC4yBW9dDsmEtYkrLkjuWj5cAxP
|
||||
6PvDaqtf/4tYt5l8D+Ezwem+R7l7RcxfNNIfTf4mJQKBgE57dnRx+Ijx7VHjJvjl
|
||||
X2jB/VSVGpK5OADykmmZ/wvHPlQcyzd+5kAIoJhSuY48CFeI1DOogR2p01LEFQEL
|
||||
j4AI5FqOOQwRJvNmfoKcKwO36tSxSEGSM8POKOsa21PG/gvDpJjVFo2hn5QcMHWn
|
||||
z5SjsgA/1YbXejubdLxT/3pl
|
||||
-----END PRIVATE KEY-----
|
||||
64
fp-admin/src/main/resources/application-druid.yml
Normal file
64
fp-admin/src/main/resources/application-druid.yml
Normal file
@@ -0,0 +1,64 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
# 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
|
||||
username: root
|
||||
password: wXn*QFs_6aNvFq@qDr.gPYsfBL-XN_o2
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置连接超时时间
|
||||
connectTimeout: 30000
|
||||
# 配置网络超时时间
|
||||
socketTimeout: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: root
|
||||
login-password: root123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
152
fp-admin/src/main/resources/application.yml
Normal file
152
fp-admin/src/main/resources/application.yml
Normal file
@@ -0,0 +1,152 @@
|
||||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 3.8.8
|
||||
# 版权年份
|
||||
copyrightYear: 2024
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath);实际是在profile的upload目录下
|
||||
# profile: D:/ruoyi/uploadPath
|
||||
profile: /home/ruoyi/uploadPath
|
||||
# imagePrefix: http://192.168.1.124:8080
|
||||
# 正常访问路径:
|
||||
# http://download.zhengfankeji.com/upload/foodPurchase/upload/2024/12/31/3_20241231182707A001.jpg
|
||||
imagePrefix: http://download.zhengfankeji.com/upload/schoolFood/upload/
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8090
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# 连接数满后的排队数,默认为100
|
||||
accept-count: 1000
|
||||
threads:
|
||||
# tomcat最大线程数,默认为200
|
||||
max: 800
|
||||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.zf.foodpurchase: debug
|
||||
org.springframework: warn
|
||||
|
||||
# 用户配置
|
||||
user:
|
||||
password:
|
||||
# 密码最大错误次数
|
||||
maxRetryCount: 5
|
||||
# 密码锁定时间(默认10分钟)
|
||||
lockTime: 10
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: druid
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 10MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 20MB
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# host: localhost
|
||||
# port: 6379
|
||||
host: 125.46.39.9
|
||||
database: 11
|
||||
password: zhengfan999
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
|
||||
|
||||
# token配置
|
||||
token:
|
||||
# 令牌自定义标识
|
||||
header: Authorization
|
||||
# 令牌密钥
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 30
|
||||
|
||||
## MyBatis配置
|
||||
#mybatis:
|
||||
# # 搜索指定包别名
|
||||
# typeAliasesPackage: com.zf.foodpurchase.**.domain
|
||||
# # 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
# mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# # 加载全局的配置文件
|
||||
# configLocation: classpath:mybatis/mybatis-config.xml
|
||||
|
||||
## MyBatis配置
|
||||
mybatis-plus:
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: com.zf.foodpurchase.**.domain,com.zf.foodpurchase.**.entity
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
configLocation: classpath:mybatis/mybatis-config.xml
|
||||
# 全局ID生成策略 (自增)
|
||||
global-config:
|
||||
db-config:
|
||||
logic-delete-field: delFlag
|
||||
logic-delete-value: 1 #逻辑删除
|
||||
logic-not-delete-value: 0 # 逻辑未删除
|
||||
id-type: auto
|
||||
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: mysql
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
# 是否开启swagger
|
||||
enabled: true
|
||||
# 请求前缀
|
||||
# pathMapping: /dev-api
|
||||
pathMapping: /
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
# 过滤开关
|
||||
enabled: true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
excludes: /system/notice
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
24
fp-admin/src/main/resources/banner.txt
Normal file
24
fp-admin/src/main/resources/banner.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
Application Version: ${ruoyi.version}
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// _ooOoo_ //
|
||||
// o8888888o //
|
||||
// 88" . "88 //
|
||||
// (| ^_^ |) //
|
||||
// O\ = /O //
|
||||
// ____/`---'\____ //
|
||||
// .' \\| |// `. //
|
||||
// / \\||| : |||// \ //
|
||||
// / _||||| -:- |||||- \ //
|
||||
// | | \\\ - /// | | //
|
||||
// | \_| ''\---/'' | | //
|
||||
// \ .-\__ `-` ___/-. / //
|
||||
// ___`. .' /--.--\ `. . ___ //
|
||||
// ."" '< `.___\_<|>_/___.' >'"". //
|
||||
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
|
||||
// \ \ `-. \_ __\ /__ _/ .-` / / //
|
||||
// ========`-.____`-.___\_____/___.-`____.-'======== //
|
||||
// `=---=' //
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
|
||||
// 佛祖保佑 永不宕机 永无BUG //
|
||||
////////////////////////////////////////////////////////////////////
|
||||
38
fp-admin/src/main/resources/i18n/messages.properties
Normal file
38
fp-admin/src/main/resources/i18n/messages.properties
Normal file
@@ -0,0 +1,38 @@
|
||||
#错误消息
|
||||
not.null=* 必须填写
|
||||
user.jcaptcha.error=验证码错误
|
||||
user.jcaptcha.expire=验证码已失效
|
||||
user.not.exists=用户不存在/密码错误
|
||||
user.password.not.match=用户不存在/密码错误
|
||||
user.password.retry.limit.count=密码输入错误{0}次
|
||||
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
|
||||
user.password.delete=对不起,您的账号已被删除
|
||||
user.blocked=用户已封禁,请联系管理员
|
||||
role.blocked=角色已封禁,请联系管理员
|
||||
login.blocked=很遗憾,访问IP已被列入系统黑名单
|
||||
user.logout.success=退出成功
|
||||
|
||||
length.not.valid=长度必须在{min}到{max}个字符之间
|
||||
|
||||
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
|
||||
user.password.not.valid=* 5-50个字符
|
||||
|
||||
user.email.not.valid=邮箱格式错误
|
||||
user.mobile.phone.number.not.valid=手机号格式错误
|
||||
user.login.success=登录成功
|
||||
user.register.success=注册成功
|
||||
user.notfound=请重新登录
|
||||
user.forcelogout=管理员强制退出,请重新登录
|
||||
user.unknown.error=未知错误,请重新登录
|
||||
|
||||
##文件上传消息
|
||||
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
|
||||
upload.filename.exceed.length=上传的文件名最长{0}个字符
|
||||
|
||||
##权限
|
||||
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
|
||||
28
fp-admin/src/main/resources/key/apiclient_key_zc.pem
Normal file
28
fp-admin/src/main/resources/key/apiclient_key_zc.pem
Normal file
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCzq6iHqjASWHeT
|
||||
TqyuTSt1NVt+xuUP8LckSRa4GNpNeq5lYlJjfDf8UEQS543Erf9D//QZI0apyUw1
|
||||
AUkS2HBh88yS7TK1eBl4LAdT3yw4QfgPAjIXX2ZlCIxo4HE3ZWwizLGCTVldXExP
|
||||
k1lPmVDMDJZwDOZiidXvtlvPgrDX+hiHiaiIYZYGPy2xHDSjPj7k6ipfT4gd9fMI
|
||||
6l+WcFcIRTpS7/QqeBkayGMDe/06bZPZvwaNqDroBVUV7JV6BIR/MsfLARFvHKIB
|
||||
NvZeKBmBhbmbItFEJGvrTmzILb/pXFEXpetYAlDSWR25BjWzXwgdOb3W2cJdUQTf
|
||||
eRxkIr8PAgMBAAECggEAbTo0cJV0OBL0TueLb0OW4eCYSRBdfT1X+YU9fJoPTP8C
|
||||
Orx1XenMl2WsnNmMhD9LammWWhnqAZpQ7ABmDkDqwYHXopL1OwFSao5JviF03pas
|
||||
WWN6VF84/r8drTyVV5ofDWDnoVGovGs6MT5hE1Ufm40jf+c3wDwPhXWVhyfqnsF0
|
||||
hyqGltZYPReP+0ambbIkc3Mfk8EikHzyTd+FGMaXktwHeAm8TC/Byy2OCjbFKjA6
|
||||
y+XVTB/pZrSe6vk/5+m95jn6PMzumXExxG/m1NaUmicbYG1eW1aBdVqmZHHsudx9
|
||||
LrKKwMZMJ38+Yo6uyG3MUlgOdvUIlvPVPV4dXire0QKBgQDqwwF7R9L4H6TMTV3Z
|
||||
zNlBsvXJ3cHy25OmDk46D6IBSjv+nI3szrXM1dMjZW02h9X319SsgMDk33SZH4sg
|
||||
7LL1aCzB5GXmQqnQ1WMbqbY8musvzqeak6oRdIprFOQ8YdA8opVTYY0zfJEuQp08
|
||||
byrI5gCJGPPEccQXiWk4aJZY0wKBgQDD7MLKaIENZcnOQYFNgk7sYEjJenEntYEW
|
||||
BhmDKw22b1p5QRlhmNNP/XXnCeIcZKgAKl2W9pmNr6abz/tF8pxM2C8hMNmtuNtz
|
||||
+tezjoNbO16Apunq+yKkTigTv6XGVECCv2vMiiG1CiUxslbR3yeisUpX/216+JDL
|
||||
P407biMbVQKBgQC7KKxNtH0lA1VG64ce1ImAL0R0oy60hwm3IUCMWVo23Q/ndLhR
|
||||
Spr1qqKhXYMsLi8PYCpVPHCMBvnV+afZn9ssetjz2zrBz/PCYdyZeTuoJXnKq15D
|
||||
heXX9KlFpWowGWsCbDvQNb10hqLX1pO0UowxjexvYE03F9vVR99y8S6rsQKBgFB+
|
||||
PAUGbEbB0+g+N05Nw/kPEbhc6pJC2pbeyKqADLEwDH6WhUP4kpBhdIgIInJB1FfF
|
||||
EBBOngV87blD+Frjct2LT8mWFUhvExISM35chZD80jWO3bmhlbjlN0fty8CwqpRM
|
||||
6o/tDC4hzegd+dddlB4eMon2sdb8uhgWswKAnEHFAoGBAOTWSt18SJawLlAQkhYN
|
||||
p/0rSss6FX6fhelv5v6V6n7zNDUEK4dR9pT4jXtoCGym/LROW9rmDi0FiZunkq2A
|
||||
M/1pUmmq1XyNl+1kf5nb1pusyVyUY1Meozn905e49/9ICbiJgzi9ZLBgWQ8XW2hl
|
||||
V1IDrfA5ImeJ4edclh9mUVvZ
|
||||
-----END PRIVATE KEY-----
|
||||
28
fp-admin/src/main/resources/key/apiclient_key_zf.pem
Normal file
28
fp-admin/src/main/resources/key/apiclient_key_zf.pem
Normal file
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDuoRtGeboKa2VE
|
||||
0U195S2ZAXPPW/J5ThqXBVsXt8QXrNcy3bIa86ksaOAPwHIN01jK5ICGvm+UOzX7
|
||||
HEM+VlzcMU2ca6/gETnJY1b3plYtzTJTdLzj7/mOvdAO1awo7K7Qp2JLly4f5rms
|
||||
tFKCmpIqb2f3Si/d89yhrcPJUhQWl0P+lBTzf2YqOFr67jh8c2fKM4W5BFG+Btpg
|
||||
qQk6x2g6C6ongI5bH7aFCt+jdPaQamNFqGlj1TPyPNM+hAcYnMxq944QDPBKT4Me
|
||||
cpZINWnXmVX0IHkh8OIHWpHA/75L+8v50FpdPoMi+TXP4ENuvurAoFB1n08TsUVq
|
||||
1ehdNvpFAgMBAAECggEBALKdtsvOy5mG/7s+K5HjnHjdpHD+8wUnmDGYmbGsJMRP
|
||||
5Ji3ZtxTrDqImcZQl06P9vOPjEDPhLdghqxaYF7lyAYthVljJbdDTYzXpb4jLHiG
|
||||
EnhzdfvroVHd9EFWYNIVL1kRITtRgv3v9uU16FjIGEZZM2nfhurM4UXHyjgEDvNE
|
||||
fkHuhhe3oZNFMfHh9T/uEsBvFmeGt4xg5wf+kEqPi/ZVprUZhQw4qZGQ89KT6M/y
|
||||
DG0MLCF0bU+Lq+nroMrVt3fRR/Bq95MTjdj0CEGOE+3ZRGAdYLabuZBhVU0YiAHX
|
||||
1i4o+9lTkr907SX4WYfageUCtnpe9VhE2GnHBZrQMbUCgYEA/iX4FBHcyHRfP8zG
|
||||
O11m2Q152H2YCU6iNLIeb0mCUAbmSw8WswTTFLd/P3DQWerOQrGDUxSgZuU/pYKD
|
||||
Gzs6xggsdVrIu4nxakFxhMOX0ouHtPASAVyFh8H4y2hh6qSGU06hEA6hiGUGeQcn
|
||||
AKDkajJrEwIr9K6CcuIFkLEK5Q8CgYEA8F4xHYPHkVJjKfmG3OA9uquT5QbK3XPi
|
||||
UJ+0+vjKcYnFpq4+lUdAFRN6QugjVCUswnx7ACSBJppEk9wkb4XygaRZ4oDzO9qQ
|
||||
fmz4oPmkRLEZviZEFGs+i2dlw3PqgkHWVujM3edu9LmI8TIByXGagzreU46Bxg9F
|
||||
1UAFp24E82sCgYAz1R6RSUtT/pfmdScAuH3fSqZNBuBZFZZzVNhsLfvLwnx5Vmx0
|
||||
ukkqcnobQDDeBctnQrjb2tsT4TFn2gRPK3dDKCuZC5jg1rNLzmkOgK2YHSjiOAwU
|
||||
BwCcvWy2X2WI62ER4Hlswu8i2CfHyzOjJy0uk3XO/KRmVKj6MSqdZd4o9QKBgDx3
|
||||
FVfdXIh79yIJ+Rj698xLeQq16LZIfnfVlQtFJnflNmk1j9yxbbdfjPPjvW9fYqER
|
||||
+0cP58U0LWgcirXbNiPSmiHWWlmGI68J7olgAyicfGNO8PVJ/RPIUNsX/7gAo9B9
|
||||
A3wWydyaB47VC4oHH90/I8pVIOQX13NLhaCWlnw9AoGAGfLvvpStmKLHwyt33Z7n
|
||||
bY3DOR9FFARd4/aSxPi+CnFLEXvMtjRE+otfPz5f4EkC+pZ6QavAElK0+qQHbvBg
|
||||
hjzFCQV9NBDNLP6HcGQNLn69cRZmUgUFSj7opwecN8qq0aEg4f59ihptPvlWZHuH
|
||||
24rcEhLyIjpSHJzRaJT8afQ=
|
||||
-----END PRIVATE KEY-----
|
||||
93
fp-admin/src/main/resources/logback.xml
Normal file
93
fp-admin/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="/home/ruoyi/logs" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 商户 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 用户访问日志输出 -->
|
||||
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-user.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 按天回滚 daily -->
|
||||
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.zf.foodpurchase" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
|
||||
<!--系统用户操作日志-->
|
||||
<logger name="sys-user" level="info">
|
||||
<appender-ref ref="sys-user"/>
|
||||
</logger>
|
||||
</configuration>
|
||||
5
fp-admin/src/main/resources/mapper/wx/AreaMapper.xml
Normal file
5
fp-admin/src/main/resources/mapper/wx/AreaMapper.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zf.foodpurchase.wx.mapper.AreaMapper">
|
||||
|
||||
</mapper>
|
||||
23
fp-admin/src/main/resources/mybatis/mybatis-config.xml
Normal file
23
fp-admin/src/main/resources/mybatis/mybatis-config.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<!-- 全局参数 -->
|
||||
<settings>
|
||||
<!-- 使全局的映射器启用或禁用缓存 -->
|
||||
<setting name="cacheEnabled" value="false" />
|
||||
<!-- 允许JDBC 支持自动生成主键 -->
|
||||
<setting name="useGeneratedKeys" value="true" />
|
||||
<!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
|
||||
<setting name="defaultExecutorType" value="SIMPLE" />
|
||||
<!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||
<setting name="logImpl" value="SLF4J" />
|
||||
<!-- 使用驼峰命名法转换字段 -->
|
||||
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
|
||||
|
||||
<!-- 禁用一级缓存 -->
|
||||
<!-- <setting name="localCacheScope" value="STATEMENT"/>-->
|
||||
</settings>
|
||||
|
||||
</configuration>
|
||||
0
fp-admin/src/main/resources/test.properites
Normal file
0
fp-admin/src/main/resources/test.properites
Normal file
Reference in New Issue
Block a user