Commit e95a50b9 authored by liboyang's avatar liboyang

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/main/java/com/yxproject/start/api/BizApi.java
#	src/main/java/com/yxproject/start/mapper/PersonPostMapper.java
#	src/main/java/com/yxproject/start/mapper/PersonalProgressStatusMapper.java
#	src/main/java/com/yxproject/start/service/PersonPostService.java
#	src/main/java/com/yxproject/start/service/PersonalProgressStatusService.java
#	src/main/java/com/yxproject/start/service/impl/PersonPostServiceImpl.java
#	src/main/java/com/yxproject/start/service/impl/PersonalProgressStatusServiceImpl.java
parents 9a2a08c0 42d37972
...@@ -23,6 +23,11 @@ ...@@ -23,6 +23,11 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId> <artifactId>spring-boot-starter-jdbc</artifactId>
...@@ -52,10 +57,27 @@ ...@@ -52,10 +57,27 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mybatis.spring.boot</groupId> <groupId>org.apache.poi</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId> <artifactId>poi</artifactId>
<version>1.3.2</version> <version>3.14</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.14</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.14</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.10</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.yxproject.start.api;
import com.yxproject.start.entity.PersonPostAbnormalEntity;
import com.yxproject.start.entity.RedoRegistrationEntity;
import com.yxproject.start.entity.TemporaryCertificateEntity;
import com.yxproject.start.utils.ExportExcel;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("exportExcel")
public class ExportExcelApi {
/**
* 导出临时证信息
*/
@RequestMapping("ExportTemporaryCertificate")
public boolean ExportTemporaryCertificate(){
PersonPostAbnormalEntity temporaryCertificate = new PersonPostAbnormalEntity();
ExportExcel obj = new ExportExcel();
obj.exportTemporaryCertificateExcel((List<TemporaryCertificateEntity>) temporaryCertificate);
return true;
}
/**
* 导出重做证件信息
*/
@RequestMapping("ExportRedoRegistration")
public boolean ExportRedoRegistration(){
RedoRegistrationEntity redoRegistration = new RedoRegistrationEntity();
ExportExcel obj = new ExportExcel();
obj.exportRedoRegistrationExcel((List<RedoRegistrationEntity>) redoRegistration);
return true;
}
}
package com.yxproject.start.api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("person")
public class PersonalDetailsApi {
}
This diff is collapsed.
package com.yxproject.start.mapper;
import com.yxproject.start.entity.CardDetailedListEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface CardDetailedListMapper {
@Update("update CARD_DETAILED_LIST set CARD_DETAILED_LIST_ID = #{cardDetailedListId},POLIST_LIST_ID = #{polistListId},UPLOAD_NO =#{uploadNo},NOTE =#{note},FILE_NAME =#{fileName},POLICE_CODE =#{policeCode}")
public void updateCardDetailedList(List<CardDetailedListEntity> cardDetailedList);
}
...@@ -2,7 +2,8 @@ package com.yxproject.start.mapper; ...@@ -2,7 +2,8 @@ package com.yxproject.start.mapper;
import com.yxproject.start.entity.PersonPostAbnormalEntity; import com.yxproject.start.entity.PersonPostAbnormalEntity;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import java.util.List; import java.util.List;
...@@ -20,4 +21,8 @@ public interface PersonPostAbnormalMapper { ...@@ -20,4 +21,8 @@ public interface PersonPostAbnormalMapper {
*/ */
@Select("select * from PERSON_POST_ABNORMAL where FIRST_WHITE in (select UPLOAD_NO from CARD_DETAILED_LIST where POLICE_CODE=#{police} and UPLOAD_NO like CONCAT(CONCAT('%',#{date}),'%'))") @Select("select * from PERSON_POST_ABNORMAL where FIRST_WHITE in (select UPLOAD_NO from CARD_DETAILED_LIST where POLICE_CODE=#{police} and UPLOAD_NO like CONCAT(CONCAT('%',#{date}),'%'))")
public List<PersonPostAbnormalEntity> selectPersonPostAbnormalMsg(@Param("police")String police,@Param("date")String date); public List<PersonPostAbnormalEntity> selectPersonPostAbnormalMsg(@Param("police")String police,@Param("date")String date);
@Update("update PERSON_POST_ABNORMAL set WAYBILL_NUMBER=#{waybillNumber},BACK_WAYBILL_NUMBER=#{backWaybillNumber},ORDER_NUMBER=#{orderNumber},CREATE_DATE=#{createDate},OPENID=#{openid},WC_PLAY_ORDER_NUMBER=#{wcPlayOrderNumber},PLAY_STATE=#{playState},ORDER_STATE=#{orderState},,APPLICANT_NAME=#{applicantName},SENDER_NAME=#{senderName},SENDER_PHONE=#{senderPhone},SENDER_ADDRESS=#{senderAddress},RECIPIENT_NAME=#{recipientName},RECIPIENT_PHONE=#{recipientPhone},RECIPIENT_ADDRESS=#{recipientAddress},ORDER_BLANK_NUMBER=#{orderBlankNumber},GET_TO_PROVINCE=#{getToProvince},GET_TO_CITY=#{getToCity},GET_TO_COUNTY=#{getToCounty},BUSINESS_TYPE=#{businessType},LATTICE_MOUTH_INFORMATION=#{latticeMouthInformation},NATURE_OF_THE_INTERNAL=#{natureOfTheInternal},NATURE_OF_THE_INFORMATION=#{natureOfTheInformation},FIRST_WHITE=#{firstWhite},ERR_CODE=#{errCode}")
public boolean updatePersonPostAbnormal(List<PersonPostAbnormalEntity> personPostAbnormal);
} }
...@@ -4,9 +4,10 @@ import com.yxproject.start.entity.PersonPostEntity; ...@@ -4,9 +4,10 @@ import com.yxproject.start.entity.PersonPostEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List; import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface PersonPostMapper { public interface PersonPostMapper {
...@@ -18,4 +19,7 @@ public interface PersonPostMapper { ...@@ -18,4 +19,7 @@ public interface PersonPostMapper {
*/ */
@Select("SELECT * FROM PERSON_POST WHERE WAYBILL_NUMBER=#{waybillNumber}") @Select("SELECT * FROM PERSON_POST WHERE WAYBILL_NUMBER=#{waybillNumber}")
public PersonPostEntity selectPersonPostMsgByIdCard(String waybillNumber); public PersonPostEntity selectPersonPostMsgByIdCard(String waybillNumber);
@Update("update PERSON_POST set WAYBILL_NUMBER=#{waybillNumber},BACK_WAYBILL_NUMBER=#{backWaybillNumber},ORDER_NUMBER=#{orderNumber},CREATE_DATE=#{createDate},OPENID=#{openid},WC_PLAY_ORDER_NUMBER=#{wcPlayOrderNumber},PLAY_STATE=#{playState},ORDER_STATE=#{orderState},APPLICANT_NAME=#{applicantName},SENDER_NAME=#{senderName},SENDER_PHONE=#{senderPhone},SENDER_ADDRESS=#{senderAddress},RECIPIENT_NAME=#{recipientName},RECIPIENT_PHONE=#{recipientPhone},RECIPIENT_ADDRESS=#{recipientAddress},ORDER_BLANK_NUMBER=#{orderBlankNumber},GET_TO_PROVINCE=#{getToProvince},GET_TO_CITY=#{getToCity},GET_TO_COUNTY=,#{getToCounty},BUSINESS_TYPE=#{businessType},LATTICE_MOUTH_INFORMATION=#{latticeMouthInformation},NATURE_OF_THE_INTERNAL=#{natureOfTheInternal},NATURE_OF_THE_INFORMATION=#{natureOfTheInformation},FIRST_WHITE=#{firstWhite}")
public void updatePersonPost(List<PersonPostEntity> personPost);
} }
...@@ -4,7 +4,12 @@ import com.yxproject.start.dto.CardsStatusAndCardsMsgDto; ...@@ -4,7 +4,12 @@ import com.yxproject.start.dto.CardsStatusAndCardsMsgDto;
import com.yxproject.start.dto.CardsStatusAndPostMsgDto; import com.yxproject.start.dto.CardsStatusAndPostMsgDto;
import com.yxproject.start.entity.PersonalProgressStatusEntity; import com.yxproject.start.entity.PersonalProgressStatusEntity;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import com.yxproject.start.entity.PersonalProgressStatusEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import java.util.List;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -35,4 +40,8 @@ public interface PersonalProgressStatusMapper { ...@@ -35,4 +40,8 @@ public interface PersonalProgressStatusMapper {
@Update("UPDATE PERSONAL_PROGRESS_STATUS SET PROGRESS_STATUS=9 WHERE UPLOAD_NO=#{uploadNo}") @Update("UPDATE PERSONAL_PROGRESS_STATUS SET PROGRESS_STATUS=9 WHERE UPLOAD_NO=#{uploadNo}")
void updateSignInDate(@Param("uploadNo")String uploadNo); void updateSignInDate(@Param("uploadNo")String uploadNo);
@Update("update PERSONAL_PROGRESS_STATUS set UPLOAD_NO =#{uploadNo},PROGRESS_STATUS=#{progressStatus},NOTE=#{note},IMPORT_DATE=#{importDate},CREATE_TASK_DATE=#{create_Task_Date},DATA_CHECK_DATE=#{data_Check_Date},FILM_PRINT_DATE=#{film_Print_Date},POSITION_DATE=#{position_Date},SORT_DATE=#{sort_Date},QUALITY_TEST_DATE=#{quality_Test_Date},OUT_STORAGE_DATE=#{out_Storage_Date},HAND_OUT_DATE=#{hand_Out_Date},SIGN_IN_DATE=#{sign_In_Date}")
public void updatePersonalProgressStatus(List<PersonalProgressStatusEntity> personalProgressStatus);
} }
package com.yxproject.start.mapper;
import com.yxproject.start.entity.RedoRegistrationEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface RedoRegistrationMapper {
@Update("update REDO_REGISTRATION set REDO_REGISTRATION_ID=#{redoRegistrationId},SUBMIT_DATE=#{submitDate},COUNTY_CODE=#{countyCode},POLICE_CODE=#{countyCode},POLICE_CODE=#{policeCode},NAME=#{name},CARD_ID=#{cardId},REDO_REASON=#{redoReason},CALL_DATE=#{callDate},BACK_DATE=#{backDate},NOTE=#{note}")
public void updateRedoRegistration(List<RedoRegistrationEntity> redoRegistration);
@Select("select * from REDO_REGISTRATION ")
public List<RedoRegistrationEntity> selectRedoRegistration();
}
package com.yxproject.start.mapper;
import com.yxproject.start.entity.TemporaryCertificateEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface TemporaryCertificateMapper {
@Update("update TEMPORARY_CERTIFICATE set TEMPORARY_CERTIFICATE_ID=#{temporaryCertificateId},NAME=#{name},CARD_ID=#{cardId},PHONE=#{phone},LAST_DURATION_OF_STATUS=#{lastDurationOfStatus},RECEIPT_DATE=#{receiptDate},DATE_OF_HAND_OVER_TO_TREAT=#{dateOfHandOverToTreat},BACK_WORKSHOP_DATE=#{backWorkshopDate},DELIVER_TO_PARTY=#{deliverToParty},NOTE=#{note}")
public void updateTemporaryCertificate(List<TemporaryCertificateEntity> TemporaryCertificate);
@Select("select * from TEMPORARY_CERTIFICATE ")
public List<TemporaryCertificateEntity> selectTemporaryCertificate();
}
package com.yxproject.start.service;
import com.yxproject.start.entity.CardDetailedListEntity;
import java.util.List;
/**
* 导入身份证详单
*/
public interface CardDetailedListService {
public boolean updateCardDetailedList(List<CardDetailedListEntity> cardDetailedListEntities);
}
...@@ -18,4 +18,8 @@ public interface PersonPostAbnormalService { ...@@ -18,4 +18,8 @@ public interface PersonPostAbnormalService {
* @return * @return
*/ */
public List<PersonPostAbnormalEntity> getPersonPostAbnormal(String date, String police); public List<PersonPostAbnormalEntity> getPersonPostAbnormal(String date, String police);
/**
* 导入个人邮寄异常信息
*/
public boolean updatePersonPostAbnormal(List<PersonPostAbnormalEntity> personPostAbnormalEntities);
} }
...@@ -2,7 +2,12 @@ package com.yxproject.start.service; ...@@ -2,7 +2,12 @@ package com.yxproject.start.service;
import com.yxproject.start.entity.PersonPostEntity; import com.yxproject.start.entity.PersonPostEntity;
import java.util.List;
/**
* 导入个人信息表
*/
public interface PersonPostService { public interface PersonPostService {
public boolean updatePersonPost(List<PersonPostEntity> personPostEntities);
public PersonPostEntity getPersonPostMsg(String idwaybillNumberCard); public PersonPostEntity getPersonPostMsg(String idwaybillNumberCard);
} }
...@@ -16,4 +16,10 @@ public interface PersonalProgressStatusService { ...@@ -16,4 +16,10 @@ public interface PersonalProgressStatusService {
public List<CardsStatusAndPostMsgDto> getStatusAndPostMsg(String date, String police); public List<CardsStatusAndPostMsgDto> getStatusAndPostMsg(String date, String police);
public List<CardsStatusAndCardsMsgDto> getStatusAndCardMsg(String date, String police); public List<CardsStatusAndCardsMsgDto> getStatusAndCardMsg(String date, String police);
public boolean updateSignInDate(JSONArray jsonArray); public boolean updateSignInDate(JSONArray jsonArray);
/**
* 导入个人制证进度状态表
*/
public boolean updatePersonalProgressStatus(List<PersonalProgressStatusEntity> personalProgressStatusEntities);
} }
package com.yxproject.start.service;
import com.yxproject.start.entity.CardDetailedListEntity;
import com.yxproject.start.entity.RedoRegistrationEntity;
import java.util.List;
public interface RedoRegistrationService {
/**
* 导入重做证件信息
*/
public boolean updateRedoRegistration(List<RedoRegistrationEntity> redoRegistrationEntities);
/**
* 导出重做证件信息
*/
public List<RedoRegistrationEntity> selectRedoRegistration();
}
package com.yxproject.start.service;
import com.yxproject.start.entity.RedoRegistrationEntity;
import com.yxproject.start.entity.TemporaryCertificateEntity;
import java.util.List;
public interface TemporaryCertificateService {
/**
* 导入临时证信息
*/
public boolean updateTemporaryCertificate(List<TemporaryCertificateEntity> temporaryCertificateEntities);
/**
* 导出临时证信息
*/
public List<TemporaryCertificateEntity> selectTemporaryCertificate();
}
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.CardDetailedListEntity;
import com.yxproject.start.mapper.CardDetailedListMapper;
import com.yxproject.start.service.CardDetailedListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CardDetialedListServiceImpl implements CardDetailedListService {
@Autowired
private CardDetailedListMapper cardDetailedListMapper;
@Override
public boolean updateCardDetailedList(List<CardDetailedListEntity> cardDetailedListEntities) {
cardDetailedListMapper.updateCardDetailedList(cardDetailedListEntities);
return true;
}
}
...@@ -18,7 +18,11 @@ public class PersonPostAbnormalServiceImpl implements PersonPostAbnormalService ...@@ -18,7 +18,11 @@ public class PersonPostAbnormalServiceImpl implements PersonPostAbnormalService
private PersonPostAbnormalMapper personPostAbnormalMapper; private PersonPostAbnormalMapper personPostAbnormalMapper;
@Override @Override
public List<PersonPostAbnormalEntity> getPersonPostAbnormal(String date, String police) { public List<PersonPostAbnormalEntity> getPersonPostAbnormal(String date, String police) {
List<PersonPostAbnormalEntity> list = personPostAbnormalMapper.selectPersonPostAbnormalMsg(police,date); List<PersonPostAbnormalEntity> list = personPostAbnormalMapper.selectPersonPostAbnormalMsg(police, date);
return list; return list;
} }
public boolean updatePersonPostAbnormal(List<PersonPostAbnormalEntity> personPostAbnormalEntities) {
personPostAbnormalMapper.updatePersonPostAbnormal(personPostAbnormalEntities);
return true;
}
} }
...@@ -5,10 +5,13 @@ import com.yxproject.start.mapper.PersonPostMapper; ...@@ -5,10 +5,13 @@ import com.yxproject.start.mapper.PersonPostMapper;
import com.yxproject.start.service.PersonPostService; import com.yxproject.start.service.PersonPostService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @author Administrator * @author Administrator
*/ */
@Service @Service
public class PersonPostServiceImpl implements PersonPostService { public class PersonPostServiceImpl implements PersonPostService {
...@@ -19,5 +22,9 @@ public class PersonPostServiceImpl implements PersonPostService { ...@@ -19,5 +22,9 @@ public class PersonPostServiceImpl implements PersonPostService {
public PersonPostEntity getPersonPostMsg(String idwaybillNumberCard) { public PersonPostEntity getPersonPostMsg(String idwaybillNumberCard) {
PersonPostEntity personPostEntity = personPostMapper.selectPersonPostMsgByIdCard(idwaybillNumberCard); PersonPostEntity personPostEntity = personPostMapper.selectPersonPostMsgByIdCard(idwaybillNumberCard);
return personPostEntity; return personPostEntity;
@Override
public boolean updatePersonPost(List<PersonPostEntity> personPostEntities) {
personPostMapper.updatePersonPost(personPostEntities);
return true;
} }
} }
...@@ -22,7 +22,7 @@ public class PersonalProgressStatusServiceImpl implements PersonalProgressStatus ...@@ -22,7 +22,7 @@ public class PersonalProgressStatusServiceImpl implements PersonalProgressStatus
private PersonalProgressStatusMapper personalProgressStatusMapper; private PersonalProgressStatusMapper personalProgressStatusMapper;
@Override @Override
public List<CardsStatusAndPostMsgDto> getStatusAndPostMsg(String date, String police) { public List<CardsStatusAndPostMsgDto> getStatusAndPostMsg(String date, String police) {
List<CardsStatusAndPostMsgDto> list = personalProgressStatusMapper.selectStatusAndPostMsg(date,police); List<CardsStatusAndPostMsgDto> list = personalProgressStatusMapper.selectStatusAndPostMsg(date, police);
return list; return list;
} }
...@@ -40,4 +40,9 @@ public class PersonalProgressStatusServiceImpl implements PersonalProgressStatus ...@@ -40,4 +40,9 @@ public class PersonalProgressStatusServiceImpl implements PersonalProgressStatus
} }
return true; return true;
} }
@Override
public boolean updatePersonalProgressStatus(List<PersonalProgressStatusEntity> personalProgressStatusEntities) {
personalProgressStatusMapper.updatePersonalProgressStatus(personalProgressStatusEntities);
return true;
}
} }
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.RedoRegistrationEntity;
import com.yxproject.start.mapper.RedoRegistrationMapper;
import com.yxproject.start.service.RedoRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class RedoRegistrationServiceImpl implements RedoRegistrationService {
@Autowired
private RedoRegistrationMapper redoRegistrationMapper;
@Override
public boolean updateRedoRegistration(List<RedoRegistrationEntity> redoRegistrationEntities) {
redoRegistrationMapper.updateRedoRegistration(redoRegistrationEntities);
return false;
}
@Override
public List<RedoRegistrationEntity> selectRedoRegistration() {
List<RedoRegistrationEntity> list = redoRegistrationMapper.selectRedoRegistration();
return list;
}
}
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.TemporaryCertificateEntity;
import com.yxproject.start.mapper.TemporaryCertificateMapper;
import com.yxproject.start.service.TemporaryCertificateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TemporaryCertificateServiceImpl implements TemporaryCertificateService {
@Autowired
private TemporaryCertificateMapper temporaryCertificateMapper;
@Override
public boolean updateTemporaryCertificate(List<TemporaryCertificateEntity> temporaryCertificateEntities) {
temporaryCertificateMapper.updateTemporaryCertificate(temporaryCertificateEntities);
return true;
}
@Override
public List<TemporaryCertificateEntity> selectTemporaryCertificate() {
List<TemporaryCertificateEntity> list = temporaryCertificateMapper.selectTemporaryCertificate();
return list;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
package com.yxproject.start.utils;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import java.io.InputStream;
public class MybatisUtils {
public static SqlSessionFactory getFactory(){
String resource="conf.xml";
//加载mybatis 的配置文件(它也加载关联的映射文件)
InputStream is=MybatisUtils.class.getClassLoader().getResourceAsStream(resource);
//构建sqlSession 的工厂
SqlSessionFactory factory=new SqlSessionFactoryBuilder().build(is);
return factory;
}
}
package com.yxproject.start.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
/**
* Created by zhangyusheng on 2019/1/30 14:39
*/
public class ReadExcel {
public static void main(String[] args) {
ReadExcel obj = new ReadExcel();
// 此处为我创建Excel路径:E:/zhanhj/studysrc/jxl下
File file = new File("E:/北京制证项目/personal_progress_status.xls");
List excelList = obj.readExcel(file);
System.out.println("list中的数据打印出来");
for (int i = 0; i < excelList.size(); i++) {
System.out.println("第"+i+"行:"+excelList.get(i));
List list = (List) excelList.get(i);
for (int j = 0; j < list.size(); j++) {
// System.out.print(list.get(j));
}
}
}
// 去读Excel的方法readExcel,该方法的入口参数为一个File对象
public List readExcel(File file) {
try {
// 创建输入流,读取Excel
InputStream is = new FileInputStream(file.getAbsolutePath());
// jxl提供的Workbook类
Workbook wb = Workbook.getWorkbook(is);
// Excel的页签数量
int sheet_size = wb.getNumberOfSheets();
for (int index = 0; index < sheet_size; index++) {
List<List> outerList=new ArrayList<List>();
// 每个页签创建一个Sheet对象
Sheet sheet = wb.getSheet(index);
// sheet.getRows()返回该页的总行数
for (int i = 0; i < sheet.getRows(); i++) {
List innerList=new ArrayList();
// sheet.getColumns()返回该页的总列数
for (int j = 0; j < sheet.getColumns(); j++) {
String cellinfo = sheet.getCell(j, i).getContents();
if(cellinfo.isEmpty()){
continue;
}
innerList.add(cellinfo);
}
outerList.add(i, innerList);
}
return outerList;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (BiffException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment