|
@@ -6,15 +6,22 @@ import com.jpsoft.smart.modules.common.dto.Sort;
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
import com.jpsoft.smart.modules.base.entity.PersonInfo;
|
|
import com.jpsoft.smart.modules.base.entity.PersonInfo;
|
|
import com.jpsoft.smart.modules.base.service.PersonInfoService;
|
|
import com.jpsoft.smart.modules.base.service.PersonInfoService;
|
|
|
|
+import com.jpsoft.smart.modules.sys.entity.User;
|
|
|
|
+import com.jpsoft.smart.modules.sys.service.UserService;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.slf4j.Logger;
|
|
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.ByteArrayInputStream;
|
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
@@ -26,39 +33,37 @@ public class PersonInfoController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private PersonInfoService personInfoService;
|
|
private PersonInfoService personInfoService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private UserService userService;
|
|
|
|
|
|
- @ApiOperation(value="创建空记录")
|
|
|
|
- @GetMapping("create")
|
|
|
|
- public MessageResult<PersonInfo> create(){
|
|
|
|
- MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- PersonInfo personInfo = new PersonInfo();
|
|
|
|
-
|
|
|
|
- msgResult.setData(personInfo);
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="添加信息")
|
|
|
|
- @PostMapping("add")
|
|
|
|
- public MessageResult<PersonInfo> add(@RequestBody PersonInfo personInfo,@RequestAttribute String subject){
|
|
|
|
|
|
+ @ApiOperation(value="保存信息")
|
|
|
|
+ @PostMapping("save")
|
|
|
|
+ public MessageResult<PersonInfo> save(@RequestBody PersonInfo personInfo,@RequestAttribute String subject){
|
|
|
|
+ User user = userService.get(subject);
|
|
MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
-// personInfo.setId(UUID.randomUUID().toString());
|
|
|
|
- personInfo.setDelFlag(false);
|
|
|
|
- personInfo.setCreateBy(subject);
|
|
|
|
- personInfo.setCreateTime(new Date());
|
|
|
|
-
|
|
|
|
- int affectCount = personInfoService.insert(personInfo);
|
|
|
|
|
|
+ int affectCount = 0;
|
|
|
|
+ if(personInfo.getId() != null) {
|
|
|
|
+ personInfo.setCompanyId(user.getCompanyId());
|
|
|
|
+ personInfo.setDelFlag(false);
|
|
|
|
+ personInfo.setCreateBy(subject);
|
|
|
|
+ personInfo.setCreateTime(new Date());
|
|
|
|
+
|
|
|
|
+ affectCount = personInfoService.insert(personInfo);
|
|
|
|
+ }else{
|
|
|
|
+ personInfo.setUpdateBy(subject);
|
|
|
|
+ personInfo.setUpdateTime(new Date());
|
|
|
|
+
|
|
|
|
+ affectCount = personInfoService.update(personInfo);
|
|
|
|
+ }
|
|
|
|
|
|
if (affectCount > 0) {
|
|
if (affectCount > 0) {
|
|
msgResult.setResult(true);
|
|
msgResult.setResult(true);
|
|
msgResult.setData(personInfo);
|
|
msgResult.setData(personInfo);
|
|
- } else {
|
|
|
|
|
|
+ }else{
|
|
msgResult.setResult(false);
|
|
msgResult.setResult(false);
|
|
- msgResult.setMessage("数据库添加失败");
|
|
|
|
|
|
+ msgResult.setMessage("数据库保存失败");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch(Exception ex){
|
|
catch(Exception ex){
|
|
@@ -71,9 +76,9 @@ public class PersonInfoController {
|
|
return msgResult;
|
|
return msgResult;
|
|
}
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="获取信息")
|
|
|
|
- @GetMapping("edit/{id}")
|
|
|
|
- public MessageResult<PersonInfo> edit(@PathVariable("id") String id){
|
|
|
|
|
|
+ @ApiOperation(value="获取详情信息")
|
|
|
|
+ @GetMapping("detail/{id}")
|
|
|
|
+ public MessageResult<PersonInfo> detail(@PathVariable("id") String id){
|
|
MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -97,35 +102,6 @@ public class PersonInfoController {
|
|
return msgResult;
|
|
return msgResult;
|
|
}
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="更新用户")
|
|
|
|
- @PostMapping("update")
|
|
|
|
- public MessageResult<PersonInfo> update(@RequestBody PersonInfo personInfo,@RequestAttribute String subject){
|
|
|
|
- MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- personInfo.setUpdateBy(subject);
|
|
|
|
- personInfo.setUpdateTime(new Date());
|
|
|
|
-
|
|
|
|
- int affectCount = personInfoService.update(personInfo);
|
|
|
|
-
|
|
|
|
- if (affectCount > 0) {
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(personInfo);
|
|
|
|
- } else {
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage("数据库更新失败");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- catch(Exception ex){
|
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
|
-
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage(ex.getMessage());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@ApiOperation(value="删除")
|
|
@ApiOperation(value="删除")
|
|
@PostMapping("delete/{id}")
|
|
@PostMapping("delete/{id}")
|
|
public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
@@ -157,7 +133,6 @@ public class PersonInfoController {
|
|
return msgResult;
|
|
return msgResult;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
@ApiOperation(value="批量删除")
|
|
@ApiOperation(value="批量删除")
|
|
@PostMapping("batchDelete")
|
|
@PostMapping("batchDelete")
|
|
public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
|
|
public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
|
|
@@ -195,8 +170,21 @@ public class PersonInfoController {
|
|
|
|
|
|
@ApiOperation(value="列表")
|
|
@ApiOperation(value="列表")
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "name",value = "姓名", required = false, paramType = "form",dataType = "String"),
|
|
|
|
+ @ApiImplicitParam(name = "position1",value = "一级位置", required = false, paramType = "form",dataType = "String"),
|
|
|
|
+ @ApiImplicitParam(name = "position2",value = "二级位置", required = false, paramType = "form",dataType = "String"),
|
|
|
|
+ @ApiImplicitParam(name = "position3",value = "三级位置", required = false, paramType = "form",dataType = "String"),
|
|
|
|
+ @ApiImplicitParam(name = "position4",value = "四级位置", required = false, paramType = "form",dataType = "String"),
|
|
|
|
+ @ApiImplicitParam(name = "position5",value = "五级位置", required = false, paramType = "form",dataType = "String")
|
|
|
|
+ })
|
|
public MessageResult<Map> pageList(
|
|
public MessageResult<Map> pageList(
|
|
- String id,
|
|
|
|
|
|
+ @RequestParam(value="name",defaultValue="") String name,
|
|
|
|
+ @RequestParam(value="position1",defaultValue="") String position1,
|
|
|
|
+ @RequestParam(value="position2",defaultValue="") String position2,
|
|
|
|
+ @RequestParam(value="position3",defaultValue="") String position3,
|
|
|
|
+ @RequestParam(value="position4",defaultValue="") String position4,
|
|
|
|
+ @RequestParam(value="position5",defaultValue="") String position5,
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
@RequestAttribute String subject){
|
|
@RequestAttribute String subject){
|
|
@@ -211,8 +199,23 @@ public class PersonInfoController {
|
|
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(name)) {
|
|
|
|
+ searchParams.put("name","%" + name + "%");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(position1)) {
|
|
|
|
+ searchParams.put("position1",position1);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(position2)) {
|
|
|
|
+ searchParams.put("position2",position2);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(position3)) {
|
|
|
|
+ searchParams.put("position3",position3);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(position4)) {
|
|
|
|
+ searchParams.put("position4",position4);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(position5)) {
|
|
|
|
+ searchParams.put("position5",position5);
|
|
}
|
|
}
|
|
|
|
|
|
Page<PersonInfo> page = personInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
Page<PersonInfo> page = personInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
@@ -222,4 +225,324 @@ public class PersonInfoController {
|
|
|
|
|
|
return msgResult;
|
|
return msgResult;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="人脸授权")
|
|
|
|
+ @PostMapping("EnabledFace")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "id",value = "人员编号", required = false, paramType = "form",dataType = "String")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<PersonInfo> EnabledFace(@RequestParam(value="id",defaultValue="") String id,@RequestAttribute String subject){
|
|
|
|
+ MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ PersonInfo personInfo = personInfoService.get(id);
|
|
|
|
+
|
|
|
|
+ if(personInfo.getFaceEnabled()){
|
|
|
|
+ personInfo.setFaceEnabled(false);
|
|
|
|
+ }else{
|
|
|
|
+ personInfo.setFaceEnabled(true);
|
|
|
|
+ }
|
|
|
|
+ personInfo.setUpdateBy(subject);
|
|
|
|
+ personInfo.setUpdateTime(new Date());
|
|
|
|
+
|
|
|
|
+ int affectCount = personInfoService.update(personInfo);
|
|
|
|
+
|
|
|
|
+ if (affectCount > 0) {
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(personInfo);
|
|
|
|
+ }else{
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage("数据库保存失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ catch(Exception ex){
|
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return msgResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="刷卡授权")
|
|
|
|
+ @PostMapping("EnabledCard")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "id",value = "人员编号", required = false, paramType = "form",dataType = "String")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<PersonInfo> EnabledCard(@RequestParam(value="id",defaultValue="") String id,@RequestAttribute String subject){
|
|
|
|
+ MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ PersonInfo personInfo = personInfoService.get(id);
|
|
|
|
+
|
|
|
|
+ if(personInfo.getCardEnabled()){
|
|
|
|
+ personInfo.setCardEnabled(false);
|
|
|
|
+ }else{
|
|
|
|
+ personInfo.setCardEnabled(true);
|
|
|
|
+ }
|
|
|
|
+ personInfo.setUpdateBy(subject);
|
|
|
|
+ personInfo.setUpdateTime(new Date());
|
|
|
|
+
|
|
|
|
+ int affectCount = personInfoService.update(personInfo);
|
|
|
|
+
|
|
|
|
+ if (affectCount > 0) {
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(personInfo);
|
|
|
|
+ }else{
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage("数据库保存失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ catch(Exception ex){
|
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return msgResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="手机授权")
|
|
|
|
+ @PostMapping("EnabledApp")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "id",value = "人员编号", required = false, paramType = "form",dataType = "String")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<PersonInfo> EnabledApp(@RequestParam(value="id",defaultValue="") String id,@RequestAttribute String subject){
|
|
|
|
+ MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ PersonInfo personInfo = personInfoService.get(id);
|
|
|
|
+
|
|
|
|
+ if(personInfo.getAppEnabled()){
|
|
|
|
+ personInfo.setAppEnabled(false);
|
|
|
|
+ }else{
|
|
|
|
+ personInfo.setAppEnabled(true);
|
|
|
|
+ }
|
|
|
|
+ personInfo.setUpdateBy(subject);
|
|
|
|
+ personInfo.setUpdateTime(new Date());
|
|
|
|
+
|
|
|
|
+ int affectCount = personInfoService.update(personInfo);
|
|
|
|
+
|
|
|
|
+ if (affectCount > 0) {
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(personInfo);
|
|
|
|
+ }else{
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage("数据库保存失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ catch(Exception ex){
|
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return msgResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="访客授权")
|
|
|
|
+ @PostMapping("EnabledGuest")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "id",value = "人员编号", required = false, paramType = "form",dataType = "String")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<PersonInfo> EnabledGuest(@RequestParam(value="id",defaultValue="") String id,@RequestAttribute String subject){
|
|
|
|
+ MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ PersonInfo personInfo = personInfoService.get(id);
|
|
|
|
+
|
|
|
|
+ if(personInfo.getGuestEnabled()){
|
|
|
|
+ personInfo.setGuestEnabled(false);
|
|
|
|
+ }else{
|
|
|
|
+ personInfo.setGuestEnabled(true);
|
|
|
|
+ }
|
|
|
|
+ personInfo.setUpdateBy(subject);
|
|
|
|
+ personInfo.setUpdateTime(new Date());
|
|
|
|
+
|
|
|
|
+ int affectCount = personInfoService.update(personInfo);
|
|
|
|
+
|
|
|
|
+ if (affectCount > 0) {
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(personInfo);
|
|
|
|
+ }else{
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage("数据库保存失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ catch(Exception ex){
|
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return msgResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+// @ApiOperation(value="导入企业人员")
|
|
|
|
+// @PostMapping("importXls")
|
|
|
|
+// @ApiImplicitParams({
|
|
|
|
+// @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,
|
|
|
|
+// MultipartFile uploadFile,
|
|
|
|
+// @RequestAttribute String subject){
|
|
|
|
+// User user = userService.get(subject);
|
|
|
|
+//
|
|
|
|
+// MessageResult<String> msgResult = new MessageResult<>();
|
|
|
|
+// PersonInfo personInfo = new PersonInfo();
|
|
|
|
+//
|
|
|
|
+// try {
|
|
|
|
+// POIUtils poiUtils = new POIUtils(uploadFile.getInputStream());
|
|
|
|
+// int sheetIndex = 0;
|
|
|
|
+// Sheet sheet1 = poiUtils.getSheetAt(sheetIndex);
|
|
|
|
+//
|
|
|
|
+// int affectCount = 0;
|
|
|
|
+// int failCount = 0;
|
|
|
|
+// int validateColIndex = 7;
|
|
|
|
+//
|
|
|
|
+// for(int rowIndex=1 ; rowIndex<=sheet1.getLastRowNum(); rowIndex++){
|
|
|
|
+// try {
|
|
|
|
+// String name = (String)poiUtils.getCellValue(sheetIndex,rowIndex,1);
|
|
|
|
+// String cardType = (String)poiUtils.getCellValue(sheetIndex,rowIndex,2);
|
|
|
|
+// String cardNo = (String)poiUtils.getCellValue(sheetIndex,rowIndex,3);
|
|
|
|
+// String sex = (String)poiUtils.getCellValue(sheetIndex,rowIndex,4);
|
|
|
|
+//// String age = array[5].toString();
|
|
|
|
+// String jobName = (String)poiUtils.getCellValue(sheetIndex,rowIndex,5);
|
|
|
|
+// String healthStatus = (String)poiUtils.getCellValue(sheetIndex,rowIndex,6);
|
|
|
|
+//
|
|
|
|
+// if(StringUtils.isEmpty(name)){
|
|
|
|
+// break;
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// Map<String, Object> searchParams = new HashMap<>();
|
|
|
|
+// searchParams.put("companyId", company.getId());
|
|
|
|
+// searchParams.put("cardNo", cardNo);
|
|
|
|
+// searchParams.put("delFlag", false);
|
|
|
|
+//
|
|
|
|
+// List<Sort> sortList = new ArrayList<>();
|
|
|
|
+// Page<CompanyMember> page = companyMemberService.pageSearch(searchParams, 1, 100, sortList);
|
|
|
|
+//
|
|
|
|
+// if (page.size() > 0) {
|
|
|
|
+// sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("身份证已导入!");
|
|
|
|
+// failCount++;
|
|
|
|
+// continue;
|
|
|
|
+// } else {
|
|
|
|
+// companyMember.setId(UUID.randomUUID().toString());
|
|
|
|
+// if (StringUtils.isNotEmpty(company.getId())) companyMember.setCompanyId(company.getId());
|
|
|
|
+// if (StringUtils.isNotEmpty(name)) companyMember.setName(name);
|
|
|
|
+//
|
|
|
|
+// CheckIdCard cic = null;
|
|
|
|
+//
|
|
|
|
+// if(StringUtils.isEmpty(cardNo)){
|
|
|
|
+// sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("身份证不能为空!");
|
|
|
|
+// failCount++;
|
|
|
|
+// continue;
|
|
|
|
+// }
|
|
|
|
+// else{
|
|
|
|
+// cardNo = cardNo.trim().toUpperCase();
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// for(DataDictionary dd : ddList){
|
|
|
|
+// if(dd.getName().equals(cardType)) {
|
|
|
|
+// companyMember.setCardType(dd.getValue());
|
|
|
|
+// break;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// if (StringUtils.isEmpty(companyMember.getCardType())){
|
|
|
|
+// sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("证件类型未选择!");
|
|
|
|
+// failCount++;
|
|
|
|
+// continue;
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// if (cardType.contains("身份证")) {
|
|
|
|
+// cic = new CheckIdCard(cardNo);
|
|
|
|
+//
|
|
|
|
+// if (!cic.validate()){
|
|
|
|
+// sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("身份证验证失败!");
|
|
|
|
+// failCount++;
|
|
|
|
+//
|
|
|
|
+// continue;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// companyMember.setCardNo(cardNo);
|
|
|
|
+//
|
|
|
|
+// List<Jobs> jobsList = jobsService.findByName(jobsName);
|
|
|
|
+//
|
|
|
|
+// if (jobsList.size() > 0) {
|
|
|
|
+// companyMember.setJobsId(jobsList.get(0).getId());
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// if (StringUtils.isNotEmpty(healthStatus)) companyMember.setHealthStatus(healthStatus);
|
|
|
|
+//
|
|
|
|
+// companyMember.setStatus("0");
|
|
|
|
+// companyMember.setDelFlag(false);
|
|
|
|
+// companyMember.setCreateBy(principal.getName());
|
|
|
|
+// companyMember.setCreateTime(new Date());
|
|
|
|
+//
|
|
|
|
+// if (companyMemberService.insert(companyMember) > 0) {
|
|
|
|
+// affectCount++;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// catch(Exception innerEx){
|
|
|
|
+// logger.error(innerEx.getMessage(),innerEx);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// if (failCount>0){
|
|
|
|
+// //有导入失败的记录
|
|
|
|
+// msgResult.setResult(false);
|
|
|
|
+// msgResult.setMessage("数据成功导入" + affectCount + "条,有" + failCount + "条数据未导入成功,错误原因请查看报表。");
|
|
|
|
+//
|
|
|
|
+// //todo 只保留错误数据的sheet
|
|
|
|
+// int rowIndex = 1;
|
|
|
|
+//
|
|
|
|
+// while(rowIndex<= sheet1.getLastRowNum()){
|
|
|
|
+// Cell cell = sheet1.getRow(rowIndex).getCell(validateColIndex);
|
|
|
|
+//
|
|
|
|
+// if (cell==null || StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
|
+// sheet1.removeRow(sheet1.getRow(rowIndex));
|
|
|
|
+//
|
|
|
|
+// if (rowIndex<sheet1.getLastRowNum()) {
|
|
|
|
+// sheet1.shiftRows(rowIndex + 1, sheet1.getLastRowNum(), -1); //删除后下面行上移,则不需要移动rowIndex
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// else {
|
|
|
|
+// rowIndex++;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// //todo 将wb保存到oss
|
|
|
|
+// ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
|
+// poiUtils.getWorkbook().write(output);
|
|
|
|
+//
|
|
|
|
+// byte[] buffer = output.toByteArray();
|
|
|
|
+// ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
|
+//
|
|
|
|
+// String downloadUrl = OSSUtil.upload(ossConfig,"import","error.xls",input);
|
|
|
|
+//
|
|
|
|
+// //todo 返回导入失败报表下载链接
|
|
|
|
+// msgResult.setData(downloadUrl);
|
|
|
|
+// }
|
|
|
|
+// else{
|
|
|
|
+// msgResult.setResult(true);
|
|
|
|
+// msgResult.setMessage("数据成功导入" + affectCount + "条");
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// catch(Exception ex){
|
|
|
|
+// logger.error(ex.getMessage(),ex);
|
|
|
|
+//
|
|
|
|
+// msgResult.setResult(false);
|
|
|
|
+// msgResult.setMessage(ex.getMessage());
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// return msgResult;
|
|
|
|
+// }
|
|
}
|
|
}
|