未符合项
This commit is contained in:
+53
-13
@@ -10,6 +10,7 @@ import com.jero.modules.projectLibrary.service.ILawsEvaluationNotMetService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -19,14 +20,19 @@ import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 评估未符合项条款
|
||||
|
||||
/**
|
||||
* @Description: 未符合项
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-09-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="评估未符合项条款")
|
||||
@Api(tags="未符合项")
|
||||
@RestController
|
||||
@RequestMapping("/projectLibrary/lawsEvaluationNotMet")
|
||||
@Slf4j
|
||||
@@ -37,8 +43,8 @@ public class LawsEvaluationNotMetController extends JeroController<LawsEvaluatio
|
||||
/**
|
||||
* 分页列表查询
|
||||
*/
|
||||
@AutoLog(value = "评估未符合项条款-分页列表查询")
|
||||
@ApiOperation(value="评估未符合项条款-分页列表查询", notes="评估未符合项条款-分页列表查询")
|
||||
@AutoLog(value = "未符合项-分页列表查询")
|
||||
@ApiOperation(value="未符合项-分页列表查询", notes="未符合项-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<LawsEvaluationNotMet>> queryPageList(LawsEvaluationNotMet lawsEvaluationNotMet,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@@ -51,8 +57,8 @@ public class LawsEvaluationNotMetController extends JeroController<LawsEvaluatio
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@AutoLog(value = "评估未符合项条款-添加")
|
||||
@ApiOperation(value="评估未符合项条款-添加", notes="评估未符合项条款-添加")
|
||||
@AutoLog(value = "未符合项-添加")
|
||||
@ApiOperation(value="未符合项-添加", notes="未符合项-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@Validated @RequestBody LawsEvaluationNotMet lawsEvaluationNotMet) {
|
||||
lawsEvaluationNotMetService.add(lawsEvaluationNotMet);
|
||||
@@ -62,8 +68,8 @@ public class LawsEvaluationNotMetController extends JeroController<LawsEvaluatio
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
@AutoLog(value = "评估未符合项条款-编辑")
|
||||
@ApiOperation(value="评估未符合项条款-编辑", notes="评估未符合项条款-编辑")
|
||||
@AutoLog(value = "未符合项-编辑")
|
||||
@ApiOperation(value="未符合项-编辑", notes="未符合项-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@Validated @RequestBody LawsEvaluationNotMet lawsEvaluationNotMet) {
|
||||
lawsEvaluationNotMetService.editById(lawsEvaluationNotMet);
|
||||
@@ -75,8 +81,8 @@ public class LawsEvaluationNotMetController extends JeroController<LawsEvaluatio
|
||||
/**
|
||||
* 通过id查询
|
||||
*/
|
||||
@AutoLog(value = "评估未符合项条款-通过id查询")
|
||||
@ApiOperation(value="评估未符合项条款-通过id查询", notes="评估未符合项条款-通过id查询")
|
||||
@AutoLog(value = "未符合项-通过id查询")
|
||||
@ApiOperation(value="未符合项-通过id查询", notes="未符合项-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<LawsEvaluationNotMet> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
LawsEvaluationNotMet lawsEvaluationNotMet = lawsEvaluationNotMetService.queryById(id);
|
||||
@@ -86,12 +92,46 @@ public class LawsEvaluationNotMetController extends JeroController<LawsEvaluatio
|
||||
return Result.OK(lawsEvaluationNotMet);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 批量关闭
|
||||
*/
|
||||
@AutoLog(value = "未符合项-批量关闭")
|
||||
@ApiOperation(value="未符合项-批量关闭", notes="项目库-批量关闭")
|
||||
@PostMapping(value = "/batchClose")
|
||||
public Result<T> batchClose(@RequestBody Map<String, String> map) {
|
||||
if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
List<String> ids = Arrays.asList(map.get("ids").split(","));
|
||||
//检查所选数据是否均是待整改状态、当前时间大于预计整改完成日期
|
||||
if (this.check(ids)) {
|
||||
throw new JeroBootException(ResultCommon.CANNOT_CLOSE);
|
||||
}
|
||||
lawsEvaluationNotMetService.batchClose(ids);
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
private boolean check(List<String> ids) {
|
||||
Date date = new Date();
|
||||
List<LawsEvaluationNotMet> notMets = lawsEvaluationNotMetService.listByIds(ids);
|
||||
for (LawsEvaluationNotMet notMet : notMets) {
|
||||
String state = notMet.getState();
|
||||
Date expectedTime = notMet.getExpectedTime();
|
||||
// 判断expectedTime是否小于今日
|
||||
boolean isLessThanToday = expectedTime.before(date);
|
||||
if (!state.equals("1") || !isLessThanToday){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, LawsEvaluationNotMet lawsEvaluationNotMet) {
|
||||
return super.exportXls(request, lawsEvaluationNotMet, LawsEvaluationNotMet.class, "评估未符合项条款");
|
||||
return super.exportXls(request, lawsEvaluationNotMet, LawsEvaluationNotMet.class, "未符合项");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -102,8 +102,8 @@ public class LawsEvaluationNotMet implements Serializable {
|
||||
|
||||
/**整改状态(1-待整改、2-整改中、3-审批中、4-已完成)*/
|
||||
@Dict(dicCode = "assess_rectification")
|
||||
@Excel(name = "整改状态(1-待整改、2-整改中、3-审批中、4-已完成)", width = 15)
|
||||
@ApiModelProperty(value = "整改状态(1-待整改、2-整改中、3-审批中、4-已完成)")
|
||||
@Excel(name = "整改状态(1-待整改、2-整改中、3-审批中、4-已完成、5-已关闭)", width = 15)
|
||||
@ApiModelProperty(value = "整改状态(1-待整改、2-整改中、3-审批中、4-已完成、5-已关闭)")
|
||||
private String state;
|
||||
|
||||
/**创建人*/
|
||||
|
||||
+2
@@ -73,4 +73,6 @@ public interface ILawsEvaluationNotMetService extends IService<LawsEvaluationNot
|
||||
* @return
|
||||
*/
|
||||
LawsEvaluationNotMet queryById(String id);
|
||||
|
||||
void batchClose(List<String> ids);
|
||||
}
|
||||
|
||||
+12
@@ -1,6 +1,7 @@
|
||||
package com.jero.modules.projectLibrary.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.jero.modules.projectLibrary.entity.LawsEvaluationNotMet;
|
||||
import com.jero.modules.projectLibrary.mapper.LawsEvaluationNotMetMapper;
|
||||
import com.jero.modules.projectLibrary.service.ILawsEvaluationNotMetService;
|
||||
@@ -115,4 +116,15 @@ public class LawsEvaluationNotMetServiceImpl extends ServiceImpl<LawsEvaluationN
|
||||
public LawsEvaluationNotMet queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchClose(List<String> ids) {
|
||||
if (ids == null || ids.isEmpty()){
|
||||
return;
|
||||
}
|
||||
LambdaUpdateWrapper<LawsEvaluationNotMet> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.set(LawsEvaluationNotMet::getState, "5");
|
||||
wrapper.in(LawsEvaluationNotMet::getId, ids);
|
||||
update(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user