01fff184 康伟

kangwei : 采购计划相关接口

1 个父辈 041dcd38
正在显示 25 个修改的文件 包含 352 行增加223 行删除
......@@ -135,13 +135,15 @@ public class PaperController {
@AutoLog(value = "在线考试-发布试卷")
@ApiOperation(value="在线考试-发布试卷", notes="在线考试-发布试卷")
@PutMapping(value = "/publish")
public Result<Paper> publish(@RequestBody Paper paper) {
@GetMapping(value = "/publish")
public Result<Paper> publish(@RequestParam(name="id",required=true) String id) {
Result<Paper> result = new Result<Paper>();
Paper paperEntity = paperService.getById(paper.getId());
if(paperEntity==null) {
Paper paper = paperService.getById(id);
if(paper==null) {
result.error500("未找到对应实体");
}else {
paper.setSendStatus("1");
paper.setSendTime( new Date());
boolean ok = paperService.updateById(paper);
//TODO 返回false说明什么?
if(ok) {
......
......@@ -10,17 +10,13 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.query.QueryGenerator;
import com.skua.core.service.ISequenceService;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.edu.entity.Question;
import com.skua.modules.edu.service.IQuestionService;
import java.util.Date;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.edu.vo.QuestionVO;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
......@@ -94,7 +90,7 @@ public class QuestionController {
@AutoLog(value = "在线考试-试题-添加")
@ApiOperation(value="在线考试-试题-添加", notes="在线考试-试题-添加")
@PostMapping(value = "/add")
public Result<Question> add(@RequestBody QuestionVO question)throws Exception {
public Result<Question> add(@RequestBody Question question)throws Exception {
Result<Question> result = new Result<Question>();
try {
questionService.saveQuestion(question);
......@@ -117,7 +113,7 @@ public class QuestionController {
@AutoLog(value = "在线考试-试题-编辑")
@ApiOperation(value="在线考试-试题-编辑", notes="在线考试-试题-编辑")
@PutMapping(value = "/edit")
public Result<Question> edit(@RequestBody QuestionVO question) throws Exception {
public Result<Question> edit(@RequestBody Question question) throws Exception {
Result<Question> result = new Result<Question>();
Question questionEntity = questionService.getById(question.getId());
if(questionEntity==null) {
......@@ -190,7 +186,7 @@ public class QuestionController {
@GetMapping(value = "/queryById")
public Result<Question> queryById(@RequestParam(name="id",required=true) String id) {
Result<Question> result = new Result<Question>();
Question question = questionService.getById(id);
Question question = questionService.queryById(id);
if(question==null) {
result.error500("未找到对应实体");
}else {
......
......@@ -2,6 +2,8 @@ package com.skua.modules.edu.entity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
......@@ -81,4 +83,15 @@ public class Question {
@Excel(name = "delFlag", width = 15)
@ApiModelProperty(value = "delFlag")
private Integer delFlag;
/**试题分值*/
@TableField(exist=false)
@Excel(name = "试题分值", width = 15)
@ApiModelProperty(value = "试题分值")
private String score;
@TableField(exist=false)
@ApiModelProperty(value = "试题选项集合")
private List<QuestionOption> optionList;
}
......
......@@ -2,9 +2,6 @@ package com.skua.modules.edu.service;
import com.skua.modules.edu.entity.Question;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.edu.vo.QuestionVO;
import java.lang.reflect.InvocationTargetException;
/**
* 在线考试-试题
......@@ -16,12 +13,20 @@ public interface IQuestionService extends IService<Question> {
* @param question
* @return
*/
public int saveQuestion(QuestionVO question)throws Exception;
public int saveQuestion(Question question)throws Exception;
/***
* 修改试题 以及试题选项
* @param question
* @return
*/
public boolean updateQuestion(QuestionVO question) throws Exception ;
public boolean updateQuestion(Question question) throws Exception ;
/***
* 修改试题 以及试题选项
* @param id
* @return
*/
public Question queryById(String id);
}
......
......@@ -7,7 +7,6 @@ import com.skua.modules.edu.mapper.PaperMapper;
import com.skua.modules.edu.mapper.PaperQuestionMapper;
import com.skua.modules.edu.service.IPaperService;
import com.skua.modules.edu.vo.PaperVO;
import com.skua.modules.edu.vo.QuestionVO;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.stereotype.Service;
......@@ -41,10 +40,10 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
// 步骤2:批量插入试题选项集合
PaperQuestion paperQuestion = null;
int index = 1;
if(paperVO.getQuestionVOList() != null ){
for(QuestionVO questionVO :paperVO.getQuestionVOList() ){
if(paperVO.getQuestionList() != null ){
for(Question question :paperVO.getQuestionList() ){
//( String paperId, String questionId, String score, Integer sort )
paperQuestion = new PaperQuestion( paperVO.getId(),questionVO.getId(),questionVO.getScore(), index);
paperQuestion = new PaperQuestion( paperVO.getId(),question.getId(),question.getScore(), index);
paperQuestionMapper.insert( paperQuestion ) ;
}
}
......@@ -71,15 +70,13 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
// 步骤3:批量插入试题选项集合
PaperQuestion paperQuestion = null;
int index = 1;
if(paperVO.getQuestionVOList() != null ){
for(QuestionVO questionVO :paperVO.getQuestionVOList() ){
if(paperVO.getQuestionList() != null ){
for(Question question :paperVO.getQuestionList() ){
//( String paperId, String questionId, String score, Integer sort )
paperQuestion = new PaperQuestion( paperVO.getId(),questionVO.getId(),questionVO.getScore(), index);
paperQuestion = new PaperQuestion( paperVO.getId(),question.getId(),question.getScore(), index);
paperQuestionMapper.insert( paperQuestion ) ;
}
}
return true;
}
......
package com.skua.modules.edu.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.gson.Gson;
import com.skua.modules.edu.entity.Question;
import com.skua.modules.edu.entity.QuestionOption;
import com.skua.modules.edu.mapper.QuestionMapper;
import com.skua.modules.edu.mapper.QuestionOptionMapper;
import com.skua.modules.edu.service.IQuestionService;
import com.skua.modules.edu.vo.QuestionVO;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* 在线考试-试题
......@@ -23,28 +23,24 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
private QuestionOptionMapper optionMapper;
/***
* 添加试题 以及试题选项
* @param questionVO
* @param question
* @return
*/
@Transactional
public int saveQuestion(QuestionVO questionVO)throws Exception{
public int saveQuestion(Question question)throws Exception{
// 步骤1 保存试题表
Question question = new Question();
//将questionVO的属性 赋值给 question
BeanUtils.copyProperties(questionVO, question);
int count = this.baseMapper.insert( question );
// 步骤2:批量插入试题选项集合
if(questionVO.getOptionVOList() != null ){
for(QuestionOption option :questionVO.getOptionVOList() ){
option.setQuestionId( questionVO.getId() ) ;
if(question.getOptionList() != null ){
for(QuestionOption option : question.getOptionList() ){
option.setQuestionId( question.getId() ) ;
optionMapper.insert( option );
}
// 创建Gson实例
Gson gson = new Gson();
// 将List转换为Json字符串
String questionData = gson.toJson( questionVO.getOptionVOList() ) ;
String questionData = gson.toJson( question.getOptionList() ) ;
question.setQuestionData( questionData ) ;
this.baseMapper.updateById( question ) ;
}
......@@ -54,35 +50,45 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
/***
* 修改试题 以及试题选项
* @param questionVO
* @param question
* @return
*/
@Transactional
public boolean updateQuestion(QuestionVO questionVO) throws Exception {
// 步骤1 保存试题表
Question question = new Question();
//将questionVO的属性 赋值给 question
BeanUtils.copyProperties(questionVO, question);
public boolean updateQuestion(Question question) throws Exception {
// 步骤2:根据试题编号删除,试题选项集合
optionMapper.delByQuestionId( questionVO.getId() ) ;
optionMapper.delByQuestionId( question.getId() ) ;
// 步骤3:批量插入试题选项集合
if(questionVO.getOptionVOList() != null ){
for(QuestionOption option :questionVO.getOptionVOList() ){
option.setQuestionId( questionVO.getId() ) ;
if(question.getOptionList() != null ){
for(QuestionOption option :question.getOptionList() ){
option.setQuestionId( question.getId() ) ;
optionMapper.insert( option );
}
// 创建Gson实例
Gson gson = new Gson();
// 将List转换为Json字符串
String questionData = gson.toJson( questionVO.getOptionVOList() ) ;
String questionData = gson.toJson( question.getOptionList() ) ;
question.setQuestionData( questionData ) ;
}
//保存
this.baseMapper.updateById( question );
return true;
}
/***
* 修改试题 以及试题选项
* @param id
* @return
*/
public Question queryById(String id){
Question question = this.baseMapper.selectById(id);
if(question != null ){
LambdaQueryWrapper<QuestionOption> lambda = new LambdaQueryWrapper<QuestionOption>();
lambda.eq(QuestionOption::getQuestionId,id);
List<QuestionOption> userInfoList = optionMapper.selectList(lambda);
question.setOptionList( userInfoList);
}
return question;
}
}
......
......@@ -91,7 +91,7 @@ public class PaperVO {
@ApiModelProperty(value = "试卷试题集合")
private List<QuestionVO> questionVOList;
private List<Question> questionList;
}
......
package com.skua.modules.edu.vo;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.modules.edu.entity.QuestionOption;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* 在线考试-试题
*/
@Data
@ApiModel(value="edu_question数据传输对象", description="在线考试-试题")
public class QuestionVO implements Serializable{
/**主键*/
@ApiModelProperty(value = "主键")
private String id;
/**题库编号*/
@Excel(name = "题库编号", width = 15)
@ApiModelProperty(value = "题库编号")
private String questionDbId;
/**试题标题*/
@Excel(name = "试题标题", width = 15)
@ApiModelProperty(value = "试题标题")
private String questionTitle;
/**试题类型:1 单选、2多选、3判断*/
@Excel(name = "试题类型:1 单选、2多选、3判断", width = 15)
@ApiModelProperty(value = "试题类型:1 单选、2多选、3判断")
private String questionType;
/**正确答案*/
@Excel(name = "正确答案", width = 15)
@ApiModelProperty(value = "正确答案")
private String correct;
/**试题选项Json内容*/
@Excel(name = "试题选项Json内容", width = 15)
@ApiModelProperty(value = "试题选项Json内容")
private String questionData;
/**试题解析*/
@Excel(name = "试题解析", width = 15)
@ApiModelProperty(value = "试题解析")
private String analyzes;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
/**试题分值*/
@Excel(name = "试题分值", width = 15)
@ApiModelProperty(value = "试题分值")
private String score;
@ApiModelProperty(value = "试题选项集合")
private List<QuestionOption> optionVOList;
}
package com.skua.modules.erp.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.query.QueryGenerator;
import com.skua.modules.equipment.service.IEquipmentSparepartService;
import com.skua.modules.erp.entity.ApproveRecord;
import com.skua.modules.supplies.entity.EquipmentSparepartSupplies;
import com.skua.modules.supplies.service.IEquipmentSparepartSuppliesService;
import com.skua.modules.system.entity.SysUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* @auther kangwei
* @create ${year}-09-20-10:18
*/
@Slf4j
@Api(tags="ert通用方法")
@RestController("rrpCommonController")
@RequestMapping("/web/erp/common")
public class ErpCommonController {
@Autowired
private IEquipmentSparepartSuppliesService sparepartSuppliesService;//物料serivce
@AutoLog(value = "ERP-物料列表")
@ApiOperation(value = "ERP-物料列表", notes = "ERP-物料列表")
@RequestMapping(value = "/sparepartList", method = RequestMethod.GET)
public Result<IPage<EquipmentSparepartSupplies>> departUserList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
Result<IPage<EquipmentSparepartSupplies>> result = new Result<IPage<EquipmentSparepartSupplies>>();
Page<EquipmentSparepartSupplies> page = new Page<EquipmentSparepartSupplies>(pageNo, pageSize);
String depId = BaseContextHandler.getRealDepartId();//临时参数
// String username = req.getParameter("username");
IPage<EquipmentSparepartSupplies> pageList = sparepartSuppliesService.queryPageByOut(page, depId);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
}
package com.skua.modules.erp.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
......@@ -16,10 +14,11 @@ import com.skua.core.service.ISequenceService;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.erp.entity.PurchasePlan;
import com.skua.modules.erp.service.IPurchasePlanService;
import java.util.Date;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.erp.vo.PurchasePlanVO;
import com.skua.modules.guest.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
......@@ -56,7 +55,7 @@ public class PurchasePlanController {
* <pre>
* 分页列表查询
* </pre>
* @param purchasePlan
* @param purchasePlanVO
* @param pageNo
* @param pageSize
* @param req
......@@ -69,14 +68,30 @@ public class PurchasePlanController {
@ApiOperation(value="erp采购计划表-分页列表查询", notes="erp采购计划表-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<PurchasePlan>> queryPageList(PurchasePlan purchasePlan,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<PurchasePlan>> result = new Result<IPage<PurchasePlan>>();
QueryWrapper<PurchasePlan> queryWrapper = QueryGenerator.initQueryWrapper(purchasePlan, req.getParameterMap());
QueryWrapper<PurchasePlan> queryWrapper = QueryGenerator.initQueryWrapper(purchasePlan, req.getParameterMap());
Page<PurchasePlan> page = new Page<PurchasePlan>(pageNo, pageSize);
queryWrapper.eq("depart_id", purchasePlan.getDepartId());
/*if(purchasePlanVO.getDepartId() != null ){
queryWrapper.eq("depart_id", purchasePlanVO.getDepartId());
}
if(purchasePlanVO.getStatus() != null ){
queryWrapper.eq("status", purchasePlanVO.getStatus());
}
if(purchasePlanVO.getApplyYear() != null ){
queryWrapper.eq("apply_year", purchasePlanVO.getApplyYear());
}
if(purchasePlanVO.getApplyYear() != null ){
queryWrapper.eq("apply_year", purchasePlanVO.getApplyYear());
}
if(purchasePlanVO.getApplyUser() != null ){
queryWrapper.like("apply_user", purchasePlanVO.getApplyUser());
}*/
queryWrapper.orderByDesc("create_time");
IPage<PurchasePlan> pageList = purchasePlanService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
......@@ -92,8 +107,24 @@ public class PurchasePlanController {
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<PurchasePlan>> result = new Result<IPage<PurchasePlan>>();
QueryWrapper<PurchasePlan> queryWrapper = QueryGenerator.initQueryWrapper(purchasePlan, req.getParameterMap());
QueryWrapper<PurchasePlan> queryWrapper = QueryGenerator.initQueryWrapper(purchasePlan, req.getParameterMap());
Page<PurchasePlan> page = new Page<PurchasePlan>(pageNo, pageSize);
/* queryWrapper.in("depart_id", BaseContextHandler.getDeparts().split(","));
if(purchasePlan.getStatus() != null ){
queryWrapper.eq("status", purchasePlan.getStatus());
}
if(purchasePlan.getApplyYear() != null ){
queryWrapper.eq("apply_year", purchasePlan.getApplyYear());
}
if(purchasePlan.getApplyYear() != null ){
queryWrapper.eq("apply_year", purchasePlan.getApplyYear());
}
if(purchasePlan.getApplyUser() != null ){
queryWrapper.like("apply_user", purchasePlan.getApplyUser());
}*/
queryWrapper.in("depart_id", BaseContextHandler.getDeparts().split(","));
queryWrapper.orderByDesc("create_time");
IPage<PurchasePlan> pageList = purchasePlanService.page(page, queryWrapper);
......@@ -114,10 +145,13 @@ public class PurchasePlanController {
@AutoLog(value = "erp采购计划表-添加")
@ApiOperation(value="erp采购计划表-添加", notes="erp采购计划表-添加")
@PostMapping(value = "/add")
public Result<PurchasePlan> add(@RequestBody PurchasePlan purchasePlan) {
public Result<PurchasePlan> add(@RequestBody PurchasePlanVO purchasePlanVO) {
Result<PurchasePlan> result = new Result<PurchasePlan>();
try {
purchasePlanService.savePurchasePlan(purchasePlan);
purchasePlanVO.setApplyTime(DateUtil.getCurrentDate());
//purchasePlan.setApplyUser(BaseContextHandler.getUserId());
purchasePlanService.savePurchasePlan(purchasePlanVO);
result.success("添加成功!");
} catch (Exception e) {
log.error(e.getMessage(),e);
......@@ -129,7 +163,7 @@ public class PurchasePlanController {
* <pre>
* 编辑
* </pre>
* @param purchasePlan
* @param purchasePlanVO
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
......@@ -137,13 +171,13 @@ public class PurchasePlanController {
@AutoLog(value = "erp采购计划表-编辑")
@ApiOperation(value="erp采购计划表-编辑", notes="erp采购计划表-编辑")
@PutMapping(value = "/edit")
public Result<PurchasePlan> edit(@RequestBody PurchasePlan purchasePlan) {
public Result<PurchasePlan> edit(@RequestBody PurchasePlanVO purchasePlanVO) {
Result<PurchasePlan> result = new Result<PurchasePlan>();
PurchasePlan purchasePlanEntity = purchasePlanService.getById(purchasePlan.getId());
PurchasePlan purchasePlanEntity = purchasePlanService.getById(purchasePlanVO.getId());
if(purchasePlanEntity==null) {
result.error500("未找到对应实体");
}else {
boolean ok = purchasePlanService.updatePurchasePlan(purchasePlan);
boolean ok = purchasePlanService.updatePurchasePlan(purchasePlanVO);
//TODO 返回false说明什么?
if(ok) {
result.success("修改成功!");
......@@ -208,9 +242,9 @@ public class PurchasePlanController {
@AutoLog(value = "erp采购计划表-通过id查询")
@ApiOperation(value="erp采购计划表-通过id查询", notes="erp采购计划表-通过id查询")
@GetMapping(value = "/queryById")
public Result<PurchasePlan> queryById(@RequestParam(name="id",required=true) String id) {
Result<PurchasePlan> result = new Result<PurchasePlan>();
PurchasePlan purchasePlan = purchasePlanService.queryById(id);
public Result<PurchasePlanVO> queryById(@RequestParam(name="id",required=true) String id) {
Result<PurchasePlanVO> result = new Result<PurchasePlanVO>();
PurchasePlanVO purchasePlan = purchasePlanService.queryById(id);
if(purchasePlan==null) {
result.error500("未找到对应实体");
}else {
......@@ -222,16 +256,38 @@ public class PurchasePlanController {
@AutoLog(value = "erp采购计划表-送审")
@ApiOperation(value="erp采购计划表-送审", notes="erp采购计划表-送审")
@GetMapping(value = "/sendAudit")
public Result<PurchasePlan> sendAudit(@RequestParam(name="id",required=true) String id) {
Result<PurchasePlan> result = new Result<PurchasePlan>();
PurchasePlan purchasePlan = null;
try {
purchasePlan = purchasePlanService.getById(id);
purchasePlan.setStatus("1");//提交审核
if(purchasePlan==null) {
result.error500("未找到对应实体");
}
} catch (Exception e) {
log.error("送审失败",e.getMessage());
result.setResult(purchasePlan);
result.setSuccess(true);
}
return result;
}
@AutoLog(value = "erp采购计划表-审批")
@ApiOperation(value="erp采购计划表-审批", notes="erp采购计划表-审批")
@PutMapping(value = "/audit")
public Result<PurchasePlan> auditPurchasePlan(@RequestBody PurchasePlan purchasePlan) {
Result<PurchasePlan> result = new Result<PurchasePlan>();
public Result<PurchasePlanVO> auditPurchasePlan(@RequestBody PurchasePlanVO purchasePlanVO) {
Result<PurchasePlanVO> result = new Result<PurchasePlanVO>();
try {
purchasePlanService.auditPurchasePlan(purchasePlan);
purchasePlanService.auditPurchasePlan(purchasePlanVO);
} catch (Exception e) {
log.error("审批失败",e.getMessage());
result.setResult(purchasePlan);
result.setResult(purchasePlanVO);
result.setSuccess(true);
}
return result;
......
......@@ -96,16 +96,5 @@ public class PurchasePlan implements Serializable{
@ApiModelProperty(value = "删除标识,0:有效,1:删除")
private Integer delFlag;
@TableField(exist=false)
@ApiModelProperty(value = "删除标识,0:有效,1:删除")
private List<PurchasePlanItem> planItemList ;
/**审批人*/
@TableField(exist=false)
@ApiModelProperty(value = "审批意见")
private String approveMessage;
/**审批状态*/
@TableField(exist=false)
@ApiModelProperty(value = "审批状态 1通过2不通过")
private String approveState;
}
......
......@@ -38,7 +38,6 @@ public class PurchasePlanItem implements Serializable{
@ApiModelProperty(value = "物料类别编号")
private String sparepartTypeId;
/**物料编号*/
@Excel(name = "物料编号", width = 15)
@ApiModelProperty(value = "物料编号")
......@@ -63,13 +62,13 @@ public class PurchasePlanItem implements Serializable{
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remarks;
/**版本号*/
@Excel(name = "版本号", width = 15)
@ApiModelProperty(value = "版本号")
private Integer versions;
@Excel(name = "去年出库数量", width = 15)
@ApiModelProperty(value = "去年出库数量")
private Integer outNum;
@Excel(name = "总价", width = 15)
@ApiModelProperty(value = "总价")
private String totalPrice;
......
......@@ -3,6 +3,7 @@ package com.skua.modules.erp.service;
import com.skua.modules.erp.entity.PurchasePlan;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.erp.entity.PurchasePlanItem;
import com.skua.modules.erp.vo.PurchasePlanVO;
import java.util.List;
......@@ -13,17 +14,17 @@ public interface IPurchasePlanService extends IService<PurchasePlan> {
/***
* 新增
* @param purchasePlan
* @param purchasePlanVO
* @return
*/
public int savePurchasePlan(PurchasePlan purchasePlan);
public int savePurchasePlan(PurchasePlanVO purchasePlanVO);
/***
* 修改
* @param purchasePlan
* @param purchasePlanVO
* @return
*/
public boolean updatePurchasePlan(PurchasePlan purchasePlan);
public boolean updatePurchasePlan(PurchasePlanVO purchasePlanVO);
/***
* 删除
......@@ -37,7 +38,7 @@ public interface IPurchasePlanService extends IService<PurchasePlan> {
* @param planId
* @return
*/
public PurchasePlan queryById(String planId);
public PurchasePlanVO queryById(String planId);
/**
* 根据编号获取采购清单集合
......@@ -48,7 +49,7 @@ public interface IPurchasePlanService extends IService<PurchasePlan> {
/***
* 审批 采购计划
* @param purchasePlan
* @param purchasePlanVO
*/
public void auditPurchasePlan(PurchasePlan purchasePlan);
public void auditPurchasePlan(PurchasePlanVO purchasePlanVO);
}
......
......@@ -8,6 +8,8 @@ import com.skua.modules.erp.mapper.ApproveRecordMapper;
import com.skua.modules.erp.mapper.PurchasePlanItemMapper;
import com.skua.modules.erp.mapper.PurchasePlanMapper;
import com.skua.modules.erp.service.IPurchasePlanService;
import com.skua.modules.erp.vo.PurchasePlanVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -29,15 +31,15 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur
private ApproveRecordMapper recordMapper ;
/***
* 新增
* @param purchasePlan
* @param purchasePlanVO
* @return
*/
@Transactional
public int savePurchasePlan(PurchasePlan purchasePlan){
int count = this.baseMapper.insert( purchasePlan );
if(count > 0 && purchasePlan.getPlanItemList() != null && !purchasePlan.getPlanItemList().isEmpty()){
for(PurchasePlanItem planItem : purchasePlan.getPlanItemList()){
planItem.setPlanId( purchasePlan.getId() );
public int savePurchasePlan(PurchasePlanVO purchasePlanVO){
int count = this.baseMapper.insert( purchasePlanVO );
if(count > 0 && purchasePlanVO.getPlanItemList() != null && !purchasePlanVO.getPlanItemList().isEmpty()){
for(PurchasePlanItem planItem : purchasePlanVO.getPlanItemList()){
planItem.setPlanId( purchasePlanVO.getId() );
planItemMapper.insert( planItem );
}
}
......@@ -46,19 +48,19 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur
/***
* 修改
* @param purchasePlan
* @param purchasePlanVO
* @return
*/
@Transactional
public boolean updatePurchasePlan(PurchasePlan purchasePlan){
int count = this.baseMapper.updateById( purchasePlan );
public boolean updatePurchasePlan(PurchasePlanVO purchasePlanVO){
int count = this.baseMapper.updateById( purchasePlanVO );
// ge根据计划编号删除清单集合
planItemMapper.delByPlanId(purchasePlan.getId() ) ;
planItemMapper.delByPlanId(purchasePlanVO.getId() ) ;
if( purchasePlan.getPlanItemList() != null && !purchasePlan.getPlanItemList().isEmpty()){
for(PurchasePlanItem planItem : purchasePlan.getPlanItemList()){
planItem.setPlanId( purchasePlan.getId() );
if( purchasePlanVO.getPlanItemList() != null && !purchasePlanVO.getPlanItemList().isEmpty()){
for(PurchasePlanItem planItem : purchasePlanVO.getPlanItemList()){
planItem.setPlanId( purchasePlanVO.getId() );
planItemMapper.insert( planItem );
}
}
......@@ -84,15 +86,17 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur
* @return
*/
@Transactional
public PurchasePlan queryById(String planId){
public PurchasePlanVO queryById(String planId){
PurchasePlan purchasePlan = this.baseMapper.selectById( planId );
PurchasePlanVO purchasePlanVO = new PurchasePlanVO();
List<PurchasePlanItem> planItemList = planItemMapper.queryListByPlanId( planId );
if(purchasePlan != null ){
purchasePlan.setPlanItemList( planItemList );
BeanUtils.copyProperties(purchasePlan,purchasePlanVO);
List<PurchasePlanItem> planItemList = planItemMapper.queryListByPlanId( planId );
purchasePlanVO.setPlanItemList( planItemList );
}
return purchasePlan;
return purchasePlanVO;
}
/**
......@@ -109,20 +113,29 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur
* @param purchasePlan
*/
@Transactional
public void auditPurchasePlan(PurchasePlan purchasePlan){
public void auditPurchasePlan(PurchasePlanVO purchasePlanVO){
//保存
//purchasePlan.getApproveState() 审批状态 1通过2不通过
if("1".equals( purchasePlan.getApproveState() )){
purchasePlan.setStatus( "3" );
if("1".equals( purchasePlanVO.getApproveState() )){
purchasePlanVO.setStatus( "3" );
}
if("2".equals( purchasePlan.getApproveState() )){
purchasePlan.setStatus( "4" );
if("2".equals( purchasePlanVO.getApproveState() )){
purchasePlanVO.setStatus( "4" );
}
this.baseMapper.updateById( purchasePlan ) ;
this.baseMapper.updateById( purchasePlanVO ) ;
// ge根据计划编号删除清单集合
planItemMapper.delByPlanId(purchasePlanVO.getId() ) ;
if( purchasePlanVO.getPlanItemList() != null && !purchasePlanVO.getPlanItemList().isEmpty()){
for(PurchasePlanItem planItem : purchasePlanVO.getPlanItemList()){
planItem.setPlanId( purchasePlanVO.getId() );
planItemMapper.insert( planItem );
}
}
//审批记录
ApproveRecord record = new ApproveRecord( "CGJH", purchasePlan.getApplyUser(), purchasePlan.getId(), BaseContextHandler.getUserId(), purchasePlan.getApproveMessage(), purchasePlan.getApproveState());
ApproveRecord record = new ApproveRecord( "CGJH", purchasePlanVO.getApplyUser(), purchasePlanVO.getId(), BaseContextHandler.getUserId(), purchasePlanVO.getApproveMessage(), purchasePlanVO.getApproveState());
recordMapper.insert( record ) ;
}
}
......
package com.skua.modules.erp.vo;
public enum ApproveType {
/** 已处理 */
YCL("5"),
/** 处理中(已发起工单) */
CLZ("3"),
/** 未处理 */
NO("0") ;
//0 未发布、1 已发布(审核通知) 2 审核通过,3 审核驳回
private String value;
private ApproveType(String code) {
this.value = code;
}
public String getValue() {
return value;
}
public void setStatusCode(String code) {
this.value = code;
}
}
package com.skua.modules.erp.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.skua.core.aspect.annotation.Dict;
import com.skua.modules.erp.entity.PurchasePlan;
import com.skua.modules.erp.entity.PurchasePlanItem;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.util.List;
/**
* erp采购计划表
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="PurchasePlan查询对象", description="PurchasePlan查询对象")
public class PurchasePlanVO extends PurchasePlan {
@TableField(exist=false)
@ApiModelProperty(value = "采购计划物料清单集合")
private List<PurchasePlanItem> planItemList = null;
/**审批意见*/
@TableField(exist=false)
@ApiModelProperty(value = "审批意见")
private String approveMessage;
/**审批状态*/
@TableField(exist=false)
@ApiModelProperty(value = "审批状态 1通过2不通过")
private String approveState;
}
package com.skua.modules.equipment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.equipment.entity.EquipmentSparepart;
import com.skua.modules.supplies.entity.EquipmentSparepartSupplies;
import org.apache.ibatis.annotations.Param;
/**
......@@ -10,4 +13,6 @@ import org.apache.ibatis.annotations.Param;
public interface EquipmentSparepartMapper extends BaseMapper<EquipmentSparepart> {
Integer updateStorageNumById(@Param("id") String id, @Param("storageNum") Double storageNum, @Param("version") Integer version);
}
......
package com.skua.modules.equipment.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.equipment.entity.EquipmentSparepart;
import com.skua.modules.supplies.entity.EquipmentSparepartSupplies;
/**
* 备品备件表
......@@ -10,4 +13,5 @@ public interface IEquipmentSparepartService extends IService<EquipmentSparepart>
Integer updateStorageNumById(String id, Double storageNum, Integer version);
}
......
package com.skua.modules.equipment.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.skua.modules.equipment.entity.EquipmentSparepart;
import com.skua.modules.equipment.mapper.EquipmentSparepartMapper;
import com.skua.modules.equipment.service.IEquipmentSparepartService;
import com.skua.modules.supplies.entity.EquipmentSparepartSupplies;
import org.springframework.stereotype.Service;
/**
......@@ -17,4 +20,6 @@ public class EquipmentSparepartServiceImpl extends ServiceImpl<EquipmentSparepar
return baseMapper.updateStorageNumById(id, storageNum, version);
}
}
......
......@@ -247,4 +247,13 @@ public class EquipmentSparepartSupplies {
@Dict(dicCode = "yn")
private String isDangerous;
@ApiModelProperty(value = "物料类别名称")
@TableField(exist=false)
private String sparepartTypeName;
@ApiModelProperty(value = "去年出库数量")
@TableField(exist=false)
private String outNum;
}
......
......@@ -2,6 +2,8 @@ package com.skua.modules.supplies.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.supplies.entity.EquipmentSparepartSupplies;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -10,5 +12,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* 物料信息表
*/
public interface EquipmentSparepartSuppliesMapper extends BaseMapper<EquipmentSparepartSupplies> {
/***
* 物料列表+去年出库
* @param page
* @param depId
* @return
*/
public IPage<EquipmentSparepartSupplies> queryPageByOut(Page<EquipmentSparepartSupplies> page, String depId);
}
......
......@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.supplies.mapper.EquipmentSparepartSuppliesInspectMapper">
<select id="pageQuery" resultType="com.skua.modules.supplies.vo.EquipmentSuppliesInspectQueryVO">
<select id="" resultType="com.skua.modules.supplies.vo.EquipmentSuppliesInspectQueryVO">
select
inspect.id,
inspect.inspect_order inspectOrder,
......
......@@ -2,4 +2,16 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.supplies.mapper.EquipmentSparepartSuppliesMapper">
<!-- 物料列表+去年出库 -->
<select id="queryPageByOut" resultType="com.skua.modules.supplies.entity.EquipmentSparepartSupplies">
select st.item_text 'sparepart_type_name' , aaa.out_num, ss.* from equipment_sparepart_supplies ss
left join equipment_sparepart_type st on ss.sparepart_type = st.id
left join (
select sum(out_num) out_num ,sparepart_id from equipment_out_child
where
YEAR(create_time) = YEAR(CURRENT_DATE - INTERVAL 1 YEAR)
group by sparepart_id
) aaa on aaa.sparepart_id = ss.id
</select>
</mapper>
\ No newline at end of file
......
package com.skua.modules.supplies.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.supplies.entity.EquipmentSparepartSupplies;
import com.baomidou.mybatisplus.extension.service.IService;
......@@ -7,5 +9,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
* 物料信息表
*/
public interface IEquipmentSparepartSuppliesService extends IService<EquipmentSparepartSupplies> {
/***
* 物料列表+去年出库
* @param page
* @param depId
* @return
*/
public IPage<EquipmentSparepartSupplies> queryPageByOut(Page<EquipmentSparepartSupplies> page, String depId);
}
......
package com.skua.modules.supplies.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.supplies.entity.EquipmentSparepartSupplies;
import com.skua.modules.supplies.mapper.EquipmentSparepartSuppliesMapper;
import com.skua.modules.supplies.service.IEquipmentSparepartSuppliesService;
......@@ -12,5 +14,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
*/
@Service
public class EquipmentSparepartSuppliesServiceImpl extends ServiceImpl<EquipmentSparepartSuppliesMapper, EquipmentSparepartSupplies> implements IEquipmentSparepartSuppliesService {
/***
* 物料列表+去年出库
* @param page
* @param depId
* @return
*/
public IPage<EquipmentSparepartSupplies> queryPageByOut(Page<EquipmentSparepartSupplies> page, String depId){
return baseMapper.queryPageByOut(page,depId);
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!