|
@@ -449,22 +449,38 @@ public class PatentProjectService extends ServiceImpl<PatentProjectMapper, Paten
|
|
//根据传入对象id查询project对象
|
|
//根据传入对象id查询project对象
|
|
Project project = projectService.getById(updatePatentProjectDTO.getId());
|
|
Project project = projectService.getById(updatePatentProjectDTO.getId());
|
|
BeanUtils.copyProperties(updatePatentProjectDTO, project);
|
|
BeanUtils.copyProperties(updatePatentProjectDTO, project);
|
|
- //当委托方id不为空时
|
|
|
|
- if (updatePatentProjectDTO.getEntrustId() != null) {
|
|
|
|
- project.setEntrustId(updatePatentProjectDTO.getEntrustId());
|
|
|
|
- } else {//若且租户类型为代理机构,并且委托方id为空,委托方名称不为空时,新增委托方
|
|
|
|
- ClientDTO clientDTO = new ClientDTO();
|
|
|
|
- clientDTO.setName(updatePatentProjectDTO.getEntrustName());
|
|
|
|
- clientDTO.setTenantId(personnelVO.getTenantId());
|
|
|
|
- try {
|
|
|
|
- String res = permissionService.addClient(clientDTO);
|
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
|
- Integer clientId = Integer.parseInt(jsonObject.get("data").toString());
|
|
|
|
- project.setEntrustId(clientId.toString());
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- throw new XiaoShiException("网络异常");
|
|
|
|
- }
|
|
|
|
|
|
+ //TODO 当委托方id或者委托方名称不为空时,
|
|
|
|
+ if (updatePatentProjectDTO.getEntrustId() != null || updatePatentProjectDTO.getEntrustName() != null) {
|
|
|
|
+
|
|
|
|
+ //根据创建人的租户类型设置project的委托类型
|
|
|
|
+ if (personnelVO.getTenantType().equals("1")) {
|
|
|
|
+ project.setEntrustType(1);
|
|
|
|
+
|
|
|
|
+ //当委托方id不为空时
|
|
|
|
+ if (updatePatentProjectDTO.getEntrustId() != null) {
|
|
|
|
+ project.setEntrustId(updatePatentProjectDTO.getEntrustId());
|
|
|
|
+ }
|
|
|
|
+ //若且租户类型为代理机构,并且委托方id为空,委托方名称不为空时,新增委托方
|
|
|
|
+ else {
|
|
|
|
+ ClientDTO clientDTO = new ClientDTO();
|
|
|
|
+ clientDTO.setName(updatePatentProjectDTO.getEntrustName());
|
|
|
|
+ clientDTO.setTenantId(personnelVO.getTenantId());
|
|
|
|
+ try {
|
|
|
|
+ String res = permissionService.addClient(clientDTO);
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
|
+ Integer clientId = Integer.parseInt(jsonObject.get("data").toString());
|
|
|
|
+ project.setEntrustId(clientId.toString());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ throw new XiaoShiException("网络异常");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
|
|
|
|
+ if (updatePatentProjectDTO.getEntrustId() != null) {
|
|
|
|
+ project.setEntrustType(0);
|
|
|
|
+ project.setEntrustId(updatePatentProjectDTO.getEntrustId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
project.updateById();
|
|
project.updateById();
|
|
/**
|
|
/**
|