|
@@ -24,6 +24,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
+import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.tool.api.R;
|
|
@@ -31,17 +32,16 @@ import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
|
|
|
import org.springblade.manager.entity.ContractInfo;
|
|
|
import org.springblade.manager.entity.ProjectInfo;
|
|
|
-import org.springblade.manager.service.IContractInfoService;
|
|
|
-import org.springblade.manager.service.IProjectInfoService;
|
|
|
-import org.springblade.manager.service.SaveUserInfoByProjectService;
|
|
|
+import org.springblade.manager.entity.SignPfxDeputy;
|
|
|
+import org.springblade.manager.service.*;
|
|
|
import org.springblade.manager.vo.*;
|
|
|
+import org.springblade.system.entity.Role;
|
|
|
import org.springblade.system.feign.ISysClient;
|
|
|
import org.springblade.system.vo.RoleVO;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.springblade.manager.entity.SignPfxFile;
|
|
|
-import org.springblade.manager.service.ISignPfxFileService;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -71,6 +71,8 @@ public class SignPfxFileController extends BladeController {
|
|
|
|
|
|
private final ISysClient sysClient;
|
|
|
|
|
|
+ private final ISignPfxDeputyService signPfxDeputyService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取当前项目及其所有合同段
|
|
|
* @return 项目及合同段列表
|
|
@@ -127,14 +129,14 @@ public class SignPfxFileController extends BladeController {
|
|
|
//返回结果
|
|
|
List<RoleSignPfxUserVO> result = new ArrayList<>();
|
|
|
//企业章
|
|
|
- RoleSignPfxUserVO pfxUnitVo = new RoleSignPfxUserVO();
|
|
|
- pfxUnitVo.setRoleId(1L);
|
|
|
- pfxUnitVo.setRoleName("单位证书");
|
|
|
- List<SignPfxFile> unitPfxList = this.signPfxFileService.list(Wrappers.<SignPfxFile>lambdaQuery().eq(SignPfxFile::getContractId, contractId).eq(SignPfxFile::getIsDeleted, 0));
|
|
|
- if(unitPfxList != null && unitPfxList.size() > 0){
|
|
|
- pfxUnitVo.setSignPfxFileList(unitPfxList);
|
|
|
- }
|
|
|
- result.add(pfxUnitVo);
|
|
|
+// RoleSignPfxUserVO pfxUnitVo = new RoleSignPfxUserVO();
|
|
|
+// pfxUnitVo.setRoleId(1L);
|
|
|
+// pfxUnitVo.setRoleName("单位证书");
|
|
|
+// List<SignPfxFile> unitPfxList = this.signPfxFileService.list(Wrappers.<SignPfxFile>lambdaQuery().eq(SignPfxFile::getContractId, contractId).eq(SignPfxFile::getIsDeleted, 0));
|
|
|
+// if(unitPfxList != null && unitPfxList.size() > 0){
|
|
|
+// pfxUnitVo.setSignPfxFileList(unitPfxList);
|
|
|
+// }
|
|
|
+// result.add(pfxUnitVo);
|
|
|
|
|
|
//循环角色,对项目人员进行分组
|
|
|
for(RoleVO vo : roleVOS){
|
|
@@ -193,11 +195,16 @@ public class SignPfxFileController extends BladeController {
|
|
|
/**
|
|
|
* 证书管理分页
|
|
|
*/
|
|
|
- @PostMapping("/singPfxManagementPage")
|
|
|
+ @GetMapping("/singPfxManagementPage")
|
|
|
@ApiOperationSupport(order = 7)
|
|
|
@ApiOperation(value = "证书管理分页")
|
|
|
@ApiImplicitParam(name = "vo", value = "必传current、size, 选传projectId")
|
|
|
- public R<IPage<SingPfxManagementVO>> singPfxManagementPage(SingPfxManagementVO vo){
|
|
|
+ public R<IPage<SingPfxManagementVO>> singPfxManagementPage(@RequestParam Integer current, @RequestParam Integer size, @RequestParam Long contractId){
|
|
|
+ SingPfxManagementVO vo = new SingPfxManagementVO();
|
|
|
+ vo.setCurrent(current);
|
|
|
+ vo.setSize(size);
|
|
|
+ vo.setContractId(contractId);
|
|
|
+
|
|
|
Query query = new Query();
|
|
|
query.setSize(vo.getSize());
|
|
|
query.setCurrent(vo.getCurrent());
|
|
@@ -212,8 +219,15 @@ public class SignPfxFileController extends BladeController {
|
|
|
@ApiOperationSupport(order = 6)
|
|
|
@ApiOperation(value = "获取详情数据")
|
|
|
@ApiImplicitParam(name = "id", value = "列表数据主键ID", required = true)
|
|
|
- public R<SignPfxFile> getById(Long id){
|
|
|
- return R.data(this.signPfxFileService.getById(id));
|
|
|
+ public R<SignPfxFileVO> getById(Long id){
|
|
|
+ //查询数据
|
|
|
+ SignPfxFile data = this.signPfxFileService.getById(id);
|
|
|
+ //实体转换
|
|
|
+ SignPfxFileVO vo = JSONObject.parseObject(JSONObject.toJSONString(data), SignPfxFileVO.class);
|
|
|
+ List<SignPfxDeputy> deputies = this.signPfxDeputyService.list(Wrappers.<SignPfxDeputy>lambdaQuery().eq(SignPfxDeputy::getSignPfxFileId, id).eq(SignPfxDeputy::getIsDeleted, 0));
|
|
|
+ vo.setSignPfxDeputieList(deputies);
|
|
|
+
|
|
|
+ return R.data(vo);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -253,8 +267,13 @@ public class SignPfxFileController extends BladeController {
|
|
|
@PostMapping("/save")
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiOperation(value = "新增", notes = "传入signPfxFile")
|
|
|
- public R save(@Valid @RequestBody SignPfxFile signPfxFile) {
|
|
|
- return R.status(this.signPfxFileService.save(signPfxFile));
|
|
|
+ public R save(@Valid @RequestBody SignPfxFileVO vo) {
|
|
|
+
|
|
|
+ if(new Integer("2").equals(vo.getCertificateType())){
|
|
|
+ this.saveSignPfxDeputy(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.status(this.signPfxFileService.save(vo));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -263,10 +282,51 @@ public class SignPfxFileController extends BladeController {
|
|
|
@PostMapping("/update")
|
|
|
@ApiOperationSupport(order = 3)
|
|
|
@ApiOperation(value = "修改", notes = "传入signPfxFile")
|
|
|
- public R update(@Valid @RequestBody SignPfxFile signPfxFile) {
|
|
|
- return R.status(this.signPfxFileService.updateById(signPfxFile));
|
|
|
+ public R update(@Valid @RequestBody SignPfxFileVO vo) {
|
|
|
+ if(new Integer("2").equals(vo.getCertificateType())){
|
|
|
+ //查询旧数据
|
|
|
+ SignPfxFile oldData = this.signPfxFileService.getById(vo.getId());
|
|
|
+ if(!vo.getProjectContractRole().trim().equals(oldData.getProjectContractRole().trim())){
|
|
|
+ //如果不匹配,先删除
|
|
|
+ this.signPfxDeputyService.update(Wrappers.<SignPfxDeputy>lambdaUpdate().set(SignPfxDeputy::getIsDeleted, 1).eq(SignPfxDeputy::getSignPfxFileId, vo.getId()));
|
|
|
+ //再重新生成
|
|
|
+ this.saveSignPfxDeputy(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.status(this.signPfxFileService.updateById(vo));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ private void saveSignPfxDeputy(SignPfxFileVO vo){
|
|
|
+ String[] projectContractRoles = vo.getProjectContractRole().trim().split(",");
|
|
|
+ //从表数据
|
|
|
+ List<SignPfxDeputy> insertList = new ArrayList<>();
|
|
|
+ vo.setId(SnowFlakeUtil.getId());
|
|
|
+ for(String projectContractRole : projectContractRoles){
|
|
|
+ String[] array = projectContractRole.split("-");
|
|
|
+ //查询项目信息
|
|
|
+ ProjectInfo projectInfo = this.projectInfoService.getById(array[0]);
|
|
|
+ //获取合同段ID
|
|
|
+ ContractInfo contractInfo = this.contractInfoService.getById(array[1]);
|
|
|
+ //获取角色
|
|
|
+ Role role = this.sysClient.getRole(Long.parseLong(array[2])).getData();
|
|
|
+
|
|
|
+ //新增从表数据
|
|
|
+ SignPfxDeputy signPfxDeputy = new SignPfxDeputy();
|
|
|
+ signPfxDeputy.setSignPfxFileId(vo.getId());
|
|
|
+ signPfxDeputy.setProjectId(projectInfo.getId());
|
|
|
+ signPfxDeputy.setProjectName(projectInfo.getProjectName());
|
|
|
+ signPfxDeputy.setContractId(contractInfo.getId());
|
|
|
+ signPfxDeputy.setContractName(contractInfo.getContractName());
|
|
|
+ signPfxDeputy.setRoleId(role.getId());
|
|
|
+ signPfxDeputy.setRoleName(role.getRoleName());
|
|
|
+
|
|
|
+ insertList.add(signPfxDeputy);
|
|
|
+ }
|
|
|
+ if(insertList.size() > 0){
|
|
|
+ this.signPfxDeputyService.saveBatch(insertList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 删除 个人/企业证书信息表
|
|
|
*/
|