|
@@ -1,19 +1,32 @@
|
|
|
package com.ruoyi.web.controller.branch;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.ruoyi.branch.domain.TBranchMemTransfer;
|
|
|
+import com.ruoyi.branch.domain.TBranchMember;
|
|
|
import com.ruoyi.branch.domain.approve.DevTask;
|
|
|
+import com.ruoyi.branch.domain.vo.TBranchDyVo;
|
|
|
+import com.ruoyi.branch.domain.vo.TBranchJjfzFzdxVo;
|
|
|
+import com.ruoyi.branch.domain.vo.TBranchWyhVo;
|
|
|
import com.ruoyi.branch.service.ITBranchMemTransferService;
|
|
|
+import com.ruoyi.branch.service.ITBranchMemberService;
|
|
|
+import com.ruoyi.common.annotation.Log;
|
|
|
+import com.ruoyi.common.core.controller.BaseController;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysDept;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysRole;
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
+import com.ruoyi.common.enums.BusinessType;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
+import com.ruoyi.common.utils.file.ExcelUtils;
|
|
|
+import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
+import com.ruoyi.system.domain.SysPost;
|
|
|
+import com.ruoyi.system.service.ISysDeptService;
|
|
|
+import com.ruoyi.system.service.ISysDictTypeService;
|
|
|
+import com.ruoyi.system.service.ISysPostService;
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
import org.activiti.engine.ProcessEngine;
|
|
|
import org.activiti.engine.ProcessEngines;
|
|
@@ -22,23 +35,20 @@ import org.activiti.engine.TaskService;
|
|
|
import org.activiti.engine.impl.identity.Authentication;
|
|
|
import org.activiti.engine.runtime.ProcessInstance;
|
|
|
import org.activiti.engine.task.Task;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.apache.poi.ss.usermodel.Cell;
|
|
|
+import org.apache.poi.ss.usermodel.Row;
|
|
|
+import org.apache.poi.ss.usermodel.Sheet;
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-import com.ruoyi.common.annotation.Log;
|
|
|
-import com.ruoyi.common.core.controller.BaseController;
|
|
|
-import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
-import com.ruoyi.common.enums.BusinessType;
|
|
|
-import com.ruoyi.branch.domain.TBranchMember;
|
|
|
-import com.ruoyi.branch.service.ITBranchMemberService;
|
|
|
-import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 支部成员管理Controller
|
|
@@ -48,8 +58,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/branch/member")
|
|
|
-public class TBranchMemberController extends BaseController
|
|
|
-{
|
|
|
+public class TBranchMemberController extends BaseController {
|
|
|
@Autowired
|
|
|
private ITBranchMemberService tBranchMemberService;
|
|
|
|
|
@@ -62,6 +71,15 @@ public class TBranchMemberController extends BaseController
|
|
|
@Autowired
|
|
|
private ITBranchMemTransferService transferService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISysDictTypeService sysDictTypeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysDeptService sysDeptService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysPostService sysPostService;
|
|
|
+
|
|
|
/**
|
|
|
* 审批处理
|
|
|
*
|
|
@@ -135,8 +153,7 @@ public class TBranchMemberController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('branch:member:edit')")
|
|
|
@PutMapping("/apply")
|
|
|
- public AjaxResult apply(@RequestBody TBranchMember tBranchMember)
|
|
|
- {
|
|
|
+ public AjaxResult apply(@RequestBody TBranchMember tBranchMember) {
|
|
|
String userId = getUserId().toString();
|
|
|
|
|
|
// 开始流程
|
|
@@ -180,8 +197,7 @@ public class TBranchMemberController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('branch:member:list')")
|
|
|
@GetMapping("/listPoliticalBirthday")
|
|
|
- public AjaxResult listPoliticalBirthday(TBranchMember tBranchMember)
|
|
|
- {
|
|
|
+ public AjaxResult listPoliticalBirthday(TBranchMember tBranchMember) {
|
|
|
return AjaxResult.success(tBranchMemberService.selectPoliticalBirthdayList(tBranchMember));
|
|
|
}
|
|
|
|
|
@@ -190,8 +206,7 @@ public class TBranchMemberController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('branch:member:list')")
|
|
|
@GetMapping("/list")
|
|
|
- public TableDataInfo list(TBranchMember tBranchMember)
|
|
|
- {
|
|
|
+ public TableDataInfo list(TBranchMember tBranchMember) {
|
|
|
startPage();
|
|
|
List<TBranchMember> list = tBranchMemberService.selectTBranchMemberList(tBranchMember);
|
|
|
TableDataInfo dataTable = getDataTable(list);
|
|
@@ -205,11 +220,60 @@ public class TBranchMemberController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('branch:member:export')")
|
|
|
@Log(title = "支部成员管理", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
|
- public void export(HttpServletResponse response, TBranchMember tBranchMember)
|
|
|
- {
|
|
|
- List<TBranchMember> list = tBranchMemberService.selectTBranchMemberList(tBranchMember);
|
|
|
- ExcelUtil<TBranchMember> util = new ExcelUtil<TBranchMember>(TBranchMember.class);
|
|
|
- util.exportExcel(response, list, "支部成员管理数据");
|
|
|
+ public void export(HttpServletResponse response, TBranchMember tBranchMember) {
|
|
|
+ if ("1".equals(tBranchMember.getMemberType())) {
|
|
|
+ List<TBranchJjfzFzdxVo> list = tBranchMemberService.selectTBranchJjfzFzdxVoList(tBranchMember);
|
|
|
+ for (TBranchJjfzFzdxVo vo : list) {
|
|
|
+ if (StringUtils.isNotEmpty(vo.getCurrentMentor())) {
|
|
|
+ String name = "";
|
|
|
+ for (String s : vo.getCurrentMentor().split(",")) {
|
|
|
+ SysUser sysUser = userService.selectUserById(Long.valueOf(s));
|
|
|
+ name += sysUser.getNickName() + "、";
|
|
|
+ }
|
|
|
+ vo.setCurrentMentor(name.substring(0, name.length() - 1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ExcelUtil<TBranchJjfzFzdxVo> util = new ExcelUtil<TBranchJjfzFzdxVo>(TBranchJjfzFzdxVo.class);
|
|
|
+ util.exportExcel(response, list, "积极分子名册数据");
|
|
|
+ } else if ("4".equals(tBranchMember.getMemberType())) {
|
|
|
+ List<TBranchJjfzFzdxVo> list = tBranchMemberService.selectTBranchJjfzFzdxVoList(tBranchMember);
|
|
|
+ for (TBranchJjfzFzdxVo vo : list) {
|
|
|
+ if (StringUtils.isNotEmpty(vo.getCurrentMentor())) {
|
|
|
+ String name = "";
|
|
|
+ for (String s : vo.getCurrentMentor().split(",")) {
|
|
|
+ SysUser sysUser = userService.selectUserById(Long.valueOf(s));
|
|
|
+ name += sysUser.getNickName() + "、";
|
|
|
+ }
|
|
|
+ vo.setCurrentMentor(name.substring(0, name.length() - 1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ExcelUtil<TBranchJjfzFzdxVo> util = new ExcelUtil<TBranchJjfzFzdxVo>(TBranchJjfzFzdxVo.class);
|
|
|
+ util.exportExcel(response, list, "发展对象名册数据");
|
|
|
+ } else if ("2".equals(tBranchMember.getMemberType())) {
|
|
|
+ List<TBranchDyVo> list = tBranchMemberService.selectTBranchDyVoList(tBranchMember);
|
|
|
+ ExcelUtil<TBranchDyVo> util = new ExcelUtil<TBranchDyVo>(TBranchDyVo.class);
|
|
|
+ util.exportExcel(response, list, "党员名册数据");
|
|
|
+ } else if ("3".equals(tBranchMember.getMemberType())) {
|
|
|
+ List<TBranchWyhVo> list = tBranchMemberService.selectTBranchWyhVoList(tBranchMember);
|
|
|
+ for (TBranchWyhVo vo : list) {
|
|
|
+ if (CollectionUtils.isNotEmpty(vo.getPosts())) {
|
|
|
+ String postName = "";
|
|
|
+ for (SysPost post : vo.getPosts()) {
|
|
|
+ postName += post.getPostName() + "兼";
|
|
|
+ }
|
|
|
+ vo.setPost(postName.substring(0, postName.length() - 1));
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(vo.getRoles())) {
|
|
|
+ String roleName = "";
|
|
|
+ for (SysRole role : vo.getRoles()) {
|
|
|
+ roleName += role.getRoleName() + "兼";
|
|
|
+ }
|
|
|
+ vo.setRole(roleName.substring(0, roleName.length() - 1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ExcelUtil<TBranchWyhVo> util = new ExcelUtil<TBranchWyhVo>(TBranchWyhVo.class);
|
|
|
+ util.exportExcel(response, list, "委员会名册数据");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -217,8 +281,7 @@ public class TBranchMemberController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('branch:member:query')")
|
|
|
@GetMapping(value = "/{memberId}")
|
|
|
- public AjaxResult getInfo(@PathVariable("memberId") Long memberId)
|
|
|
- {
|
|
|
+ public AjaxResult getInfo(@PathVariable("memberId") Long memberId) {
|
|
|
return success(tBranchMemberService.selectTBranchMemberByMemberId(memberId));
|
|
|
}
|
|
|
|
|
@@ -228,11 +291,7 @@ public class TBranchMemberController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('branch:member:add')")
|
|
|
@Log(title = "支部成员管理", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
- public AjaxResult add(@RequestBody TBranchMember tBranchMember)
|
|
|
- {
|
|
|
- Long userId = getUserId();
|
|
|
- Long deptId = userService.selectUserById(userId).getDeptId();
|
|
|
- tBranchMember.setDeptId(deptId);
|
|
|
+ public AjaxResult add(@RequestBody TBranchMember tBranchMember) {
|
|
|
return toAjax(tBranchMemberService.insertTBranchMember(tBranchMember));
|
|
|
}
|
|
|
|
|
@@ -242,8 +301,7 @@ public class TBranchMemberController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('branch:member:edit')")
|
|
|
@Log(title = "支部成员管理", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
- public AjaxResult edit(@RequestBody TBranchMember tBranchMember)
|
|
|
- {
|
|
|
+ public AjaxResult edit(@RequestBody TBranchMember tBranchMember) {
|
|
|
return toAjax(tBranchMemberService.updateTBranchMember(tBranchMember));
|
|
|
}
|
|
|
|
|
@@ -252,9 +310,238 @@ public class TBranchMemberController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('branch:member:remove')")
|
|
|
@Log(title = "支部成员管理", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/{memberIds}")
|
|
|
- public AjaxResult remove(@PathVariable Long[] memberIds)
|
|
|
- {
|
|
|
+ @DeleteMapping("/{memberIds}")
|
|
|
+ public AjaxResult remove(@PathVariable Long[] memberIds) {
|
|
|
return toAjax(tBranchMemberService.deleteTBranchMemberByMemberIds(memberIds));
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping("/importData/{memberType}")
|
|
|
+ public AjaxResult importData(@RequestParam("file") MultipartFile file, @PathVariable String memberType) throws IOException {
|
|
|
+ //报错行数统计
|
|
|
+ List<Integer> failRow = new ArrayList<>();
|
|
|
+ Workbook workbook = ExcelUtils.getWorkBook(file);
|
|
|
+ Sheet sheet = workbook.getSheetAt(0);
|
|
|
+ List<TBranchMember> list = new ArrayList<>();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ int rowNum = sheet.getPhysicalNumberOfRows();
|
|
|
+ int failNumber = 0;
|
|
|
+ //字典查询
|
|
|
+ List<SysDictData> educationLevel = sysDictTypeService.selectDictDataByType("member_education_level");
|
|
|
+ List<SysDept> sysDepts = sysDeptService.selectAllDeptList(new SysDept());
|
|
|
+ for (int i = 1; i < rowNum; i++) {
|
|
|
+ try {
|
|
|
+ logger.info("读取行数:" + i);
|
|
|
+ Row row = sheet.getRow(i);
|
|
|
+ int cellNum = row.getLastCellNum();
|
|
|
+ TBranchMember entity = new TBranchMember();
|
|
|
+ entity.setMemberType(memberType);
|
|
|
+ for (int j = 0; j < cellNum; j++) {
|
|
|
+ Cell cell = row.getCell(j);
|
|
|
+ if (cell == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String cellValue = ExcelUtils.getCellValue(cell);
|
|
|
+ logger.info("cellValue:" + cellValue);
|
|
|
+ if (j == 0) {
|
|
|
+ // 党支部
|
|
|
+ for (SysDept sysDept : sysDepts) {
|
|
|
+ if (sysDept.getDeptName().contains(cellValue)) {
|
|
|
+ entity.setDeptId(sysDept.getDeptId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (j == 1) {
|
|
|
+ // 委员会或党员名册导入时第二列为姓名
|
|
|
+ if ("2".equals(memberType) || "3".equals(memberType)) {
|
|
|
+ SysUser sysUser = new SysUser();
|
|
|
+ sysUser.setNickName(cellValue);
|
|
|
+ List<SysUser> sysUsers = userService.selectUserList(sysUser);
|
|
|
+ if (CollectionUtils.isEmpty(sysUsers) || sysUsers.size() > 1) {
|
|
|
+ failNumber++;
|
|
|
+ failRow.add(i + 1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ //姓名
|
|
|
+ entity.setUserId(sysUsers.get(0).getUserId());
|
|
|
+ } else {
|
|
|
+ //积极分子或发展对象为工号
|
|
|
+ entity.setStaffId(cellValue);
|
|
|
+ }
|
|
|
+ } else if (j == 2) {
|
|
|
+ // 积极分子或发展对象为姓名
|
|
|
+ if ("4".equals(memberType) || "1".equals(memberType)) {
|
|
|
+
|
|
|
+ SysUser sysUser = new SysUser();
|
|
|
+ sysUser.setNickName(cellValue);
|
|
|
+ List<SysUser> sysUsers = userService.selectUserList(sysUser);
|
|
|
+ if (CollectionUtils.isEmpty(sysUsers) || sysUsers.size() > 1) {
|
|
|
+ failNumber++;
|
|
|
+ failRow.add(i + 1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ //姓名
|
|
|
+ entity.setUserId(sysUsers.get(0).getUserId());
|
|
|
+ }
|
|
|
+ } else if (j == 3) {
|
|
|
+ if ("2".equals(memberType) || "3".equals(memberType)) {
|
|
|
+ //出生年月
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setBirthday(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ }
|
|
|
+ } else if (j == 4) {
|
|
|
+ if ("2".equals(memberType) || "3".equals(memberType)) {
|
|
|
+ // 学历
|
|
|
+ for (SysDictData data : educationLevel) {
|
|
|
+ if (data.getDictLabel().equals(cellValue)) {
|
|
|
+ entity.setEducationLevel(data.getDictValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ entity.setEthnic(cellValue);//民族
|
|
|
+ }
|
|
|
+ } else if (j == 5) {
|
|
|
+ if ("2".equals(memberType)) {
|
|
|
+ // 参加工作时间
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setWorkJoinTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ } else if ("3".equals(memberType)) {
|
|
|
+ // 入职时间
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setWorkEntryTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ } else {
|
|
|
+ //出生年月
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setBirthday(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ }
|
|
|
+ } else if (j == 6) {
|
|
|
+ if ("1".equals(memberType) || "4".equals(memberType)) {
|
|
|
+ // 参加工作时间
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setWorkJoinTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ } else if ("2".equals(memberType)) {
|
|
|
+ // 入党时间
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setPartyEntryTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ }
|
|
|
+ } else if (j == 7) {
|
|
|
+ if ("1".equals(memberType) || "4".equals(memberType)) {
|
|
|
+ // 入BYC时间
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setWorkEntryTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ } else if ("3".equals(memberType)) {
|
|
|
+ // 入党时间
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setPartyEntryTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ } else {
|
|
|
+ // 联系方式
|
|
|
+ entity.setPhonenumber(cellValue);
|
|
|
+ }
|
|
|
+ } else if (j == 8) {
|
|
|
+ if ("1".equals(memberType) || "4".equals(memberType)) {
|
|
|
+ // 学历
|
|
|
+ for (SysDictData data : educationLevel) {
|
|
|
+ if (data.getDictLabel().equals(cellValue)) {
|
|
|
+ entity.setEducationLevel(data.getDictValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if ("2".equals(memberType)) {
|
|
|
+ // 调进时间
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setEntryTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ }
|
|
|
+ } else if (j == 9) {
|
|
|
+ if ("2".equals(memberType)) {
|
|
|
+ // 调出时间
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setLeaveTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ } else if ("3".equals(memberType)) {
|
|
|
+ // 任职时间
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setLabourEntryTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ } else {
|
|
|
+ // 是否团员
|
|
|
+ entity.setIsLeague("是".equals(cellValue) ? "1" : "0");
|
|
|
+ }
|
|
|
+ } else if (j == 10) {
|
|
|
+ if ("2".equals(memberType)) {
|
|
|
+ // 备注
|
|
|
+ entity.setRemarks(cellValue);
|
|
|
+ } else if ("3".equals(memberType)) {
|
|
|
+ // 离职时间
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setLabourLeaveTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ }
|
|
|
+ } else if (j == 11) {
|
|
|
+ // 申请入党时间
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setApplyTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ } else if (j == 12) {
|
|
|
+ //建表考察时间
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setFormCreateTime(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ } else if (j == 13) {
|
|
|
+ // 现培养人
|
|
|
+ if (StringUtils.isNotEmpty(cellValue)) {
|
|
|
+ String[] names = cellValue.split("、");
|
|
|
+ String userIds = null;
|
|
|
+ for (String name : names) {
|
|
|
+ SysUser sysUser = new SysUser();
|
|
|
+ sysUser.setNickName(name);
|
|
|
+ List<SysUser> sysUsers = userService.selectUserList(sysUser);
|
|
|
+ if (CollectionUtils.isNotEmpty(sysUsers) && sysUsers.size() == 1) {
|
|
|
+ userIds += sysUsers.get(0).getUserId() + ",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(userIds))
|
|
|
+ entity.setCurrentMentor(userIds.substring(0, userIds.length() - 1));
|
|
|
+ }
|
|
|
+ } else if (j == 14) {
|
|
|
+ // 计划发展时间
|
|
|
+ if (StringUtils.isNotEmpty(cellValue))
|
|
|
+ entity.setPlanDevelopDuration(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
|
|
|
+ } else if (j == 15) {
|
|
|
+ // 是否参加过入党前培训
|
|
|
+ entity.setIsTrained("是".equals(cellValue) ? "1" : "0");
|
|
|
+ } else if (j == 16) {
|
|
|
+ // 备注
|
|
|
+ entity.setRemarks(cellValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ logger.info("entity:" + entity);
|
|
|
+ list.add(entity);
|
|
|
+ } catch (Exception e) {
|
|
|
+ failNumber++;
|
|
|
+ logger.info("e:" + JSON.toJSONString(e));
|
|
|
+ failRow.add(i + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ int successNumber = 0;
|
|
|
+ int failNum = 0;
|
|
|
+ for (TBranchMember t : list) {
|
|
|
+ failNum++;
|
|
|
+ try {
|
|
|
+ TBranchMember tBranchMember = new TBranchMember();
|
|
|
+ tBranchMember.setUserId(t.getUserId());
|
|
|
+ tBranchMember.setMemberType(memberType);
|
|
|
+ tBranchMember.setBirthday(t.getBirthday());
|
|
|
+ if (CollectionUtils.isEmpty(tBranchMemberService.selectTBranchMemberList(tBranchMember))) {
|
|
|
+ add(t);
|
|
|
+ successNumber++;
|
|
|
+ } else {
|
|
|
+ failNumber++;
|
|
|
+ logger.info("======================数据已存在");
|
|
|
+ failRow.add(failNum + 1);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ failNumber++;
|
|
|
+ logger.info("e:" + e);
|
|
|
+ failRow.add(failNum + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ logger.info("list:" + JSON.toJSONString(list));
|
|
|
+ logger.info("successNumber:" + successNumber);
|
|
|
+ logger.info("failNumber:" + failNumber);
|
|
|
+ logger.info("failRow:" + failRow);
|
|
|
+ return AjaxResult.success(String.valueOf(successNumber), failRow);
|
|
|
+ }
|
|
|
}
|