更新责任人管理和填写人管理

This commit is contained in:
zjh 2025-12-02 14:39:51 +08:00
parent 5a11390c19
commit 835a1e7c00
9 changed files with 99 additions and 16 deletions

View File

@ -36,7 +36,7 @@ public class DeleteController {
@GetMapping("/loginVo")
public Response loginVo(@RequestParam String userId) {
Map<String, Object> map = new HashMap<>();
AppTokenDTO token = apaasMyTokenFeign.token(
AppTokenDTO token = apaasMyTokenFeign.getAppToken(
"client_credentials",
"2b5b3de8-e7fd-406a-a59a-d5568457b1f4",
"94bddc6a-27a4-4204-885b-b075812ec535"

View File

@ -56,6 +56,22 @@ public class ResponsiblePersonController {
return Response.ok().data(deptResponsible);
}
// 查询所有部门填写人
@GetMapping("/getDeptFilled")
public Response getDeptFilled(
@Valid DeptResponsiblePageForm form,
BindingResult bindingResult
) {
if (bindingResult.hasErrors()) {
bindingResult.getFieldErrors().forEach(error -> {
throw new MpaasBusinessException(error.getDefaultMessage());
});
}
PageQueryResult<ResponsiblePerson> deptResponsible =
responsiblePersonService.getDeptFilled(form);
return Response.ok().data(deptResponsible);
}
// 根据部门id获取子部门
@GetMapping("/getSubDepartmentById")
public Response getSubDepartmentById(
@ -113,7 +129,22 @@ public class ResponsiblePersonController {
});
}
responsiblePersonService.saveResponsiblePerson(form);
return Response.ok().setMessage(form.toString());
return Response.ok().setMessage("添加成功");
}
// 保存部门填写人
@PostMapping("/saveFilledPerson")
public Response saveFilledPerson(
@Valid @RequestBody ResponsiblePersonForm form,
BindingResult bindingResult
) {
if (bindingResult.hasErrors()) {
bindingResult.getFieldErrors().forEach(error -> {
throw new MpaasBusinessException(error.getDefaultMessage());
});
}
responsiblePersonService.saveFilledPerson(form);
return Response.ok().setMessage("添加成功");
}
// 修改部门责任人

View File

@ -1,14 +1,23 @@
package com.xdap.self_development.feign;
import com.xdap.self_development.feign.dto.AppTokenDTO;
import com.xdap.self_development.feign.dto.UserTokenDT0;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(name = "apaas-client", url = "http://apaas-meim.app.yuchai.com/apaas/backend/a5e8e08/ycgf-yf-rddata")
@FeignClient(name = "apaas-client", url = "${apaas.token.url}")
public interface ApaasMyTokenFeign {
@PostMapping("/xdap-open/token")
AppTokenDTO token(@RequestParam("grant type") String grant_type,
@RequestParam("client id") String client_id,
@RequestParam("client secret")String client_secret);
AppTokenDTO getAppToken(
@RequestParam("grant_type") String grant_type,
@RequestParam("client_id") String client_id,
@RequestParam("client_secret")String client_secret
);
@PostMapping("/xdap-open/token/userToken")
UserTokenDT0 getUserToken(
@RequestParam("token") String token,
@RequestParam("userid") String userid
);
}

View File

@ -0,0 +1,8 @@
package com.xdap.self_development.feign.dto;
import lombok.Data;
@Data
public class UserTokenDT0 {
private String access_token;
}

View File

@ -10,7 +10,7 @@ import lombok.EqualsAndHashCode;
@Table("yfsjglpt_model_responsible_person")
@SQLQuery(value = {
@SQL(view = "getResponsibleAndName",
sql = "SELECT ymrp.*, xu.username FROM yfsjglpt_model_responsible_person ymrp JOIN xdap_users xu ON ymrp.user_id = xu.id")
sql = "SELECT ymrp.*, xu.username FROM yfsjglpt_model_responsible_person ymrp JOIN xdap_users xu ON ymrp.user_id = xu.id where ymrp.person_level = #level")
})
public class ResponsiblePerson extends MpaasBasePojo {
@RowID(sequence = "responsible_person_s", type = RowIDType.UUID)
@ -19,6 +19,7 @@ public class ResponsiblePerson extends MpaasBasePojo {
private String userId;
private String department;
private String subsystem;
private Integer personLevel;
@Column(type = ColumnType.CALCULATE)
private String username;

View File

@ -0,0 +1,4 @@
package com.xdap.self_development.pojo;
public class permissions {
}

View File

@ -0,0 +1,4 @@
package com.xdap.self_development.pojo;
public class role {
}

View File

@ -15,12 +15,16 @@ import java.util.Set;
public interface ResponsiblePersonService {
void saveResponsiblePerson(@Valid ResponsiblePersonForm form);
void saveFilledPerson(@Valid ResponsiblePersonForm form);
void updateResponsiblePerson(@Valid UpdateResponsiblePersonForm form);
void deleteResponsiblePerson(@NotBlank String rowId);
PageQueryResult<ResponsiblePerson> getDeptResponsible(@Valid DeptResponsiblePageForm form);
PageQueryResult<ResponsiblePerson> getDeptFilled(@Valid DeptResponsiblePageForm form);
Boolean isResponsiblePerson(String userId);
Set<String> getAllSubsystem();

View File

@ -29,17 +29,23 @@ public class ResponsiblePersonServiceImpl implements ResponsiblePersonService {
@Override
public void saveResponsiblePerson(ResponsiblePersonForm form) {
List<ResponsiblePerson> responsiblePeople = bd.getBusinessDatabase()
.eq("department_id", form.getDepartmentId())
.doQuery(ResponsiblePerson.class);
if (!responsiblePeople.isEmpty()) {
throw new MpaasBusinessException("该部门已有责任人");
}
ResponsiblePerson responsiblePerson = new ResponsiblePerson();
responsiblePerson.setDepartment(form.getDepartment());
responsiblePerson.setDepartmentId(form.getDepartmentId());
responsiblePerson.setUserId(form.getUserId());
responsiblePerson.setSubsystem(form.getSubsystem());
responsiblePerson.setPersonLevel(1);
bd.getBusinessDatabase().doInsert(responsiblePerson);
}
@Override
public void saveFilledPerson(ResponsiblePersonForm form) {
ResponsiblePerson responsiblePerson = new ResponsiblePerson();
responsiblePerson.setDepartment(form.getDepartment());
responsiblePerson.setDepartmentId(form.getDepartmentId());
responsiblePerson.setUserId(form.getUserId());
responsiblePerson.setSubsystem(form.getSubsystem());
responsiblePerson.setPersonLevel(2);
bd.getBusinessDatabase().doInsert(responsiblePerson);
}
@ -63,7 +69,9 @@ public class ResponsiblePersonServiceImpl implements ResponsiblePersonService {
@Override
public void deleteResponsiblePerson(String rowId) {
bd.getBusinessDatabase().rowid("id", rowId).doDelete(ResponsiblePerson.class);
bd.getBusinessDatabase()
.rowid("id", rowId)
.doDelete(ResponsiblePerson.class);
}
@Override
@ -71,18 +79,32 @@ public class ResponsiblePersonServiceImpl implements ResponsiblePersonService {
return bd.getBusinessDatabase()
.viewQueryMode(true).view("getResponsibleAndName")
.setVar("level", 1)
.doPageQuery(form.getPageNumber(), form.getPageSize(), ResponsiblePerson.class);
}
@Override
public PageQueryResult<ResponsiblePerson> getDeptFilled(DeptResponsiblePageForm form) {
return bd.getBusinessDatabase()
.viewQueryMode(true).view("getResponsibleAndName")
.setVar("level", 2)
.doPageQuery(form.getPageNumber(), form.getPageSize(), ResponsiblePerson.class);
}
@Override
public Boolean isResponsiblePerson(String userId) {
List<ResponsiblePerson> responsiblePeople = bd.getBusinessDatabase().eq("userId", userId).doQuery(ResponsiblePerson.class);
List<ResponsiblePerson> responsiblePeople = bd.getBusinessDatabase()
.eq("userId", userId)
.doQuery(ResponsiblePerson.class);
return !responsiblePeople.isEmpty();
}
@Override
public Set<String> getAllSubsystem() {
List<Template> templates = bd.getBusinessDatabase().select("template_name").doQuery(Template.class);
List<Template> templates = bd
.getBusinessDatabase()
.select("template_name")
.doQuery(Template.class);
return templates.stream().map(Template::getTemplateName).collect(Collectors.toSet());
}
}