更新责任人管理和填写人管理
This commit is contained in:
parent
5a11390c19
commit
835a1e7c00
@ -36,7 +36,7 @@ public class DeleteController {
|
|||||||
@GetMapping("/loginVo")
|
@GetMapping("/loginVo")
|
||||||
public Response loginVo(@RequestParam String userId) {
|
public Response loginVo(@RequestParam String userId) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
AppTokenDTO token = apaasMyTokenFeign.token(
|
AppTokenDTO token = apaasMyTokenFeign.getAppToken(
|
||||||
"client_credentials",
|
"client_credentials",
|
||||||
"2b5b3de8-e7fd-406a-a59a-d5568457b1f4",
|
"2b5b3de8-e7fd-406a-a59a-d5568457b1f4",
|
||||||
"94bddc6a-27a4-4204-885b-b075812ec535"
|
"94bddc6a-27a4-4204-885b-b075812ec535"
|
||||||
|
|||||||
@ -56,6 +56,22 @@ public class ResponsiblePersonController {
|
|||||||
return Response.ok().data(deptResponsible);
|
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获取子部门
|
// 根据部门id获取子部门
|
||||||
@GetMapping("/getSubDepartmentById")
|
@GetMapping("/getSubDepartmentById")
|
||||||
public Response getSubDepartmentById(
|
public Response getSubDepartmentById(
|
||||||
@ -113,7 +129,22 @@ public class ResponsiblePersonController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
responsiblePersonService.saveResponsiblePerson(form);
|
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("添加成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改部门责任人
|
// 修改部门责任人
|
||||||
|
|||||||
@ -1,14 +1,23 @@
|
|||||||
package com.xdap.self_development.feign;
|
package com.xdap.self_development.feign;
|
||||||
|
|
||||||
import com.xdap.self_development.feign.dto.AppTokenDTO;
|
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.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
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 {
|
public interface ApaasMyTokenFeign {
|
||||||
@PostMapping("/xdap-open/token")
|
@PostMapping("/xdap-open/token")
|
||||||
AppTokenDTO token(@RequestParam("grant type") String grant_type,
|
AppTokenDTO getAppToken(
|
||||||
@RequestParam("client id") String client_id,
|
@RequestParam("grant_type") String grant_type,
|
||||||
@RequestParam("client secret")String client_secret);
|
@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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.xdap.self_development.feign.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserTokenDT0 {
|
||||||
|
private String access_token;
|
||||||
|
}
|
||||||
@ -10,7 +10,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
@Table("yfsjglpt_model_responsible_person")
|
@Table("yfsjglpt_model_responsible_person")
|
||||||
@SQLQuery(value = {
|
@SQLQuery(value = {
|
||||||
@SQL(view = "getResponsibleAndName",
|
@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 {
|
public class ResponsiblePerson extends MpaasBasePojo {
|
||||||
@RowID(sequence = "responsible_person_s", type = RowIDType.UUID)
|
@RowID(sequence = "responsible_person_s", type = RowIDType.UUID)
|
||||||
@ -19,6 +19,7 @@ public class ResponsiblePerson extends MpaasBasePojo {
|
|||||||
private String userId;
|
private String userId;
|
||||||
private String department;
|
private String department;
|
||||||
private String subsystem;
|
private String subsystem;
|
||||||
|
private Integer personLevel;
|
||||||
|
|
||||||
@Column(type = ColumnType.CALCULATE)
|
@Column(type = ColumnType.CALCULATE)
|
||||||
private String username;
|
private String username;
|
||||||
|
|||||||
@ -0,0 +1,4 @@
|
|||||||
|
package com.xdap.self_development.pojo;
|
||||||
|
|
||||||
|
public class permissions {
|
||||||
|
}
|
||||||
4
src/main/java/com/xdap/self_development/pojo/role.java
Normal file
4
src/main/java/com/xdap/self_development/pojo/role.java
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
package com.xdap.self_development.pojo;
|
||||||
|
|
||||||
|
public class role {
|
||||||
|
}
|
||||||
@ -15,12 +15,16 @@ import java.util.Set;
|
|||||||
public interface ResponsiblePersonService {
|
public interface ResponsiblePersonService {
|
||||||
void saveResponsiblePerson(@Valid ResponsiblePersonForm form);
|
void saveResponsiblePerson(@Valid ResponsiblePersonForm form);
|
||||||
|
|
||||||
|
void saveFilledPerson(@Valid ResponsiblePersonForm form);
|
||||||
|
|
||||||
void updateResponsiblePerson(@Valid UpdateResponsiblePersonForm form);
|
void updateResponsiblePerson(@Valid UpdateResponsiblePersonForm form);
|
||||||
|
|
||||||
void deleteResponsiblePerson(@NotBlank String rowId);
|
void deleteResponsiblePerson(@NotBlank String rowId);
|
||||||
|
|
||||||
PageQueryResult<ResponsiblePerson> getDeptResponsible(@Valid DeptResponsiblePageForm form);
|
PageQueryResult<ResponsiblePerson> getDeptResponsible(@Valid DeptResponsiblePageForm form);
|
||||||
|
|
||||||
|
PageQueryResult<ResponsiblePerson> getDeptFilled(@Valid DeptResponsiblePageForm form);
|
||||||
|
|
||||||
Boolean isResponsiblePerson(String userId);
|
Boolean isResponsiblePerson(String userId);
|
||||||
|
|
||||||
Set<String> getAllSubsystem();
|
Set<String> getAllSubsystem();
|
||||||
|
|||||||
@ -29,17 +29,23 @@ public class ResponsiblePersonServiceImpl implements ResponsiblePersonService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveResponsiblePerson(ResponsiblePersonForm form) {
|
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 responsiblePerson = new ResponsiblePerson();
|
||||||
responsiblePerson.setDepartment(form.getDepartment());
|
responsiblePerson.setDepartment(form.getDepartment());
|
||||||
responsiblePerson.setDepartmentId(form.getDepartmentId());
|
responsiblePerson.setDepartmentId(form.getDepartmentId());
|
||||||
responsiblePerson.setUserId(form.getUserId());
|
responsiblePerson.setUserId(form.getUserId());
|
||||||
responsiblePerson.setSubsystem(form.getSubsystem());
|
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);
|
bd.getBusinessDatabase().doInsert(responsiblePerson);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +69,9 @@ public class ResponsiblePersonServiceImpl implements ResponsiblePersonService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteResponsiblePerson(String rowId) {
|
public void deleteResponsiblePerson(String rowId) {
|
||||||
bd.getBusinessDatabase().rowid("id", rowId).doDelete(ResponsiblePerson.class);
|
bd.getBusinessDatabase()
|
||||||
|
.rowid("id", rowId)
|
||||||
|
.doDelete(ResponsiblePerson.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -71,18 +79,32 @@ public class ResponsiblePersonServiceImpl implements ResponsiblePersonService {
|
|||||||
|
|
||||||
return bd.getBusinessDatabase()
|
return bd.getBusinessDatabase()
|
||||||
.viewQueryMode(true).view("getResponsibleAndName")
|
.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);
|
.doPageQuery(form.getPageNumber(), form.getPageSize(), ResponsiblePerson.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean isResponsiblePerson(String userId) {
|
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();
|
return !responsiblePeople.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getAllSubsystem() {
|
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());
|
return templates.stream().map(Template::getTemplateName).collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user