|
@@ -284,6 +284,7 @@ public class PersonInfoController {
|
|
|
@ApiImplicitParam(name = "name",value = "姓名", required = false, paramType = "form",dataType = "String"),
|
|
|
@ApiImplicitParam(name = "idCard",value = "身份证", required = false, paramType = "form",dataType = "String"),
|
|
|
@ApiImplicitParam(name = "phone",value = "手机号", required = false, paramType = "form",dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "companyId",value = "企业id", 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"),
|
|
@@ -294,6 +295,7 @@ public class PersonInfoController {
|
|
|
@RequestParam(value="name",defaultValue="") String name,
|
|
|
@RequestParam(value="idCard",defaultValue="") String idCard,
|
|
|
@RequestParam(value="phone",defaultValue="") String phone,
|
|
|
+ @RequestParam(value="companyId",defaultValue="") String companyId,
|
|
|
@RequestParam(value="position1",defaultValue="") String position1,
|
|
|
@RequestParam(value="position2",defaultValue="") String position2,
|
|
|
@RequestParam(value="position3",defaultValue="") String position3,
|
|
@@ -317,10 +319,13 @@ public class PersonInfoController {
|
|
|
searchParams.put("name","%" + name + "%");
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(idCard)) {
|
|
|
- searchParams.put("name","%" + idCard + "%");
|
|
|
+ searchParams.put("idCard","%" + idCard + "%");
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(phone)) {
|
|
|
- searchParams.put("name","%" + phone + "%");
|
|
|
+ searchParams.put("phone","%" + phone + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(companyId)) {
|
|
|
+ searchParams.put("companyId",companyId);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(position1)) {
|
|
|
searchParams.put("position1",position1);
|
|
@@ -656,21 +661,126 @@ public class PersonInfoController {
|
|
|
|
|
|
@ApiOperation(value="导出人员")
|
|
|
@PostMapping("exportXls")
|
|
|
- public MessageResult<String> exportXls(HttpServletRequest request, HttpServletResponse response){
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "name",value = "姓名", required = false, paramType = "form",dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "idCard",value = "身份证", required = false, paramType = "form",dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "phone",value = "手机号", required = false, paramType = "form",dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "companyId",value = "企业id", 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<String> exportXls(@RequestParam(value="name",defaultValue="") String name,
|
|
|
+ @RequestParam(value="idCard",defaultValue="") String idCard,
|
|
|
+ @RequestParam(value="phone",defaultValue="") String phone,
|
|
|
+ @RequestParam(value="companyId",defaultValue="") String companyId,
|
|
|
+ @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,
|
|
|
+ @RequestAttribute String subject){
|
|
|
MessageResult<String> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
- //创建hssfWorkbook
|
|
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
|
|
-
|
|
|
- //创建工作簿
|
|
|
HSSFSheet sheet = workbook.createSheet();
|
|
|
+ //表头
|
|
|
+ HSSFRow rowTitle = sheet.createRow(0);
|
|
|
+ HSSFCell cellTitle1 = rowTitle.createCell(0);
|
|
|
+ cellTitle1.setCellValue("序号");
|
|
|
+ HSSFCell cellTitle2 = rowTitle.createCell(1);
|
|
|
+ cellTitle2.setCellValue("姓名");
|
|
|
+ HSSFCell cellTitle3 = rowTitle.createCell(2);
|
|
|
+ cellTitle3.setCellValue("身份证");
|
|
|
+ HSSFCell cellTitle4 = rowTitle.createCell(3);
|
|
|
+ cellTitle4.setCellValue("手机号");
|
|
|
+ HSSFCell cellTitle5 = rowTitle.createCell(4);
|
|
|
+ cellTitle5.setCellValue("位置1");
|
|
|
+ HSSFCell cellTitle6 = rowTitle.createCell(5);
|
|
|
+ cellTitle6.setCellValue("位置2");
|
|
|
+ HSSFCell cellTitle7 = rowTitle.createCell(6);
|
|
|
+ cellTitle7.setCellValue("位置3");
|
|
|
+ HSSFCell cellTitle8 = rowTitle.createCell(7);
|
|
|
+ cellTitle8.setCellValue("位置4");
|
|
|
+ HSSFCell cellTitle9 = rowTitle.createCell(8);
|
|
|
+ cellTitle9.setCellValue("位置5");
|
|
|
+ HSSFCell cellTitle10 = rowTitle.createCell(9);
|
|
|
+ cellTitle10.setCellValue("人脸开关");
|
|
|
+ HSSFCell cellTitle11 = rowTitle.createCell(10);
|
|
|
+ cellTitle11.setCellValue("刷卡开关");
|
|
|
+ HSSFCell cellTitle12 = rowTitle.createCell(11);
|
|
|
+ cellTitle12.setCellValue("手机开关");
|
|
|
+ HSSFCell cellTitle13 = rowTitle.createCell(12);
|
|
|
+ cellTitle13.setCellValue("访客开关");
|
|
|
+
|
|
|
+ //表内容
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("a.id_","asc"));
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+ if (StringUtils.isNotEmpty(name)) {
|
|
|
+ searchParams.put("name","%" + name + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(idCard)) {
|
|
|
+ searchParams.put("idCard","%" + idCard + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(phone)) {
|
|
|
+ searchParams.put("phone","%" + phone + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(companyId)) {
|
|
|
+ searchParams.put("companyId",companyId);
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ }
|
|
|
|
|
|
- //创建标题
|
|
|
- HSSFRow row = sheet.createRow(0);
|
|
|
- HSSFCell cell = row.createCell(0);
|
|
|
- cell.setCellValue("商品信息汇总");
|
|
|
-
|
|
|
+ Page<PersonInfo> page = personInfoService.pageSearch(searchParams,1,10000,false,sortList);
|
|
|
+
|
|
|
+ for(int i=0; i<page.size(); i++){
|
|
|
+ PersonInfo personInfo = page.get(i);
|
|
|
+
|
|
|
+ HSSFRow rowContent = sheet.createRow(0);
|
|
|
+ HSSFCell cellContent1 = rowContent.createCell(0);
|
|
|
+ cellContent1.setCellValue(i+1);
|
|
|
+ HSSFCell cellContent2 = rowContent.createCell(1);
|
|
|
+ cellContent2.setCellValue(personInfo.getName());
|
|
|
+ HSSFCell cellContent3 = rowContent.createCell(2);
|
|
|
+ cellContent3.setCellValue(personInfo.getIdCard());
|
|
|
+ HSSFCell cellContent4 = rowContent.createCell(3);
|
|
|
+ cellContent4.setCellValue(personInfo.getPhone());
|
|
|
+ HSSFCell cellContent5 = rowContent.createCell(4);
|
|
|
+ cellContent5.setCellValue(personInfo.getPosition1());
|
|
|
+ HSSFCell cellContent6 = rowContent.createCell(5);
|
|
|
+ cellContent6.setCellValue(personInfo.getPosition2());
|
|
|
+ HSSFCell cellContent7 = rowContent.createCell(6);
|
|
|
+ cellContent7.setCellValue(personInfo.getPosition3());
|
|
|
+ HSSFCell cellContent8 = rowContent.createCell(7);
|
|
|
+ cellContent8.setCellValue(personInfo.getPosition4());
|
|
|
+ HSSFCell cellContent9 = rowContent.createCell(8);
|
|
|
+ cellContent9.setCellValue(personInfo.getPosition5());
|
|
|
+ HSSFCell cellContent10 = rowContent.createCell(9);
|
|
|
+ cellContent10.setCellValue(personInfo.getFaceEnabled());
|
|
|
+ HSSFCell cellContent11 = rowContent.createCell(10);
|
|
|
+ cellContent11.setCellValue(personInfo.getCardEnabled());
|
|
|
+ HSSFCell cellContent12 = rowContent.createCell(11);
|
|
|
+ cellContent12.setCellValue(personInfo.getAppEnabled());
|
|
|
+ HSSFCell cellContent13 = rowContent.createCell(12);
|
|
|
+ cellContent13.setCellValue(personInfo.getGuestEnabled());
|
|
|
+ }
|
|
|
|
|
|
//todo 将wb保存到oss
|
|
|
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
@@ -704,4 +814,24 @@ public class PersonInfoController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="数据同步")
|
|
|
+ @PostMapping("dataSync")
|
|
|
+ public MessageResult<String> dataSync(@RequestBody List<String> ids){
|
|
|
+ MessageResult<String> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ for(String id : ids){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|