|
|
@ -10,9 +10,12 @@ import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
import com.glxp.api.constant.Constant;
|
|
|
|
import com.glxp.api.constant.Constant;
|
|
|
|
import com.glxp.api.constant.ConstantStatus;
|
|
|
|
import com.glxp.api.constant.ConstantStatus;
|
|
|
|
import com.glxp.api.entity.basic.BasicCorpEntity;
|
|
|
|
import com.glxp.api.entity.basic.BasicCorpEntity;
|
|
|
|
|
|
|
|
import com.glxp.api.entity.purchase.PurApplyDetailEntity;
|
|
|
|
|
|
|
|
import com.glxp.api.entity.purchase.PurApplyEntity;
|
|
|
|
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
|
|
|
|
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
|
|
|
|
import com.glxp.api.entity.purchase.PurPlanEntity;
|
|
|
|
import com.glxp.api.entity.purchase.PurPlanEntity;
|
|
|
|
import com.glxp.api.req.purchase.PostPurPlanRequest;
|
|
|
|
import com.glxp.api.req.purchase.PostPurPlanRequest;
|
|
|
|
|
|
|
|
import com.glxp.api.req.purchase.PurApplyDetailRequest;
|
|
|
|
import com.glxp.api.req.purchase.PurPlanDetailRequest;
|
|
|
|
import com.glxp.api.req.purchase.PurPlanDetailRequest;
|
|
|
|
import com.glxp.api.req.purchase.PurPlanRequest;
|
|
|
|
import com.glxp.api.req.purchase.PurPlanRequest;
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
@ -21,6 +24,8 @@ import com.glxp.api.res.purchase.PurPlanResponse;
|
|
|
|
import com.glxp.api.service.auth.CustomerService;
|
|
|
|
import com.glxp.api.service.auth.CustomerService;
|
|
|
|
import com.glxp.api.service.basic.BasicCorpService;
|
|
|
|
import com.glxp.api.service.basic.BasicCorpService;
|
|
|
|
import com.glxp.api.service.basic.UdiRelevanceService;
|
|
|
|
import com.glxp.api.service.basic.UdiRelevanceService;
|
|
|
|
|
|
|
|
import com.glxp.api.service.purchase.PurApplyDetailService;
|
|
|
|
|
|
|
|
import com.glxp.api.service.purchase.PurApplyService;
|
|
|
|
import com.glxp.api.service.purchase.PurPlanDetailService;
|
|
|
|
import com.glxp.api.service.purchase.PurPlanDetailService;
|
|
|
|
import com.glxp.api.service.purchase.PurPlanService;
|
|
|
|
import com.glxp.api.service.purchase.PurPlanService;
|
|
|
|
import com.glxp.api.util.GennerOrderUtils;
|
|
|
|
import com.glxp.api.util.GennerOrderUtils;
|
|
|
@ -33,6 +38,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.validation.constraints.NotEmpty;
|
|
|
|
import javax.validation.constraints.NotEmpty;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -46,14 +52,18 @@ import java.util.*;
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
|
public class PurPlanController {
|
|
|
|
public class PurPlanController {
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// @Resource
|
|
|
|
@Resource
|
|
|
|
// PurPlanService purPlanService;
|
|
|
|
PurPlanService purPlanService;
|
|
|
|
// @Resource
|
|
|
|
@Resource
|
|
|
|
// PurPlanDetailService purPlanDetailService;
|
|
|
|
PurApplyService purApplyService;
|
|
|
|
//
|
|
|
|
@Resource
|
|
|
|
// @Resource
|
|
|
|
PurApplyDetailService purApplyDetailService;
|
|
|
|
// CustomerService customerService;
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
PurPlanDetailService purPlanDetailService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
CustomerService customerService;
|
|
|
|
// @Resource
|
|
|
|
// @Resource
|
|
|
|
// GennerOrderUtils gennerOrderUtils;
|
|
|
|
// GennerOrderUtils gennerOrderUtils;
|
|
|
|
// @Resource
|
|
|
|
// @Resource
|
|
|
@ -108,25 +118,25 @@ public class PurPlanController {
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// /**
|
|
|
|
/**
|
|
|
|
// * 查询采购计划列表
|
|
|
|
* 查询采购计划列表
|
|
|
|
// */
|
|
|
|
*/
|
|
|
|
// @GetMapping("/purchase/plan/list")
|
|
|
|
@GetMapping("/purchase/plan/list")
|
|
|
|
// public BaseResponse list(PurPlanRequest purApplyRequest) {
|
|
|
|
public BaseResponse list(PurPlanRequest purApplyRequest) {
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (purApplyRequest.getStatus() == null) {
|
|
|
|
if (purApplyRequest.getStatus() == null) {
|
|
|
|
// purApplyRequest.setStatus(11); //查询未审核和草稿状态
|
|
|
|
purApplyRequest.setStatus(11); //查询未审核和草稿状态
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
//
|
|
|
|
|
|
|
|
// List<PurPlanResponse> purApplyEntities = purPlanService.queryPageList(purApplyRequest);
|
|
|
|
List<PurPlanResponse> purApplyEntities = purPlanService.queryPageList(purApplyRequest);
|
|
|
|
// PageInfo<PurPlanResponse> pageInfo;
|
|
|
|
PageInfo<PurPlanResponse> pageInfo;
|
|
|
|
// pageInfo = new PageInfo<>(purApplyEntities);
|
|
|
|
pageInfo = new PageInfo<>(purApplyEntities);
|
|
|
|
// PageSimpleResponse<PurPlanResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
PageSimpleResponse<PurPlanResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
// pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
// pageSimpleResponse.setList(purApplyEntities);
|
|
|
|
pageSimpleResponse.setList(purApplyEntities);
|
|
|
|
// return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// /**
|
|
|
|
// /**
|
|
|
@ -334,4 +344,56 @@ public class PurPlanController {
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 添加申购单到采购单里面
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@PostMapping("/purchase/plan/addPlanDetail")
|
|
|
|
|
|
|
|
public BaseResponse addPlanDetail(@RequestBody PurPlanRequest purApplyRequest) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (purApplyRequest.getRId() == null && purApplyRequest.getId() == null) {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(999,"参数错误!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询申购单详情
|
|
|
|
|
|
|
|
PurApplyDetailRequest purApplyDetailRequest=new PurApplyDetailRequest();
|
|
|
|
|
|
|
|
purApplyDetailRequest.setOrderIdFk(purApplyRequest.getRId());
|
|
|
|
|
|
|
|
List<PurApplyDetailEntity> purApplyDetailEntityList=purApplyDetailService.selectPurApplyDetailList(purApplyDetailRequest);
|
|
|
|
|
|
|
|
//使用stream拷贝list
|
|
|
|
|
|
|
|
List<PurPlanDetailEntity> purPlanDetailEntityList = purApplyDetailEntityList.stream()
|
|
|
|
|
|
|
|
.map(e-> {
|
|
|
|
|
|
|
|
PurPlanDetailEntity d = new PurPlanDetailEntity();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(e, d);
|
|
|
|
|
|
|
|
return d;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (PurPlanDetailEntity obj:purPlanDetailEntityList){
|
|
|
|
|
|
|
|
obj.setOrderIdFk(purApplyRequest.getId()+"");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean falg= purPlanDetailService.insertPurPlanDetailEntity(purPlanDetailEntityList);
|
|
|
|
|
|
|
|
if(falg){
|
|
|
|
|
|
|
|
//查询申购单
|
|
|
|
|
|
|
|
return ResultVOUtils.success("添加成功");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
return ResultVOUtils.success("添加失败");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 新增计划单
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
|
|
|
@PostMapping("/purchase/plan/add")
|
|
|
|
|
|
|
|
public BaseResponse add() {
|
|
|
|
|
|
|
|
Long userId = customerService.getUserId();
|
|
|
|
|
|
|
|
PurPlanEntity purPlanEntity= new PurPlanEntity();
|
|
|
|
|
|
|
|
purPlanEntity.setCreateUser(userId + "");
|
|
|
|
|
|
|
|
purPlanEntity.setCreateTime(new Date());
|
|
|
|
|
|
|
|
purPlanEntity.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
purPlanEntity.setUpdateUser(userId + "");
|
|
|
|
|
|
|
|
purPlanService.insert(purPlanEntity);
|
|
|
|
|
|
|
|
Long id=purPlanEntity.getId();
|
|
|
|
|
|
|
|
return ResultVOUtils.success(id);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|