src/main/java/org/springblade/modules/dispatcher/controller/DispatcherController.java
@@ -23,7 +23,6 @@ import lombok.AllArgsConstructor; import javax.validation.Valid; import org.springblade.common.utils.arg; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; @@ -43,6 +42,7 @@ import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; /** * 控制器 @@ -167,14 +167,11 @@ @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入dispatcher") public R submit(@Valid @RequestBody Dispatcher dispatcher) { //List<String> list = Arrays.asList(dispatcher.getUserIds().split(",")); //计算派遣人数 //dispatcher.setNum(list.size()); boolean status = false; if (dispatcher.getId()==null){ if (dispatcher.getId() == null) { dispatcher.setCreateTime(new Date()); dispatcher.setStatus(0); dispatcher.setUserIds(dispatcher.getUserIds()); User user = new User(); user.setId(Long.parseLong(dispatcher.getUserIds())); @@ -187,7 +184,7 @@ //数据同步 String s1 = "insert into sys_dispatcher(id,dispatcherTime,dispatcherAddress,dispatcher_unit_id,user_ids,end_time,dept_id,jurisdiction,create_time,status) " + "values(" + "'" + dispatcher.getId() + "'" + "," + "values(" + "'" + dispatcher.getId() + "'" + "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getDispatchertime()) + "'" + "," + "'" + dispatcher.getDispatcheraddress() + "'" + "," + "'" + dispatcher.getDispatcherUnitId() + "'" + "," + @@ -196,62 +193,196 @@ "'" + dispatcher.getDeptId() + "'" + "," + "'" + dispatcher.getJurisdiction() + "'" + "," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dispatcher.getCreateTime()) + "'" + "," + "'" +dispatcher.getStatus() + "'" + ");" + "'" + dispatcher.getStatus() + "'" + ");" + "update blade_user set dispatch = " + "'" + user.getDispatch() + "'" + " " + "where id = " + "'" + user.getId() + "'"; FtpUtil.sqlFileUpload(s1); } else { dispatcher.setUpdateTime(new Date()); //查询当前派遣记录 Dispatcher dispatcher1 = dispatcherService.getById(dispatcher.getId()); if (!dispatcher1.getUserIds().equals(dispatcher.getUserIds())) { //修改原保安人员的派遣状态 //查询原保安人员的派遣记录,是否存在多条未结束派遣的 Dispatcher dispatcher2 = new Dispatcher(); dispatcher2.setUserIds(dispatcher1.getUserIds()); dispatcher2.setStatus(0); List<Dispatcher> dispatcherList = dispatcherService.list(Condition.getQueryWrapper(dispatcher2)); User user = new User(); user.setId(Long.parseLong(dispatcher1.getUserIds())); if (dispatcherList.size() == 1) { //用户状态改变 user.setDispatch("1"); } else { user.setDispatch("0"); } //修改原保安人员用户信息 userService.updateById(user); //修改当前保安人员的派遣状态 User user1 = new User(); user1.setId(Long.parseLong(dispatcher.getUserIds())); user1.setDispatch("0"); userService.updateById(user1); //修改 status = dispatcherService.updateById(dispatcher); //内网同步 String s1 = "update blade_user set dispatch = " + "'" + user.getDispatch() + "'" + " " + "where id = " + "'" + user.getId() + "';" + "update sys_dispatcher set dispatcherTime = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getDispatchertime()) + "'" + ",dispatcherAddress = " + "'" + dispatcher.getDispatcheraddress() + "'" + ",dispatcher_unit_id = " + "'" + dispatcher.getDispatcherUnitId() + "'" + ",user_ids = " + "'" + dispatcher.getUserIds() + "'" + ",end_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getEndTime()) + "'" + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dispatcher.getUpdateTime()) + "'" + ",dept_id = " + "'" + dispatcher.getDeptId() + "'" + ",jurisdiction = " + "'" + dispatcher.getJurisdiction() + "'" + " " + "where id = " + "'" + dispatcher.getId() + "';" + "update blade_user set dispatch = " + "'" + user1.getDispatch() + "'" + " " + "where id = " + "'" + user1.getId() + "'"; FtpUtil.sqlFileUpload(s1); }else { //没有修改保安员,只修改了派遣时间等信息 //修改 status = dispatcherService.updateById(dispatcher); //内网同步 String s1 = "update sys_dispatcher set dispatcherTime = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getDispatchertime()) + "'" + ",dispatcherAddress = " + "'" + dispatcher.getDispatcheraddress() + "'" + ",dispatcher_unit_id = " + "'" + dispatcher.getDispatcherUnitId() + "'" + ",user_ids = " + "'" + dispatcher.getUserIds() + "'" + ",end_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getEndTime()) + "'" + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dispatcher.getUpdateTime()) + "'" + ",dept_id = " + "'" + dispatcher.getDeptId() + "'" + ",jurisdiction = " + "'" + dispatcher.getJurisdiction() + "'" + " " + "where id = " + "'" + dispatcher.getId() + "'"; FtpUtil.sqlFileUpload(s1); } } return R.status(status); } /** * 新增派遣(批量) */ @PostMapping("/saveDispatcher") public R saveDispatcher(@RequestBody DispatcherVO dispatcher) { List<String> list = Arrays.asList(dispatcher.getIds().split(",")); //修改状态 AtomicBoolean status = new AtomicBoolean(false); if (list.size()>0) { //遍历 list.forEach(id -> { dispatcher.setCreateTime(new Date()); dispatcher.setStatus(0); dispatcher.setUserIds(id); User user = new User(); user.setId(Long.parseLong(id)); user.setDispatch("0"); userService.updateById(user); //新增派遣记录 status.set(dispatcherService.save(dispatcher)); //数据同步 String s1 = "insert into sys_dispatcher(id,dispatcherTime,dispatcherAddress,dispatcher_unit_id,user_ids,end_time,dept_id,jurisdiction,create_time,status) " + "values(" + "'" + dispatcher.getId() + "'" + "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getDispatchertime()) + "'" + "," + "'" + dispatcher.getDispatcheraddress() + "'" + "," + "'" + dispatcher.getDispatcherUnitId() + "'" + "," + "'" + dispatcher.getUserIds() + "'" + "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getEndTime()) + "'" + "," + "'" + dispatcher.getDeptId() + "'" + "," + "'" + dispatcher.getJurisdiction() + "'" + "," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dispatcher.getCreateTime()) + "'" + "," + "'" + dispatcher.getStatus() + "'" + ");" + "update blade_user set dispatch = " + "'" + user.getDispatch() + "'" + " " + "where id = " + "'" + user.getId() + "'"; FtpUtil.sqlFileUpload(s1); }); } return R.status(status.get()); } /** * 派遣记录修改 */ @PostMapping("/updateDispatcher") public R updateDispatcher(@RequestBody DispatcherVO dispatcher) { boolean status = false; dispatcher.setUpdateTime(new Date()); //查询当前派遣记录 Dispatcher dispatcher1 = dispatcherService.getById(dispatcher.getId()); if (!dispatcher1.getUserIds().equals(dispatcher.getUserIds())) { //修改原保安人员的派遣状态 //查询原保安人员的派遣记录,是否存在多条未结束派遣的 Dispatcher dispatcher2 = new Dispatcher(); dispatcher2.setUserIds(dispatcher1.getUserIds()); dispatcher2.setStatus(0); List<Dispatcher> dispatcherList = dispatcherService.list(Condition.getQueryWrapper(dispatcher2)); User user = new User(); user.setId(Long.parseLong(dispatcher1.getUserIds())); if (dispatcherList.size() == 1) { //用户状态改变 user.setDispatch("1"); } else { user.setDispatch("0"); } //修改原保安人员用户信息 userService.updateById(user); //修改当前保安人员的派遣状态 User user1 = new User(); user1.setId(Long.parseLong(dispatcher.getUserIds())); user1.setDispatch("0"); userService.updateById(user1); //修改派遣记录信息 status = dispatcherService.updateById(dispatcher); //内网同步 String s1 = "update blade_user set dispatch = " + "'" + user.getDispatch() + "'" + " " +"where id = " + "'" + user.getId() + "'"; " " + "where id = " + "'" + user.getId() + "';" + "update sys_dispatcher set dispatcherTime = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getDispatchertime()) + "'" + ",dispatcherAddress = " + "'" + dispatcher.getDispatcheraddress() + "'" + ",dispatcher_unit_id = " + "'" + dispatcher.getDispatcherUnitId() + "'" + ",user_ids = " + "'" + dispatcher.getUserIds() + "'" + ",end_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getEndTime()) + "'" + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dispatcher.getUpdateTime()) + "'" + ",dept_id = " + "'" + dispatcher.getDeptId() + "'" + ",jurisdiction = " + "'" + dispatcher.getJurisdiction() + "'" + " " + "where id = " + "'" + dispatcher.getId() + "';" + "update blade_user set dispatch = " + "'" + user1.getDispatch() + "'" + " " + "where id = " + "'" + user1.getId() + "'"; FtpUtil.sqlFileUpload(s1); }else { dispatcher.setUpdateTime(new Date()); //没有修改保安员,只修改了派遣时间等信息 //修改 status = dispatcherService.updateById(dispatcher); //查询当前派遣记录 Dispatcher dispatcher1 = dispatcherService.getById(dispatcher.getId()); if (!dispatcher1.getUserIds().equals(dispatcher.getUserIds())){ //修改原保安人员的派遣状态 //查询原保安人员的派遣记录,是否存在多条未结束派遣的 Dispatcher dispatcher2 = new Dispatcher(); dispatcher2.setUserIds(dispatcher1.getUserIds()); dispatcher2.setStatus(0); List<Dispatcher> dispatcherList = dispatcherService.list(Condition.getQueryWrapper(dispatcher2)); User user = new User(); user.setId(Long.parseLong(dispatcher1.getUserIds())); if (dispatcherList.size()<1){ //用户状态改变 user.setDispatch("1"); }else { user.setDispatch("0"); } //修改原保安人员用户信息 userService.updateById(user); //修改当前保安人员的派遣状态 User user1 = new User(); user1.setId(Long.parseLong(dispatcher.getUserIds())); user1.setDispatch("0"); userService.updateById(user1); //修改 status = dispatcherService.updateById(dispatcher); //内网同步 String s1 = "update blade_user set dispatch = " + "'" + user.getDispatch() + "'" + " " +"where id = " + "'" + user.getId() + "';"+ "update sys_dispatcher set dispatcherTime = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getDispatchertime()) + "'" + ",dispatcherAddress = " + "'" + dispatcher.getDispatcheraddress() + "'" + ",dispatcher_unit_id = " + "'" + dispatcher.getDispatcherUnitId() + "'" + ",user_ids = " + "'" + dispatcher.getUserIds() + "'" + ",end_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getEndTime()) + "'" + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dispatcher.getUpdateTime()) + "'" + ",dept_id = " + "'" + dispatcher.getDeptId() + "'" + ",jurisdiction = " + "'" + dispatcher.getJurisdiction() + "'" + " " +"where id = " + "'" + dispatcher.getId() + "';"+ "update blade_user set dispatch = " + "'" + user1.getDispatch() + "'" + " " +"where id = " + "'" + user1.getId() + "'"; FtpUtil.sqlFileUpload(s1); } //内网同步 String s1 = "update sys_dispatcher set dispatcherTime = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getDispatchertime()) + "'" + ",dispatcherAddress = " + "'" + dispatcher.getDispatcheraddress() + "'" + ",dispatcher_unit_id = " + "'" + dispatcher.getDispatcherUnitId() + "'" + ",user_ids = " + "'" + dispatcher.getUserIds() + "'" + ",end_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getEndTime()) + "'" + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dispatcher.getUpdateTime()) + "'" + ",dept_id = " + "'" + dispatcher.getDeptId() + "'" + ",jurisdiction = " + "'" + dispatcher.getJurisdiction() + "'" + " " + "where id = " + "'" + dispatcher.getId() + "'"; FtpUtil.sqlFileUpload(s1); } return R.status(status); } src/main/java/org/springblade/modules/dispatcher/controller/DispatcherUnitController.java
@@ -28,6 +28,7 @@ import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.modules.FTP.FtpUtil; import org.springblade.modules.dispatcher.entity.Dispatcher; @@ -45,6 +46,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -197,9 +199,27 @@ */ @GetMapping("export-template") @ApiOperation(value = "导出模板") public void exportUser(HttpServletResponse response) { public void exportUser(HttpServletResponse response) throws ParseException { List<DispatcherUnitExcel> list = new ArrayList<>(); ExcelUtil.export(response, "派遣单位数据导入模板", "派遣单位数据表", list, DispatcherUnitExcel.class); DispatcherUnitExcel unitExcel = new DispatcherUnitExcel(); unitExcel.setDeptName("****保安服务公司"); unitExcel.setName("****公司"); unitExcel.setLinkman("张三"); unitExcel.setPhone("13112341234"); unitExcel.setStartTime(new SimpleDateFormat("yyyy/MM/dd").parse("2020/5/1")); unitExcel.setEndTime(new SimpleDateFormat("yyyy/MM/dd").parse("2021/5/1")); list.add(unitExcel); DispatcherUnitExcel unitExcel1 = new DispatcherUnitExcel(); unitExcel1.setDeptName("****保安服务公司"); unitExcel1.setName("****公司"); unitExcel1.setLinkman("李四"); unitExcel1.setPhone("13112341234"); unitExcel1.setStartTime(new SimpleDateFormat("yyyy/MM/dd").parse("2020/10/10")); unitExcel1.setEndTime(new SimpleDateFormat("yyyy/MM/dd").parse("2021/10/10")); list.add(unitExcel1); ExcelUtil.export(response, "派遣单位数据导入模板"+ DateUtil.time(), "派遣单位数据表", list, DispatcherUnitExcel.class); } src/main/java/org/springblade/modules/dispatcher/excel/DispatcherUnitExcel.java
@@ -17,6 +17,7 @@ package org.springblade.modules.dispatcher.excel; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.format.DateTimeFormat; import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ContentRowHeight; import com.alibaba.excel.annotation.write.style.HeadRowHeight; @@ -38,33 +39,35 @@ @ColumnWidth(25) @ExcelProperty("保安公司名称") @ExcelProperty("保安公司名称*") private String deptName; @ColumnWidth(25) @ExcelProperty("服务对象名称") @ExcelProperty("服务对象名称*") private String name; @ColumnWidth(20) @ExcelProperty("联系人") @ExcelProperty("联系人*") private String linkman; @ColumnWidth(20) @ExcelProperty("联系电话") @ExcelProperty("联系电话*") private String phone; @ColumnWidth(20) @ExcelProperty("合同开始时间") private String startTime; @ExcelProperty("合同开始时间*") @DateTimeFormat("yyyy/MM/dd") private Date startTime; @ColumnWidth(20) @ExcelProperty("合同结束时间") private String endTime; @ExcelProperty("合同结束时间*") @DateTimeFormat("yyyy/MM/dd") private Date endTime; } src/main/java/org/springblade/modules/dispatcher/service/impl/DispatcherUnitServiceImpl.java
@@ -117,31 +117,34 @@ dispatcherUnit.setPhone(dispatcherUnitExcel.getPhone()); } if (dispatcherUnitExcel.getStartTime()!=null){ String year = dispatcherUnitExcel.getStartTime().substring(0, 4); String month = dispatcherUnitExcel.getStartTime().substring(4, 6); String day = dispatcherUnitExcel.getStartTime().substring(6, 8); String dateFormat = year + "-" +month+"-" +day; try { Date date = new SimpleDateFormat("yyyy-MM-dd").parse(dateFormat); dispatcherUnit.setStartTime(date); } catch (ParseException e) { e.printStackTrace(); } } dispatcherUnit.setStartTime(dispatcherUnitExcel.getStartTime()); dispatcherUnit.setEndTime(dispatcherUnitExcel.getEndTime()); if (dispatcherUnitExcel.getEndTime()!=null){ String year = dispatcherUnitExcel.getEndTime().substring(0, 4); String month = dispatcherUnitExcel.getEndTime().substring(4, 6); String day = dispatcherUnitExcel.getEndTime().substring(6, 8); String dateFormat = year + "-" +month+"-" +day; try { Date date = new SimpleDateFormat("yyyy-MM-dd").parse(dateFormat); dispatcherUnit.setEndTime(date); } catch (ParseException e) { e.printStackTrace(); } } // if (dispatcherUnitExcel.getStartTime()!=null){ // String year = dispatcherUnitExcel.getStartTime().substring(0, 4); // String month = dispatcherUnitExcel.getStartTime().substring(4, 6); // String day = dispatcherUnitExcel.getStartTime().substring(6, 8); // String dateFormat = year + "-" +month+"-" +day; // try { // Date date = new SimpleDateFormat("yyyy-MM-dd").parse(dateFormat); // dispatcherUnit.setStartTime(date); // } catch (ParseException e) { // e.printStackTrace(); // } // } // // if (dispatcherUnitExcel.getEndTime()!=null){ // String year = dispatcherUnitExcel.getEndTime().substring(0, 4); // String month = dispatcherUnitExcel.getEndTime().substring(4, 6); // String day = dispatcherUnitExcel.getEndTime().substring(6, 8); // String dateFormat = year + "-" +month+"-" +day; // try { // Date date = new SimpleDateFormat("yyyy-MM-dd").parse(dateFormat); // dispatcherUnit.setEndTime(date); // } catch (ParseException e) { // e.printStackTrace(); // } // } //新增 this.save(dispatcherUnit); @@ -154,8 +157,8 @@ "'" + dispatcherUnit.getDeptId() + "'" + "," + "'" + dispatcherUnit.getLinkman() + "'" + "," + "'" + dispatcherUnit.getPhone() + "'" + "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcherUnit.getStartTime()) + "'" + "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcherUnit.getEndTime()) + "'" + ")"; "'" + new SimpleDateFormat("yyyy/MM/dd").format(dispatcherUnit.getStartTime()) + "'" + "," + "'" + new SimpleDateFormat("yyyy/MM/dd").format(dispatcherUnit.getEndTime()) + "'" + ")"; FtpUtil.sqlFileUpload(s1); }); } src/main/java/org/springblade/modules/dispatcher/vo/DispatcherVO.java
@@ -69,4 +69,9 @@ */ private String dispatch; /** * 批量派遣 */ private String ids; } src/main/java/org/springblade/modules/social/controller/SocialController.java
@@ -16,28 +16,37 @@ */ package org.springblade.modules.social.controller; import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.apache.commons.codec.Charsets; import org.springblade.common.excel.RowWriteHandler; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.modules.social.entity.Social; import org.springblade.modules.social.excel.SocialExcel; import org.springblade.modules.social.excel.SocialImporter; import org.springblade.modules.social.service.ISocialService; import org.springblade.modules.social.vo.SocialVO; import org.springblade.modules.system.excel.UserExcel; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; import java.net.URLEncoder; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; @@ -148,8 +157,46 @@ @GetMapping("export-template") @ApiOperationSupport(order = 14) @ApiOperation(value = "导出模板") public void exportUser(HttpServletResponse response) { public void exportUser(HttpServletResponse response) throws IOException, ParseException { List<SocialExcel> list = new ArrayList<>(); ExcelUtil.export(response, "社保数据模板", "社保数据模板", list, SocialExcel.class); SocialExcel socialExcel = new SocialExcel(); socialExcel.setNamb("张三"); socialExcel.setSex("男"); socialExcel.setNation("汉"); socialExcel.setBirthday(new SimpleDateFormat("yyyy/MM/dd").parse("1999/5/1")); socialExcel.setTelephone("13112341234"); socialExcel.setCardid("360XXX19XXXXXX****"); socialExcel.setResidence("江西省南昌市***********"); socialExcel.setAddress("江西省南昌市***********"); socialExcel.setNature("城镇"); socialExcel.setAmount("1000.00"); socialExcel.setInsuredtime(new SimpleDateFormat("yyyy/MM/dd").parse("2020/5/1")); list.add(socialExcel); SocialExcel socialExcel1 = new SocialExcel(); socialExcel1.setNamb("李四"); socialExcel1.setSex("女"); socialExcel1.setNation("汉"); socialExcel1.setBirthday(new SimpleDateFormat("yyyy/MM/dd").parse("1999/5/1")); socialExcel1.setTelephone("13112341234"); socialExcel1.setCardid("360XXX19XXXXXX****"); socialExcel1.setResidence("江西省南昌市***********"); socialExcel1.setAddress("江西省南昌市***********"); socialExcel1.setNature("农村"); socialExcel1.setAmount("1000.00"); socialExcel1.setInsuredtime(new SimpleDateFormat("yyyy/MM/dd").parse("2020/5/1")); list.add(socialExcel1); String fileName = null; try { response.setContentType("application/vnd.ms-excel"); response.setCharacterEncoding(org.apache.commons.codec.Charsets.UTF_8.name()); fileName = URLEncoder.encode("社保数据模板"+ DateUtil.time(), Charsets.UTF_8.name()); response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); //修改单元格格式为文本格式 EasyExcel.write(response.getOutputStream(), SocialExcel.class).sheet("社保数据模板").registerWriteHandler(new RowWriteHandler()).doWrite(list); } catch (Throwable var6) { throw var6; } // ExcelUtil.export(response, "社保数据模板", "社保数据模板", list, SocialExcel.class); } } src/main/java/org/springblade/modules/social/excel/SocialExcel.java
@@ -17,6 +17,7 @@ package org.springblade.modules.social.excel; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.format.DateTimeFormat; import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ContentRowHeight; import com.alibaba.excel.annotation.write.style.HeadRowHeight; @@ -38,26 +39,28 @@ private static final long serialVersionUID = 1L; @ColumnWidth(15) @ExcelProperty("姓名") @ExcelProperty("姓名*") private String namb; @ColumnWidth(10) @ExcelProperty("性别") @ExcelProperty("性别*") private String sex; @ColumnWidth(15) @ExcelProperty("民族") private String nation; @ColumnWidth(15) @ExcelProperty("出生日期") @ColumnWidth(20) @ExcelProperty("出生日期*") @DateTimeFormat("yyyy/MM/dd") private Date birthday; @ColumnWidth(15) @ExcelProperty("联系电话") @ExcelProperty("联系电话*") private String telephone; @ExcelProperty("身份证号") @ColumnWidth(20) @ExcelProperty("身份证号*") private String cardid; @ColumnWidth(15) @@ -70,12 +73,11 @@ @ExcelProperty("户籍性质") private String nature; @ExcelProperty("个人缴费") @ExcelProperty("个人缴费*") private String amount ; @ExcelProperty("参保时间") @ExcelProperty("参保时间*") @DateTimeFormat("yyyy/MM/dd") private Date insuredtime; } src/main/java/org/springblade/modules/social/mapper/SocialMapper.xml
@@ -30,7 +30,7 @@ LEFT JOIN blade_user u ON s.namb = u.id s.cardid = u.cardid left join sys_jurisdiction sj on @@ -45,8 +45,11 @@ <if test="social.realname!=null and social.realname!=''"> and u.real_name like concat(concat('%', #{social.realname}),'%') </if> <if test="social.cardid!=null and social.cardid!=''"> and s.cardid like concat(concat('%', #{social.cardid}),'%') </if> <if test="social.namb!=null and social.namb!=''"> and s.namb=#{social.namb} and s.namb like concat('%',#{social.namb},'%') </if> <if test="social.deptid!=null and social.deptid!=''"> and s.deptid=#{social.deptid} src/main/java/org/springblade/modules/social/service/impl/SocialServiceImpl.java
@@ -52,6 +52,15 @@ public void importUser(List<SocialExcel> data, Boolean isCovered,String deptid) { data.forEach(SocialExcel -> { Social social = Objects.requireNonNull(BeanUtil.copy(SocialExcel, Social.class)); // if (null!=social.getSex() && !"".equals(social.getSex())) { // if (social.getSex().equals("男")){ // social.setSex("1"); // } // if (social.getSex().equals("女")){ // social.setSex("2"); // } // } if (null!=social.getBirthday()) { social.setBirthday(social.getBirthday()); } src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
@@ -608,7 +608,7 @@ */ @Override public List<User> selectUserPageSecurityUnit(IPage<User> page, User user) { return baseMapper.selectUserPageSecurity(page, user); return baseMapper.selectUserPageSecurity(null, user); }