|
@@ -1,19 +1,18 @@
|
|
|
package org.jeecg.modules.cuspCode.controller;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.HashMap;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import org.jeecg.common.util.DateUtils;
|
|
|
import org.jeecg.modules.baseCode.service.ISerialPatternService;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.jeecg.modules.cuspCode.entity.CuspSupplierEvaluation;
|
|
|
import org.jeecg.modules.cuspCode.entity.CuspSupplierEvaluationScore;
|
|
|
+import org.jeecg.modules.cuspCode.entity.CuspSupplierProfile;
|
|
|
+import org.jeecg.modules.cuspCode.service.ICuspSupplierProfileService;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
@@ -44,308 +43,477 @@ import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
* @Description: 供应商考评
|
|
|
* @Author: jeecg-boot
|
|
|
- * @Date: 2024-11-07
|
|
|
+ * @Date: 2024-11-07
|
|
|
* @Version: V1.0
|
|
|
*/
|
|
|
-@Api(tags="供应商考评")
|
|
|
+@Api(tags = "供应商考评")
|
|
|
@RestController
|
|
|
@RequestMapping("/cuspCode/cuspSupplierEvaluation")
|
|
|
@Slf4j
|
|
|
public class CuspSupplierEvaluationController {
|
|
|
- @Autowired
|
|
|
- private ICuspSupplierEvaluationService cuspSupplierEvaluationService;
|
|
|
- @Autowired
|
|
|
- private ICuspSupplierEvaluationScoreService cuspSupplierEvaluationScoreService;
|
|
|
- @Autowired
|
|
|
- private ISerialPatternService serialPatternService;
|
|
|
-
|
|
|
-
|
|
|
- * 分页列表查询
|
|
|
- *
|
|
|
- * @param cuspSupplierEvaluation
|
|
|
- * @param pageNo
|
|
|
- * @param pageSize
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
- */
|
|
|
-
|
|
|
- @ApiOperation(value="供应商考评-分页列表查询", notes="供应商考评-分页列表查询")
|
|
|
- @GetMapping(value = "/list")
|
|
|
- public Result<IPage<CuspSupplierEvaluation>> queryPageList(CuspSupplierEvaluation cuspSupplierEvaluation,
|
|
|
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
+ @Autowired
|
|
|
+ private ICuspSupplierEvaluationService cuspSupplierEvaluationService;
|
|
|
+ @Autowired
|
|
|
+ private ICuspSupplierEvaluationScoreService cuspSupplierEvaluationScoreService;
|
|
|
+ @Autowired
|
|
|
+ private ISerialPatternService serialPatternService;
|
|
|
+ @Autowired
|
|
|
+ private ICuspSupplierProfileService cuspSupplierProfileService;
|
|
|
+
|
|
|
+
|
|
|
+ * 分页列表查询
|
|
|
+ *
|
|
|
+ * @param cuspSupplierEvaluation
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+
|
|
|
+ @ApiOperation(value = "供应商考评-分页列表查询", notes = "供应商考评-分页列表查询")
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ public Result<IPage<CuspSupplierEvaluation>> queryPageList(CuspSupplierEvaluation cuspSupplierEvaluation,
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
|
|
|
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
|
|
|
|
|
customeRuleMap.put("supplierId", QueryRuleEnum.LIKE_WITH_OR);
|
|
|
customeRuleMap.put("evaluationLevel", QueryRuleEnum.LIKE_WITH_OR);
|
|
|
customeRuleMap.put("submit", QueryRuleEnum.LIKE_WITH_OR);
|
|
|
- QueryWrapper<CuspSupplierEvaluation> queryWrapper = QueryGenerator.initQueryWrapper(cuspSupplierEvaluation, req.getParameterMap(),customeRuleMap);
|
|
|
- Page<CuspSupplierEvaluation> page = new Page<CuspSupplierEvaluation>(pageNo, pageSize);
|
|
|
- IPage<CuspSupplierEvaluation> pageList = cuspSupplierEvaluationService.page(page, queryWrapper);
|
|
|
- return Result.OK(pageList);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- * 添加
|
|
|
- *
|
|
|
- * @param cuspSupplierEvaluationPage
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "供应商考评-添加")
|
|
|
- @ApiOperation(value="供应商考评-添加", notes="供应商考评-添加")
|
|
|
+ QueryWrapper<CuspSupplierEvaluation> queryWrapper = QueryGenerator.initQueryWrapper(cuspSupplierEvaluation, req.getParameterMap(), customeRuleMap);
|
|
|
+ Page<CuspSupplierEvaluation> page = new Page<CuspSupplierEvaluation>(pageNo, pageSize);
|
|
|
+ IPage<CuspSupplierEvaluation> pageList = cuspSupplierEvaluationService.page(page, queryWrapper);
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 添加
|
|
|
+ *
|
|
|
+ * @param cuspSupplierEvaluationPage
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "供应商考评-添加")
|
|
|
+ @ApiOperation(value = "供应商考评-添加", notes = "供应商考评-添加")
|
|
|
@RequiresPermissions("cuspCode:cusp_supplier_evaluation:add")
|
|
|
- @PostMapping(value = "/add")
|
|
|
- public Result<String> add(@RequestBody CuspSupplierEvaluationPage cuspSupplierEvaluationPage) {
|
|
|
-
|
|
|
-
|
|
|
- String code = cuspSupplierEvaluationPage.getBillCode();
|
|
|
- if (StringUtils.isNotBlank(code)) {
|
|
|
-
|
|
|
- QueryWrapper<CuspSupplierEvaluation> queryWrapper = new QueryWrapper();
|
|
|
- queryWrapper.eq("bill_code", code);
|
|
|
- queryWrapper.eq("del_flag", "0");
|
|
|
-
|
|
|
- List<CuspSupplierEvaluation> list = cuspSupplierEvaluationService.list(queryWrapper);
|
|
|
- if (list.size() != 0) {
|
|
|
- return Result.error("供应商考评编码重复,请修改!");
|
|
|
- }
|
|
|
- } else {
|
|
|
-
|
|
|
- Result<String> result = serialPatternService.getNextSerial("cusp_supplier_evaluation", "bill_code");
|
|
|
- if (!result.isSuccess()) {
|
|
|
- return result;
|
|
|
- }
|
|
|
- cuspSupplierEvaluationPage.setBillCode(result.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- CuspSupplierEvaluation cuspSupplierEvaluation = new CuspSupplierEvaluation();
|
|
|
- BeanUtils.copyProperties(cuspSupplierEvaluationPage, cuspSupplierEvaluation);
|
|
|
- cuspSupplierEvaluationService.saveMain(cuspSupplierEvaluation, cuspSupplierEvaluationPage.getCuspSupplierEvaluationScoreList());
|
|
|
- return Result.OK("添加成功!");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- * 编辑
|
|
|
- *
|
|
|
- * @param cuspSupplierEvaluationPage
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "供应商考评-编辑")
|
|
|
- @ApiOperation(value="供应商考评-编辑", notes="供应商考评-编辑")
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public Result<String> add(@RequestBody CuspSupplierEvaluationPage cuspSupplierEvaluationPage) {
|
|
|
+
|
|
|
+
|
|
|
+ Date getBillDate = cuspSupplierEvaluationPage.getBillDate();
|
|
|
+ if (getBillDate == null) {
|
|
|
+ cuspSupplierEvaluationPage.setBillDate(new Date());
|
|
|
+ }
|
|
|
+
|
|
|
+ String supplierId = cuspSupplierEvaluationPage.getSupplierId();
|
|
|
+ String evaluationPeriod = cuspSupplierEvaluationPage.getEvaluationPeriod();
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(supplierId)) {
|
|
|
+ return Result.error("供应商不能为空,请填写!");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(evaluationPeriod)) {
|
|
|
+ cuspSupplierEvaluationPage.setEvaluationPeriod(DateUtils.nowYear());
|
|
|
+ }
|
|
|
+
|
|
|
+ String code = cuspSupplierEvaluationPage.getBillCode();
|
|
|
+ if (StringUtils.isNotBlank(code)) {
|
|
|
+
|
|
|
+ QueryWrapper<CuspSupplierEvaluation> queryWrapper = new QueryWrapper();
|
|
|
+ queryWrapper.eq("bill_code", code);
|
|
|
+ queryWrapper.eq("del_flag", "0");
|
|
|
+
|
|
|
+ List<CuspSupplierEvaluation> list = cuspSupplierEvaluationService.list(queryWrapper);
|
|
|
+ if (list.size() != 0) {
|
|
|
+ return Result.error("供应商考评编码重复,请修改!");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+
|
|
|
+ QueryWrapper<CuspSupplierEvaluation> queryWrapper = new QueryWrapper();
|
|
|
+ queryWrapper.eq("supplier_Id", supplierId);
|
|
|
+ queryWrapper.eq("evaluation_Period", cuspSupplierEvaluationPage.getEvaluationPeriod());
|
|
|
+ queryWrapper.eq("del_flag", "0");
|
|
|
+
|
|
|
+ List<CuspSupplierEvaluation> list = cuspSupplierEvaluationService.list(queryWrapper);
|
|
|
+ if (list.size() != 0) {
|
|
|
+ return Result.error("供应商重复,请修改!");
|
|
|
+ }
|
|
|
+
|
|
|
+ Result<String> result = serialPatternService.getNextSerial("cusp_supplier_evaluation", "bill_code");
|
|
|
+ if (!result.isSuccess()) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ cuspSupplierEvaluationPage.setBillCode(result.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ CuspSupplierEvaluation cuspSupplierEvaluation = new CuspSupplierEvaluation();
|
|
|
+ BeanUtils.copyProperties(cuspSupplierEvaluationPage, cuspSupplierEvaluation);
|
|
|
+ cuspSupplierEvaluationService.saveMain(cuspSupplierEvaluation, cuspSupplierEvaluationPage.getCuspSupplierEvaluationScoreList());
|
|
|
+ return Result.OK("添加成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 编辑
|
|
|
+ *
|
|
|
+ * @param cuspSupplierEvaluationPage
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "供应商考评-编辑")
|
|
|
+ @ApiOperation(value = "供应商考评-编辑", notes = "供应商考评-编辑")
|
|
|
@RequiresPermissions("cuspCode:cusp_supplier_evaluation:edit")
|
|
|
- @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
- public Result<String> edit(@RequestBody CuspSupplierEvaluationPage cuspSupplierEvaluationPage) {
|
|
|
- CuspSupplierEvaluation cuspSupplierEvaluation = new CuspSupplierEvaluation();
|
|
|
- BeanUtils.copyProperties(cuspSupplierEvaluationPage, cuspSupplierEvaluation);
|
|
|
- CuspSupplierEvaluation cuspSupplierEvaluationEntity = cuspSupplierEvaluationService.getById(cuspSupplierEvaluation.getId());
|
|
|
- if(cuspSupplierEvaluationEntity==null) {
|
|
|
- return Result.error("未找到对应数据");
|
|
|
- }
|
|
|
-
|
|
|
- String code = cuspSupplierEvaluation.getBillCode();
|
|
|
- QueryWrapper<CuspSupplierEvaluation> queryWrapper = new QueryWrapper();
|
|
|
- queryWrapper.eq("bill_code", code);
|
|
|
- queryWrapper.eq("del_flag", "0");
|
|
|
- queryWrapper.notIn("id", cuspSupplierEvaluation.getId());
|
|
|
-
|
|
|
- List<CuspSupplierEvaluation> list = cuspSupplierEvaluationService.list(queryWrapper);
|
|
|
- if (list.size() != 0) {
|
|
|
- return Result.error("供应商考评编码重复,请修改!");
|
|
|
- }
|
|
|
-
|
|
|
- cuspSupplierEvaluationService.updateMain(cuspSupplierEvaluation, cuspSupplierEvaluationPage.getCuspSupplierEvaluationScoreList());
|
|
|
- return Result.OK("编辑成功!");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- * 通过id删除
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "供应商考评-通过id删除")
|
|
|
- @ApiOperation(value="供应商考评-通过id删除", notes="供应商考评-通过id删除")
|
|
|
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
|
|
+ public Result<String> edit(@RequestBody CuspSupplierEvaluationPage cuspSupplierEvaluationPage) {
|
|
|
+ CuspSupplierEvaluation cuspSupplierEvaluation = new CuspSupplierEvaluation();
|
|
|
+ BeanUtils.copyProperties(cuspSupplierEvaluationPage, cuspSupplierEvaluation);
|
|
|
+ CuspSupplierEvaluation cuspSupplierEvaluationEntity = cuspSupplierEvaluationService.getById(cuspSupplierEvaluation.getId());
|
|
|
+ if (cuspSupplierEvaluationEntity == null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ String supplierId = cuspSupplierEvaluationPage.getSupplierId();
|
|
|
+ String evaluationPeriod = cuspSupplierEvaluationPage.getEvaluationPeriod();
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(supplierId)) {
|
|
|
+ return Result.error("供应商不能为空,请填写!");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(evaluationPeriod)) {
|
|
|
+ return Result.error("考评期间不能为空,请填写!");
|
|
|
+ }
|
|
|
+
|
|
|
+ QueryWrapper<CuspSupplierEvaluation> queryWrapper = new QueryWrapper();
|
|
|
+ queryWrapper.eq("supplier_Id", supplierId);
|
|
|
+ queryWrapper.eq("evaluation_Period", evaluationPeriod);
|
|
|
+ queryWrapper.eq("del_flag", "0");
|
|
|
+ queryWrapper.notIn("id", cuspSupplierEvaluation.getId());
|
|
|
+
|
|
|
+ List<CuspSupplierEvaluation> list = cuspSupplierEvaluationService.list(queryWrapper);
|
|
|
+ if (list.size() != 0) {
|
|
|
+ return Result.error("供应商重复,请修改!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ cuspSupplierEvaluationService.updateMain(cuspSupplierEvaluation, cuspSupplierEvaluationPage.getCuspSupplierEvaluationScoreList());
|
|
|
+ return Result.OK("编辑成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 通过id删除
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "供应商考评-通过id删除")
|
|
|
+ @ApiOperation(value = "供应商考评-通过id删除", notes = "供应商考评-通过id删除")
|
|
|
@RequiresPermissions("cuspCode:cusp_supplier_evaluation:delete")
|
|
|
- @DeleteMapping(value = "/delete")
|
|
|
- public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
- cuspSupplierEvaluationService.delMain(id);
|
|
|
- return Result.OK("删除成功!");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- * 批量提交
|
|
|
- *
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "供应商考评-批量提交")
|
|
|
- @ApiOperation(value="供应商考评-批量提交", notes="供应商考评-批量提交")
|
|
|
+ @DeleteMapping(value = "/delete")
|
|
|
+ public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ CuspSupplierEvaluation list = cuspSupplierEvaluationService.getById(id);
|
|
|
+
|
|
|
+ Integer submit = list.getSubmit();
|
|
|
+ if (submit != null && submit.equals(1)) {
|
|
|
+ return Result.error("已提交的数据,无法删除!");
|
|
|
+ }
|
|
|
+
|
|
|
+ cuspSupplierEvaluationService.delMain(id);
|
|
|
+ return Result.OK("删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 批量提交
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "供应商考评-批量提交")
|
|
|
+ @ApiOperation(value = "供应商考评-批量提交", notes = "供应商考评-批量提交")
|
|
|
|
|
|
- @DeleteMapping(value = "/submitBatch")
|
|
|
- public Result<String> submitBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
-
|
|
|
- QueryWrapper<CuspSupplierEvaluation> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.in("id",Arrays.asList(ids.split(",")));
|
|
|
- CuspSupplierEvaluation ent = new CuspSupplierEvaluation();
|
|
|
- ent.setSubmit(1);
|
|
|
- cuspSupplierEvaluationService.update(ent,queryWrapper);
|
|
|
-
|
|
|
- return Result.OK("提交成功!");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- * 批量取消提交
|
|
|
- *
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "供应商考评-批量取消提交")
|
|
|
- @ApiOperation(value="供应商考评-批量取消提交", notes="供应商考评-批量取消提交")
|
|
|
+ @GetMapping(value = "/submitBatch")
|
|
|
+ public Result<String> submitBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
+
|
|
|
+ QueryWrapper<CuspSupplierEvaluation> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.in("id", Arrays.asList(ids.split(",")));
|
|
|
+
|
|
|
+ List<CuspSupplierEvaluation> list = cuspSupplierEvaluationService.list(queryWrapper);
|
|
|
+ if (list.size() == 0) {
|
|
|
+ return Result.error("数据为空!");
|
|
|
+ }
|
|
|
+
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (CuspSupplierEvaluation o : list) {
|
|
|
+
|
|
|
+ Integer submit = o.getSubmit();
|
|
|
+ String code = o.getBillCode();
|
|
|
+
|
|
|
+ String supplierId = o.getSupplierId();
|
|
|
+ String evaluationPeriod = o.getEvaluationPeriod();
|
|
|
+ String evaluationLevel = o.getEvaluationLevel();
|
|
|
+ Date getBillDate = o.getBillDate();
|
|
|
+
|
|
|
+ if (submit != null && submit.equals(1)) {
|
|
|
+ sb.append("考评单号" + code).append("已提交,请勿再次提交;");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(supplierId) || StringUtils.isBlank(evaluationPeriod)
|
|
|
+ || StringUtils.isBlank(evaluationLevel) || getBillDate == null) {
|
|
|
+ sb.append("考评单号" + code).append("数据维护不全,请维护后提交;");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(sb.toString())) {
|
|
|
+
|
|
|
+ return Result.error(sb.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ CuspSupplierEvaluation ent = new CuspSupplierEvaluation();
|
|
|
+ ent.setSubmit(1);
|
|
|
+ cuspSupplierEvaluationService.update(ent, queryWrapper);
|
|
|
+
|
|
|
+ for (CuspSupplierEvaluation cuspSupplierEvaluationPage : list) {
|
|
|
+
|
|
|
+ String supplierId = cuspSupplierEvaluationPage.getSupplierId();
|
|
|
+
|
|
|
+ String evaluationLevel = cuspSupplierEvaluationPage.getEvaluationLevel();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ CuspSupplierProfile profile = new CuspSupplierProfile();
|
|
|
+ profile.setId(supplierId);
|
|
|
+ profile.setEvaluationLevel(evaluationLevel);
|
|
|
+ cuspSupplierProfileService.updateById(profile);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return Result.OK("提交成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 批量取消提交
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "供应商考评-批量取消提交")
|
|
|
+ @ApiOperation(value = "供应商考评-批量取消提交", notes = "供应商考评-批量取消提交")
|
|
|
|
|
|
- @DeleteMapping(value = "/returnSubmitBatch")
|
|
|
- public Result<String> returnSubmitBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
-
|
|
|
- QueryWrapper<CuspSupplierEvaluation> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.in("id",Arrays.asList(ids.split(",")));
|
|
|
- CuspSupplierEvaluation ent = new CuspSupplierEvaluation();
|
|
|
- ent.setSubmit(0);
|
|
|
- cuspSupplierEvaluationService.update(ent,queryWrapper);
|
|
|
-
|
|
|
- return Result.OK("取消提交成功!");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- * 批量删除
|
|
|
- *
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "供应商考评-批量删除")
|
|
|
- @ApiOperation(value="供应商考评-批量删除", notes="供应商考评-批量删除")
|
|
|
+ @GetMapping(value = "/returnSubmitBatch")
|
|
|
+ public Result<String> returnSubmitBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
+
|
|
|
+ QueryWrapper<CuspSupplierEvaluation> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.in("id", Arrays.asList(ids.split(",")));
|
|
|
+
|
|
|
+ List<CuspSupplierEvaluation> list = cuspSupplierEvaluationService.list(queryWrapper);
|
|
|
+ if (list.size() == 0) {
|
|
|
+ return Result.error("数据为空!");
|
|
|
+ }
|
|
|
+
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (CuspSupplierEvaluation o : list) {
|
|
|
+
|
|
|
+ Integer submit = o.getSubmit();
|
|
|
+ String code = o.getBillCode();
|
|
|
+
|
|
|
+ if (submit == null || submit.equals(0)) {
|
|
|
+ sb.append("考评单号" + code).append("已取消提交,请勿再次取消提交;");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(sb.toString())) {
|
|
|
+
|
|
|
+ return Result.error(sb.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ CuspSupplierEvaluation ent = new CuspSupplierEvaluation();
|
|
|
+ ent.setSubmit(0);
|
|
|
+ cuspSupplierEvaluationService.update(ent, queryWrapper);
|
|
|
+
|
|
|
+ for (CuspSupplierEvaluation cuspSupplierEvaluationPage : list) {
|
|
|
+
|
|
|
+ String supplierId = cuspSupplierEvaluationPage.getSupplierId();
|
|
|
+ String evaluationPeriod = cuspSupplierEvaluationPage.getEvaluationPeriod();
|
|
|
+
|
|
|
+ if (!evaluationPeriod.equals(DateUtils.nowYear())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ cuspSupplierProfileService.updateEvaluationLevel(supplierId);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return Result.OK("取消提交成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 批量删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "供应商考评-批量删除")
|
|
|
+ @ApiOperation(value = "供应商考评-批量删除", notes = "供应商考评-批量删除")
|
|
|
@RequiresPermissions("cuspCode:cusp_supplier_evaluation:deleteBatch")
|
|
|
- @DeleteMapping(value = "/deleteBatch")
|
|
|
- public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
- this.cuspSupplierEvaluationService.delBatchMain(Arrays.asList(ids.split(",")));
|
|
|
- return Result.OK("批量删除成功!");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- * 通过id查询
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
-
|
|
|
- @ApiOperation(value="供应商考评-通过id查询", notes="供应商考评-通过id查询")
|
|
|
- @GetMapping(value = "/queryById")
|
|
|
- public Result<CuspSupplierEvaluation> queryById(@RequestParam(name="id",required=true) String id) {
|
|
|
- CuspSupplierEvaluation cuspSupplierEvaluation = cuspSupplierEvaluationService.getById(id);
|
|
|
- if(cuspSupplierEvaluation==null) {
|
|
|
- return Result.error("未找到对应数据");
|
|
|
- }
|
|
|
- return Result.OK(cuspSupplierEvaluation);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- * 通过id查询
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
-
|
|
|
- @ApiOperation(value="供应商考评-得分主表ID查询", notes="供应商考评-得分-通主表ID查询")
|
|
|
- @GetMapping(value = "/queryCuspSupplierEvaluationScoreByMainId")
|
|
|
- public Result<List<CuspSupplierEvaluationScore>> queryCuspSupplierEvaluationScoreListByMainId(@RequestParam(name="id",required=true) String id) {
|
|
|
- List<CuspSupplierEvaluationScore> cuspSupplierEvaluationScoreList = cuspSupplierEvaluationScoreService.selectByMainId(id);
|
|
|
- return Result.OK(cuspSupplierEvaluationScoreList);
|
|
|
- }
|
|
|
+ @DeleteMapping(value = "/deleteBatch")
|
|
|
+ public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
+
|
|
|
+ QueryWrapper<CuspSupplierEvaluation> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.in("id", Arrays.asList(ids.split(",")));
|
|
|
+
|
|
|
+ List<CuspSupplierEvaluation> list = cuspSupplierEvaluationService.list(queryWrapper);
|
|
|
+ if (list.size() == 0) {
|
|
|
+ return Result.error("数据为空!");
|
|
|
+ }
|
|
|
+
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (CuspSupplierEvaluation o : list) {
|
|
|
+
|
|
|
+ Integer submit = o.getSubmit();
|
|
|
+ String code = o.getBillCode();
|
|
|
+
|
|
|
+ if (submit != null && submit.equals(1)) {
|
|
|
+ sb.append("考评单号" + code).append("已提交,无法删除;");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(sb.toString())) {
|
|
|
+ return Result.error(sb.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ this.cuspSupplierEvaluationService.delBatchMain(Arrays.asList(ids.split(",")));
|
|
|
+ return Result.OK("批量删除成功!");
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- * 导出excel
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param cuspSupplierEvaluation
|
|
|
- */
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+
|
|
|
+ @ApiOperation(value = "供应商考评-通过id查询", notes = "供应商考评-通过id查询")
|
|
|
+ @GetMapping(value = "/queryById")
|
|
|
+ public Result<CuspSupplierEvaluation> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ CuspSupplierEvaluation cuspSupplierEvaluation = cuspSupplierEvaluationService.getById(id);
|
|
|
+ if (cuspSupplierEvaluation == null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+ return Result.OK(cuspSupplierEvaluation);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+
|
|
|
+ @ApiOperation(value = "供应商考评-得分主表ID查询", notes = "供应商考评-得分-通主表ID查询")
|
|
|
+ @GetMapping(value = "/queryCuspSupplierEvaluationScoreByMainId")
|
|
|
+ public Result<List<CuspSupplierEvaluationScore>> queryCuspSupplierEvaluationScoreListByMainId(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ List<CuspSupplierEvaluationScore> cuspSupplierEvaluationScoreList = cuspSupplierEvaluationScoreService.selectByMainId(id);
|
|
|
+ return Result.OK(cuspSupplierEvaluationScoreList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 导出excel
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param cuspSupplierEvaluation
|
|
|
+ */
|
|
|
@RequiresPermissions("cuspCode:cusp_supplier_evaluation:exportXls")
|
|
|
@RequestMapping(value = "/exportXls")
|
|
|
public ModelAndView exportXls(HttpServletRequest request, CuspSupplierEvaluation cuspSupplierEvaluation) {
|
|
|
-
|
|
|
- QueryWrapper<CuspSupplierEvaluation> queryWrapper = QueryGenerator.initQueryWrapper(cuspSupplierEvaluation, request.getParameterMap());
|
|
|
- LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
-
|
|
|
-
|
|
|
- String selections = request.getParameter("selections");
|
|
|
- if(oConvertUtils.isNotEmpty(selections)) {
|
|
|
- List<String> selectionList = Arrays.asList(selections.split(","));
|
|
|
- queryWrapper.in("id",selectionList);
|
|
|
- }
|
|
|
-
|
|
|
- List<CuspSupplierEvaluation> cuspSupplierEvaluationList = cuspSupplierEvaluationService.list(queryWrapper);
|
|
|
-
|
|
|
-
|
|
|
- List<CuspSupplierEvaluationPage> pageList = new ArrayList<CuspSupplierEvaluationPage>();
|
|
|
- for (CuspSupplierEvaluation main : cuspSupplierEvaluationList) {
|
|
|
- CuspSupplierEvaluationPage vo = new CuspSupplierEvaluationPage();
|
|
|
- BeanUtils.copyProperties(main, vo);
|
|
|
- List<CuspSupplierEvaluationScore> cuspSupplierEvaluationScoreList = cuspSupplierEvaluationScoreService.selectByMainId(main.getId());
|
|
|
- vo.setCuspSupplierEvaluationScoreList(cuspSupplierEvaluationScoreList);
|
|
|
- pageList.add(vo);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
- mv.addObject(NormalExcelConstants.FILE_NAME, "供应商考评列表");
|
|
|
- mv.addObject(NormalExcelConstants.CLASS, CuspSupplierEvaluationPage.class);
|
|
|
- mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("供应商考评数据", "导出人:"+sysUser.getRealname(), "供应商考评"));
|
|
|
- mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
|
|
- return mv;
|
|
|
+
|
|
|
+ QueryWrapper<CuspSupplierEvaluation> queryWrapper = QueryGenerator.initQueryWrapper(cuspSupplierEvaluation, request.getParameterMap());
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+
|
|
|
+
|
|
|
+ String selections = request.getParameter("selections");
|
|
|
+ if (oConvertUtils.isNotEmpty(selections)) {
|
|
|
+ List<String> selectionList = Arrays.asList(selections.split(","));
|
|
|
+ queryWrapper.in("id", selectionList);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CuspSupplierEvaluation> cuspSupplierEvaluationList = cuspSupplierEvaluationService.list(queryWrapper);
|
|
|
+
|
|
|
+
|
|
|
+ List<CuspSupplierEvaluationPage> pageList = new ArrayList<CuspSupplierEvaluationPage>();
|
|
|
+ for (CuspSupplierEvaluation main : cuspSupplierEvaluationList) {
|
|
|
+ CuspSupplierEvaluationPage vo = new CuspSupplierEvaluationPage();
|
|
|
+ BeanUtils.copyProperties(main, vo);
|
|
|
+ List<CuspSupplierEvaluationScore> cuspSupplierEvaluationScoreList = cuspSupplierEvaluationScoreService.selectByMainId(main.getId());
|
|
|
+ vo.setCuspSupplierEvaluationScoreList(cuspSupplierEvaluationScoreList);
|
|
|
+ pageList.add(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
+ mv.addObject(NormalExcelConstants.FILE_NAME, "供应商考评列表");
|
|
|
+ mv.addObject(NormalExcelConstants.CLASS, CuspSupplierEvaluationPage.class);
|
|
|
+ mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("供应商考评数据", "导出人:" + sysUser.getRealname(), "供应商考评"));
|
|
|
+ mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
|
|
+ return mv;
|
|
|
}
|
|
|
|
|
|
|
|
|
- * 通过excel导入数据
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param response
|
|
|
- * @return
|
|
|
- */
|
|
|
+ * 通过excel导入数据
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@RequiresPermissions("cuspCode:cusp_supplier_evaluation:importExcel")
|
|
|
@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<CuspSupplierEvaluationPage> list = ExcelImportUtil.importExcel(file.getInputStream(), CuspSupplierEvaluationPage.class, params);
|
|
|
- for (CuspSupplierEvaluationPage page : list) {
|
|
|
- CuspSupplierEvaluation po = new CuspSupplierEvaluation();
|
|
|
- BeanUtils.copyProperties(page, po);
|
|
|
- cuspSupplierEvaluationService.saveMain(po, page.getCuspSupplierEvaluationScoreList());
|
|
|
- }
|
|
|
- return Result.OK("文件导入成功!数据行数:" + list.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("文件导入失败!");
|
|
|
+ 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<CuspSupplierEvaluationPage> list = ExcelImportUtil.importExcel(file.getInputStream(), CuspSupplierEvaluationPage.class, params);
|
|
|
+ for (CuspSupplierEvaluationPage page : list) {
|
|
|
+ CuspSupplierEvaluation po = new CuspSupplierEvaluation();
|
|
|
+ BeanUtils.copyProperties(page, po);
|
|
|
+ cuspSupplierEvaluationService.saveMain(po, page.getCuspSupplierEvaluationScoreList());
|
|
|
+ }
|
|
|
+ return Result.OK("文件导入成功!数据行数:" + list.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("文件导入失败!");
|
|
|
}
|
|
|
|
|
|
}
|