|
|
@@ -1,11 +1,14 @@
|
|
|
package com.xjrsoft.module.evaluate.controller;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
|
+import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.evaluate.dto.AddEvaluateManageDto;
|
|
|
import com.xjrsoft.module.evaluate.dto.EvaluateManageChangeStatusDto;
|
|
|
import com.xjrsoft.module.evaluate.dto.EvaluateManagePageDto;
|
|
|
@@ -16,19 +19,14 @@ import com.xjrsoft.module.evaluate.service.IEvaluateManageService;
|
|
|
import com.xjrsoft.module.evaluate.service.IEvaluateTemplateService;
|
|
|
import com.xjrsoft.module.evaluate.vo.EvaluateManagePageVo;
|
|
|
import com.xjrsoft.module.evaluate.vo.EvaluateManageVo;
|
|
|
+import com.xjrsoft.module.system.entity.DictionaryDetail;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -60,14 +58,20 @@ public class EvaluateManageController {
|
|
|
@ApiOperation(value="根据id查询评价管理信息")
|
|
|
@SaCheckPermission("evaluatemanage:detail")
|
|
|
public RT<EvaluateManageVo> info(@RequestParam Long id){
|
|
|
- EvaluateManage evaluateManage = evaluateManageService.getByIdDeep(id);
|
|
|
- if (evaluateManage == null) {
|
|
|
+ MPJLambdaWrapper<EvaluateManage> evaluateManageMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
+ evaluateManageMPJLambdaWrapper
|
|
|
+ .selectAs(DictionaryDetail::getName, EvaluateManageVo::getCreateFrequencyCN)
|
|
|
+ .select(EvaluateManage.class, x -> VoToColumnUtil.fieldsToColumns(EvaluateManageVo.class).contains(x.getProperty()))
|
|
|
+ .eq(EvaluateManage::getId, id)
|
|
|
+ .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, EvaluateManage::getCreateFrequency)
|
|
|
+ .disableSubLogicDel();
|
|
|
+ EvaluateManageVo evaluateManageVo = evaluateManageService.selectJoinOne(EvaluateManageVo.class, evaluateManageMPJLambdaWrapper);
|
|
|
+ if (evaluateManageVo == null) {
|
|
|
return RT.error("找不到此数据!");
|
|
|
}
|
|
|
- EvaluateTemplate evaluateTemplate = evaluateTemplateService.getById(evaluateManage.getEvaluateTemplateId());
|
|
|
- EvaluateManageVo manageVo = BeanUtil.toBean(evaluateManage, EvaluateManageVo.class);
|
|
|
- manageVo.setEvaluateType(evaluateTemplate.getEvaluateType());
|
|
|
- return RT.ok(manageVo);
|
|
|
+ EvaluateTemplate evaluateTemplate = evaluateTemplateService.getById(evaluateManageVo.getEvaluateTemplateId());
|
|
|
+ evaluateManageVo.setEvaluateType(evaluateTemplate.getEvaluateType());
|
|
|
+ return RT.ok(evaluateManageVo);
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = "/change-status")
|
|
|
@@ -78,6 +82,13 @@ public class EvaluateManageController {
|
|
|
Boolean release = evaluateManageService.release(dto.getId());
|
|
|
return RT.ok(release);
|
|
|
}
|
|
|
+ if(dto.getStatus() == 0){
|
|
|
+ EvaluateManage evaluateManage = BeanUtil.toBean(dto, EvaluateManage.class);
|
|
|
+ evaluateManage.setModifyDate(new Date());
|
|
|
+ evaluateManage.setModifyUserId(StpUtil.getLoginIdAsLong());
|
|
|
+
|
|
|
+ return RT.ok(evaluateManageService.updateById(evaluateManage));
|
|
|
+ }
|
|
|
|
|
|
return RT.ok(true);
|
|
|
}
|
|
|
@@ -88,6 +99,8 @@ public class EvaluateManageController {
|
|
|
@SaCheckPermission("evaluatemanage:add")
|
|
|
public RT<Boolean> add(@Valid @RequestBody AddEvaluateManageDto dto){
|
|
|
EvaluateManage evaluateManage = BeanUtil.toBean(dto, EvaluateManage.class);
|
|
|
+ evaluateManage.setCreateDate(new Date());
|
|
|
+ evaluateManage.setCreateUserId(StpUtil.getLoginIdAsLong());
|
|
|
boolean isSuccess = evaluateManageService.add(evaluateManage);
|
|
|
return RT.ok(isSuccess);
|
|
|
}
|