aea41295 张雷

Merge remote-tracking branch 'origin/master' into master

2 个父辈 a8f11427 cf4bb5e0
正在显示 58 个修改的文件 包含 1279 行增加177 行删除
......@@ -10,9 +10,7 @@ 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.Paper;
import com.skua.modules.edu.service.IPaperService;
......
......@@ -142,7 +142,13 @@ public class QuestionController {
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
try {
questionService.removeById(id);
boolean isUse = questionService.checkByPaper(id);
if(isUse){//true被使用
return Result.error("删除失败!试题被试卷使用");
}else{
questionService.removeById(id);
}
} catch (Exception e) {
log.error("删除失败",e.getMessage());
return Result.error("删除失败!");
......
......@@ -7,15 +7,18 @@ 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.modules.edu.entity.Paper;
import com.skua.modules.edu.entity.Question;
import com.skua.modules.edu.entity.QuestionOption;
import com.skua.modules.edu.entity.UserPaper;
import com.skua.core.util.DateUtils;
import com.skua.modules.common.service.ICommonSqlService;
import com.skua.modules.edu.entity.*;
import com.skua.modules.edu.service.IPaperService;
import com.skua.modules.edu.service.IUserPaperService;
import com.skua.modules.edu.vo.PaperVO;
import com.skua.modules.edu.vo.UserPaperVO;
import com.skua.modules.equipment.pojo.Equipment;
import com.skua.modules.equipment.util.EquipmentUtils;
import com.skua.modules.equipment.vo.EquipmentVO;
import com.skua.modules.guest.util.DateUtil;
import com.skua.tool.util.JoinSqlUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -34,6 +37,8 @@ import java.io.IOException;
import java.math.BigInteger;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Slf4j
@Api(tags="在线考试-用户考试")
......@@ -46,28 +51,53 @@ public class UserPaperController {
@Autowired
private IUserPaperService userPaperService;
// 我的 考试
@AutoLog(value = "在线考试--试卷列表")
@ApiOperation(value="在线考试--试卷列表", notes="在线考试--试卷列表")
@GetMapping(value = "/paperList")
public Result<IPage<Paper>> queryPageList(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
public Result<IPage<Paper>> queryPageList(Paper paper,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
HttpServletRequest req) throws Exception{
Result<IPage<Paper>> result = new Result<IPage<Paper>>();
QueryWrapper<Paper> queryWrapper = new QueryWrapper<>() ;// QueryGenerator.initQueryWrapper(paperAnswer, req.getParameterMap());
//QueryWrapper<Paper> queryWrapper = new QueryWrapper<>() ;// QueryGenerator.initQueryWrapper(paperAnswer, req.getParameterMap());
Page<Paper> page = new Page<Paper>(pageNo, pageSize);
queryWrapper.like("exam_user_ids", BaseContextHandler.getUserId());
/* queryWrapper.like("exam_user_ids", BaseContextHandler.getUserId());
queryWrapper.eq("send_status","1");//已发布的状态
String currentDate = DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss");
queryWrapper.le("start_time",currentDate);// 当前时间 > 开始结束时间
queryWrapper.ge("end_time",currentDate);
IPage<Paper> pageList = paperService.page(page, queryWrapper);
IPage<Paper> pageList = paperService.page(page, queryWrapper);*/
paper.setUserId(BaseContextHandler.getUserId());
paper.setStartTime(DateUtils.now());
paper.setEndTime( DateUtils.now() );
IPage<Paper> pageList = paperService.queryMyPaperByList(page ,paper);
result.setSuccess(true);
result.setResult(pageList);
return result;
/* String currentDate = DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss");
StringBuffer sql = new StringBuffer();
sql.append("select aaa.* from ( ");
sql.append(" select ifnull(up.user_id ,0) 'user_id', ifnull(count(up.id) ,0) as user_count, d.depart_name , p.* from edu_paper p ");
sql.append(" left join edu_user_paper up on p.id = up.paper_id ");
sql.append(" left join sys_depart d on p.depart_id = d.id");
sql.append(" where p.send_status =1 and p.exam_user_ids like '%"+BaseContextHandler.getUserId()+"%'");
if( paper.getDepartId() != null && paper.getDepartId().length() > 0){
sql.append(" and p.depart_id= '"+paper.getDepartId()+"' ");
}
if( paper.getPaperTitle() != null && paper.getPaperTitle().length() > 0){
sql.append(" and p.paper_title like '%"+paper.getPaperTitle()+"%' ");
}
if( paper.getDepartId() != null && paper.getDepartId().length() > 0){
sql.append(" and p.depart_id= '"+paper.getDepartId()+"' ");
}
sql.append(" and p.send_time >= '"+currentDate+"' and and p.send_time <= '"+currentDate+"'");
sql.append(" )aaa where aaa.user_id = 0 ");
// 分页查询
Page<Map<String, Object>> pageList = iCommonSqlService.queryForPage(page, sql.toString());
List<Paper> paperList = JoinSqlUtils.multiMaps2Beans(pageList.getRecords(), Paper.class);
//List<Paper> paperList = EquipmentUtils.equipEntities2VOs(dataList);
*/
}
// 根据试卷获取试题
......@@ -76,20 +106,21 @@ public class UserPaperController {
@GetMapping(value = "/startExam")
public Result<PaperVO> startExam(@RequestParam(name="id",required=true) String id) {
Result<PaperVO> result = new Result<PaperVO>();
Boolean flag = paperService.checkExamCount(id,BaseContextHandler.getUserId());
PaperVO paperVO = paperService.queryById(id);
if(paperVO == null) {
result.error500("未找到对应实体");
}else if( paperVO!= null && !"1".equals(paperVO.getSendStatus() ) ) {
result.error500("试卷未发布!");
}else{
result.setResult(paperVO);
result.setSuccess(true);
}
/* Boolean flag = paperService.checkExamCount(id,BaseContextHandler.getUserId());
if(flag){
PaperVO paperVO = paperService.queryById(id);
if(paperVO == null) {
result.error500("未找到对应实体");
}else if( paperVO!= null && !"1".equals(paperVO.getSendStatus() ) ) {
result.error500("试卷未发布!");
}else{
result.setResult(paperVO);
result.setSuccess(true);
}
}else{
result.error500("考试次数已用完!不能参加考试");
}
}*/
return result;
}
// 在线答题
......@@ -103,10 +134,13 @@ public class UserPaperController {
Result<UserPaperVO> result = new Result<UserPaperVO>();
String paperScore = "0";
try {
userPaperVO.setEndTime(DateUtil.getCurrentDate());
userPaperVO.setEndTime(DateUtils.now());
userPaperVO.setUserId(BaseContextHandler.getUserId());//考试人编号
paperScore = paperService.submitPaper(userPaperVO);
userPaperVO.setScore( paperScore );
//计算排名
userPaperService.changeRankByPaperId(userPaperVO.getPaperId() ) ;
result.setResult( userPaperVO );
result.success("交卷成功!");
} catch (Exception e) {
......@@ -127,24 +161,29 @@ public class UserPaperController {
@AutoLog(value = "在线考试--历史试卷列表")
@ApiOperation(value="在线考试--历史试卷列表", notes="在线考试--历史试卷列表")
@GetMapping(value = "/historyList")
public Result<IPage<UserPaper>> historyList(
@RequestParam(name="paperId",required=true) String paperId,
@RequestParam(name="userId") String userId,
public Result<IPage<Paper>> historyList(
Paper paper,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<UserPaper>> result = new Result<IPage<UserPaper>>();
QueryWrapper<UserPaper> queryWrapper = new QueryWrapper<>() ;// QueryGenerator.initQueryWrapper(paperAnswer, req.getParameterMap());
Page<UserPaper> page = new Page<UserPaper>(pageNo, pageSize);
queryWrapper.eq("paper_id",paperId);
if(userId == null ){
userId = BaseContextHandler.getUserId();
}
queryWrapper.eq("user_id",userId);//已发布的状态
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) throws Exception {
Result<IPage<Paper>> result = new Result<IPage<Paper>>();
/* StringBuffer sql = new StringBuffer();
sql.append("select up.score, p.* from edu_user_paper up ");
sql.append(" left join edu_paper p on p.id = up.paper_id ");
sql.append(" where up.user_id = '"+BaseContextHandler.getUserId()+"' ");
// 分页查询
Page page = new Page(pageNo, pageSize);
Page<Map<String, Object>> pageList = iCommonSqlService.queryForPage(page, sql.toString());
List<Paper> paperList = JoinSqlUtils.multiMaps2Beans(pageList.getRecords(), Paper.class);
*/
IPage<UserPaper> pageList = userPaperService.page(page, queryWrapper);
Page<Paper> page = new Page<Paper>(pageNo, pageSize);
paper.setUserId(BaseContextHandler.getUserId());//获取当前用户编号
IPage<Paper> paperList = paperService.queryMyPaperRecoredByList(page,paper);
result.setResult(paperList);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
//历史试卷详情 history_detail
......@@ -214,7 +253,7 @@ public class UserPaperController {
paragraphOption = document.createParagraph();
setHight( paragraphOption , "500" );
optionRun = paragraphOption.createRun();
optionRun.setText(" "+option.getAlias()+"."+ option.getOptionTitle());
optionRun.setText(" "+option.getAlias()+". "+ option.getOptionTitle());
}
}
index++;
......
......@@ -127,4 +127,33 @@ public class Paper {
@ApiModelProperty(value = "delFlag")
private Integer delFlag;
@TableField(exist=false)
@ApiModelProperty(value = "考试人次")
private Integer userCount ;
@TableField(exist=false)
@ApiModelProperty(value = "扩展:考试人员")
private String userId;
@TableField(exist=false)
@ApiModelProperty(value = "扩展:考试分数")
private String score;
@TableField(exist=false)
@ApiModelProperty(value = "扩展:考试名次")
private String rank;
@TableField(exist=false)
@ApiModelProperty(value = "扩展:用户考试试卷编号")
private String userPaperId;
@TableField(exist=false)
@ApiModelProperty(value = "别名:试卷编号")
private String paperId;
public String getPaperId() {
return id;
}
}
......
......@@ -2,6 +2,8 @@ package com.skua.modules.edu.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.edu.entity.Paper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -10,5 +12,20 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* 在线考试-试卷
*/
public interface PaperMapper extends BaseMapper<Paper> {
/***
* 我的试卷列表
* @param page
* @param paper
* @return
*/
IPage<Paper> queryMyPaperByList(Page<Paper> page, @Param("param") Paper paper);
/***
* 我的试卷记录
* @param page
* @param paper
* @return
*/
IPage<Paper> queryMyPaperRecoredByList(Page<Paper> page, @Param("param") Paper paper);
}
......
......@@ -25,4 +25,10 @@ public interface QuestionMapper extends BaseMapper<Question> {
*/
public List<Question> selectListByPaperIdAndUserId(@Param("paperId") String paperId,@Param("userPaperId") String userPaperId);
/***
* 校验试题是否被试卷使用
* @param questionId
* @return
*/
public int checkByPaper(@Param("questionId")String questionId);
}
......
......@@ -27,4 +27,12 @@ public interface UserPaperMapper extends BaseMapper<UserPaper> {
public UserPaper queryLastOne(String paperId, String userId);
public int queryPaperCount(String paperId, String userId);
/***
* 设置试卷的考试排名
* @param paperId
* @return
*/
public int changeRankByPaperId( @Param("paperId") String paperId);
}
......
......@@ -2,4 +2,36 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.edu.mapper.PaperMapper">
<!-- 我的考试列表 -->
<select id="queryMyPaperByList" resultType="com.skua.modules.edu.entity.Paper">
select d.depart_name ,p.*,( select count(1) from edu_user_paper up where up.paper_id = p.id ) 'user_count'
from edu_paper p
left join sys_depart d on p.depart_id = d.id
where
p.send_status =1
<if test="param.userId != null and param.userId !=''">
and p.exam_user_ids like CONCAT('%',#{param.userId},'%')
</if>
<if test="param.departId != null and param.departId !=''">
and p.depart_id = #{param.departId}
</if>
and p.id NOT in ( select DISTINCT p1.id
from edu_user_paper up , edu_paper p1
where up.paper_id = p1.id and up.user_id = #{param.userId}
)
<!-- <if test="param.startTime != null and param.startTime !=''">
and p.start_time &lt;= #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime !=''">
and p.end_time &gt;= #{param.endTime}
</if>-->
</select>
<!-- 考试记录-->
<select id="queryMyPaperRecoredByList" resultType="com.skua.modules.edu.entity.Paper">
select up.score, up.rank,up.id as 'user_paper_id', p.* from edu_user_paper up
left join edu_paper p on p.id = up.paper_id
where up.user_id = #{param.userId}
order by up.start_time desc
</select>
</mapper>
\ No newline at end of file
......
......@@ -19,7 +19,9 @@
where pq.paper_id = #{paperId}
</select>
<select id="checkByPaper" resultType="java.lang.Integer">
select count(1) from edu_paper_question where question_id =#{questionId}
</select>
</mapper>
\ No newline at end of file
......
......@@ -4,9 +4,10 @@
<!-- 校对答案,设置试题分值-->
<update id="checkAnswerByUserPaperId" >
update edu_user_answer ua , edu_question q ,edu_paper_question pq
update edu_user_answer ua , edu_question q ,edu_paper_question pq
set ua.score = pq.score
where ua.user_paper_id = #{userPaperId} and ua.question_id = q.id and ua.answer = q.question_answer and pq.question_id = ua.question_id ;
where q.id = ua.question_id and q.id = pq.question_id and ua.paper_id = pq.paper_id
and ua.user_paper_id =#{userPaperId}
</update>
</mapper>
\ No newline at end of file
......
......@@ -9,7 +9,7 @@
<select id="queryLastOne" resultType="com.skua.modules.edu.entity.UserPaper">
select t.* from edu_user_answer t where t.paper_id = #{paperId} and t.user_id = #{userId}
select t.* from edu_user_answer t where t.paper_id = #{paperId} and t.user_id = #{userId} limit 1
</select>
......@@ -17,4 +17,18 @@
select IFNULL(count(1 ),'0') as 'userExamCount' from edu_user_answer where paper_id = #{paperId} and user_id = #{userId}
</select>
<!-- 设置试卷的考试排名-->
<update id="changeRankByPaperId" >
update edu_user_paper up ,(
SELECT
a.user_id ,
( SELECT count( DISTINCT b.score ) + 1 FROM edu_user_paper b WHERE b.score > a.score and b.paper_id = #{paperId} ) sort
FROM
edu_user_paper a
where a.paper_id = #{paperId}
)aaa set up.rank = aaa.sort
where up.paper_id =#{paperId} and up.user_id = aaa.user_id
</update>
</mapper>
\ No newline at end of file
......
package com.skua.modules.edu.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.edu.entity.Paper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.edu.entity.Question;
......@@ -56,4 +58,21 @@ public interface IPaperService extends IService<Paper> {
* @return
*/
public Boolean checkExamCount(String paperId, String userId);
/***
* 我的试卷列表
* @param page
* @param paper
* @return
*/
IPage<Paper> queryMyPaperByList(Page<Paper> page, Paper paper);
/***
* 我的试卷记录
* @param page
* @param paper
* @return
*/
IPage<Paper> queryMyPaperRecoredByList(Page<Paper> page, Paper paper);
}
......
......@@ -29,4 +29,12 @@ public interface IQuestionService extends IService<Question> {
* @return
*/
public Question queryById(String id);
/***
* 校验 试题是否被试卷使用,如果使用返回true,未使用返回false
* @param questionId
* @return
*/
public boolean checkByPaper(String questionId);
}
......
......@@ -2,10 +2,16 @@ package com.skua.modules.edu.service;
import com.skua.modules.edu.entity.UserPaper;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
/**
* 在线考试
*/
public interface IUserPaperService extends IService<UserPaper> {
/***
* 设置试卷的考试排名
* @param paperId
* @return
*/
public int changeRankByPaperId( String paperId);
}
......
package com.skua.modules.edu.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.skua.core.context.BaseContextHandler;
......@@ -96,17 +98,17 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
PaperVO paperVO = new PaperVO();//
if( paper != null ){
BeanUtils.copyProperties(paper, paperVO);
List<Question> questionList = questionMapper.selectListByPaperId(id);
List<QuestionOption> optionList = null;
if(questionList != null && !questionList.isEmpty()){
// 创建Gson实例
Gson gson = new Gson();
Type questionTypeListType = new TypeToken<List<QuestionOption>>() {}.getType();
for( Question question : questionList){
optionList = gson.fromJson(question.getQuestionData(),questionTypeListType);
question.setOptionList(optionList );
}
}
List<Question> questionList = questionMapper.selectListByPaperId(id);
List<QuestionOption> optionList = null;
if(questionList != null && !questionList.isEmpty()){
// 创建Gson实例
Gson gson = new Gson();
Type questionTypeListType = new TypeToken<List<QuestionOption>>() {}.getType();
for( Question question : questionList){
optionList = gson.fromJson(question.getQuestionData(),questionTypeListType);
question.setOptionList(optionList );
}
}
paperVO.setQuestionList(questionList);
}
return paperVO;
......@@ -159,6 +161,25 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
}
/***
* 我的试卷列表
* @param page
* @param paper
* @return
*/
public IPage<Paper> queryMyPaperByList(Page<Paper> page, Paper paper){
return this.baseMapper.queryMyPaperByList(page,paper) ;
}
/***
* 我的试卷记录
* @param page
* @param paper
* @return
*/
public IPage<Paper> queryMyPaperRecoredByList(Page<Paper> page, Paper paper){
return this.baseMapper.queryMyPaperRecoredByList(page,paper) ;
}
/***
* 交卷
* @param paperVO
*/
......@@ -187,14 +208,10 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
userPaperMapper.updateById( userPaper);
//计算分数
// answer.setScore( totalScore );
// answerMapper.updateById( answer ) ;
// answer.setScore( totalScore );
// answerMapper.updateById( answer ) ;
return totalScore;
}
/* public String queryPaperScore(String paperId,String userId){
}*/
}
......
......@@ -91,4 +91,14 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
return question;
}
/***
* 校验 试题是否被试卷使用
* @param questionId
* @return
*/
public boolean checkByPaper(String questionId){
int count = this.baseMapper.checkByPaper( questionId );
return count > 0?true:false;
}
}
......
......@@ -12,5 +12,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
*/
@Service
public class UserPaperServiceImpl extends ServiceImpl<UserPaperMapper, UserPaper> implements IUserPaperService {
/***
* 设置试卷的考试排名
* @param paperId
* @return
*/
public int changeRankByPaperId( String paperId){
return this.baseMapper.changeRankByPaperId(paperId);
}
}
......
......@@ -28,7 +28,6 @@ public class PaperVO extends Paper {
@ApiModelProperty(value = "试卷试题集合")
private List<Question> questionList;
@ApiModelProperty(value = "参加考试人员")
private String userId;
}
......
......@@ -73,6 +73,20 @@ public class DistributContractController {
return result;
}
@AutoLog(value = "erp分销合同-列表查询")
@ApiOperation(value="erp分销合同-列表查询", notes="erp分销合同-列表查询")
@GetMapping(value = "/disContractList")
public Result<List<DistributContract>> queryPageList(DistributContract distributContract,
HttpServletRequest req) {
Result<List<DistributContract>> result = new Result<List<DistributContract>>();
QueryWrapper<DistributContract> queryWrapper = QueryGenerator.initQueryWrapper(distributContract, req.getParameterMap());
List<DistributContract> dataList = distributContractService.list(queryWrapper);
result.setSuccess(true);
result.setResult(dataList);
return result;
}
@AutoLog(value = "erp分销合同-添加")
@ApiOperation(value="erp分销合同-添加", notes="erp分销合同-添加")
@PostMapping(value = "/add")
......@@ -151,6 +165,37 @@ public class DistributContractController {
}
@AutoLog(value = "erp分销合同-通过id查询")
@ApiOperation(value="erp分销合同-通过id查询", notes="erp分销合同-通过id查询")
@GetMapping(value = "/sendAudit")
public Result<DistributContractVO> sendAudit(@RequestParam(name="id",required=true) String id) {
Result<DistributContractVO> result = new Result<DistributContractVO>();
DistributContractVO distributContract = distributContractService.queryById(id);
if(distributContract==null) {
result.error500("未找到对应实体");
}else {
distributContract.setStatus("1");
distributContractService.updateById( distributContract);
result.setResult(distributContract);
result.setSuccess(true);
}
return result;
}
@AutoLog(value = "erp分销合同-审批")
@ApiOperation(value="erp分销合同-审批", notes="erp分销合同-审批")
@PutMapping(value = "/audit")
public Result<DistributContract> audit(@RequestBody DistributContractVO distributContract) {
Result<DistributContract> result = new Result<DistributContract>();
try {
distributContractService.auditDistributContract(distributContract);
} catch (Exception e) {
log.error("审批失败",e.getMessage());
result.setResult(distributContract);
result.setSuccess(true);
}
return result;
}
@AutoLog(value = "erp分销合同-采购物料列表")
@ApiOperation(value="erp分销合同-采购物料列表", notes="erp分销合同-采购物料列表")
@GetMapping(value = "/purchaseMaterialList")
......
......@@ -77,12 +77,14 @@ public class ErpCommonController {
@ApiOperation(value = "ERP-采购合同--物料清单药剂入库使用()", notes = "ERP-采购合同--物料清单(药剂入库使用)")
@RequestMapping(value = "/queryPurchaseMaterialListByIn", method = RequestMethod.GET)
public Result<IPage<PurchaseMaterialVO>> queryPurchaseMaterialListByIn(
MaterialSearchVO materialSearchVO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
Result<IPage<PurchaseMaterialVO>> result = new Result<IPage<PurchaseMaterialVO>>();
Page<PurchaseMaterialVO> page = new Page<PurchaseMaterialVO>(pageNo, pageSize);
String departId = BaseContextHandler.getRealDepartId();//当前部门编号
IPage<PurchaseMaterialVO> pageList = purchaseMaterialService.queryPurchaseMaterialListByIn(page,departId);
//String departId = BaseContextHandler.getRealDepartId();//当前部门编号
materialSearchVO.setDepartId( BaseContextHandler.getRealDepartId() );
IPage<PurchaseMaterialVO> pageList = purchaseMaterialService.queryPurchaseMaterialListByIn(page,materialSearchVO);
result.setSuccess(true);
result.setResult(pageList);
return result;
......
......@@ -10,18 +10,16 @@ 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.erp.entity.MaterialAcceptanceForm;
import com.skua.modules.erp.service.IMaterialAcceptanceFormService;
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 lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
......@@ -45,7 +43,7 @@ import io.swagger.annotations.ApiOperation;
* @version V0.1, 开发时间
*/
@Slf4j
@Api(tags="物料验收单")
@Api(tags="erp--物料验收单")
@RestController("webMaterialAcceptanceFormController")
@RequestMapping("/web/erp/materialAcceptanceForm")
public class MaterialAcceptanceFormController {
......@@ -65,8 +63,8 @@ public class MaterialAcceptanceFormController {
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "物料验收单-分页列表查询")
@ApiOperation(value="物料验收单-分页列表查询", notes="物料验收单-分页列表查询")
@AutoLog(value = "erp--物料验收单-分页列表查询")
@ApiOperation(value="erp--物料验收单-分页列表查询", notes="erp--物料验收单-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MaterialAcceptanceForm>> queryPageList(MaterialAcceptanceForm materialAcceptanceForm,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
......@@ -90,12 +88,25 @@ public class MaterialAcceptanceFormController {
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "物料验收单-添加")
@ApiOperation(value="物料验收单-添加", notes="物料验收单-添加")
@AutoLog(value = "erp--物料验收单-添加")
@ApiOperation(value="erp--物料验收单-添加", notes="erp--物料验收单-添加")
@PostMapping(value = "/add")
public Result<MaterialAcceptanceForm> add(@RequestBody MaterialAcceptanceForm materialAcceptanceForm) {
Result<MaterialAcceptanceForm> result = new Result<MaterialAcceptanceForm>();
try {
/*materialAcceptanceForm.setConfirmStatus("1");
if(StringUtils.isNotBlank(materialAcceptanceForm.getSenderSign()) && StringUtils.isNotBlank(materialAcceptanceForm.getReceiverSign()) ){
materialAcceptanceForm.setConfirmStatus("2");
}*/
if(StringUtils.isNotBlank(materialAcceptanceForm.getReceiverSign())){
materialAcceptanceForm.setConfirmStatus("1");
}
if(StringUtils.isNotBlank(materialAcceptanceForm.getSenderSign())){
materialAcceptanceForm.setConfirmStatus("2");
}
if(StringUtils.isNotBlank(materialAcceptanceForm.getSenderSign()) && StringUtils.isNotBlank(materialAcceptanceForm.getReceiverSign()) ){
materialAcceptanceForm.setConfirmStatus("9");
}
materialAcceptanceFormService.save(materialAcceptanceForm);
result.success("添加成功!");
} catch (Exception e) {
......@@ -113,24 +124,35 @@ public class MaterialAcceptanceFormController {
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "物料验收单-编辑")
@ApiOperation(value="物料验收单-编辑", notes="物料验收单-编辑")
@AutoLog(value = "erp--物料验收单-编辑")
@ApiOperation(value="erp--物料验收单-编辑", notes="erp--物料验收单-编辑")
@PutMapping(value = "/edit")
public Result<MaterialAcceptanceForm> edit(@RequestBody MaterialAcceptanceForm materialAcceptanceForm) {
Result<MaterialAcceptanceForm> result = new Result<MaterialAcceptanceForm>();
/* */
if(StringUtils.isNotBlank(materialAcceptanceForm.getReceiverSign())){
materialAcceptanceForm.setConfirmStatus("1");
}
if(StringUtils.isNotBlank(materialAcceptanceForm.getSenderSign())){
materialAcceptanceForm.setConfirmStatus("2");
}
if(StringUtils.isNotBlank(materialAcceptanceForm.getSenderSign()) && StringUtils.isNotBlank(materialAcceptanceForm.getReceiverSign()) ){
materialAcceptanceForm.setConfirmStatus("9");
}
MaterialAcceptanceForm materialAcceptanceFormEntity = materialAcceptanceFormService.getById(materialAcceptanceForm.getId());
if(materialAcceptanceFormEntity==null) {
result.error500("未找到对应实体");
//result.error500("未找到对应实体");
materialAcceptanceFormService.save(materialAcceptanceForm);
}else {
boolean ok = materialAcceptanceFormService.updateById(materialAcceptanceForm);
//TODO 返回false说明什么?
if(ok) {
result.success("修改成功!");
}
materialAcceptanceFormService.updateById(materialAcceptanceForm);
}
//TODO 返回false说明什么?
result.success("修改成功!");
return result;
}
/**
* <pre>
* 通过id删除
......@@ -140,8 +162,8 @@ public class MaterialAcceptanceFormController {
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "物料验收单-通过id删除")
@ApiOperation(value="物料验收单-通过id删除", notes="物料验收单-通过id删除")
@AutoLog(value = "erp--物料验收单-通过id删除")
@ApiOperation(value="erp--物料验收单-通过id删除", notes="erp--物料验收单-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
try {
......@@ -152,29 +174,6 @@ public class MaterialAcceptanceFormController {
}
return Result.ok("删除成功!");
}
/**
* <pre>
* 批量删除
* </pre>
* @param ids
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "物料验收单-批量删除")
@ApiOperation(value="物料验收单-批量删除", notes="物料验收单-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<MaterialAcceptanceForm> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
Result<MaterialAcceptanceForm> result = new Result<MaterialAcceptanceForm>();
if(ids==null || "".equals(ids.trim())) {
result.error500("参数不识别!");
}else {
this.materialAcceptanceFormService.removeByIds(Arrays.asList(ids.split(",")));
result.success("删除成功!");
}
return result;
}
/**
* <pre>
* 通过id查询
......@@ -184,21 +183,63 @@ public class MaterialAcceptanceFormController {
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "物料验收单-通过id查询")
@ApiOperation(value="物料验收单-通过id查询", notes="物料验收单-通过id查询")
@AutoLog(value = "erp--物料验收单-通过id查询")
@ApiOperation(value="erp--物料验收单-通过id查询", notes="erp--物料验收单-通过id查询")
@GetMapping(value = "/queryById")
public Result<MaterialAcceptanceForm> queryById(@RequestParam(name="id",required=true) String id) {
Result<MaterialAcceptanceForm> result = new Result<MaterialAcceptanceForm>();
MaterialAcceptanceForm materialAcceptanceForm = materialAcceptanceFormService.getById(id);
if(materialAcceptanceForm==null) {
//result.error500("未找到对应实体");
materialAcceptanceForm = new MaterialAcceptanceForm();
materialAcceptanceForm.setId(id);
}
result.setResult(materialAcceptanceForm);
result.setSuccess(true);
return result;
}
@AutoLog(value = "erp--物料验收单-送货/供方人员签字")
@ApiOperation(value="erp--物料验收单-送货/供方人员签字", notes="erp--物料验收单-送货/供方人员签字")
@PutMapping(value = "/senderSign")
public Result<MaterialAcceptanceForm> senderSign(@RequestBody MaterialAcceptanceForm acceptanceForm) {
Result<MaterialAcceptanceForm> result = new Result<MaterialAcceptanceForm>();
MaterialAcceptanceForm materialAcceptanceFormEntity = materialAcceptanceFormService.getById(acceptanceForm.getId());
if(materialAcceptanceFormEntity==null) {
result.error500("未找到对应实体");
}else {
acceptanceForm.setConfirmStatus("2");
boolean ok = materialAcceptanceFormService.updateById(acceptanceForm);
//TODO 返回false说明什么?
if(ok) {
result.success("修改成功!");
}
}
return result;
}
@AutoLog(value = "erp--物料验收单-收货人员签字")
@ApiOperation(value="erp--物料验收单-收货人员签字", notes="erp--物料验收单-收货人员签字")
@PutMapping(value = "/receiverSign")
public Result<MaterialAcceptanceForm> receiverSign(@RequestBody MaterialAcceptanceForm acceptanceForm) {
Result<MaterialAcceptanceForm> result = new Result<MaterialAcceptanceForm>();
MaterialAcceptanceForm materialAcceptanceFormEntity = materialAcceptanceFormService.getById(acceptanceForm.getId());
if(materialAcceptanceFormEntity==null) {
result.error500("未找到对应实体");
}else {
result.setResult(materialAcceptanceForm);
result.setSuccess(true);
acceptanceForm.setConfirmStatus("1");
boolean ok = materialAcceptanceFormService.updateById(acceptanceForm);
//TODO 返回false说明什么?
if(ok) {
result.success("修改成功!");
}
}
return result;
}
/**
* <pre>
* 导出excel
......
......@@ -12,15 +12,16 @@ 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.erp.entity.MaterialIN;
import com.skua.modules.erp.service.IMaterialINService;
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.MaterialINVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
......@@ -44,7 +45,7 @@ import io.swagger.annotations.ApiOperation;
* @version V0.1, 开发时间
*/
@Slf4j
@Api(tags="物料(药剂)入库")
@Api(tags="erp-物料(药剂)入库")
@RestController("webMaterialINController")
@RequestMapping("/web/erp/materialIN")
public class MaterialINController {
......@@ -64,22 +65,74 @@ public class MaterialINController {
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "物料(药剂)入库-分页列表查询")
@ApiOperation(value="物料(药剂)入库-分页列表查询", notes="物料(药剂)入库-分页列表查询")
@AutoLog(value = "erp--物料(药剂)入库-分页列表查询")
@ApiOperation(value="erp--物料(药剂)入库-分页列表查询", notes="erp--物料(药剂)入库-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MaterialIN>> queryPageList(MaterialIN materialIN,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<MaterialIN>> result = new Result<IPage<MaterialIN>>();
QueryWrapper<MaterialIN> queryWrapper = QueryGenerator.initQueryWrapper(materialIN, req.getParameterMap());
QueryWrapper<MaterialIN> queryWrapper = new QueryWrapper();// QueryGenerator.initQueryWrapper(materialIN, req.getParameterMap());
Page<MaterialIN> page = new Page<MaterialIN>(pageNo, pageSize);
if(StringUtils.isNotBlank(materialIN.getDepartId())){
queryWrapper.eq("depart_id",materialIN.getDepartId());
}
if(StringUtils.isNotBlank(materialIN.getAuditStatus())){
queryWrapper.eq("audit_status",materialIN.getAuditStatus());
}
if(StringUtils.isNotBlank(materialIN.getConfirmStatus())){
queryWrapper.eq("confirm_status",materialIN.getConfirmStatus());
}
if(StringUtils.isNotBlank(materialIN.getGoodCode())){
queryWrapper.like("good_code",materialIN.getGoodCode());
}
if(StringUtils.isNotBlank(materialIN.getStartTime())){
queryWrapper.ge("arrive_time",materialIN.getStartTime());
}
if(StringUtils.isNotBlank(materialIN.getEndTime())){
queryWrapper.le("arrive_time",materialIN.getEndTime());
}
IPage<MaterialIN> pageList = materialINService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "erp--物料(药剂)入库-集团审核列表")
@ApiOperation(value="erp--物料(药剂)入库-集团审核列表", notes="erp--物料(药剂)入库-集团审核列表")
@GetMapping(value = "/handleList")
public Result<IPage<MaterialIN>> handleList(MaterialIN materialIN,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<MaterialIN>> result = new Result<IPage<MaterialIN>>();
QueryWrapper<MaterialIN> queryWrapper = new QueryWrapper();//QueryGenerator.initQueryWrapper(materialIN, req.getParameterMap());
Page<MaterialIN> page = new Page<MaterialIN>(pageNo, pageSize);
if(StringUtils.isNotBlank(materialIN.getDepartId())){
queryWrapper.eq("depart_id",materialIN.getDepartId());
}
if(StringUtils.isNotBlank(materialIN.getAuditStatus())){
queryWrapper.eq("audit_status",materialIN.getAuditStatus());
}
if(StringUtils.isNotBlank(materialIN.getConfirmStatus())){
queryWrapper.eq("confirm_status",materialIN.getConfirmStatus());
}
if(StringUtils.isNotBlank(materialIN.getGoodCode())){
queryWrapper.like("good_code",materialIN.getGoodCode());
}
if(StringUtils.isNotBlank(materialIN.getStartTime())){
queryWrapper.ge("arrive_time",materialIN.getStartTime());
}
if(StringUtils.isNotBlank(materialIN.getEndTime())){
queryWrapper.le("arrive_time",materialIN.getEndTime());
}
IPage<MaterialIN> pageList = materialINService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
/**
* <pre>
* 添加
......@@ -89,8 +142,8 @@ public class MaterialINController {
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "物料(药剂)入库-添加")
@ApiOperation(value="物料(药剂)入库-添加", notes="物料(药剂)入库-添加")
@AutoLog(value = "erp--物料(药剂)入库-添加")
@ApiOperation(value="erp--物料(药剂)入库-添加", notes="erp--物料(药剂)入库-添加")
@PostMapping(value = "/add")
public Result<MaterialIN> add(@RequestBody MaterialIN materialIN) {
Result<MaterialIN> result = new Result<MaterialIN>();
......@@ -112,8 +165,8 @@ public class MaterialINController {
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "物料(药剂)入库-编辑")
@ApiOperation(value="物料(药剂)入库-编辑", notes="物料(药剂)入库-编辑")
@AutoLog(value = "erp--物料(药剂)入库-编辑")
@ApiOperation(value="erp--物料(药剂)入库-编辑", notes="erp--物料(药剂)入库-编辑")
@PutMapping(value = "/edit")
public Result<MaterialIN> edit(@RequestBody MaterialIN materialIN) {
Result<MaterialIN> result = new Result<MaterialIN>();
......@@ -127,7 +180,6 @@ public class MaterialINController {
result.success("修改成功!");
}
}
return result;
}
/**
......@@ -139,8 +191,8 @@ public class MaterialINController {
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "物料(药剂)入库-通过id删除")
@ApiOperation(value="物料(药剂)入库-通过id删除", notes="物料(药剂)入库-通过id删除")
@AutoLog(value = "erp--物料(药剂)入库-通过id删除")
@ApiOperation(value="erp--物料(药剂)入库-通过id删除", notes="erp--物料(药剂)入库-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
try {
......@@ -161,8 +213,8 @@ public class MaterialINController {
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "物料(药剂)入库-批量删除")
@ApiOperation(value="物料(药剂)入库-批量删除", notes="物料(药剂)入库-批量删除")
@AutoLog(value = "erp--物料(药剂)入库-批量删除")
@ApiOperation(value="erp--物料(药剂)入库-批量删除", notes="erp--物料(药剂)入库-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<MaterialIN> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
Result<MaterialIN> result = new Result<MaterialIN>();
......@@ -183,8 +235,8 @@ public class MaterialINController {
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "物料(药剂)入库-通过id查询")
@ApiOperation(value="物料(药剂)入库-通过id查询", notes="物料(药剂)入库-通过id查询")
@AutoLog(value = "erp--物料(药剂)入库-通过id查询")
@ApiOperation(value="erp--物料(药剂)入库-通过id查询", notes="erp--物料(药剂)入库-通过id查询")
@GetMapping(value = "/queryById")
public Result<MaterialIN> queryById(@RequestParam(name="id",required=true) String id) {
Result<MaterialIN> result = new Result<MaterialIN>();
......@@ -198,6 +250,43 @@ public class MaterialINController {
return result;
}
@AutoLog(value = "erp--药剂入库-送审")
@ApiOperation(value="erp--药剂入库-送审", notes="erp--药剂入库-送审")
@GetMapping(value = "/sendAudit")
public Result<MaterialIN> sendAudit(@RequestParam(name="id",required=true) String id) {
Result<MaterialIN> result = new Result<MaterialIN>();
MaterialIN materialIN = null;
try {
materialIN = materialINService.getById(id);
if(materialIN == null) {
result.error500("未找到对应实体");
}else{
materialIN.setAuditStatus("1");//提交审核
materialIN.setApplyUser(BaseContextHandler.getUserId());
materialINService.updateById(materialIN);
}
} catch (Exception e) {
log.error("送审失败",e.getMessage());
result.setResult(materialIN);
result.setSuccess(true);
}
return result;
}
@AutoLog(value = "erp--erp采购合同-审批")
@ApiOperation(value="erp--采购合同-审批", notes="erp--采购合同-审批")
@PutMapping(value = "/audit")
public Result<MaterialINVO> auditMaterialINVO(@RequestBody MaterialINVO materialINVO) {
Result<MaterialINVO> result = new Result<MaterialINVO>();
try {
materialINService.auditMaterialINVO(materialINVO);
} catch (Exception e) {
log.error("审批失败",e.getMessage());
result.setResult(materialINVO);
result.setSuccess(true);
}
return result;
}
/**
* <pre>
* 导出excel
......@@ -208,7 +297,6 @@ public class MaterialINController {
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
......
package com.skua.modules.erp.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import cn.hutool.core.date.DateUtil;
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.util.DateUtils;
import com.skua.modules.erp.entity.ERPPurchaseContract;
import com.skua.modules.erp.service.IEROPurchaseContractService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -15,6 +19,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.erp.vo.PurchaseContractVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
......@@ -52,7 +57,23 @@ public class PurchaseContractController {
result.setResult(pageList);
return result;
}
@AutoLog(value = "erp采购合同-集团审核列表")
@ApiOperation(value="erp采购合同-集团审核列表", notes="erp采购合同-集团审核列表")
@GetMapping(value = "/handleList")
public Result<IPage<ERPPurchaseContract>> handleList(ERPPurchaseContract ERPPurchaseContract,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<ERPPurchaseContract>> result = new Result<IPage<ERPPurchaseContract>>();
QueryWrapper<ERPPurchaseContract> queryWrapper = QueryGenerator.initQueryWrapper(ERPPurchaseContract, req.getParameterMap());
Page<ERPPurchaseContract> page = new Page<ERPPurchaseContract>(pageNo, pageSize);
// 需要添加条件判断
IPage<ERPPurchaseContract> pageList = purchaseContractService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "erp采购合同-有权限的采购合同集合")
@ApiOperation(value="erp采购合同-有权限的采购合同集合", notes="erp采购合同-有权限的采购合同集合")
......@@ -168,6 +189,25 @@ public class PurchaseContractController {
}
return result;
}
@AutoLog(value = "erp采购合同-送审")
@ApiOperation(value="erp采购合同-送审", notes="erp采购合同-送审")
@GetMapping(value = "/sendAudit")
public Result<PurchaseContractVO> sendAudit(@RequestParam(name="id",required=true) String id) {
Result<PurchaseContractVO> result = new Result<PurchaseContractVO>();
PurchaseContractVO purchaseContract = purchaseContractService.queryById(id);
if(purchaseContract==null) {
result.error500("未找到对应实体");
}else {
purchaseContract.setStatus("1");
purchaseContract.setApplyUser(BaseContextHandler.getUserId());
purchaseContract.setApplyTime(DateUtils.now());
purchaseContractService.updateById(purchaseContract);
result.setResult(purchaseContract);
result.setSuccess(true);
}
return result;
}
@AutoLog(value = "erp采购合同-审批")
@ApiOperation(value="erp采购合同-审批", notes="erp采购合同-审批")
@PutMapping(value = "/audit")
......
......@@ -12,6 +12,7 @@ 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.core.util.DateUtils;
import com.skua.modules.erp.entity.PurchaseMaterial;
import com.skua.modules.erp.entity.PurchasePlan;
import com.skua.modules.erp.entity.PurchasePlanItem;
......@@ -247,9 +248,12 @@ public class PurchasePlanController {
PurchasePlan purchasePlan = null;
try {
purchasePlan = purchasePlanService.getById(id);
purchasePlan.setStatus("1");//提交审核
if(purchasePlan==null) {
result.error500("未找到对应实体");
}else{
purchasePlan.setStatus("1");//提交审核
purchasePlan.setApplyTime(DateUtils.now());
purchasePlanService.updateById(purchasePlan);
}
} catch (Exception e) {
log.error("送审失败",e.getMessage());
......@@ -259,8 +263,6 @@ public class PurchasePlanController {
return result;
}
@AutoLog(value = "erp采购计划表-审批")
@ApiOperation(value="erp采购计划表-审批", notes="erp采购计划表-审批")
@PutMapping(value = "/audit")
......
......@@ -25,7 +25,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
@ApiModel(value="erp_distribut_material对象", description="erp分销物料")
public class DistributMaterial {
/**主键*/
@TableId(type = IdType.ID_WORKER_STR)
@TableId(type = IdType.UUID)
@ApiModelProperty(value = "主键")
private String id;
/**分销合同编号*/
......
package com.skua.modules.erp.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.skua.core.aspect.annotation.Dict;
......@@ -30,6 +31,7 @@ public class ERPPurchaseContract {
/**厂站*/
@Excel(name = "厂站", width = 15)
@ApiModelProperty(value = "厂站")
@Dict(dictTable = "sys_depart", dicCode="id", dicText = "depart_name")
private java.lang.String departId;
/**采购名称*/
@Excel(name = "采购名称", width = 15)
......@@ -70,13 +72,14 @@ public class ERPPurchaseContract {
@ApiModelProperty(value = "使用机构编码集合")
private java.lang.String departs;
/**入库仓库编号*/
@Excel(name = "入库仓库编号", width = 15)
@ApiModelProperty(value = "入库仓库编号")
@Dict(dicCode = "id", dicText = "warehouse_name", dictTable = "supplies_warehouse")
private java.lang.String inWarehouseId;
@ApiModelProperty(value = "入库仓库名称")
private java.lang.String inWarehouseName;
/**合同附件*/
@Excel(name = "合同附件", width = 15)
@ApiModelProperty(value = "合同附件")
......@@ -131,4 +134,8 @@ public class ERPPurchaseContract {
@ApiModelProperty(value = "删除标识,0:有效,1:删除")
private String equipmentInId;
/**审批意见*/
@ApiModelProperty(value = "审批意见")
private String approveMessage;
}
......
......@@ -58,9 +58,8 @@ public class MaterialAcceptanceForm {
@Excel(name = "收货人员签字", width = 15)
@ApiModelProperty(value = "收货人员签字")
private String receiverSign;
/**确认状态 0 未确认、1 部分确认、2全部确认*/
@Excel(name = "确认状态 0 未确认、1 部分确认、2全部确认", width = 15)
@ApiModelProperty(value = "确认状态 0 未确认、1 部分确认、2全部确认")
@ApiModelProperty(value = "确认状态 0 未确认、1 收货签字、2 送货方签字 、9 全部确认")
@Dict( dicCode="purchase_confirm_status")
private String confirmStatus;
/**分享地址*/
......
......@@ -58,15 +58,25 @@ public class MaterialIN {
/**收货人*/
@Excel(name = "收货人", width = 15)
@ApiModelProperty(value = "收货人")
@Dict(dictTable = "sys_user", dicCode="id", dicText = "realname")
private String receiver;
@Excel(name = "物料类别", width = 15)
@ApiModelProperty(value = "物料类别")
@Dict(dictTable = "equipment_sparepart_type", dicCode="id", dicText = "item_text")
private String sparepartType;
/**物料编号*/
@Excel(name = "物料编号", width = 15)
@ApiModelProperty(value = "物料编号")
@Dict(dictTable = "equipment_sparepart_supplies", dicCode="id", dicText = "sparepart_name")
private String sparepartId;
/**药剂(物料)名称*/
@Excel(name = "药剂(物料)名称", width = 15)
@ApiModelProperty(value = "药剂(物料)名称")
private String sparepartName;
@ApiModelProperty(value = "物料编码")
private String sparepartCode;
/**规格型号*/
@Excel(name = "规格型号", width = 15)
@ApiModelProperty(value = "规格型号")
......@@ -78,11 +88,12 @@ public class MaterialIN {
/**数量*/
@Excel(name = "数量", width = 15)
@ApiModelProperty(value = "数量")
private String materialNum;
private String purchaseNum;
/**供应商编号*/
@Excel(name = "供应商编号", width = 15)
@ApiModelProperty(value = "供应商编号")
@Dict(dictTable = "equipment_sparepart_supplies", dicCode="id", dicText = "sparepart_name")
private String supplierId;
/**货号*/
@Excel(name = "货号", width = 15)
......@@ -124,8 +135,15 @@ public class MaterialIN {
/**审批状态:0 未发布 1 已发布(待审核)2 审核驳回 3 审核通过*/
@Excel(name = "审批状态:0 未发布 1 已发布(待审核)2 审核驳回 3 审核通过", width = 15)
@ApiModelProperty(value = "审批状态:0 未发布 1 已发布(待审核)2 审核驳回 3 审核通过")
@Dict( dicCode="purchase_plan_status")
@Dict( dicCode="audit_status")
private String auditStatus;
/**审批意见*/
@ApiModelProperty(value = "审批意见")
private String approveMessage;
@ApiModelProperty(value = "申请人")
private String applyUser;
/**入库类型*/
@Excel(name = "入库类型", width = 15)
@ApiModelProperty(value = "入库类型")
......@@ -166,4 +184,11 @@ public class MaterialIN {
@Excel(name = "删除标识,0:正常,1:删除", width = 15)
@ApiModelProperty(value = "删除标识,0:正常,1:删除")
private Integer delFlag;
@TableField(exist = false)
@ApiModelProperty(value = "结束时间")
private String endTime;
@TableField(exist = false)
@ApiModelProperty(value = "开始时间")
private String startTime;
}
......
......@@ -27,7 +27,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
public class PurchaseMaterial {
/**主键*/
@TableId(type = IdType.ID_WORKER_STR)
@TableId(type = IdType.UUID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**采购计划编号*/
......@@ -42,6 +42,10 @@ public class PurchaseMaterial {
@Excel(name = "物料编号", width = 15)
@ApiModelProperty(value = "物料编号")
private java.lang.String sparepartId;
@ApiModelProperty(value = "物料编码")
private java.lang.String sparepartCode;
@ApiModelProperty(value = "物料名称")
private java.lang.String sparepartName;
/**物料编号*/
@Excel(name = "货号", width = 15)
@ApiModelProperty(value = "货号")
......@@ -78,15 +82,8 @@ public class PurchaseMaterial {
@TableField(exist=false)
@ApiModelProperty(value = "物料类别名称")
private String sparepartCode;
@TableField(exist=false)
@ApiModelProperty(value = "物料类别名称")
private String sparepartTypeName;
@TableField(exist=false)
@ApiModelProperty(value = "物料名称")
private String sparepartName;
@TableField(exist=false)
@ApiModelProperty(value = "供应商名称")
......
......@@ -5,6 +5,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.erp.entity.DistributContract;
import com.skua.modules.erp.vo.MaterialSearchVO;
import com.skua.modules.erp.vo.PurchaseMaterialVO;
import com.skua.modules.erp.vo.PurchasePlanSearchVO;
import org.apache.ibatis.annotations.Param;
......@@ -60,8 +61,8 @@ public interface PurchaseMaterialMapper extends BaseMapper<PurchaseMaterial> {
/**
* 药剂入库查询结果:物料清单
* @param departId
* @param materialSearchVO
* @return
*/
public IPage<PurchaseMaterialVO> queryPurchaseMaterialListByIn(Page<PurchaseMaterialVO> page,@Param("departId")String departId);
public IPage<PurchaseMaterialVO> queryPurchaseMaterialListByIn(Page<PurchaseMaterialVO> page,@Param("param") MaterialSearchVO materialSearchVO);
}
......
......@@ -2,4 +2,13 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.erp.mapper.MaterialAcceptanceFormMapper">
<select id="queryByList" resultType="com.skua.modules.erp.vo.PurchasePlanItemVO">
select
t.arrive_time '到货日期', t.purchase_num '数量',t.measuring_unit '单位' ,
f.appearance_info '外观情况',f.matched_info '匹配情况' ,f.handle_msg '处理意见',f.sender_sign , f.receiver_sign,f.remark ,
t.sparepart_name,t.sparepart_code ,t.sparepart_type,t.specification ,t.depart_id ,
from erp_material_in t
left join erp_material_acceptance_form f on t.id = f.id
where t.supplier_id = 100 and t.depart_id = 'af880d6a13404a67825e94bc0f2f3808'
</select>
</mapper>
\ No newline at end of file
......
......@@ -2,4 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.erp.mapper.MaterialINMapper">
<!--查询 入库单 -->
<select id="queryByList" resultType="com.skua.modules.erp.entity.MaterialIN">
select t.*
from erp_material_in t
where t.supplier_id = 100 and t.depart_id = 'af880d6a13404a67825e94bc0f2f3808'
</select>
</mapper>
\ No newline at end of file
......
......@@ -64,13 +64,21 @@
<!-- 药剂入库查询结果:物料清单-->
<select id="queryPurchaseMaterialListByIn" resultType="com.skua.modules.erp.vo.PurchaseMaterialVO">
select dm.distribut_price ,dm.distribut_total_price ,aaa.* from (
select dm.distribut_price ,dm.distribut_total_price ,ss.sparepart_name, st.item_text as 'sparepart_type_name',sm.supp_name as 'supplier_name',
aaa.* from (
select pm.*
from erp_purchase_material pm , erp_purchase_contract pc
where pm.contract_id =pc.id
and pc.departs like concat('%', #{departId}, '%')
and pc.departs like concat('%', #{param.departId}, '%')
<if test="param.sparepartCode != null and param.sparepartCode !=''"> and pm.sparepart_code =#{param.sparepartCode}</if>
<if test="param.sparepartType != null and param.sparepartType !=''"> and pm.sparepart_type = #{param.sparepartType}</if>
<if test="param.sparepartName != null and param.sparepartName !=''"> and pm.sparepart_name like concat('%', #{param.sparepartName}, '%')</if>
)aaa
left join erp_distribut_material dm on aaa.good_code = dm.good_code
left join equipment_sparepart_supplies ss on aaa.sparepart_id = ss.id
left join equipment_sparepart_type st on st.id = aaa.sparepart_type
left join ajh_supplier_manage sm on sm.id = aaa.supplier_id
</select>
</mapper>
\ No newline at end of file
......
......@@ -2,10 +2,16 @@ package com.skua.modules.erp.service;
import com.skua.modules.erp.entity.MaterialIN;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.erp.vo.MaterialINVO;
/**
* 物料(药剂)入库
*/
public interface IMaterialINService extends IService<MaterialIN> {
/***
* 审核药剂入库单
* @param materialINVO
*/
public void auditMaterialINVO(MaterialINVO materialINVO);
}
......
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.erp.entity.DistributContract;
import com.skua.modules.erp.entity.PurchaseMaterial;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.erp.vo.MaterialSearchVO;
import com.skua.modules.erp.vo.PurchaseMaterialVO;
import com.skua.modules.erp.vo.PurchasePlanSearchVO;
......@@ -34,8 +35,7 @@ public interface IPurchaseMaterialService extends IService<PurchaseMaterial> {
/**
* 药剂入库查询结果:采购物料清单+分销单价+分销总价
* @param departId
* @return
*/
public IPage<PurchaseMaterialVO> queryPurchaseMaterialListByIn(Page<PurchaseMaterialVO> page,String departId);
public IPage<PurchaseMaterialVO> queryPurchaseMaterialListByIn(Page<PurchaseMaterialVO> page, MaterialSearchVO materialSearchVO);
}
......
......@@ -41,6 +41,7 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM
int count = this.baseMapper.insert( distributContractVO );
if(count > 0 && distributContractVO.getMaterialList() != null && !distributContractVO.getMaterialList().isEmpty()){
for(DistributMaterial material : distributContractVO.getMaterialList()){
material.setId(null);
material.setContractId( distributContractVO.getId() );
materialMapper.insert( material );
}
......@@ -61,6 +62,7 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM
if(count > 0 && distributContractVO.getMaterialList() != null && !distributContractVO.getMaterialList().isEmpty()){
for(DistributMaterial material : distributContractVO.getMaterialList()){
material.setId(null);
material.setContractId( distributContractVO.getId() );
materialMapper.insert( material );
}
......@@ -118,7 +120,7 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM
distributContractVO.setStatus( "3" );
}
if("2".equals( distributContractVO.getApproveState() )){
distributContractVO.setStatus( "4" );
distributContractVO.setStatus( "2" );
}
this.baseMapper.updateById( distributContractVO ) ;
......@@ -127,12 +129,13 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM
if( distributContractVO.getMaterialList() != null && !distributContractVO.getMaterialList().isEmpty()){
for(DistributMaterial material : distributContractVO.getMaterialList()){
material.setId(null);
material.setContractId( distributContractVO.getId() );
materialMapper.insert( material );
}
}
//审批记录
ApproveRecord record = new ApproveRecord( "FXHT", distributContractVO.getApplyUser(), distributContractVO.getId(), BaseContextHandler.getUserId(), distributContractVO.getApproveMessage(), distributContractVO.getApproveState());
ApproveRecord record = new ApproveRecord( "DIS_HT", distributContractVO.getApplyUser(), distributContractVO.getId(), BaseContextHandler.getUserId(), distributContractVO.getApproveMessage(), distributContractVO.getApproveState());
recordMapper.insert( record ) ;
}
}
......
......@@ -68,6 +68,7 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr
int count = this.baseMapper.insert( purchaseContractVO );
if(count > 0 && purchaseContractVO.getMaterialList() != null && !purchaseContractVO.getMaterialList().isEmpty()){
for(PurchaseMaterial material : purchaseContractVO.getMaterialList()){
material.setId(null);
material.setContractId( purchaseContractVO.getId() );
purchaseMaterialMapper.insert( material );
}
......@@ -89,6 +90,7 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr
if(count > 0 && purchaseContractVO.getMaterialList() != null && !purchaseContractVO.getMaterialList().isEmpty()){
for(PurchaseMaterial material : purchaseContractVO.getMaterialList()){
material.setId(null);
material.setContractId( purchaseContractVO.getId() );
purchaseMaterialMapper.insert( material );
}
......@@ -154,6 +156,7 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr
if( purchaseContractVO.getMaterialList() != null && !purchaseContractVO.getMaterialList().isEmpty()){
for(PurchaseMaterial material : purchaseContractVO.getMaterialList()){
material.setId(null);
material.setContractId( purchaseContractVO.getId() );
purchaseMaterialMapper.insert( material );
}
......
package com.skua.modules.erp.service.impl;
import com.skua.core.context.BaseContextHandler;
import com.skua.modules.erp.entity.ApproveRecord;
import com.skua.modules.erp.entity.MaterialIN;
import com.skua.modules.erp.mapper.ApproveRecordMapper;
import com.skua.modules.erp.mapper.MaterialINMapper;
import com.skua.modules.erp.service.IMaterialINService;
import com.skua.modules.erp.vo.MaterialINVO;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.annotation.Resource;
/**
* 物料(药剂)入库
*/
@Service
public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, MaterialIN> implements IMaterialINService {
@Resource
private ApproveRecordMapper recordMapper;
/***
* 审核药剂入库单
* @param materialINVO
*/
public void auditMaterialINVO(MaterialINVO materialINVO){
//保存
//purchasePlan.getApproveState() 审批状态 1通过2不通过
if("1".equals( materialINVO.getApproveState() )){
materialINVO.setAuditStatus( "3" );
}
if("2".equals( materialINVO.getApproveState() )){
materialINVO.setAuditStatus( "2" );
}
this.baseMapper.updateById( materialINVO ) ;
//审批记录
ApproveRecord record = new ApproveRecord( "YJIN", materialINVO.getApplyUser(), materialINVO.getId(), BaseContextHandler.getUserId(), materialINVO.getApproveMessage(), materialINVO.getApproveState());
recordMapper.insert( record ) ;
}
}
......
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.erp.entity.PurchaseMaterial;
import com.skua.modules.erp.mapper.PurchaseMaterialMapper;
import com.skua.modules.erp.service.IPurchaseMaterialService;
import com.skua.modules.erp.vo.MaterialSearchVO;
import com.skua.modules.erp.vo.PurchaseMaterialVO;
import org.springframework.stereotype.Service;
......@@ -39,11 +40,10 @@ public class PurchaseMaterialServiceImpl extends ServiceImpl<PurchaseMaterialMap
}
/**
* 药剂入库查询结果:采购物料清单+分销单价+分销总价
* @param departId
* @return
*/
public IPage<PurchaseMaterialVO> queryPurchaseMaterialListByIn(Page<PurchaseMaterialVO> page,String departId){
return this.baseMapper.queryPurchaseMaterialListByIn(page ,departId ) ;
public IPage<PurchaseMaterialVO> queryPurchaseMaterialListByIn(Page<PurchaseMaterialVO> page, MaterialSearchVO materialSearchVO){
return this.baseMapper.queryPurchaseMaterialListByIn(page ,materialSearchVO ) ;
}
}
......
......@@ -43,6 +43,7 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur
int count = this.baseMapper.insert( purchasePlanVO );
if(count > 0 && purchasePlanVO.getPlanItemList() != null && !purchasePlanVO.getPlanItemList().isEmpty()){
for(PurchasePlanItem planItem : purchasePlanVO.getPlanItemList()){
planItem.setId(null);
planItem.setPlanId( purchasePlanVO.getId() );
planItemMapper.insert( planItem );
}
......@@ -64,6 +65,7 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur
if( purchasePlanVO.getPlanItemList() != null && !purchasePlanVO.getPlanItemList().isEmpty()){
for(PurchasePlanItem planItem : purchasePlanVO.getPlanItemList()){
planItem.setId(null);
planItem.setPlanId( purchasePlanVO.getId() );
planItemMapper.insert( planItem );
}
......@@ -125,7 +127,7 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur
purchasePlanVO.setStatus( "3" );
}
if("2".equals( purchasePlanVO.getApproveState() )){
purchasePlanVO.setStatus( "4" );
purchasePlanVO.setStatus( "2" );
//发送入库单据,物料库存增加
warehousing = true;
}
......
package com.skua.modules.erp.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.modules.erp.entity.MaterialIN;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="MaterialINVO查询对象", description="MaterialINVO查询对象")
public class MaterialINVO extends MaterialIN {
/**审批状态*/
@TableField(exist=false)
@ApiModelProperty(value = "审批状态 1通过2不通过")
private String approveState;
}
......@@ -24,13 +24,9 @@ public class PurchaseContractVO extends ERPPurchaseContract {
@ApiModelProperty(value = "采购合同物料清单集合")
private List<PurchaseMaterial> materialList = null;
/**审批意见*/
@TableField(exist=false)
@ApiModelProperty(value = "审批意见")
private String approveMessage;
/**审批状态*/
@TableField(exist=false)
@ApiModelProperty(value = "审批状态 1通过2不通过")
private String approveState;
}
......
package com.skua.modules.erp.vo;
/**
* @auther kangwei
* @create 2024-09-30-9:57
*/
public class PurchasePlanItemVO {
}
package com.skua.modules.safe.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
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.util.ConvertUtils;
import com.skua.modules.safe.entity.HealthRecords;
import com.skua.modules.safe.service.IHealthRecordsService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* <pre>
* 健康档案
* </pre>
* @author 开发者姓名
* @version V0.1, 开发时间
*/
@Slf4j
@Api(tags="健康档案")
@RestController("webHealthRecordsController")
@RequestMapping("/web/safe/healthRecords")
public class HealthRecordsController {
@Autowired
private IHealthRecordsService healthRecordsService;
/**
* <pre>
* 分页列表查询
* </pre>
* @param healthRecords
* @param pageNo
* @param pageSize
* @param req
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "健康档案-分页列表查询")
@ApiOperation(value="健康档案-分页列表查询", notes="健康档案-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<HealthRecords>> queryPageList(HealthRecords healthRecords,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<HealthRecords>> result = new Result<IPage<HealthRecords>>();
QueryWrapper<HealthRecords> queryWrapper = QueryGenerator.initQueryWrapper(healthRecords, req.getParameterMap());
Page<HealthRecords> page = new Page<HealthRecords>(pageNo, pageSize);
//queryWrapper.eq("depart_id", BaseContextHandler.getRealDepartId());
queryWrapper.in("depart_id", BaseContextHandler.getDeparts().split(","));
IPage<HealthRecords> pageList = healthRecordsService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
/**
* <pre>
* 添加
* </pre>
* @param healthRecords
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "健康档案-添加")
@ApiOperation(value="健康档案-添加", notes="健康档案-添加")
@PostMapping(value = "/add")
public Result<HealthRecords> add(@RequestBody HealthRecords healthRecords) {
Result<HealthRecords> result = new Result<HealthRecords>();
try {
healthRecordsService.save(healthRecords);
result.success("添加成功!");
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
}
return result;
}
/**
* <pre>
* 编辑
* </pre>
* @param healthRecords
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "健康档案-编辑")
@ApiOperation(value="健康档案-编辑", notes="健康档案-编辑")
@PutMapping(value = "/edit")
public Result<HealthRecords> edit(@RequestBody HealthRecords healthRecords) {
Result<HealthRecords> result = new Result<HealthRecords>();
HealthRecords healthRecordsEntity = healthRecordsService.getById(healthRecords.getId());
if(healthRecordsEntity==null) {
result.error500("未找到对应实体");
}else {
boolean ok = healthRecordsService.updateById(healthRecords);
//TODO 返回false说明什么?
if(ok) {
result.success("修改成功!");
}
}
return result;
}
/**
* <pre>
* 通过id删除
* </pre>
* @param id
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "健康档案-通过id删除")
@ApiOperation(value="健康档案-通过id删除", notes="健康档案-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
try {
healthRecordsService.removeById(id);
} catch (Exception e) {
log.error("删除失败",e.getMessage());
return Result.error("删除失败!");
}
return Result.ok("删除成功!");
}
/**
* <pre>
* 批量删除
* </pre>
* @param ids
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "健康档案-批量删除")
@ApiOperation(value="健康档案-批量删除", notes="健康档案-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<HealthRecords> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
Result<HealthRecords> result = new Result<HealthRecords>();
if(ids==null || "".equals(ids.trim())) {
result.error500("参数不识别!");
}else {
this.healthRecordsService.removeByIds(Arrays.asList(ids.split(",")));
result.success("删除成功!");
}
return result;
}
/**
* <pre>
* 通过id查询
* </pre>
* @param id
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "健康档案-通过id查询")
@ApiOperation(value="健康档案-通过id查询", notes="健康档案-通过id查询")
@GetMapping(value = "/queryById")
public Result<HealthRecords> queryById(@RequestParam(name="id",required=true) String id) {
Result<HealthRecords> result = new Result<HealthRecords>();
HealthRecords healthRecords = healthRecordsService.getById(id);
if(healthRecords==null) {
result.error500("未找到对应实体");
}else {
result.setResult(healthRecords);
result.setSuccess(true);
}
return result;
}
/**
* <pre>
* 导出excel
* </pre>
* @param request
* @param response
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
QueryWrapper<HealthRecords> queryWrapper = null;
try {
String paramsStr = request.getParameter("paramsStr");
if (ConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
HealthRecords healthRecords = JSON.parseObject(deString, HealthRecords.class);
queryWrapper = QueryGenerator.initQueryWrapper(healthRecords, request.getParameterMap());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<HealthRecords> pageList = healthRecordsService.list(queryWrapper);
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "健康档案列表");
mv.addObject(NormalExcelConstants.CLASS, HealthRecords.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("健康档案列表数据", "导出人:Jeecg", "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
/**
* <pre>
* 通过excel导入数据
* </pre>
* @param request
* @param response
* @return
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<HealthRecords> listHealthRecordss = ExcelImportUtil.importExcel(file.getInputStream(), HealthRecords.class, params);
healthRecordsService.saveBatch(listHealthRecordss);
return Result.ok("文件导入成功!数据行数:" + listHealthRecordss.size());
} catch (Exception e) {
log.error(e.getMessage(),e);
return Result.error("文件导入失败:"+e.getMessage());
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.ok("文件导入失败!");
}
}
......@@ -20,10 +20,10 @@ import org.jeecgframework.poi.excel.annotation.Excel;
* 事故案例库
*/
@Data
@TableName("safe_accident_case")
@TableName("safety_accident_case")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="safe_accident_case对象", description="事故案例库")
@ApiModel(value="safety_accident_case对象", description="事故案例库")
public class AccidentCase {
/**id*/
......
package com.skua.modules.safe.entity;
import java.io.Serializable;
import java.util.Date;
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.core.aspect.annotation.Dict;
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
@TableName("safety_environment_target")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="safety_environment_target对象", description="安环环保目标")
public class EnvironmentTarget {
/**主键id*/
@TableId(type = IdType.ID_WORKER_STR)
@ApiModelProperty(value = "主键id")
private String id;
/**所属厂站*/
@Excel(name = "所属厂站", width = 15)
@ApiModelProperty(value = "所属厂站")
@Dict(dictTable = "sys_depart", dicCode="id", dicText = "depart_name")
private String departId;
/**祖级列表*/
@Excel(name = "祖级列表", width = 15)
@ApiModelProperty(value = "祖级列表")
private String departAncestors;
/**目标年度*/
@Excel(name = "目标年度", width = 15)
@ApiModelProperty(value = "目标年度")
private String targetYear;
/**生成安全工亡责任事务*/
@Excel(name = "生成安全工亡责任事务", width = 15)
@ApiModelProperty(value = "生成安全工亡责任事务")
private String workerDeathNum;
/**突发环境事件*/
@Excel(name = "突发环境事件", width = 15)
@ApiModelProperty(value = "突发环境事件")
private String suddenlyNum;
/**新增职业病病例*/
@Excel(name = "新增职业病病例", width = 15)
@ApiModelProperty(value = "新增职业病病例")
private String newCaseNum;
/**考核分数*/
@Excel(name = "考核分数", width = 15)
@ApiModelProperty(value = "考核分数")
private String examScore;
/**创建人Id*/
@Excel(name = "创建人Id", width = 15)
@ApiModelProperty(value = "创建人Id")
private String createBy;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**修改人Id*/
@Excel(name = "修改人Id", width = 15)
@ApiModelProperty(value = "修改人Id")
private String updateBy;
/**修改时间*/
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updateTime;
/**删除标识*/
@Excel(name = "删除标识", width = 15)
@ApiModelProperty(value = "删除标识")
private Integer delFlag;
}
package com.skua.modules.safe.entity;
import java.io.Serializable;
import java.util.Date;
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.core.aspect.annotation.Dict;
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
@TableName("safety_health_records")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="safety_health_records对象", description="健康档案")
public class HealthRecords {
/**主键*/
@TableId(type = IdType.ID_WORKER_STR)
@ApiModelProperty(value = "主键")
private String id;
/**所属厂站*/
@Excel(name = "所属厂站", width = 15)
@ApiModelProperty(value = "所属厂站")
@Dict(dictTable = "sys_depart", dicCode="id", dicText = "depart_name")
private String departId;
/**祖级列表*/
@Excel(name = "祖级列表", width = 15)
@ApiModelProperty(value = "祖级列表")
private String departAncestors;
/**用户编号*/
@Excel(name = "用户编号", width = 15)
@ApiModelProperty(value = "用户编号")
private String userId;
/**检查地点*/
@Excel(name = "检查地点", width = 15)
@ApiModelProperty(value = "检查地点")
private String inspectPlace;
/**检查结果*/
@Excel(name = "检查结果", width = 15)
@ApiModelProperty(value = "检查结果")
private String inspectResult;
/**检查报告*/
@Excel(name = "检查报告", width = 15)
@ApiModelProperty(value = "检查报告")
private String inspectReportFile;
/**异常情况以及处理意见*/
@Excel(name = "异常情况以及处理意见", width = 15)
@ApiModelProperty(value = "异常情况以及处理意见")
private String proposal;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**创建人*/
@Excel(name = "创建人", width = 15)
@ApiModelProperty(value = "创建人")
private String createBy;
/**修改时间*/
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updateTime;
/**修改人*/
@Excel(name = "修改人", width = 15)
@ApiModelProperty(value = "修改人")
private String updateBy;
}
package com.skua.modules.safe.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.safe.entity.EnvironmentTarget;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 安环环保目标
*/
public interface EnvironmentTargetMapper extends BaseMapper<EnvironmentTarget> {
}
package com.skua.modules.safe.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.safe.entity.HealthRecords;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 健康档案
*/
public interface HealthRecordsMapper extends BaseMapper<HealthRecords> {
}
<?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.skua.modules.safe.mapper.EnvironmentTargetMapper">
</mapper>
\ No newline at end of file
<?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.skua.modules.safe.mapper.HealthRecordsMapper">
</mapper>
\ No newline at end of file
package com.skua.modules.safe.service;
import com.skua.modules.safe.entity.EnvironmentTarget;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 安环环保目标
*/
public interface IEnvironmentTargetService extends IService<EnvironmentTarget> {
}
package com.skua.modules.safe.service;
import com.skua.modules.safe.entity.HealthRecords;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 健康档案
*/
public interface IHealthRecordsService extends IService<HealthRecords> {
}
package com.skua.modules.safe.service.impl;
import com.skua.modules.safe.entity.EnvironmentTarget;
import com.skua.modules.safe.mapper.EnvironmentTargetMapper;
import com.skua.modules.safe.service.IEnvironmentTargetService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 安环环保目标
*/
@Service
public class EnvironmentTargetServiceImpl extends ServiceImpl<EnvironmentTargetMapper, EnvironmentTarget> implements IEnvironmentTargetService {
}
package com.skua.modules.safe.service.impl;
import com.skua.modules.safe.entity.HealthRecords;
import com.skua.modules.safe.mapper.HealthRecordsMapper;
import com.skua.modules.safe.service.IHealthRecordsService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 健康档案
*/
@Service
public class HealthRecordsServiceImpl extends ServiceImpl<HealthRecordsMapper, HealthRecords> implements IHealthRecordsService {
}
......@@ -243,24 +243,26 @@ public class EquipmentSparepartSupplies {
@ApiModelProperty(value = "物料类别名称")
@ApiModelProperty(value = "扩展:物料类别名称")
@TableField(exist=false)
private String sparepartTypeName;
@ApiModelProperty(value = "去年出库数量")
@ApiModelProperty(value = "扩展:去年出库数量")
@TableField(exist=false)
private String outNum;
@TableField(exist=false)
@ApiModelProperty(value = "总价")
@ApiModelProperty(value = "扩展:总价")
private String totalPrice;
@TableField(exist=false)
@ApiModelProperty(value = "计划采购数量")
@ApiModelProperty(value = "扩展:计划采购数量")
private String purchaseNum;
@TableField(exist=false)
@ApiModelProperty(value = "计划采购数量")
@ApiModelProperty(value = "扩展:货号")
private String goodCode;
@TableField(exist=false)
@ApiModelProperty(value = "扩展:计划采购数量")
private String sparepartId;
public String getSparepartId() {
......
......@@ -59,6 +59,10 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/sys/common/view/**", "anon");//图片预览不限制token
filterChainDefinitionMap.put("/sys/common/download/**", "anon");//文件下载不限制token
filterChainDefinitionMap.put("/sys/common/pdf/**", "anon");//pdf预览
filterChainDefinitionMap.put("/web/erp/materialAcceptanceForm/queryById", "anon");//采购入库,送货方查询验货单
filterChainDefinitionMap.put("/web/erp/materialAcceptanceForm/senderSign", "anon");//采购入库,送货方签名
filterChainDefinitionMap.put("/web/erp/materialIN/queryById", "anon");//采购入库,查询采购入库信息
filterChainDefinitionMap.put("/generic/**", "anon");//pdf预览需要文件
filterChainDefinitionMap.put("/generic/**", "anon");//pdf预览需要文件
filterChainDefinitionMap.put("/", "anon");
filterChainDefinitionMap.put("/doc.html", "anon");
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!