|
@@ -2,8 +2,10 @@ package com.jpsoft.picc.modules.auth.controller;
|
|
|
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.picc.modules.base.entity.Company;
|
|
|
import com.jpsoft.picc.modules.base.entity.CompanyMember;
|
|
|
import com.jpsoft.picc.modules.base.service.CompanyMemberService;
|
|
|
+import com.jpsoft.picc.modules.base.service.CompanyService;
|
|
|
import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.picc.modules.common.dto.Sort;
|
|
|
import com.jpsoft.picc.modules.common.utils.POIUtils;
|
|
@@ -33,12 +35,19 @@ public class CompanyMemberController {
|
|
|
@Autowired
|
|
|
private CompanyMemberService companyMemberService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CompanyService companyService;
|
|
|
+
|
|
|
@ApiOperation(value="读取企业人员列表")
|
|
|
@RequestMapping(value = "list",method = RequestMethod.POST)
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form",dataType = "String")
|
|
|
+// @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form",dataType = "String")
|
|
|
})
|
|
|
- public MessageResult<Map> list(@RequestParam(value="companyId",defaultValue="") String companyId){
|
|
|
+ public MessageResult<Map> list(//@RequestParam(value="companyId",defaultValue="") String companyId,
|
|
|
+ HttpServletRequest request){
|
|
|
+ AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
|
|
|
+ Company company = companyService.findByCreateBy(principal.getName());
|
|
|
+
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
@@ -47,8 +56,8 @@ public class CompanyMemberController {
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("id_","asc"));
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(companyId)) {
|
|
|
- searchParams.put("companyId",companyId);
|
|
|
+ if (StringUtils.isNotEmpty(company.getId())) {
|
|
|
+ searchParams.put("companyId",company.getId());
|
|
|
}
|
|
|
|
|
|
Page<CompanyMember> page = companyMemberService.pageSearch(searchParams,1,1000,sortList);
|
|
@@ -62,12 +71,16 @@ public class CompanyMemberController {
|
|
|
@ApiOperation(value="读取企业人员分页列表")
|
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form",dataType = "String")
|
|
|
+// @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form",dataType = "String")
|
|
|
})
|
|
|
public MessageResult<Map> pageList(
|
|
|
- @RequestParam(value="companyId",defaultValue="") String companyId,
|
|
|
+// @RequestParam(value="companyId",defaultValue="") String companyId,
|
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
- @RequestParam(value="pageSize",defaultValue="20") int pageSize){
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
+ HttpServletRequest request){
|
|
|
+ AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
|
|
|
+ Company company = companyService.findByCreateBy(principal.getName());
|
|
|
+
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
@@ -76,8 +89,8 @@ public class CompanyMemberController {
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("id_","asc"));
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(companyId)) {
|
|
|
- searchParams.put("companyId",companyId);
|
|
|
+ if (StringUtils.isNotEmpty(company.getId())) {
|
|
|
+ searchParams.put("companyId",company.getId());
|
|
|
}
|
|
|
|
|
|
Page<CompanyMember> page = companyMemberService.pageSearch(searchParams,pageIndex,pageSize,sortList);
|
|
@@ -91,7 +104,7 @@ public class CompanyMemberController {
|
|
|
@ApiOperation(value="添加企业人员")
|
|
|
@PostMapping("add")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form",dataType = "String"),
|
|
|
+// @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form",dataType = "String"),
|
|
|
@ApiImplicitParam(name = "name",value = "姓名", required = true, paramType = "form",dataType = "String"),
|
|
|
@ApiImplicitParam(name = "cardType",value = "证件类型", required = true, paramType = "form",dataType = "String"),
|
|
|
@ApiImplicitParam(name = "cardNo",value = "证件编号", required = true, paramType = "form",dataType = "String"),
|
|
@@ -102,7 +115,7 @@ public class CompanyMemberController {
|
|
|
@ApiImplicitParam(name = "cardFiles",value = "身份证件附件", required = false, paramType = "form",dataType = "String"),
|
|
|
@ApiImplicitParam(name = "status",value = "状态", required = true, paramType = "form",dataType = "String")
|
|
|
})
|
|
|
- public MessageResult<CompanyMember> add(@RequestParam(value="companyId",defaultValue="") String companyId,
|
|
|
+ public MessageResult<CompanyMember> add(//@RequestParam(value="companyId",defaultValue="") String companyId,
|
|
|
@RequestParam(value="name",defaultValue="") String name,
|
|
|
@RequestParam(value="cardType",defaultValue="") String cardType,
|
|
|
@RequestParam(value="cardNo",defaultValue="") String cardNo,
|
|
@@ -114,13 +127,14 @@ public class CompanyMemberController {
|
|
|
@RequestParam(value="status",defaultValue="") String status,
|
|
|
HttpServletRequest request){
|
|
|
AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
|
|
|
+ Company company = companyService.findByCreateBy(principal.getName());
|
|
|
|
|
|
MessageResult<CompanyMember> msgResult = new MessageResult<>();
|
|
|
CompanyMember companyMember = new CompanyMember();
|
|
|
|
|
|
try {
|
|
|
companyMember.setId(UUID.randomUUID().toString());
|
|
|
- if(StringUtils.isNotEmpty(companyId)) companyMember.setCompanyId(companyId);
|
|
|
+ if(StringUtils.isNotEmpty(company.getId())) companyMember.setCompanyId(company.getId());
|
|
|
if(StringUtils.isNotEmpty(name)) companyMember.setName(name);
|
|
|
if(StringUtils.isNotEmpty(cardType)) companyMember.setCardType(cardType);
|
|
|
if(StringUtils.isNotEmpty(cardNo)) companyMember.setCardNo(cardNo);
|
|
@@ -187,7 +201,7 @@ public class CompanyMemberController {
|
|
|
@PostMapping("update")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form",dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form",dataType = "String"),
|
|
|
+// @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form",dataType = "String"),
|
|
|
@ApiImplicitParam(name = "name",value = "姓名", required = true, paramType = "form",dataType = "String"),
|
|
|
@ApiImplicitParam(name = "cardType",value = "证件类型", required = true, paramType = "form",dataType = "String"),
|
|
|
@ApiImplicitParam(name = "cardNo",value = "证件编号", required = true, paramType = "form",dataType = "String"),
|
|
@@ -199,7 +213,7 @@ public class CompanyMemberController {
|
|
|
@ApiImplicitParam(name = "status",value = "状态", required = true, paramType = "form",dataType = "String")
|
|
|
})
|
|
|
public MessageResult<CompanyMember> update(@RequestParam(value="id",defaultValue="") String id,
|
|
|
- @RequestParam(value="companyId",defaultValue="") String companyId,
|
|
|
+// @RequestParam(value="companyId",defaultValue="") String companyId,
|
|
|
@RequestParam(value="name",defaultValue="") String name,
|
|
|
@RequestParam(value="cardType",defaultValue="") String cardType,
|
|
|
@RequestParam(value="cardNo",defaultValue="") String cardNo,
|
|
@@ -211,13 +225,14 @@ public class CompanyMemberController {
|
|
|
@RequestParam(value="status",defaultValue="") String status,
|
|
|
HttpServletRequest request){
|
|
|
AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
|
|
|
+ Company company = companyService.findByCreateBy(principal.getName());
|
|
|
|
|
|
MessageResult<CompanyMember> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
CompanyMember companyMember = companyMemberService.get(id);
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(companyId)) companyMember.setCompanyId(companyId);
|
|
|
+ if(StringUtils.isNotEmpty(company.getId())) companyMember.setCompanyId(company.getId());
|
|
|
if(StringUtils.isNotEmpty(name)) companyMember.setName(name);
|
|
|
if(StringUtils.isNotEmpty(cardType)) companyMember.setCardType(cardType);
|
|
|
if(StringUtils.isNotEmpty(cardNo)) companyMember.setCardNo(cardNo);
|
|
@@ -290,13 +305,14 @@ public class CompanyMemberController {
|
|
|
@ApiOperation(value="导入企业人员")
|
|
|
@PostMapping("importXls")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form",dataType = "String"),
|
|
|
+// @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form",dataType = "String"),
|
|
|
@ApiImplicitParam(name = "uploadFile",value = "上传文件", required = true,paramType="form", dataType = "__file")
|
|
|
})
|
|
|
- public MessageResult<String> importXls(@RequestParam(value="companyId",defaultValue="") String companyId,
|
|
|
+ public MessageResult<String> importXls(//@RequestParam(value="companyId",defaultValue="") String companyId,
|
|
|
MultipartFile uploadFile,
|
|
|
HttpServletRequest request){
|
|
|
AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
|
|
|
+ Company company = companyService.findByCreateBy(principal.getName());
|
|
|
|
|
|
MessageResult<String> msgResult = new MessageResult<>();
|
|
|
CompanyMember companyMember = new CompanyMember();
|
|
@@ -316,7 +332,7 @@ public class CompanyMemberController {
|
|
|
String healthStatus = array[3].toString();
|
|
|
|
|
|
companyMember.setId(UUID.randomUUID().toString());
|
|
|
- if(StringUtils.isNotEmpty(companyId)) companyMember.setCompanyId(companyId);
|
|
|
+ if(StringUtils.isNotEmpty(company.getId())) companyMember.setCompanyId(company.getId());
|
|
|
if(StringUtils.isNotEmpty(name)) companyMember.setName(name);
|
|
|
if(StringUtils.isNotEmpty(cardType)) companyMember.setCardType(cardType);
|
|
|
if(StringUtils.isNotEmpty(cardNo)) companyMember.setCardNo(cardNo);
|