|
|
@@ -12,12 +12,14 @@ import com.qdport.service.PolicyTodoService;
|
|
|
import com.qdport.service.impl.PolicySystemService;
|
|
|
import com.qdport.util.StringUtil;
|
|
|
import com.qdport.vo.PolicyFileVO;
|
|
|
+import com.qdport.vo.PolicyStriveVO;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import com.qdport.entity.PolicyCase;
|
|
|
import com.qdport.service.PolicyCaseService;
|
|
|
import com.qdport.query.PolicyCaseQuery;
|
|
|
import com.qdport.vo.PolicyCaseVO;
|
|
|
import com.qdport.wrapper.PolicyCaseWrapper;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import io.swagger.annotations.Api;
|
|
|
@@ -27,17 +29,18 @@ import com.qdport.core.tool.api.R;
|
|
|
import com.qdport.core.tool.utils.Func;
|
|
|
import com.qdport.core.boot.ctrl.QdportController;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
-* 案例分享
|
|
|
-*
|
|
|
-* @author yuheng
|
|
|
-* @since 1.0.0 2024-10-17
|
|
|
-*/
|
|
|
+ * 案例分享
|
|
|
+ *
|
|
|
+ * @author yuheng
|
|
|
+ * @since 1.0.0 2024-10-17
|
|
|
+ */
|
|
|
@RestController
|
|
|
@RequestMapping("qdport-zcgx/case")
|
|
|
@Api(value = "案例分享", tags = "案例分享")
|
|
|
@@ -51,11 +54,11 @@ public class PolicyCaseController extends QdportController {
|
|
|
private final PolicyStriveService policyStriveService;
|
|
|
|
|
|
/**
|
|
|
- * 分页
|
|
|
- */
|
|
|
+ * 分页
|
|
|
+ */
|
|
|
@GetMapping("page")
|
|
|
@ApiOperation(value = "分页", notes = "分页")
|
|
|
- public R<IPage<PolicyCaseVO>> page(@Valid PolicyCaseQuery query){
|
|
|
+ public R<IPage<PolicyCaseVO>> page(@Valid PolicyCaseQuery query) {
|
|
|
IPage<PolicyCaseVO> page = policyCaseService.page(query);
|
|
|
List<PolicyCaseVO> records = page.getRecords();
|
|
|
for (PolicyCaseVO model : records) {
|
|
|
@@ -68,17 +71,24 @@ public class PolicyCaseController extends QdportController {
|
|
|
model.setFileList(fileList);
|
|
|
|
|
|
PolicyStrive strive = policyStriveService.getById(model.getStriveId());
|
|
|
- model.setPolicyStrive(strive);
|
|
|
+ PolicyStriveVO striveVO = new PolicyStriveVO();
|
|
|
+ BeanUtils.copyProperties(strive, striveVO);
|
|
|
+ createUser = sysUserService.getById(strive.getCreateId());
|
|
|
+ resultMap = policySystemService.getDeptNameAndCompanyName(createUser.getDeptId());
|
|
|
+ striveVO.setDeptName(resultMap.get("deptName"));
|
|
|
+ striveVO.setCompanyName(resultMap.get("companyName"));
|
|
|
+
|
|
|
+ model.setPolicyStrive(striveVO);
|
|
|
}
|
|
|
return R.data(page);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 详情
|
|
|
- */
|
|
|
+ * 详情
|
|
|
+ */
|
|
|
@GetMapping("{id}")
|
|
|
@ApiOperation(value = "详情", notes = "id")
|
|
|
- public R<PolicyCaseVO> get(@PathVariable("id") Long id){
|
|
|
+ public R<PolicyCaseVO> get(@PathVariable("id") Long id) {
|
|
|
PolicyCase entity = policyCaseService.getById(id);
|
|
|
PolicyCaseVO vo = PolicyCaseWrapper.build().entityVO(entity);
|
|
|
|
|
|
@@ -87,25 +97,34 @@ public class PolicyCaseController extends QdportController {
|
|
|
vo.setDeptName(resultMap.get("deptName"));
|
|
|
vo.setCompanyName(resultMap.get("companyName"));
|
|
|
|
|
|
- List<PolicyFileVO> fileList = policyFileService.getFileList(entity.getId().toString(), QDPortEnum.POLICY_FILE_REFTYPE_POLICY_STRIVE.getValue());
|
|
|
+ PolicyStrive strive = policyStriveService.getById(entity.getStriveId());
|
|
|
+ PolicyStriveVO striveVO = new PolicyStriveVO();
|
|
|
+ BeanUtils.copyProperties(strive, striveVO);
|
|
|
+ createUser = sysUserService.getById(strive.getCreateId());
|
|
|
+ resultMap = policySystemService.getDeptNameAndCompanyName(createUser.getDeptId());
|
|
|
+ striveVO.setDeptName(resultMap.get("deptName"));
|
|
|
+ striveVO.setCompanyName(resultMap.get("companyName"));
|
|
|
+
|
|
|
|
|
|
- vo.setFileList(fileList);
|
|
|
+ List<PolicyFileVO> fileList = policyFileService.getFileList(strive.getId().toString(), QDPortEnum.POLICY_FILE_REFTYPE_POLICY_STRIVE.getValue());
|
|
|
+ striveVO.setFileList(fileList);
|
|
|
+ vo.setPolicyStrive(striveVO);
|
|
|
return R.data(vo);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 新增
|
|
|
- */
|
|
|
+ * 新增
|
|
|
+ */
|
|
|
@PostMapping("/save")
|
|
|
@ApiOperation(value = "新增", notes = "传入PolicyCase")
|
|
|
- public R save(@RequestBody PolicyCaseVO vo){
|
|
|
+ public R save(@RequestBody PolicyCaseVO vo) {
|
|
|
vo.setStatus(QDPortEnum.POLICY_CASE_STATUS_ACTIVE.getValue());
|
|
|
policyCaseService.save(vo);
|
|
|
return R.success("保存成功");
|
|
|
}
|
|
|
|
|
|
@PostMapping("/saveDone")
|
|
|
- @ApiOperation(value = "新增", notes = "传入PolicyStrive")
|
|
|
+ @ApiOperation(value = "新增", notes = "传入PolicyCase")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public R saveDone(@RequestBody PolicyCaseVO vo) {
|
|
|
vo.setStatus(QDPortEnum.POLICY_CASE_STATUS_DONE.getValue());
|
|
|
@@ -114,7 +133,7 @@ public class PolicyCaseController extends QdportController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/saveApprove")
|
|
|
- @ApiOperation(value = "新增并且提交", notes = "传入PolicyStrive")
|
|
|
+ @ApiOperation(value = "新增并且提交", notes = "传入PolicyCase")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public R saveApprove(@RequestBody PolicyCaseVO vo) {
|
|
|
if (StringUtil.isEmpty(vo.getId())) {
|
|
|
@@ -125,17 +144,19 @@ public class PolicyCaseController extends QdportController {
|
|
|
policyCaseService.update(vo);
|
|
|
}
|
|
|
PolicyStrive strive = policyStriveService.getById(vo.getStriveId());
|
|
|
- vo.setPolicyStrive(strive);
|
|
|
+ PolicyStriveVO striveVO = new PolicyStriveVO();
|
|
|
+ BeanUtils.copyProperties(strive, striveVO);
|
|
|
+ vo.setPolicyStrive(striveVO);
|
|
|
|
|
|
policyTodoService.save(vo);
|
|
|
return R.success("新增并且提交成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 修改
|
|
|
- */
|
|
|
+ * 修改
|
|
|
+ */
|
|
|
@PostMapping("/update")
|
|
|
- public R update(@RequestBody @Valid PolicyCaseVO vo){
|
|
|
+ public R update(@RequestBody @Valid PolicyCaseVO vo) {
|
|
|
policyCaseService.update(vo);
|
|
|
return R.success("更新成功");
|
|
|
}
|
|
|
@@ -198,13 +219,14 @@ public class PolicyCaseController extends QdportController {
|
|
|
|
|
|
return R.success("更新成功");
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- * 删除
|
|
|
- */
|
|
|
+ * 删除
|
|
|
+ */
|
|
|
@PostMapping("/remove")
|
|
|
@ApiOperation(value = "逻辑删除", notes = "传入ids")
|
|
|
- public R delete(@ApiParam(value = "主键集合", required = true) @RequestParam(name = "ids") String ids){
|
|
|
- List<Long> idList = Func.toLongList(ids);
|
|
|
+ public R delete(@ApiParam(value = "主键集合", required = true) @RequestParam(name = "ids") String ids) {
|
|
|
+ List<Long> idList = Func.toLongList(ids);
|
|
|
policyCaseService.delete(idList);
|
|
|
return R.success("删除成功");
|
|
|
}
|