食品采购接口优化
This commit is contained in:
@@ -51,6 +51,27 @@ public class RepoRecordController extends BaseController {
|
||||
});
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/listByProductId")
|
||||
public AjaxResult listByProductId(Long productId)
|
||||
{
|
||||
List<RepoRecordVO> list = repoRecordService.selectRepoRecordListByProductId(productId);
|
||||
list.forEach(f -> {
|
||||
if(f.getStatus() != null){
|
||||
if(ObjectUtil.equal(f.getStatus(),1)){
|
||||
f.setStatusName("入库");
|
||||
} else{
|
||||
f.setStatusName("出库");
|
||||
}
|
||||
}
|
||||
if(f.getProductId() != null){
|
||||
FoodProduct products = foodProductsService.getById(f.getProductId());
|
||||
f.setFoodProducts(Arrays.asList(products));
|
||||
}
|
||||
});
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{repoRecordId}")
|
||||
public AjaxResult getInfo(@PathVariable("repoRecordId") Long repoRecordId)
|
||||
{
|
||||
@@ -64,9 +85,14 @@ public class RepoRecordController extends BaseController {
|
||||
}
|
||||
if(repoRecordVO.getProductId() != null){
|
||||
FoodProduct products = foodProductsService.getById(repoRecordVO.getProductId());
|
||||
repoRecordVO.setFoodProducts(Arrays.asList(products));
|
||||
if(ObjectUtil.isNotNull( products)){
|
||||
repoRecordVO.setFoodProductNum(products.getNum());
|
||||
repoRecordVO.setFoodProductName(products.getName());
|
||||
repoRecordVO.setUnitName(products.getUnitLabel());
|
||||
repoRecordVO.setPrice(products.getPrice());
|
||||
}
|
||||
}
|
||||
return success(repoRecordService.selectRepoRecordByRepoRecordId(repoRecordId));
|
||||
return success(repoRecordVO);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.zf.foodpurchase.common.core.page.TableDataInfo;
|
||||
import com.zf.foodpurchase.common.utils.DateUtils;
|
||||
import com.zf.foodpurchase.fdsafe.entity.Repository;
|
||||
import com.zf.foodpurchase.fdsafe.service.IRepositoryService;
|
||||
import com.zf.foodpurchase.fdsafe.vo.RepositoryVO;
|
||||
import com.zf.foodpurchase.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -51,7 +52,7 @@ public class RepositoryController extends BaseController {
|
||||
repository.setMerchantId(null);
|
||||
}
|
||||
}
|
||||
List<Repository> list = repositoryService.queryRepoList(repository);
|
||||
List<RepositoryVO> list = repositoryService.queryRepoList(repository);
|
||||
return AjaxResult.success("查询成功", list);
|
||||
}
|
||||
|
||||
@@ -70,16 +71,17 @@ public class RepositoryController extends BaseController {
|
||||
repository.setMerchantId(null);
|
||||
}
|
||||
}
|
||||
List<Repository> list = repositoryService.queryRepoList(repository);
|
||||
List<RepositoryVO> list = repositoryService.queryRepoList(repository);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/addRepo")
|
||||
public AjaxResult addRepo(@Validated @RequestBody Repository repository) {
|
||||
SysUser sysUser = userService.getUser();
|
||||
if (sysUser.isAdmin()) {
|
||||
if(repository.getMerchantId() == null){
|
||||
return error("必须指定要添加的仓库所属商户");
|
||||
if(ObjectUtil.isNotNull(sysUser)){
|
||||
if(!sysUser.isAdmin()){
|
||||
Long deptId = sysUser.getDeptId();
|
||||
repository.setMerchantId(deptId);
|
||||
}
|
||||
}
|
||||
repository.setCreateTime(DateUtils.getNowDate());
|
||||
|
||||
@@ -153,7 +153,7 @@ public class SchoolOrderController extends BaseController {
|
||||
* 供货商接单
|
||||
*/
|
||||
@GetMapping("/supplierAcceptOrder")
|
||||
public AjaxResult supplierAcceptOrder(@Validated SupplierAcceptOrderVO supplierAcceptOrderVO) {
|
||||
public AjaxResult supplierAcceptOrder(String orderNo) {
|
||||
// 填充学校id,教育局id等数据
|
||||
SysUser user = userService.getUser();
|
||||
if(!user.isAdmin()){
|
||||
@@ -162,7 +162,7 @@ public class SchoolOrderController extends BaseController {
|
||||
return error("非供货商账号无法接单");
|
||||
}
|
||||
}
|
||||
return schoolOrderService.supplierAcceptOrder(supplierAcceptOrderVO);
|
||||
return schoolOrderService.supplierAcceptOrder(orderNo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,10 +42,10 @@ public class FoodProductController extends BaseController {
|
||||
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(FoodProductVO foodProductVO) {
|
||||
startPage();
|
||||
SysUser user = userService.getUser();
|
||||
startPage();
|
||||
if(!user.isAdmin()){
|
||||
foodProductVO.setSchoolId(user.getSchoolId());
|
||||
foodProductVO.setDeptIds(user.getDeptIdList());
|
||||
}
|
||||
foodProductVO.setDelFlag(0);
|
||||
List<FoodProductVO> list = foodProductService.queryFoodProductVO(foodProductVO);
|
||||
@@ -68,6 +68,11 @@ public class FoodProductController extends BaseController {
|
||||
return foodProductService.supplierUpdate(foodProductVO);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteLogic")
|
||||
public AjaxResult deleteLogic(Long foodProductId) {
|
||||
return foodProductService.supplierDelete(foodProductId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 教育局审核商品
|
||||
*/
|
||||
|
||||
@@ -39,6 +39,13 @@ public class SysDeptController extends BaseController
|
||||
return success(depts);
|
||||
}
|
||||
|
||||
@GetMapping("/listSuppliers")
|
||||
public AjaxResult listSuppliers()
|
||||
{
|
||||
List<SysDept> depts = deptService.selectSuppliers();
|
||||
return success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门列表(排除节点)
|
||||
*/
|
||||
|
||||
@@ -63,6 +63,20 @@ public class SysUserController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("查询仓库管理员列表")
|
||||
@GetMapping("/listRepoUsers")
|
||||
public AjaxResult listRepoUsers()
|
||||
{
|
||||
SysUser sysUser = userService.getUser();
|
||||
SysUser user = new SysUser();
|
||||
if(!sysUser.isAdmin()){
|
||||
List<Long> deptIds = sysUser.getDeptIdList();
|
||||
user.setDeptIdList(deptIds);
|
||||
}
|
||||
List<SysUser> list = userService.listRepoUsers(user);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
||||
@PostMapping("/export")
|
||||
|
||||
Reference in New Issue
Block a user