|
@@ -1,10 +1,12 @@
|
|
package com.jpsoft.picc.modules.auth.controller;
|
|
package com.jpsoft.picc.modules.auth.controller;
|
|
|
|
|
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
import com.jpsoft.picc.modules.base.entity.CompanyMember;
|
|
import com.jpsoft.picc.modules.base.entity.CompanyMember;
|
|
import com.jpsoft.picc.modules.base.service.CompanyMemberService;
|
|
import com.jpsoft.picc.modules.base.service.CompanyMemberService;
|
|
import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
import com.jpsoft.picc.modules.common.dto.Sort;
|
|
import com.jpsoft.picc.modules.common.dto.Sort;
|
|
|
|
+import com.jpsoft.picc.modules.common.utils.POIUtils;
|
|
import com.jpsoft.picc.modules.common.utils.PojoUtils;
|
|
import com.jpsoft.picc.modules.common.utils.PojoUtils;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
@@ -15,8 +17,10 @@ import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.io.File;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
@Api(description="企业人员管理")
|
|
@Api(description="企业人员管理")
|
|
@@ -31,15 +35,9 @@ public class CompanyMemberController {
|
|
@ApiOperation(value="读取企业人员列表")
|
|
@ApiOperation(value="读取企业人员列表")
|
|
@RequestMapping(value = "list",method = RequestMethod.POST)
|
|
@RequestMapping(value = "list",method = RequestMethod.POST)
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
- @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form")
|
|
|
|
|
|
+ @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form",dataType = "String")
|
|
})
|
|
})
|
|
- public MessageResult<Map> list(
|
|
|
|
- String id,
|
|
|
|
- @RequestParam(value="companyId",defaultValue="") String companyId,
|
|
|
|
- @RequestAttribute String subject){
|
|
|
|
- //当前用户ID
|
|
|
|
- System.out.println(subject);
|
|
|
|
-
|
|
|
|
|
|
+ public MessageResult<Map> list(@RequestParam(value="companyId",defaultValue="") String companyId){
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
@@ -48,8 +46,8 @@ public class CompanyMemberController {
|
|
List<Sort> sortList = new ArrayList<>();
|
|
List<Sort> sortList = new ArrayList<>();
|
|
sortList.add(new Sort("id_","asc"));
|
|
sortList.add(new Sort("id_","asc"));
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
|
- searchParams.put("companyId",id);
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(companyId)) {
|
|
|
|
+ searchParams.put("companyId",companyId);
|
|
}
|
|
}
|
|
|
|
|
|
Page<CompanyMember> page = companyMemberService.pageSearch(searchParams,1,1000,sortList);
|
|
Page<CompanyMember> page = companyMemberService.pageSearch(searchParams,1,1000,sortList);
|
|
@@ -63,26 +61,22 @@ public class CompanyMemberController {
|
|
@ApiOperation(value="读取企业人员分页列表")
|
|
@ApiOperation(value="读取企业人员分页列表")
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
- @ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form")
|
|
|
|
|
|
+ @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form",dataType = "String")
|
|
})
|
|
})
|
|
public MessageResult<Map> pageList(
|
|
public MessageResult<Map> pageList(
|
|
- String id,
|
|
|
|
|
|
+ @RequestParam(value="companyId",defaultValue="") String companyId,
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
- @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
|
- @RequestAttribute String subject){
|
|
|
|
-
|
|
|
|
- //当前用户ID
|
|
|
|
- System.out.println(subject);
|
|
|
|
-
|
|
|
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize){
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
+ searchParams.put("delFlag",false);
|
|
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
List<Sort> sortList = new ArrayList<>();
|
|
sortList.add(new Sort("id_","asc"));
|
|
sortList.add(new Sort("id_","asc"));
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
|
- searchParams.put("id",id);
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(companyId)) {
|
|
|
|
+ searchParams.put("companyId",companyId);
|
|
}
|
|
}
|
|
|
|
|
|
Page<CompanyMember> page = companyMemberService.pageSearch(searchParams,pageIndex,pageSize,sortList);
|
|
Page<CompanyMember> page = companyMemberService.pageSearch(searchParams,pageIndex,pageSize,sortList);
|
|
@@ -95,13 +89,45 @@ public class CompanyMemberController {
|
|
|
|
|
|
@ApiOperation(value="添加企业人员")
|
|
@ApiOperation(value="添加企业人员")
|
|
@PostMapping("add")
|
|
@PostMapping("add")
|
|
- public MessageResult<CompanyMember> add(@RequestBody CompanyMember companyMember,@RequestAttribute String subject){
|
|
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @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"),
|
|
|
|
+ @ApiImplicitParam(name = "sex",value = "性别", required = true, paramType = "form",dataType = "Boolean"),
|
|
|
|
+ @ApiImplicitParam(name = "age",value = "年龄", required = true, paramType = "form",dataType = "int"),
|
|
|
|
+ @ApiImplicitParam(name = "jobsId",value = "行业ID", required = true, paramType = "form",dataType = "String"),
|
|
|
|
+ @ApiImplicitParam(name = "healthStatus",value = "健康状态", required = true, paramType = "form",dataType = "String"),
|
|
|
|
+ @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,
|
|
|
|
+ @RequestParam(value="name",defaultValue="") String name,
|
|
|
|
+ @RequestParam(value="cardType",defaultValue="") String cardType,
|
|
|
|
+ @RequestParam(value="cardNo",defaultValue="") String cardNo,
|
|
|
|
+ @RequestParam(value="sex",defaultValue="null") Boolean sex,
|
|
|
|
+ @RequestParam(value="age",defaultValue="0") Integer age,
|
|
|
|
+ @RequestParam(value="jobsId",defaultValue="") String jobsId,
|
|
|
|
+ @RequestParam(value="healthStatus",defaultValue="") String healthStatus,
|
|
|
|
+ @RequestParam(value="cardFiles",defaultValue="") String cardFiles,
|
|
|
|
+ @RequestParam(value="status",defaultValue="") String status){
|
|
MessageResult<CompanyMember> msgResult = new MessageResult<>();
|
|
MessageResult<CompanyMember> msgResult = new MessageResult<>();
|
|
|
|
+ CompanyMember companyMember = new CompanyMember();
|
|
|
|
|
|
try {
|
|
try {
|
|
companyMember.setId(UUID.randomUUID().toString());
|
|
companyMember.setId(UUID.randomUUID().toString());
|
|
|
|
+ if(StringUtils.isNotEmpty(companyId)) companyMember.setCompanyId(companyId);
|
|
|
|
+ if(StringUtils.isNotEmpty(name)) companyMember.setName(name);
|
|
|
|
+ if(StringUtils.isNotEmpty(cardType)) companyMember.setCardType(cardType);
|
|
|
|
+ if(StringUtils.isNotEmpty(cardNo)) companyMember.setCardNo(cardNo);
|
|
|
|
+ if(sex != null) companyMember.setSex(sex);
|
|
|
|
+ if(age != 0) companyMember.setAge(age);
|
|
|
|
+ if(StringUtils.isNotEmpty(jobsId)) companyMember.setJobsId(jobsId);
|
|
|
|
+ if(StringUtils.isNotEmpty(healthStatus)) companyMember.setHealthStatus(healthStatus);
|
|
|
|
+ if(StringUtils.isNotEmpty(cardFiles)) companyMember.setCardFiles(cardFiles);
|
|
|
|
+ if(StringUtils.isNotEmpty(status)) companyMember.setStatus(status);
|
|
companyMember.setDelFlag(false);
|
|
companyMember.setDelFlag(false);
|
|
- companyMember.setCreateBy(subject);
|
|
|
|
|
|
+// companyMember.setCreateBy(subject);
|
|
companyMember.setCreateTime(new Date());
|
|
companyMember.setCreateTime(new Date());
|
|
|
|
|
|
int affectCount = companyMemberService.insert(companyMember);
|
|
int affectCount = companyMemberService.insert(companyMember);
|
|
@@ -125,11 +151,11 @@ public class CompanyMemberController {
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value="获取企业人员")
|
|
@ApiOperation(value="获取企业人员")
|
|
- @GetMapping("edit")
|
|
|
|
|
|
+ @RequestMapping(value = "edit",method = RequestMethod.POST)
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
- @ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form")
|
|
|
|
|
|
+ @ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form",dataType = "String")
|
|
})
|
|
})
|
|
- public MessageResult<CompanyMember> edit(@RequestParam(value="编号",defaultValue="") String id){
|
|
|
|
|
|
+ public MessageResult<CompanyMember> edit(@RequestParam(value="id",defaultValue="") String id){
|
|
MessageResult<CompanyMember> msgResult = new MessageResult<>();
|
|
MessageResult<CompanyMember> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -155,11 +181,46 @@ public class CompanyMemberController {
|
|
|
|
|
|
@ApiOperation(value="更新企业人员")
|
|
@ApiOperation(value="更新企业人员")
|
|
@PostMapping("update")
|
|
@PostMapping("update")
|
|
- public MessageResult<CompanyMember> update(@RequestBody CompanyMember companyMember,@RequestAttribute String subject){
|
|
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "id",value = "编号", 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"),
|
|
|
|
+ @ApiImplicitParam(name = "sex",value = "性别", required = true, paramType = "form",dataType = "Boolean"),
|
|
|
|
+ @ApiImplicitParam(name = "age",value = "年龄", required = true, paramType = "form",dataType = "int"),
|
|
|
|
+ @ApiImplicitParam(name = "jobsId",value = "行业ID", required = true, paramType = "form",dataType = "String"),
|
|
|
|
+ @ApiImplicitParam(name = "healthStatus",value = "健康状态", required = true, paramType = "form",dataType = "String"),
|
|
|
|
+ @ApiImplicitParam(name = "cardFiles",value = "身份证件附件", required = false, paramType = "form",dataType = "String"),
|
|
|
|
+ @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="name",defaultValue="") String name,
|
|
|
|
+ @RequestParam(value="cardType",defaultValue="") String cardType,
|
|
|
|
+ @RequestParam(value="cardNo",defaultValue="") String cardNo,
|
|
|
|
+ @RequestParam(value="sex",defaultValue="null") Boolean sex,
|
|
|
|
+ @RequestParam(value="age",defaultValue="0") Integer age,
|
|
|
|
+ @RequestParam(value="jobsId",defaultValue="") String jobsId,
|
|
|
|
+ @RequestParam(value="healthStatus",defaultValue="") String healthStatus,
|
|
|
|
+ @RequestParam(value="cardFiles",defaultValue="") String cardFiles,
|
|
|
|
+ @RequestParam(value="status",defaultValue="") String status){
|
|
MessageResult<CompanyMember> msgResult = new MessageResult<>();
|
|
MessageResult<CompanyMember> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
- companyMember.setUpdateBy(subject);
|
|
|
|
|
|
+ CompanyMember companyMember = companyMemberService.get(id);
|
|
|
|
+
|
|
|
|
+ if(StringUtils.isNotEmpty(companyId)) companyMember.setCompanyId(companyId);
|
|
|
|
+ if(StringUtils.isNotEmpty(name)) companyMember.setName(name);
|
|
|
|
+ if(StringUtils.isNotEmpty(cardType)) companyMember.setCardType(cardType);
|
|
|
|
+ if(StringUtils.isNotEmpty(cardNo)) companyMember.setCardNo(cardNo);
|
|
|
|
+ if(sex != null) companyMember.setSex(sex);
|
|
|
|
+ if(age != 0) companyMember.setAge(age);
|
|
|
|
+ if(StringUtils.isNotEmpty(jobsId)) companyMember.setJobsId(jobsId);
|
|
|
|
+ if(StringUtils.isNotEmpty(healthStatus)) companyMember.setHealthStatus(healthStatus);
|
|
|
|
+ if(StringUtils.isNotEmpty(cardFiles)) companyMember.setCardFiles(cardFiles);
|
|
|
|
+ if(StringUtils.isNotEmpty(status)) companyMember.setStatus(status);
|
|
|
|
+// companyMember.setUpdateBy(subject);
|
|
companyMember.setUpdateTime(new Date());
|
|
companyMember.setUpdateTime(new Date());
|
|
|
|
|
|
int affectCount = companyMemberService.update(companyMember);
|
|
int affectCount = companyMemberService.update(companyMember);
|
|
@@ -185,16 +246,15 @@ public class CompanyMemberController {
|
|
@ApiOperation(value="删除企业人员")
|
|
@ApiOperation(value="删除企业人员")
|
|
@PostMapping("delete")
|
|
@PostMapping("delete")
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
- @ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form")
|
|
|
|
|
|
+ @ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form",dataType = "String")
|
|
})
|
|
})
|
|
- public MessageResult<Integer> delete(@RequestParam(value="编号",defaultValue="") String id,
|
|
|
|
- @RequestAttribute String subject){
|
|
|
|
|
|
+ public MessageResult<Integer> delete(@RequestParam(value="id",defaultValue="") String id){
|
|
MessageResult<Integer> msgResult = new MessageResult<>();
|
|
MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
CompanyMember companyMember = companyMemberService.get(id);
|
|
CompanyMember companyMember = companyMemberService.get(id);
|
|
companyMember.setDelFlag(true);
|
|
companyMember.setDelFlag(true);
|
|
- companyMember.setUpdateBy(subject);
|
|
|
|
|
|
+// companyMember.setUpdateBy(subject);
|
|
companyMember.setUpdateTime(new Date());
|
|
companyMember.setUpdateTime(new Date());
|
|
|
|
|
|
int affectCount = companyMemberService.update(companyMember);
|
|
int affectCount = companyMemberService.update(companyMember);
|
|
@@ -216,4 +276,66 @@ public class CompanyMemberController {
|
|
|
|
|
|
return msgResult;
|
|
return msgResult;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="导入企业人员")
|
|
|
|
+ @PostMapping("importXls")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "uploadFile",value = "上传文件", required = true,paramType="form", dataType = "__file")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<String> importXls(MultipartFile uploadFile){
|
|
|
|
+ MessageResult<String> msgResult = new MessageResult<>();
|
|
|
|
+ CompanyMember companyMember = new CompanyMember();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ POIUtils aaa = new POIUtils(uploadFile.getInputStream());
|
|
|
|
+ List<Object[]> list = aaa.getAllData(0);
|
|
|
|
+
|
|
|
|
+ int affectCount = 0;
|
|
|
|
+ for(Object[] array : list){
|
|
|
|
+ String name = array[1].toString();
|
|
|
|
+ String cardType = array[2].toString();
|
|
|
|
+ String cardNo = array[3].toString();
|
|
|
|
+ Boolean sex = Convert.toBool(array[3]);
|
|
|
|
+ int age = Convert.toInt(array[3]);
|
|
|
|
+ String jobsId = array[3].toString();
|
|
|
|
+ String healthStatus = array[3].toString();
|
|
|
|
+
|
|
|
|
+ companyMember.setId(UUID.randomUUID().toString());
|
|
|
|
+// if(StringUtils.isNotEmpty(companyId)) companyMember.setCompanyId(companyId);
|
|
|
|
+ if(StringUtils.isNotEmpty(name)) companyMember.setName(name);
|
|
|
|
+ if(StringUtils.isNotEmpty(cardType)) companyMember.setCardType(cardType);
|
|
|
|
+ if(StringUtils.isNotEmpty(cardNo)) companyMember.setCardNo(cardNo);
|
|
|
|
+ if(sex != null) companyMember.setSex(sex);
|
|
|
|
+ if(age != 0) companyMember.setAge(age);
|
|
|
|
+ if(StringUtils.isNotEmpty(jobsId)) companyMember.setJobsId(jobsId);
|
|
|
|
+ if(StringUtils.isNotEmpty(healthStatus)) companyMember.setHealthStatus(healthStatus);
|
|
|
|
+// if(StringUtils.isNotEmpty(cardFiles)) companyMember.setCardFiles(cardFiles);
|
|
|
|
+// if(StringUtils.isNotEmpty(status)) companyMember.setStatus(status);
|
|
|
|
+ companyMember.setDelFlag(false);
|
|
|
|
+// companyMember.setCreateBy(subject);
|
|
|
|
+ companyMember.setCreateTime(new Date());
|
|
|
|
+
|
|
|
|
+ if(companyMemberService.insert(companyMember) > 0) {
|
|
|
|
+ affectCount++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (affectCount > 0) {
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData("成功导入" + affectCount + "条记录。");
|
|
|
|
+ } else {
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage("数据库添加失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ catch(Exception ex){
|
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return msgResult;
|
|
|
|
+ }
|
|
}
|
|
}
|