Преглед на файлове

清除cookie登录失效后刷新验证码请求无法显示的问题

EDZ преди 4 години
родител
ревизия
332cb00e02
променени са 18 файла, в които са добавени 965 реда и са изтрити 99 реда
  1. 62 0
      src/main/java/net/chenlin/dp/common/excel/ExcelUtil.java
  2. 10 0
      src/main/java/net/chenlin/dp/common/excel/ExcelUtils.java
  3. 90 29
      src/main/java/net/chenlin/dp/modules/basics/controller/InterfaceController.java
  4. 9 0
      src/main/java/net/chenlin/dp/modules/basics/dao/BasicsPersonnelFillinMapper.java
  5. 9 0
      src/main/java/net/chenlin/dp/modules/basics/entity/BasicsPersonnelEntity.java
  6. 8 0
      src/main/java/net/chenlin/dp/modules/basics/entity/BasicsPersonnelFillinEntity.java
  7. 473 0
      src/main/java/net/chenlin/dp/modules/basics/entity/BasicsPersonnelFillinEntityExcel.java
  8. 88 4
      src/main/java/net/chenlin/dp/modules/basics/mapper/BasicsPersonnelFillinMapper.xml
  9. 8 0
      src/main/java/net/chenlin/dp/modules/basics/service/BasicsPersonnelFillinService.java
  10. 9 0
      src/main/java/net/chenlin/dp/modules/basics/service/BasicsPersonnelService.java
  11. 12 0
      src/main/java/net/chenlin/dp/modules/basics/service/impl/BasicsPersonnelFillinServiceImpl.java
  12. 82 0
      src/main/java/net/chenlin/dp/modules/basics/service/impl/BasicsPersonnelServiceImpl.java
  13. BIN
      src/main/resources/excel/aaa.xls
  14. BIN
      src/main/resources/excel/bbb.xls
  15. 11 1
      src/main/webapp/WEB-INF/view/basics/basicspersonnel/list.html
  16. 4 19
      src/main/webapp/WEB-INF/view/basics/basicspersonnelfillin/list.html
  17. 49 1
      src/main/webapp/static/js/basics/basicspersonnel/list.js
  18. 41 45
      src/main/webapp/static/js/basics/basicspersonnelfillin/list.js

+ 62 - 0
src/main/java/net/chenlin/dp/common/excel/ExcelUtil.java

@@ -0,0 +1,62 @@
+package net.chenlin.dp.common.excel;
+
+
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+
+import net.sf.jxls.exception.ParsePropertyException;
+import net.sf.jxls.transformer.XLSTransformer;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+
+
+public class ExcelUtil {
+
+    /**
+     * 下载excel
+     *
+     * @author
+     * @date 2018年12月6日
+     * @param sourcePath	模板路径
+     * @param beanParams	excel内容
+     * @return
+     * @throws ParsePropertyException
+     * @throws InvalidFormatException
+     * @throws IOException
+     */
+    public static ResponseEntity<byte[]> downLoadExcel(String sourcePath, Map<String, Object> beanParams,String name)
+            throws ParsePropertyException, InvalidFormatException, IOException {
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        //读取模板
+        InputStream is =ExcelUtil.class.getClassLoader().getResourceAsStream(sourcePath);
+        XLSTransformer transformer = new XLSTransformer();
+        //向模板中写入内容
+        Workbook workbook = transformer.transformXLS(is, beanParams);
+        //写入成功后转化为输出流
+        workbook.write(os);
+        //配置Response信息
+        HttpHeaders headers = new HttpHeaders();
+        String downloadFileName = name + ".xlsx";
+        //防止中文名乱码
+        downloadFileName = new String(downloadFileName.getBytes("UTF-8"), "ISO-8859-1");
+        headers.setContentDispositionFormData("attachment", downloadFileName);
+        headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
+        //返回
+        return new ResponseEntity<byte[]>(os.toByteArray(), headers, HttpStatus.CREATED);
+    }
+
+
+    public static void main(String[] args) {
+        System.out.println(ExcelUtil.class.getClassLoader().getResourceAsStream("excel/bbb.xls"));
+        System.out.println(ExcelUtil.class.getClassLoader().getResourceAsStream("excel/aaa.xls"));
+    }
+
+
+}

+ 10 - 0
src/main/java/net/chenlin/dp/common/excel/ExcelUtils.java

@@ -39,6 +39,7 @@ import org.apache.poi.ss.usermodel.IndexedColors;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -251,6 +252,15 @@ public class ExcelUtils {
 
         Workbook wb = new XSSFWorkbook();
         Sheet sheet = wb.createSheet("Sheet1");
+
+        Row titleRow = sheet.createRow(1);
+        titleRow.setHeightInPoints(30);
+        Cell titleCell = titleRow.createCell(0);
+//        titleCell.setCellStyle(styles.get("title"));
+        titleCell.setCellValue("ssssssssssssssssssssss");
+        sheet.addMergedRegion(new CellRangeAddress(titleRow.getRowNum(),
+                titleRow.getRowNum(), titleRow.getRowNum(), dataList.size()-1));
+
         AtomicInteger ai = new AtomicInteger();
         {
             Row row = sheet.createRow(ai.getAndIncrement());

+ 90 - 29
src/main/java/net/chenlin/dp/modules/basics/controller/InterfaceController.java

@@ -4,24 +4,27 @@ import net.chenlin.dp.common.annotation.RestAnon;
 import net.chenlin.dp.common.annotation.SysLog;
 import net.chenlin.dp.common.entity.Page;
 import net.chenlin.dp.common.entity.R;
-import net.chenlin.dp.common.excel.BusClick;
+import net.chenlin.dp.common.excel.ExcelUtil;
 import net.chenlin.dp.common.excel.ExcelUtils;
+import net.chenlin.dp.common.utils.DateUtils;
 import net.chenlin.dp.modules.basics.entity.BasicsPersonnelEntity;
 import net.chenlin.dp.modules.basics.entity.BasicsPersonnelFillinEntity;
+import net.chenlin.dp.modules.basics.entity.BasicsPersonnelFillinEntityExcel;
 import net.chenlin.dp.modules.basics.service.BasicsPersonnelFillinService;
+import net.chenlin.dp.modules.basics.service.BasicsPersonnelService;
 import net.chenlin.dp.modules.sys.controller.AbstractController;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 微信小程序调用接口
@@ -33,7 +36,8 @@ public class InterfaceController extends AbstractController {
 	
 	@Autowired
 	private BasicsPersonnelFillinService basicsPersonnelFillinService;
-	
+	@Autowired
+	private BasicsPersonnelService basicsPersonnelService;
 	/**
 	 * 列表
 	 * @param params
@@ -54,6 +58,7 @@ public class InterfaceController extends AbstractController {
 	@RequestMapping(value="save",method = RequestMethod.POST)
 	public R save(@RequestBody BasicsPersonnelFillinEntity basicsPersonnelFillin) {
 		basicsPersonnelFillin.setGmtCreate(new Date());
+		basicsPersonnelFillin.setDelFlag("0");
 		return basicsPersonnelFillinService.saveBasicsPersonnelFillin(basicsPersonnelFillin);
 	}
 	
@@ -100,30 +105,86 @@ public class InterfaceController extends AbstractController {
 		return basicsPersonnelFillinService.batchRemove(id);
 	}
 
+	/**
+	 * 数据导出
+	 * @param response
+	 * @throws IOException
+	 */
 	@RestAnon
-	@RequestMapping(value = "/exportExcel", method = RequestMethod.GET)
-	public void exportExcel(HttpServletResponse response)  throws IOException {
-		List<BusClick> resultList = new ArrayList<BusClick>();
-		BusClick busClick = new BusClick();
-		busClick.setCityCode("a1");
-		busClick.setClientVer("a2");
-		busClick.setDate("a3");
-		busClick.setMarkId("a4");
-		busClick.setToaluv("a5");
-		resultList.add(busClick);
-
-		busClick = new BusClick();
-		busClick.setCityCode("b1");
-		busClick.setClientVer("b2");
-		busClick.setDate("b3");
-		busClick.setMarkId("b4");
-		busClick.setToaluv("b5");
-		resultList.add(busClick);
+	@RequestMapping(value = "/exportExcelX", method = RequestMethod.POST)
+	public void exportExcel(HttpServletResponse response,@RequestParam Map<String,String> map)  throws IOException {
+
+		List<BasicsPersonnelFillinEntityExcel> list = basicsPersonnelFillinService.getExcelList(map);
 
 		long t1 = System.currentTimeMillis();
-		ExcelUtils.writeExcel("导出.xlsx",response, resultList, BusClick.class);
+		String par = DateUtils.format(new Date(),DateUtils.DATE_PATTERN);
+		ExcelUtils.writeExcel("每日员工体温登记"+par+".xlsx",response, list, BasicsPersonnelFillinEntityExcel.class);
 		long t2 = System.currentTimeMillis();
 		System.out.println(String.format("write over! cost:%sms", (t2 - t1)));
 	}
+
+	/**
+	 *模板导出数据
+	 * @param request
+	 * @param map
+	 * @param response
+	 * @return
+	 * @throws Exception
+	 */
+	@RestAnon
+	@RequestMapping(value = "/exportExcel", method = RequestMethod.POST)
+	public ResponseEntity<byte[]> exportExcel(HttpServletRequest request,@RequestParam Map<String,String> map, HttpServletResponse response) throws Exception {
+		//结果集
+		List<BasicsPersonnelFillinEntityExcel> list = basicsPersonnelFillinService.getExcelList(map);
+		Map<String, Object> beanParams = new HashMap<String, Object>();
+		beanParams.put("list", list);
+		//下载表格
+		String par = map.get("fillingDate");// DateUtils.format(new Date(),DateUtils.DATE_PATTERN);
+		beanParams.put("headName", "每日员工体温登记"+par);
+
+		return ExcelUtil.downLoadExcel("excel/aaa.xls",beanParams,"每日员工体温登记"+par);
+	}
+
+	/**
+	 *模板导出
+	 * @return
+	 * @throws Exception
+	 */
+	@RestAnon
+	@RequestMapping(value = "/exportExcelTemplate", method = RequestMethod.GET)
+	public ResponseEntity<byte[]> exportExcelTemplate(HttpServletResponse response,@RequestParam Map<String,Object> beanParams) throws Exception {
+		//结果集
+//		Map<String, Object> beanParams = new HashMap<String, Object>();
+		//下载表格
+		beanParams.put("headName", "人员档案导入模板");
+
+		return ExcelUtil.downLoadExcel("excel/bbb.xls",beanParams,"人员档案导入模板");
+	}
+
+	//处理文件上传
+	@RestAnon
+	@ResponseBody//返回json数据
+	@RequestMapping(value = "/excelImport", method = RequestMethod.POST)
+	public String excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
+
+		if (file.isEmpty()) {
+			return "文件为空!";
+		}
+
+		try {
+			List<BasicsPersonnelEntity> listData = ExcelUtils.readExcel("",BasicsPersonnelEntity.class,file);
+
+			String st = basicsPersonnelService.excelImport(listData);
+
+			return st;
+
+		} catch (Exception e) {
+			e.printStackTrace();
+			return "导入失败,请联系管理员";
+		}
+
+	}
+
+
 	
 }

+ 9 - 0
src/main/java/net/chenlin/dp/modules/basics/dao/BasicsPersonnelFillinMapper.java

@@ -1,12 +1,16 @@
 package net.chenlin.dp.modules.basics.dao;
 
 import net.chenlin.dp.modules.basics.entity.BasicsPersonnelEntity;
+import net.chenlin.dp.modules.basics.entity.BasicsPersonnelFillinEntityExcel;
 import org.apache.ibatis.annotations.Mapper;
 
 import net.chenlin.dp.modules.basics.entity.BasicsPersonnelFillinEntity;
 import net.chenlin.dp.modules.sys.dao.BaseMapper;
+import org.beetl.sql.core.annotatoin.Param;
 
+import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 人员每日填报温度信息
@@ -17,4 +21,9 @@ public interface BasicsPersonnelFillinMapper extends BaseMapper<BasicsPersonnelF
 
 	public List<BasicsPersonnelEntity> getByUserCode(String id);
 
+	public List<BasicsPersonnelFillinEntityExcel> getExcelList(Map<String,String> map);
+
+	//小程序新增时,如果当日已提交过则覆盖
+	int deleteIfExist(@Param("fillingDate") Date fillingDate, @Param("jobNumber") String jobNumber);
+
 }

+ 9 - 0
src/main/java/net/chenlin/dp/modules/basics/entity/BasicsPersonnelEntity.java

@@ -1,5 +1,7 @@
 package net.chenlin.dp.modules.basics.entity;
 
+import net.chenlin.dp.common.excel.ExcelColumn;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -36,36 +38,43 @@ public class BasicsPersonnelEntity implements Serializable {
 	/**
 	 * 工号
 	 */
+	@ExcelColumn(value = "工号", col = 1)
 	private String jobNumber;
 	
 	/**
 	 * 姓名
 	 */
+	@ExcelColumn(value = "姓名", col = 2)
 	private String name;
 	
 	/**
 	 * 本部
 	 */
+	@ExcelColumn(value = "本部", col = 3)
 	private String selfDepartment;
 	
 	/**
 	 * 部
 	 */
+	@ExcelColumn(value = "部", col = 4)
 	private String department;
 	
 	/**
 	 * 课
 	 */
+	@ExcelColumn(value = "课", col = 5)
 	private String course;
 	
 	/**
 	 * 系
 	 */
+	@ExcelColumn(value = "系", col = 6)
 	private String series;
 	
 	/**
 	 * 班次
 	 */
+	@ExcelColumn(value = "班次", col = 7)
 	private String classes;
 	
 	/**

+ 8 - 0
src/main/java/net/chenlin/dp/modules/basics/entity/BasicsPersonnelFillinEntity.java

@@ -1,6 +1,7 @@
 package net.chenlin.dp.modules.basics.entity;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import net.chenlin.dp.common.excel.ExcelColumn;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
@@ -49,36 +50,43 @@ public class BasicsPersonnelFillinEntity implements Serializable {
 	/**
 	 * 工号
 	 */
+	@ExcelColumn(value = "工号", col = 1)
 	private String jobNumber;
 	
 	/**
 	 * 姓名
 	 */
+	@ExcelColumn(value = "姓名", col = 2)
 	private String name;
 	
 	/**
 	 * 本部
 	 */
+	@ExcelColumn(value = "本部", col = 3)
 	private String selfDepartment;
 	
 	/**
 	 * 部
 	 */
+	@ExcelColumn(value = "部", col = 4)
 	private String department;
 	
 	/**
 	 * 课
 	 */
+	@ExcelColumn(value = "课", col = 5)
 	private String course;
 	
 	/**
 	 * 系
 	 */
+	@ExcelColumn(value = "系", col = 6)
 	private String series;
 	
 	/**
 	 * 班次
 	 */
+	@ExcelColumn(value = "班次", col = 7)
 	private String classes;
 	
 	/**

+ 473 - 0
src/main/java/net/chenlin/dp/modules/basics/entity/BasicsPersonnelFillinEntityExcel.java

@@ -0,0 +1,473 @@
+package net.chenlin.dp.modules.basics.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import net.chenlin.dp.common.excel.ExcelColumn;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+
+/**
+ * 人员每日填报温度信息
+ * @author ZhouChenglin<yczclcn@163.com>
+ */
+public class BasicsPersonnelFillinEntityExcel implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 主键
+	 */
+	private Long id;
+
+	/**
+	 * 创建用户id
+	 */
+	private String userIdCreate;
+
+	/**
+	 * 创建时间
+	 */
+	@JsonFormat(timezone = "GMT+0",pattern = "yyyy-MM-dd HH:mm:ss")
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+	private Date gmtCreate;
+
+	/**
+	 * 修改时间
+	 */
+	private Date gmtModified;
+
+	/**
+	 * 填报日期
+	 */
+	@JsonFormat(timezone = "GMT+0",pattern = "yyyy-MM-dd")
+	@DateTimeFormat(pattern="yyyy-MM-dd")
+	private Date fillingDate;
+
+	/**
+	 * 工号
+	 */
+	@ExcelColumn(value = "工号", col = 1)
+	private String jobNumber;
+
+	/**
+	 * 姓名
+	 */
+	@ExcelColumn(value = "姓名", col = 2)
+	private String name;
+
+	/**
+	 * 本部
+	 */
+	@ExcelColumn(value = "本部", col = 3)
+	private String selfDepartment;
+
+	/**
+	 * 部
+	 */
+	@ExcelColumn(value = "部", col = 4)
+	private String department;
+
+	/**
+	 * 课
+	 */
+	@ExcelColumn(value = "课", col = 5)
+	private String course;
+
+	/**
+	 * 系
+	 */
+	@ExcelColumn(value = "系", col = 6)
+	private String series;
+
+	/**
+	 * 班次
+	 */
+	@ExcelColumn(value = "班次", col = 7)
+	private String classes;
+
+	/**
+	 * 体温
+	 */
+	@ExcelColumn(value = "体温", col = 9)
+	private Double temperature;
+
+
+	/**
+	 * 是否返沪人员(是/否)
+	 */
+	private String ifReturn;
+
+	/**
+	 * 有无停留或途径中高风险地区(是/否)
+	 */
+	private String ifStop;
+
+	/**
+	 * 有无接触史(是/否)
+	 */
+	private String ifContact;
+
+	/**
+	 * 提交状态(是否)
+	 */
+	@ExcelColumn(value = "是否提交数据", col = 8)
+	private String status;
+
+	/**
+	 * 是否提交数据(是否)
+	 */
+	private String ifCommit;
+
+	/**
+	 * 健康状态,体温是否超过37.3(是/否)
+	 */
+	private String healthStatus;
+
+	/**
+	 * 备注
+	 */
+	private String remark;
+
+	/**
+	 * 所属组织(暂时不需要)
+	 */
+	private String pkOrg;
+
+	/**
+	 * 删除状态(0未删除,1已删除)
+	 */
+	private String delFlag;
+
+    /**
+     * BasicsPersonnelFillinEntity constructor
+     */
+	public BasicsPersonnelFillinEntityExcel() {
+		super();
+	}
+
+    /**
+     * setter for id
+     * @param id
+     */
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+    /**
+     * getter for id
+     */
+	public Long getId() {
+		return id;
+	}
+
+    /**
+     * setter for userIdCreate
+     * @param userIdCreate
+     */
+	public void setUserIdCreate(String userIdCreate) {
+		this.userIdCreate = userIdCreate;
+	}
+
+    /**
+     * getter for userIdCreate
+     */
+	public String getUserIdCreate() {
+		return userIdCreate;
+	}
+
+    /**
+     * setter for gmtCreate
+     * @param gmtCreate
+     */
+	public void setGmtCreate(Date gmtCreate) {
+		this.gmtCreate = gmtCreate;
+	}
+
+    /**
+     * getter for gmtCreate
+     */
+	public Date getGmtCreate() {
+		return gmtCreate;
+	}
+
+    /**
+     * setter for gmtModified
+     * @param gmtModified
+     */
+	public void setGmtModified(Date gmtModified) {
+		this.gmtModified = gmtModified;
+	}
+
+    /**
+     * getter for gmtModified
+     */
+	public Date getGmtModified() {
+		return gmtModified;
+	}
+
+    /**
+     * setter for fillingDate
+     * @param fillingDate
+     */
+	public void setFillingDate(Date fillingDate) {
+		this.fillingDate = fillingDate;
+	}
+
+    /**
+     * getter for fillingDate
+     */
+	public Date getFillingDate() {
+		return fillingDate;
+	}
+
+    /**
+     * setter for jobNumber
+     * @param jobNumber
+     */
+	public void setJobNumber(String jobNumber) {
+		this.jobNumber = jobNumber;
+	}
+
+    /**
+     * getter for jobNumber
+     */
+	public String getJobNumber() {
+		return jobNumber;
+	}
+
+    /**
+     * setter for name
+     * @param name
+     */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+    /**
+     * getter for name
+     */
+	public String getName() {
+		return name;
+	}
+
+    /**
+     * setter for selfDepartment
+     * @param selfDepartment
+     */
+	public void setSelfDepartment(String selfDepartment) {
+		this.selfDepartment = selfDepartment;
+	}
+
+    /**
+     * getter for selfDepartment
+     */
+	public String getSelfDepartment() {
+		return selfDepartment;
+	}
+
+    /**
+     * setter for department
+     * @param department
+     */
+	public void setDepartment(String department) {
+		this.department = department;
+	}
+
+    /**
+     * getter for department
+     */
+	public String getDepartment() {
+		return department;
+	}
+
+    /**
+     * setter for course
+     * @param course
+     */
+	public void setCourse(String course) {
+		this.course = course;
+	}
+
+    /**
+     * getter for course
+     */
+	public String getCourse() {
+		return course;
+	}
+
+    /**
+     * setter for series
+     * @param series
+     */
+	public void setSeries(String series) {
+		this.series = series;
+	}
+
+    /**
+     * getter for series
+     */
+	public String getSeries() {
+		return series;
+	}
+
+    /**
+     * setter for classes
+     * @param classes
+     */
+	public void setClasses(String classes) {
+		this.classes = classes;
+	}
+
+    /**
+     * getter for classes
+     */
+	public String getClasses() {
+		return classes;
+	}
+
+    /**
+     * setter for temperature
+     * @param temperature
+     */
+	public void setTemperature(Double temperature) {
+		this.temperature = temperature;
+	}
+
+    /**
+     * getter for temperature
+     */
+	public Double getTemperature() {
+		return temperature;
+	}
+
+    /**
+     * setter for ifReturn
+     * @param ifReturn
+     */
+	public void setIfReturn(String ifReturn) {
+		this.ifReturn = ifReturn;
+	}
+
+    /**
+     * getter for ifReturn
+     */
+	public String getIfReturn() {
+		return ifReturn;
+	}
+
+    /**
+     * setter for ifStop
+     * @param ifStop
+     */
+	public void setIfStop(String ifStop) {
+		this.ifStop = ifStop;
+	}
+
+    /**
+     * getter for ifStop
+     */
+	public String getIfStop() {
+		return ifStop;
+	}
+
+    /**
+     * setter for ifContact
+     * @param ifContact
+     */
+	public void setIfContact(String ifContact) {
+		this.ifContact = ifContact;
+	}
+
+    /**
+     * getter for ifContact
+     */
+	public String getIfContact() {
+		return ifContact;
+	}
+
+    /**
+     * setter for status
+     * @param status
+     */
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+    /**
+     * getter for status
+     */
+	public String getStatus() {
+		return status;
+	}
+
+    /**
+     * setter for healthStatus
+     * @param healthStatus
+     */
+	public void setHealthStatus(String healthStatus) {
+		this.healthStatus = healthStatus;
+	}
+
+    /**
+     * getter for healthStatus
+     */
+	public String getHealthStatus() {
+		return healthStatus;
+	}
+
+    /**
+     * setter for remark
+     * @param remark
+     */
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+    /**
+     * getter for remark
+     */
+	public String getRemark() {
+		return remark;
+	}
+
+    /**
+     * setter for pkOrg
+     * @param pkOrg
+     */
+	public void setPkOrg(String pkOrg) {
+		this.pkOrg = pkOrg;
+	}
+
+    /**
+     * getter for pkOrg
+     */
+	public String getPkOrg() {
+		return pkOrg;
+	}
+
+    /**
+     * setter for delFlag
+     * @param delFlag
+     */
+	public void setDelFlag(String delFlag) {
+		this.delFlag = delFlag;
+	}
+
+    /**
+     * getter for delFlag
+     */
+	public String getDelFlag() {
+		return delFlag;
+	}
+
+	public String getIfCommit() {
+		return ifCommit;
+	}
+
+	public void setIfCommit(String ifCommit) {
+		this.ifCommit = ifCommit;
+	}
+}

+ 88 - 4
src/main/java/net/chenlin/dp/modules/basics/mapper/BasicsPersonnelFillinMapper.xml

@@ -46,7 +46,7 @@
 			b.`if_contact` ifContact
 			FROM
 			basics_personnel a
-			left JOIN basics_personnel_fillin b ON a.job_number = b.job_number
+			left JOIN basics_personnel_fillin b ON a.job_number = b.job_number and b.del_flag='0'
 			<if test="fillingDate != null and fillingDate.trim() != ''">
 				and b.filling_Date =#{fillingDate}
 			</if>
@@ -70,7 +70,7 @@
 			FROM
 			basics_personnel_fillin b
 			where
-			(b.job_number is null or b.job_number ='')
+			(b.job_number is null or b.job_number ='') and b.del_flag='0'
 			<if test="fillingDate != null and fillingDate.trim() != ''">
 				and filling_Date =#{fillingDate}
 			</if>
@@ -89,7 +89,85 @@
 			OR temperature LIKE concat('%',#{name},'%')
 		</if>
 	</select>
-	
+
+	<select id="getExcelList" resultType="net.chenlin.dp.modules.basics.entity.BasicsPersonnelFillinEntityExcel">
+
+		SELECT A.* from (
+			SELECT
+			b.`filling_date` fillingDate,
+			a.`job_number` jobNumber,
+			a.`name` name,
+			a.`self_department` selfDepartment,
+			a.`department` department,
+			a.`course` course,
+			a.`series` series,
+			a.`classes` classes,
+			case when b.`temperature` is null or b.`temperature` = ''
+			then "否"
+			else "是"
+			end ifCommit,
+
+			case when b.`temperature` is null or b.`temperature` = ''
+			then -1
+			else temperature
+			end temperature,
+			b.`if_return` ifReturn,
+			b.`if_stop` ifStop,
+			b.`if_contact` ifContact
+			FROM
+			basics_personnel a
+			left JOIN basics_personnel_fillin b ON a.job_number = b.job_number and b.del_flag='0'
+			<if test="fillingDate != null and fillingDate.trim() != ''">
+				and b.filling_Date =#{fillingDate}
+			</if>
+			where a.del_flag='0'
+
+			union all
+
+			SELECT
+			b.`filling_date` fillingDate,
+			b.`job_number` jobNumber,
+			b.`name` name,
+			b.`self_department` selfDepartment,
+			b.`department` department,
+			b.`course` course,
+			b.`series` series,
+			b.`classes` classes,
+			case when b.`temperature` is null or b.`temperature` = ''
+			then "否"
+			else "是"
+			end ifCommit,
+
+			case when b.`temperature` is null or b.`temperature` = ''
+			then -1
+			else temperature
+			end temperature,
+			b.`if_return` ifReturn,
+			b.`if_stop` ifStop,
+			b.`if_contact` ifContact
+			FROM
+			basics_personnel_fillin b
+			where
+			(b.job_number is null or b.job_number ='') and b.del_flag='0'
+			<if test="fillingDate != null and fillingDate.trim() != ''">
+				and filling_Date =#{fillingDate}
+			</if>
+
+		) as A
+		where 1=1
+
+		<if test="name != null and name.trim() != ''">
+			and name LIKE concat('%',#{name},'%')
+			OR jobNumber =#{name}
+			OR selfDepartment LIKE concat('%',#{name},'%')
+			OR department LIKE concat('%',#{name},'%')
+			OR course LIKE concat('%',#{name},'%')
+			OR series LIKE concat('%',#{name},'%')
+			OR classes LIKE concat('%',#{name},'%')
+			OR temperature LIKE concat('%',#{name},'%')
+		</if>
+	</select>
+
 	<insert id="save">
 		INSERT INTO basics_personnel_fillin (
 			`id`, 
@@ -165,7 +243,7 @@
 		FROM
 			basics_personnel_fillin
 		WHERE
-			id = #{id}
+			id = #{id} and del_flag='0'
 	</select>
 
 	<select id="getByUserCode" resultType="net.chenlin.dp.modules.basics.entity.BasicsPersonnelEntity">
@@ -221,5 +299,11 @@
 			#{id}
 		</foreach>
 	</delete>
+	
+	<delete id="deleteIfExist">
+		update basics_personnel_fillin set del_flag='1'
+		where filling_date = #{fillingDate} and job_number = #{jobNumber}
+	</delete>
+	
 
 </mapper>

+ 8 - 0
src/main/java/net/chenlin/dp/modules/basics/service/BasicsPersonnelFillinService.java

@@ -7,6 +7,7 @@ import net.chenlin.dp.common.entity.Page;
 import net.chenlin.dp.common.entity.R;
 import net.chenlin.dp.modules.basics.entity.BasicsPersonnelEntity;
 import net.chenlin.dp.modules.basics.entity.BasicsPersonnelFillinEntity;
+import net.chenlin.dp.modules.basics.entity.BasicsPersonnelFillinEntityExcel;
 
 /**
  * 人员每日填报温度信息
@@ -43,6 +44,13 @@ public interface BasicsPersonnelFillinService {
 	List<BasicsPersonnelEntity> getByUserCode(String jobNumber);
 
     /**
+     * 导出
+     * @param map
+     * @return
+     */
+	List<BasicsPersonnelFillinEntityExcel> getExcelList(Map<String,String> map);
+
+	/**
      * 修改
      * @param basicsPersonnelFillin
      * @return

+ 9 - 0
src/main/java/net/chenlin/dp/modules/basics/service/BasicsPersonnelService.java

@@ -1,10 +1,12 @@
 package net.chenlin.dp.modules.basics.service;
 
+import java.util.List;
 import java.util.Map;
 
 import net.chenlin.dp.common.entity.Page;
 import net.chenlin.dp.common.entity.R;
 import net.chenlin.dp.modules.basics.entity.BasicsPersonnelEntity;
+import net.chenlin.dp.modules.basics.entity.BasicsPersonnelFillinEntity;
 
 /**
  * 基础人员档案
@@ -46,5 +48,12 @@ public interface BasicsPersonnelService {
      * @return
      */
 	R batchRemove(Long[] id);
+
+    /**
+     * 数据导入
+     * @param listData
+     * @return
+     */
+	public String excelImport(List<BasicsPersonnelEntity> listData);
 	
 }

+ 12 - 0
src/main/java/net/chenlin/dp/modules/basics/service/impl/BasicsPersonnelFillinServiceImpl.java

@@ -4,6 +4,7 @@ import java.util.List;
 import java.util.Map;
 
 import net.chenlin.dp.modules.basics.entity.BasicsPersonnelEntity;
+import net.chenlin.dp.modules.basics.entity.BasicsPersonnelFillinEntityExcel;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -45,6 +46,7 @@ public class BasicsPersonnelFillinServiceImpl implements BasicsPersonnelFillinSe
      */
 	@Override
 	public R saveBasicsPersonnelFillin(BasicsPersonnelFillinEntity basicsPersonnelFillin) {
+		basicsPersonnelFillinMapper.deleteIfExist(basicsPersonnelFillin.getFillingDate(),basicsPersonnelFillin.getJobNumber());
 		int count = basicsPersonnelFillinMapper.save(basicsPersonnelFillin);
 		return CommonUtils.msg(count);
 	}
@@ -71,6 +73,16 @@ public class BasicsPersonnelFillinServiceImpl implements BasicsPersonnelFillinSe
 		return basicsPersonnelFillin;
 	}
 
+    /**
+     * 根据id查询
+     * @return
+     */
+	@Override
+	public List<BasicsPersonnelFillinEntityExcel> getExcelList(Map<String,String> map) {
+		List<BasicsPersonnelFillinEntityExcel> basicsPersonnelFillin = basicsPersonnelFillinMapper.getExcelList(map);
+		return basicsPersonnelFillin;
+	}
+
     /**
      * 修改
      * @param basicsPersonnelFillin

+ 82 - 0
src/main/java/net/chenlin/dp/modules/basics/service/impl/BasicsPersonnelServiceImpl.java

@@ -1,7 +1,12 @@
 package net.chenlin.dp.modules.basics.service.impl;
 
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
+import com.mysql.cj.util.StringUtils;
+import net.chenlin.dp.modules.basics.dao.BasicsPersonnelFillinMapper;
+import net.chenlin.dp.modules.basics.entity.BasicsPersonnelFillinEntity;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -22,6 +27,8 @@ public class BasicsPersonnelServiceImpl implements BasicsPersonnelService {
 
 	@Autowired
     private BasicsPersonnelMapper basicsPersonnelMapper;
+	@Autowired
+	private BasicsPersonnelFillinMapper basicsPersonnelFillinMapper;
 
     /**
      * 分页查询
@@ -80,4 +87,79 @@ public class BasicsPersonnelServiceImpl implements BasicsPersonnelService {
 		return CommonUtils.msg(id, count);
 	}
 
+	/**
+	 * 导入数据
+	 * @return
+	 */
+	@Override
+	public String excelImport(List<BasicsPersonnelEntity> listData) {
+
+		StringBuffer sb = new StringBuffer();//存储返回信息
+		int num = 1;
+		int errorNum = 0;//失败条数
+		int successNum = 0;//成功条数
+		Map<String,String> map = new HashMap<>();//存储人员部门,用于判断编码是否重复
+		for(BasicsPersonnelEntity o:listData){
+			num ++ ;
+
+			if(!StringUtils.isNullOrEmpty(o.getJobNumber())){
+				o.setJobNumber(o.getJobNumber().trim());
+				if(map.containsKey(o.getJobNumber())){
+					sb.append("excel第"+num+"行,工号已存在<br/>");
+					errorNum++;
+					continue;
+				}
+				List<BasicsPersonnelEntity> userList = basicsPersonnelFillinMapper.getByUserCode(o.getJobNumber());
+				if(userList.size() > 0){
+					sb.append("excel第"+num+"行,工号在系统中已存在<br/>");
+					errorNum++;
+					continue;
+				}
+
+				map.put(o.getJobNumber(),"");
+			}else{
+				sb.append("excel第"+num+"行,工号不能为空<br/>");
+				errorNum++;
+				continue;
+			}
+
+			if(StringUtils.isNullOrEmpty(o.getName())){
+				sb.append("excel第"+num+"行,姓名不能为空<br/>");
+				errorNum++;
+				continue;
+			}
+			if(StringUtils.isNullOrEmpty(o.getSelfDepartment())){
+				sb.append("excel第"+num+"行,本部不能为空<br/>");
+				errorNum++;
+				continue;
+			}
+			if(StringUtils.isNullOrEmpty(o.getDepartment())){
+				sb.append("excel第"+num+"行,部不能为空<br/>");
+				errorNum++;
+				continue;
+			}
+			if(StringUtils.isNullOrEmpty(o.getCourse())){
+				sb.append("excel第"+num+"行,课不能为空<br/>");
+				errorNum++;
+				continue;
+			}
+			if(StringUtils.isNullOrEmpty(o.getSeries())){
+				sb.append("excel第"+num+"行,系不能为空<br/>");
+				errorNum++;
+				continue;
+			}
+			if(StringUtils.isNullOrEmpty(o.getClasses())){
+				sb.append("excel第"+num+"行,班次不能为空<br/>");
+				errorNum++;
+				continue;
+			}
+
+			basicsPersonnelMapper.save(o);
+
+			successNum++;
+		}
+
+
+		return "本次导入成功:"+successNum+"条,失败:"+errorNum+"条;<br/>"+sb.toString();
+	}
 }

BIN
src/main/resources/excel/aaa.xls


BIN
src/main/resources/excel/bbb.xls


+ 11 - 1
src/main/webapp/WEB-INF/view/basics/basicspersonnel/list.html

@@ -14,6 +14,7 @@
                 <a v-if="hasPermission('basics:personnel:list')" class="btn btn-default" onclick="reload();"><i class="fa fa-refresh"></i>&nbsp;刷新</a>
                 <a v-if="hasPermission('basics:personnel:save')" class="btn btn-default" \@click="save"><i class="fa fa-plus"></i>&nbsp;新增</a>
                 <a v-if="hasPermission('basics:personnel:remove')" class="btn btn-default" \@click="remove(true)"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
+                <a v-if="hasPermission('basics:personnel:save')" class="btn btn-default" onclick="importData()"><i class="fa fa-file-excel-o"></i>&nbsp;导入</a>
             </div>
         </div>
     </div>
@@ -22,4 +23,13 @@
     <table id="dataGrid"></table>
 </div>
 <script src="${ctxPath}/static/js/basics/basicspersonnel/list.js"></script>
-@}
+@}
+
+
+<div id="importDiv" class="text-center" style="display:none; margin-top:20px;">
+
+    <a class="btn btn-default" href="../../rest/interface/exportExcelTemplate" >下载excel导入模板</a>
+    <input type="file" id="file" name="file" onchange="importStart();" class="hide" accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
+    <a class="btn btn-default" onclick="importDataStar()">导入excel数据</a>
+
+</div>

+ 4 - 19
src/main/webapp/WEB-INF/view/basics/basicspersonnelfillin/list.html

@@ -7,22 +7,7 @@
         <div class="form-group">
             <input v-model="fillingDate" \@keyup.enter="load" value-format="yyyy-MM-dd"  type="date" class="form-control" placeholder="请输入查询关键字" style="width: 220px;" />
         </div>
-<!--        <div class="form-group">是否返沪人员-->
-<!--            <select>-->
-<!--                <option>是</option>-->
-<!--                <option>否</option>-->
-<!--            </select>-->
-<!--        </div> <div class="form-group">是否返沪人员-->
-<!--            <select>-->
-<!--                <option>是</option>-->
-<!--                <option>否</option>-->
-<!--            </select>-->
-<!--        </div> <div class="form-group">是否返沪人员-->
-<!--            <select>-->
-<!--                <option>是</option>-->
-<!--                <option>否</option>-->
-<!--            </select>-->
-<!--        </div>-->
+
         <div class="form-group">
             <a class="btn btn-primary" \@click="load"><i class="fa fa-search"></i>&nbsp;查询</a>
         </div>
@@ -31,15 +16,15 @@
         <div class="btn-toolbar pull-right">
             <div class="btn-group">
                 <a v-if="hasPermission('basics:personnel:fillin:list')" class="btn btn-default" onclick="reload();"><i class="fa fa-refresh"></i>&nbsp;刷新</a>
-                <a v-if="hasPermission('basics:personnel:fillin:list')" class="btn btn-default" href="../../rest/interface/exportExcel"><i class="fa fa-file-excel-o"></i>&nbsp;导出</a>
 <!--                <a v-if="hasPermission('basics:personnel:fillin:save')" class="btn btn-default" \@click="save"><i class="fa fa-plus"></i>&nbsp;新增</a>-->
-<!--                <a v-if="hasPermission('basics:personnel:fillin:remove')" class="btn btn-default" \@click="remove(true)"><i class="fa fa-trash-o"></i>&nbsp;删除</a>-->
+                <a v-if="hasPermission('basics:personnel:fillin:list')" class="btn btn-default" \@click="remove()"><i class="fa fa-file-excel-o"></i>&nbsp;导出</a>
             </div>
         </div>
     </div>
 </div>
+
 <div class="row">
     <table id="dataGrid"></table>
 </div>
 <script src="${ctxPath}/static/js/basics/basicspersonnelfillin/list.js"></script>
-@}
+@}

+ 49 - 1
src/main/webapp/static/js/basics/basicspersonnel/list.js

@@ -104,4 +104,52 @@ var vm = new Vue({
             });
         }
 	}
-})
+})
+index = 0;
+importData = function () {
+
+    index = layer.open({
+        type: 1,
+        title : "导入数据",
+        area: ['420px', '150px'], //宽高
+        content:$("#importDiv"),
+
+    });
+}
+importDataStar = function () {
+    $("#file").click();
+}
+
+importStart = function () {
+    var myform = new FormData();
+    var file = $('#file')[0].files[0].name;
+    var ext = file.slice(file.lastIndexOf(".")+1).toLowerCase();
+    if ("xls" != ext && "xlsx"!=ext) {
+        layer.msg("选择出错,只能上传Excle文件");
+        return false;
+    }
+    var indexLoad = parent.layer.load(0, {shade: false}); //0代表加载的风格,支持0-2
+
+    myform.append('file',$('#file')[0].files[0]);
+    $.ajax({
+        url: "../../rest/interface/excelImport",
+        type: "POST",
+        data: myform,
+        contentType: false,
+        processData: false,
+        dataType: "text",
+        success: function (data) {
+            layer.alert(data);
+            parent.layer.close(indexLoad);
+            layer.close(index);
+            const file = $("#file");
+            file.after(file.clone().val(""));
+            file.remove();
+            vm.load();
+        },
+        error:function(data){
+            parent.layer.close(indexLoad);
+            layer.alert("导入错误!");
+        }
+    });
+}

+ 41 - 45
src/main/webapp/static/js/basics/basicspersonnelfillin/list.js

@@ -80,52 +80,48 @@ var vm = new Vue({
 		load: function() {
 			$('#dataGrid').bootstrapTable('refresh');
 		},
-		save: function() {
-			dialogOpen({
-				title: '新增人员每日填报温度信息',
-				url: 'basics/basicspersonnelfillin/add.html?_' + $.now(),
-				width: '420px',
-				height: '350px',
-				yes : function(iframeId) {
-					top.frames[iframeId].vm.acceptClick();
-				},
-			});
-		},
-		edit: function(id) {
-            dialogOpen({
-                title: '编辑人员每日填报温度信息',
-                url: 'basics/basicspersonnelfillin/edit.html?_' + $.now(),
-                width: '420px',
-                height: '350px',
-                success: function(iframeId){
-                    top.frames[iframeId].vm.basicsPersonnelFillin.id = id;
-                    top.frames[iframeId].vm.setForm();
-                },
-                yes: function(iframeId){
-                    top.frames[iframeId].vm.acceptClick();
-                }
-            });
-        },
-        remove: function(batch, id) {
-            var ids = [];
-            if (batch) {
-                var ck = $('#dataGrid').bootstrapTable('getSelections');
-                if (!checkedArray(ck)) {
-                    return false;
-                }
-                $.each(ck, function(idx, item){
-                    ids[idx] = item.id;
-                });
-            } else {
-                ids.push(id);
-            }
-            $.RemoveForm({
-                url: '../../basics/personnel/fillin/remove?_' + $.now(),
-                param: ids,
-                success: function(data) {
-                    vm.load();
-                }
+		// save: function() {
+        //     layer.open({
+        //         type: 1,
+        //         title : "导入数据",
+        //         area: ['420px', '150px'], //宽高
+        //         content:$("#importDiv"),
+        //
+        //     });
+		// },
+		// edit: function(id) {
+        //     $("#file").click();
+        //
+        // },
+        remove: function() {//导出方法
+
+		    const fillingDate = this.fillingDate;
+            const keyword = this.keyword;
+
+            dialogConfirm("确定要导出数据吗?", function() {
+                dialogMsg("正在导出,请稍后", 'success');
+                const form = document.createElement('form');
+                form.action = '../../rest/interface/exportExcel';
+                form.method = 'post';
+                const input = document.createElement('input');
+                input.type = 'hidden';
+                input.name = 'fillingDate';
+                input.value = fillingDate;
+                const input2 = document.createElement('input');
+                input2.type = 'hidden';
+                input2.name = 'name';
+                input2.value = keyword;
+                form.appendChild(input);
+                form.appendChild(input2);
+                $(document.body).append(form);
+                form.submit();
+
             });
+
+            // console.log("==================="+this.fillingDate);
+            // console.log("==================="+this.keyword);
+
         }
+
 	}
 })