Browse Source

健康小屋-设备列表导入

huangzhiyong 6 years ago
parent
commit
cc50a63d80
34 changed files with 1729 additions and 126 deletions
  1. 5 0
      common/common-util/pom.xml
  2. 67 0
      common/common-util/src/main/java/com/yihu/jw/util/excel/AExcelReader.java
  3. 40 0
      common/common-util/src/main/java/com/yihu/jw/util/excel/AExcelWriter.java
  4. 39 0
      common/common-util/src/main/java/com/yihu/jw/util/excel/ExcelUtil.java
  5. 9 0
      common/common-util/src/main/java/com/yihu/jw/util/excel/Validation.java
  6. 13 0
      common/common-util/src/main/java/com/yihu/jw/util/excel/annotation/Child.java
  7. 14 0
      common/common-util/src/main/java/com/yihu/jw/util/excel/annotation/Location.java
  8. 12 0
      common/common-util/src/main/java/com/yihu/jw/util/excel/annotation/Row.java
  9. 12 0
      common/common-util/src/main/java/com/yihu/jw/util/excel/annotation/Sheet.java
  10. 13 0
      common/common-util/src/main/java/com/yihu/jw/util/excel/annotation/Title.java
  11. 12 0
      common/common-util/src/main/java/com/yihu/jw/util/excel/annotation/ValidRepeat.java
  12. 14 1
      svr/svr-healthy-house/pom.xml
  13. 68 2
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/facilities/FacilitiesController.java
  14. 2 2
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/facilities/FacilitiesServerController.java
  15. 3 111
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/user/UserController.java
  16. 2 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/dao/area/BaseCityDao.java
  17. 2 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/dao/area/BaseCommitteeDao.java
  18. 2 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/dao/area/BaseStreetDao.java
  19. 2 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/dao/area/BaseTownDao.java
  20. 18 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/model/facility/Facility.java
  21. 16 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/model/user/User.java
  22. 17 4
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/area/BaseCityService.java
  23. 15 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/area/BaseStreetService.java
  24. 15 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/area/BaseTownService.java
  25. 160 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/facility/FacilityService.java
  26. 89 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/user/UserService.java
  27. 101 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/util/facility/FacilityMsgReader.java
  28. 267 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/util/facility/msg/FacilityMsg.java
  29. 69 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/util/poi/AExcelReader.java
  30. 71 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/util/poi/AExcelWriter.java
  31. 546 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/util/poi/ExcelUtils.java
  32. 5 4
      svr/svr-healthy-house/src/main/resources/application.yml
  33. 3 2
      svr/svr-healthy-house/src/main/resources/bootstrap.yml
  34. 6 0
      wlyy-parent-pom/pom.xml

+ 5 - 0
common/common-util/pom.xml

@ -57,5 +57,10 @@
            <groupId>com.yihu</groupId>
            <artifactId>utils</artifactId> <!-- 此依赖包含大部分常用工具类 -->
        </dependency>
        <dependency>
            <groupId>net.sourceforge.jexcelapi</groupId>
            <artifactId>jxl</artifactId>
        </dependency>
    </dependencies>
</project>

+ 67 - 0
common/common-util/src/main/java/com/yihu/jw/util/excel/AExcelReader.java

@ -0,0 +1,67 @@
package com.yihu.jw.util.excel;
import jxl.Sheet;
import jxl.Workbook;
import java.io.File;
import java.io.InputStream;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public abstract class AExcelReader {
    protected List errorLs = new ArrayList<>();
    protected List correctLs = new ArrayList<>();
    protected Map<String, Set> repeat = new HashMap<>();
    public abstract void read(Workbook rwb) throws Exception;
    public void read(File file) throws Exception {
        read(Workbook.getWorkbook(file));
    }
    public void read(InputStream is) throws Exception {
        read(Workbook.getWorkbook(is));
    }
    public static String replaceBlank(String str) {
        String dest = "";
        if (str!=null) {
            str = str.replaceAll("\\u00A0" ," ");
            //去除字符串中的空格、回车、换行符、制表符
            Pattern p = Pattern.compile("\\s*|\t|\r|\n");
            Matcher m = p.matcher(str);
            dest = m.replaceAll("");
        }
        return dest;
    }
    protected String getCellCont(Sheet sheet, int row, int col){
        return sheet.getCell(col, row).getContents();
    }
    public List getErrorLs() {
        return errorLs;
    }
    public void setErrorLs(List errorLs) {
        this.errorLs = errorLs;
    }
    public List getCorrectLs() {
        return correctLs;
    }
    public void setCorrectLs(List correctLs) {
        this.correctLs = correctLs;
    }
    public Map<String, Set> getRepeat() {
        return repeat;
    }
    public void setRepeat(Map<String, Set> repeat) {
        this.repeat = repeat;
    }
}

+ 40 - 0
common/common-util/src/main/java/com/yihu/jw/util/excel/AExcelWriter.java

@ -0,0 +1,40 @@
package com.yihu.jw.util.excel;
import jxl.Workbook;
import jxl.write.*;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.io.OutputStream;
import java.util.List;
public abstract class AExcelWriter {
    public abstract void write(WritableWorkbook wwb, List ls) throws Exception;
    public void write(OutputStream os, List ls) throws Exception{
        write(Workbook.createWorkbook(os), ls);
    };
    public void write(File file, List ls) throws Exception{
        write(Workbook.createWorkbook(file), ls);
    };
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data) throws WriteException {
        Label label = new Label(column ,row, data);
        ws.addCell(label);
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
        Label label = new Label(column ,row, data);
        if(!StringUtils.isEmpty(memo)){
            WritableCellFeatures cellFeatures = new WritableCellFeatures();
            cellFeatures.setComment(memo);
            label.setCellFeatures(cellFeatures);
        }
        ws.addCell(label);
    }
}

+ 39 - 0
common/common-util/src/main/java/com/yihu/jw/util/excel/ExcelUtil.java

@ -0,0 +1,39 @@
package com.yihu.jw.util.excel;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
public abstract class ExcelUtil implements Serializable {
    public int excelSeq;
    public Map<String, String> errorMsg = new HashMap<>();
    public int getExcelSeq() {
        return excelSeq;
    }
    public void setExcelSeq(int excelSeq) {
        this.excelSeq = excelSeq;
    }
    public void addErrorMsg(String field, String msg){
        errorMsg.put(field, msg);
    };
    public String findErrorMsg(String field){
        return errorMsg.get(field);
    };
    public void clearErrorMsg(){
        errorMsg.clear();
    };
    public void removeErrorMsg(String field){
        errorMsg.remove(field);
    };
    @Override
    public boolean equals(Object obj) {
        return getExcelSeq() == ((ExcelUtil) obj).getExcelSeq();
    }
}

+ 9 - 0
common/common-util/src/main/java/com/yihu/jw/util/excel/Validation.java

@ -0,0 +1,9 @@
package com.yihu.jw.util.excel;
import java.util.Map;
import java.util.Set;
public interface Validation {
    public int validate(Map<String, Set> repeatMap) throws Exception;
}

+ 13 - 0
common/common-util/src/main/java/com/yihu/jw/util/excel/annotation/Child.java

@ -0,0 +1,13 @@
package com.yihu.jw.util.excel.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Child {
    String one() default "";
    String many() default "";
}

+ 14 - 0
common/common-util/src/main/java/com/yihu/jw/util/excel/annotation/Location.java

@ -0,0 +1,14 @@
package com.yihu.jw.util.excel.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Location {
    int x() default -1;
    int y() default -1;
}

+ 12 - 0
common/common-util/src/main/java/com/yihu/jw/util/excel/annotation/Row.java

@ -0,0 +1,12 @@
package com.yihu.jw.util.excel.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Row {
    int start() default 0;
}

+ 12 - 0
common/common-util/src/main/java/com/yihu/jw/util/excel/annotation/Sheet.java

@ -0,0 +1,12 @@
package com.yihu.jw.util.excel.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Sheet {
    String name();
}

+ 13 - 0
common/common-util/src/main/java/com/yihu/jw/util/excel/annotation/Title.java

@ -0,0 +1,13 @@
package com.yihu.jw.util.excel.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Title {
    int type() default 0;
    String names() default "";
}

+ 12 - 0
common/common-util/src/main/java/com/yihu/jw/util/excel/annotation/ValidRepeat.java

@ -0,0 +1,12 @@
package com.yihu.jw.util.excel.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ValidRepeat {
}

+ 14 - 1
svr/svr-healthy-house/pom.xml

@ -77,6 +77,12 @@
		<dependency>
			<groupId>com.yihu</groupId>
			<artifactId>swagger-starter</artifactId>
			<exclusions>
				<exclusion>
					<artifactId>jackson-coreutils</artifactId>
					<groupId>com.github.fge</groupId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>com.yihu</groupId>
@ -166,7 +172,14 @@
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-annotations</artifactId>
		</dependency>
		<dependency>
			<groupId>org.json</groupId>
			<artifactId>json</artifactId>
		</dependency>
		<dependency>
			<groupId>net.sf.json-lib</groupId>
			<artifactId>json-lib</artifactId>
		</dependency>
	</dependencies>
	<build>

+ 68 - 2
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/facilities/FacilitiesController.java

@ -1,12 +1,17 @@
package com.yihu.jw.healthyhouse.controller.facilities;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.cfg.ContextAttributes;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.healthyhouse.model.facility.Facility;
import com.yihu.jw.healthyhouse.model.facility.FacilityServer;
import com.yihu.jw.healthyhouse.model.facility.FacilityServerRelation;
import com.yihu.jw.healthyhouse.service.facility.FacilityServerRelationService;
import com.yihu.jw.healthyhouse.service.facility.FacilityServerService;
import com.yihu.jw.healthyhouse.service.facility.FacilityService;
import com.yihu.jw.healthyhouse.util.facility.FacilityMsgReader;
import com.yihu.jw.healthyhouse.util.facility.msg.FacilityMsg;
import com.yihu.jw.healthyhouse.util.poi.AExcelReader;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.health.house.HealthyHouseMapping;
@ -17,16 +22,21 @@ import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.text.ParseException;
import java.util.*;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
@ -211,4 +221,60 @@ public class FacilitiesController extends EnvelopRestEndpoint {
    }
    @GetMapping("/exportToExcel")
    @ApiOperation(value = "设施列表导出excel")
    public void exportToExcel(
            HttpServletResponse response,
            @ApiParam(name = "filters", value = "过滤条件", required = false)@RequestParam(required = false, name = "filters") String filters,
            @ApiParam(name = "sorts", value = "排序", required = false)@RequestParam(required = false, name = "sorts") String sorts) throws ManageException {
        //获取设施数据
        List<Facility> facilityList = null;
        try {
           facilityList = facilityService.search( filters, sorts);
        } catch (ParseException e) {
            throw new ManageException("获取设施列表异常",e);
        }
        facilityService.exportFacilityExcel(response,facilityList);
    }
    @PostMapping(value = "/batchImport")
    @ApiOperation(value = "设施列表导入")
    public void importData(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException {
        try {
            writerResponse(response, 1 + "", "l_upd_progress");
            request.setCharacterEncoding("UTF-8");
            AExcelReader excelReader = new FacilityMsgReader();
            excelReader.read(file);
            List<FacilityMsg> correctLs = excelReader.getCorrectLs();
            writerResponse(response, 35+"", "l_upd_progress");
            if(correctLs.size()>0) {
                facilityService.batchInsertFacility(correctLs);
            }
        } catch (Exception e) {
            e.printStackTrace();
            writerResponse(response, "-1", "l_upd_progress");
        }
    }
    private void writerResponse(HttpServletResponse response, String body, String client_method) throws IOException {
        StringBuffer sb = new StringBuffer();
        sb.append("<script type=\"text/javascript\">//<![CDATA[\n");
        sb.append("     parent.").append(client_method).append("(").append(body).append(");\n");
        sb.append("//]]></script>");
        response.setContentType("text/html;charset=UTF-8");
        response.addHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache,no-store,must-revalidate");
        response.setHeader("Cache-Control", "pre-check=0,post-check=0");
        response.setDateHeader("Expires", 0);
        response.getWriter().write(sb.toString());
        response.flushBuffer();
    }
}

+ 2 - 2
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/facilities/FacilitiesServerController.java

@ -33,7 +33,7 @@ public class FacilitiesServerController extends EnvelopRestEndpoint {
    private FacilityServerService facilityServerService;
    @ApiOperation(value = "获取设施服务列表", responseContainer = "List")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.FacilitiesServer.PAGE)
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.FacilitiesServer.PAGE )
    public PageEnvelop<FacilityServer> getFacilitiesServer(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "")
            @RequestParam(value = "fields", required = false) String fields,
@ -50,7 +50,7 @@ public class FacilitiesServerController extends EnvelopRestEndpoint {
    }
    @ApiOperation(value = "创建设施服务")
    @PostMapping(value = HealthyHouseMapping.HealthyHouse.FacilitiesServer.CREATE)
    @PostMapping(value = HealthyHouseMapping.HealthyHouse.FacilitiesServer.CREATE,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ObjEnvelop<FacilityServer> createFacilitiesServer(
            @ApiParam(name = "FacilityServer", value = "设施服务JSON结构")
            @RequestBody FacilityServer facilityServer) throws IOException {

+ 3 - 111
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/user/UserController.java

@ -141,9 +141,9 @@ public class UserController  extends EnvelopRestEndpoint {
        }
    }
    /******************************   导入导出   ***********************************/
    @RequestMapping("/exportToExcel")
    @GetMapping("/exportToExcel")
    @ApiOperation(value = "用户列表导出excel")
    public void exportToExcel(
            HttpServletResponse response,
            @ApiParam(name = "city", value = "所在市区", required = false)@RequestParam(required = false, name = "city") String city,
@ -158,118 +158,10 @@ public class UserController  extends EnvelopRestEndpoint {
        map.put("name",name);
        map.put("telephone",name);
        List<User> userList = userService.userList( map, sort);
        try {
            String fileName = "标准数据集"+"_";
            //设置下载
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="
                    + new String( fileName.getBytes("gb2312"), "ISO8859-1" )+".xlsx");
            OutputStream os = response.getOutputStream();
            //获取导出数据集
            JSONObject order = new JSONObject();
            order.put("id","asc");
            //获取导出数据元
            String ids="";
            User userInfo;
            for(int i=0;i<userList.size();i++){
                userInfo =   userList.get(i);
                if(i!=0){
                    ids+=",";
                }
                ids +=userInfo.getId();
            }
            //写excel
            Workbook workbook = new XSSFWorkbook();
            int k=0;
            User metaData = null;
            int row=0;
                //创建Excel工作表 指定名称和位置
                String streetName = "健康小屋-用户列表";
                Sheet sheet = workbook.createSheet(streetName);
                addStaticCell(sheet);
                addCell(sheet,1,0,"测试行");//名称
                //添加数据元信息
                WritableCellFormat wc = new WritableCellFormat();
                wc.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN, Colour.SKY_BLUE);//边框
                for(int j=0;k<userList.size(); j++,k++){
                    metaData = userList.get(k);
                    row=j+2;
                    addCell(sheet,0,row,j+1+"");//序号
                    addCell(sheet,1,row, metaData.getId());//内部id
                    addCell(sheet,2,row, metaData.getLoginCode());//登录名
                    addCell(sheet,3,row, metaData.getName());//名称
                    addCell(sheet,4,row, metaData.getGender());//性别
                    addCell(sheet,5,row, metaData.getTelephone());//电话
                    addCell(sheet,6,row, metaData.getCityName() + metaData.getAreaName() + metaData.getStreet());//地区
                    addCell(sheet,7,row, metaData.getFacilityUsedCount().toString());//使用设施次数
                    addCell(sheet,8,row, metaData.getIdCardNo());//身份证
                }
            //写入工作表
            workbook.write(os);
            workbook.close();
            os.flush();
            os.close();
        } catch (Exception e) {
            Envelop.getError("导出用户列表失败!");
        }
    }
    //添加单元格内容
    private void addCell(Sheet sheet,int column,int row,String data){
        Row sheetRow = sheet.getRow(row);
        if(sheetRow==null){
            sheetRow = sheet.createRow(row);
        }
        Cell cell= sheetRow.createCell(column);
        cell.setCellValue(data);
    }
    //添加单元格内容带样式
    private void addCell(Sheet sheet,int column,int row,String data,CellStyle cellStyle){
        Row sheetRow = sheet.getRow(row);
        if(sheetRow==null){
            sheetRow = sheet.createRow(row);
        }
        Cell cell= sheetRow.createCell(column);
        cell.setCellValue(data);
        cell.setCellStyle(cellStyle);
        userService.exportUsersExcel(response,userList);
    }
    //excel中添加固定内容
    private void addStaticCell(Sheet sheet){
        addCell(sheet,0,0,"名称");
        addCell(sheet,0,1,"标识");
        addCell(sheet,0,2,"参考");
        addCell(sheet,0,3,"备注");
        //设置样式
        Workbook workbook = sheet.getWorkbook();
        CellStyle style = workbook.createCellStyle();
        style.setFillForegroundColor(IndexedColors.LIGHT_BLUE.getIndex());//設置背景色
//        style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
//        style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 居中
        Font font = workbook.createFont();
        font.setFontName("黑体");
        font.setFontHeightInPoints((short) 12);
        style.setFont(font);
        addCell(sheet,0,4,"序号",style);
        addCell(sheet,1,4,"内部标识",style);
        addCell(sheet,2,4,"数据元编码",style);
        addCell(sheet,3,4,"数据元名称",style);
        addCell(sheet,4,4,"数据元定义",style);
        addCell(sheet,5,4,"数据类型",style);
        addCell(sheet,6,4,"表示形式",style);
        addCell(sheet,7,4,"术语范围值",style);
        addCell(sheet,8,4,"列名",style);
        addCell(sheet,9,4,"列类型",style);
        addCell(sheet,10,4,"列长度",style);
        addCell(sheet,11,4,"主键",style);
        addCell(sheet,12,4,"可为空",style);
    }

+ 2 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/dao/area/BaseCityDao.java

@ -17,4 +17,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 * @since 1.
 */
public interface BaseCityDao extends PagingAndSortingRepository<BaseCityDO, Integer>, JpaSpecificationExecutor<BaseCityDO>  {
    BaseCityDO findByName(String name);
}

+ 2 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/dao/area/BaseCommitteeDao.java

@ -17,4 +17,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 * @since 1.
 */
public interface BaseCommitteeDao extends PagingAndSortingRepository<BaseCommitteeDO, Integer>, JpaSpecificationExecutor<BaseCommitteeDO>  {
    BaseCommitteeDO findByName(String name);
}

+ 2 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/dao/area/BaseStreetDao.java

@ -17,4 +17,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 * @since 1.
 */
public interface BaseStreetDao extends PagingAndSortingRepository<BaseStreetDO, Integer>, JpaSpecificationExecutor<BaseStreetDO>  {
    BaseStreetDO findByName(String name);
}

+ 2 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/dao/area/BaseTownDao.java

@ -17,4 +17,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 * @since 1.
 */
public interface BaseTownDao extends PagingAndSortingRepository<BaseTownDO, Integer>, JpaSpecificationExecutor<BaseTownDO>  {
    BaseTownDO findByName(String name);
}

+ 18 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/model/facility/Facility.java

@ -277,4 +277,22 @@ public class Facility extends UuidIdentityEntityWithOperator {
    public void setFacilityServerRelation(List<FacilityServerRelation> facilityServerRelation) {
        this.facilityServerRelation = facilityServerRelation;
    }
    @Transient
    public String getAddress(){
        String address = "";
        if (this.getProvinceId()!=null ) {
        }
        if (this.getCityName() !=null ){
            address += this.getCityName();
        }
        if (this.getCountyName() !=null ){
            address += this.getCountyName();
        }
        if (this.getStreet() !=null) {
            address += this.getStreet();
        }
        return address;
    }
}

+ 16 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/model/user/User.java

@ -6,6 +6,7 @@ import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
@ -218,4 +219,19 @@ public class User extends UuidIdentityEntityWithOperator {
    public void setStreet(String street) {
        this.street = street;
    }
    @Transient
    public String getAddress(){
        String address ="";
        if (this.getCityName()!=null) {
            address += this.getCityName();
        }
        if (this.getAreaName()!=null) {
            address += this.getAreaName();
        }
        if (this.getStreet() !=null ){
            address += this.getStreet();
        }
        return address;
    }
}

+ 17 - 4
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/area/BaseCityService.java

@ -3,14 +3,13 @@ package com.yihu.jw.healthyhouse.service.area;
import com.yihu.jw.healthyhouse.dao.area.BaseCityDao;
import com.yihu.jw.healthyhouse.model.area.BaseCityDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * 
 * 城市字典服务service
 * 
 * @version 
 * <pre>
 *
 * @version <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年08月31日 Created
 *
@ -19,4 +18,18 @@ import org.springframework.stereotype.Service;
 */
@Service
public class BaseCityService extends BaseJpaService<BaseCityDO, BaseCityDao> {
    @Autowired
    private BaseCityDao baseCityDao;
    public String getCodeByname(String name) {
        BaseCityDO cityDO = baseCityDao.findByName(name);
        if (cityDO != null) {
            return cityDO.getCode();
        } else {
            return null;
        }
    }
}

+ 15 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/area/BaseStreetService.java

@ -1,8 +1,10 @@
package com.yihu.jw.healthyhouse.service.area;
import com.yihu.jw.healthyhouse.dao.area.BaseStreetDao;
import com.yihu.jw.healthyhouse.model.area.BaseCityDO;
import com.yihu.jw.healthyhouse.model.area.BaseStreetDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@ -19,4 +21,17 @@ import org.springframework.stereotype.Service;
 */
@Service
public class BaseStreetService extends BaseJpaService<BaseStreetDO, BaseStreetDao> {
    @Autowired
    private BaseStreetDao baseStreetDao;
    public String getCodeByname(String name) {
        BaseStreetDO streetDO = baseStreetDao.findByName(name);
        if (streetDO != null) {
            return streetDO.getCode();
        } else {
            return null;
        }
    }
}

+ 15 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/area/BaseTownService.java

@ -1,8 +1,10 @@
package com.yihu.jw.healthyhouse.service.area;
import com.yihu.jw.healthyhouse.dao.area.BaseTownDao;
import com.yihu.jw.healthyhouse.model.area.BaseStreetDO;
import com.yihu.jw.healthyhouse.model.area.BaseTownDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@ -19,4 +21,17 @@ import org.springframework.stereotype.Service;
 */
@Service
public class BaseTownService extends BaseJpaService<BaseTownDO, BaseTownDao> {
    @Autowired
    public BaseTownDao baseTownDao;
    public String getCodeByname(String name) {
        BaseTownDO townDO = baseTownDao.findByName(name);
        if (townDO != null) {
            return townDO.getCode();
        } else {
            return null;
        }
    }
}

+ 160 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/facility/FacilityService.java

@ -1,12 +1,29 @@
package com.yihu.jw.healthyhouse.service.facility;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.healthyhouse.dao.facility.FacilityDao;
import com.yihu.jw.healthyhouse.model.facility.Facility;
import com.yihu.jw.healthyhouse.service.area.BaseCityService;
import com.yihu.jw.healthyhouse.service.area.BaseStreetService;
import com.yihu.jw.healthyhouse.service.area.BaseTownService;
import com.yihu.jw.healthyhouse.util.facility.msg.FacilityMsg;
import com.yihu.jw.healthyhouse.util.poi.ExcelUtils;
import com.yihu.mysql.query.BaseJpaService;
import jxl.write.Colour;
import jxl.write.WritableCellFormat;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/**
 * 设施管理器.
 *
@ -20,9 +37,152 @@ public class FacilityService extends BaseJpaService<Facility, FacilityDao> {
    @Autowired
    private FacilityDao facilityDao;
    @Autowired
    private BaseCityService baseCityService;
    @Autowired
    private BaseTownService baseTownService;
    @Autowired
    private BaseStreetService baseStreetService;
    public Facility findById(String id) {
        return  facilityDao.findById(id);
    }
    //excel中添加固定内容
    private void addStaticCell(Sheet sheet){
        //设置样式
        Workbook workbook = sheet.getWorkbook();
        CellStyle style = workbook.createCellStyle();
        style.setFillForegroundColor(IndexedColors.LIGHT_BLUE.getIndex());//設置背景色
        Font font = workbook.createFont();
        font.setFontName("黑体");
        font.setFontHeightInPoints((short) 12);
        style.setFont(font);
        ExcelUtils.addCellData(sheet,0,0,"序号",style);
        ExcelUtils.addCellData(sheet,1,0,"设施编码",style);
        ExcelUtils.addCellData(sheet,2,0,"设施类型名称",style);
        ExcelUtils.addCellData(sheet,3,0,"设施详细地址",style);
        ExcelUtils.addCellData(sheet,4,0,"联系人",style);
        ExcelUtils.addCellData(sheet,5,0,"联系方式",style);
        ExcelUtils.addCellData(sheet,6,0,"所在省",style);
        ExcelUtils.addCellData(sheet,7,0,"所在市",style);
        ExcelUtils.addCellData(sheet,8,0,"所在区",style);
        ExcelUtils.addCellData(sheet,9,0,"所在街道",style);
        ExcelUtils.addCellData(sheet,10,0,"运营状态",style);
    }
    /**
     *  导出设施列表excel
     * @param response  响应体
     * @param facilityList  用户列表
     * @throws ManageException
     */
    public void exportFacilityExcel(HttpServletResponse response, List<Facility> facilityList) throws ManageException {
        try {
            String fileName = "健康小屋-设施列表";
            //设置下载
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="
                    + new String( fileName.getBytes("gb2312"), "ISO8859-1" )+".xlsx");
            OutputStream os = response.getOutputStream();
            //获取导出数据集
            JSONObject order = new JSONObject();
            order.put("id","asc");
            //写excel
            Workbook workbook = new XSSFWorkbook();
            int k=0;
            Facility metaData = null;
            int row=0;
            //创建Excel工作表 指定名称和位置
            String streetName = "健康小屋-设施列表";
            Sheet sheet = workbook.createSheet(streetName);
            addStaticCell(sheet);
            //添加数据元信息
            WritableCellFormat wc = new WritableCellFormat();
            wc.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN, Colour.SKY_BLUE);//边框
            for(int j=0;k<facilityList.size(); j++,k++){
                metaData = facilityList.get(k);
                row=j+1;
                ExcelUtils.addCellData(sheet,0,row,j+1+"");//序号
                ExcelUtils.addCellData(sheet,1,row, metaData.getCode());//设施编码
                ExcelUtils.addCellData(sheet,2,row, metaData.getCategory().toString());//类型名称
                ExcelUtils.addCellData(sheet,3,row, metaData.getAddress());//信息地址
                ExcelUtils.addCellData(sheet,4,row, metaData.getUserName());//联系人
                ExcelUtils.addCellData(sheet,5,row, metaData.getUserTelephone());//联系电话
                ExcelUtils.addCellData(sheet,6,row, metaData.getProvinceId());//省
                ExcelUtils.addCellData(sheet,7,row, metaData.getCityName());//市
                ExcelUtils.addCellData(sheet,8,row, metaData.getCountyName());//区县
                ExcelUtils.addCellData(sheet,9,row, metaData.getStreet());//街道
                ExcelUtils.addCellData(sheet,10,row, metaData.getStatus());//运营状态
            }
            //写入工作表
            workbook.write(os);
            workbook.close();
            os.flush();
            os.close();
        } catch (Exception e) {
            throw new ManageException("导出设施列表异常",e);
        }
    }
    /**
     * 批量存储的集合
     * @param facilities    设施列表
     */
    public void batchInsertFacility(List<FacilityMsg> facilities){
        //批量存储的集合
        List<Facility> data = new ArrayList<>();
        Facility facility = null;
        //批量存储
        for(FacilityMsg facilityMsg : facilities) {
            facility = new Facility();
            Double longitude = StringUtils.isEmpty(facilityMsg.getLongitude()) ? null :Double.parseDouble(facilityMsg.getLongitude());
            Double latitude = StringUtils.isEmpty(facilityMsg.getLongitude()) ? null :Double.parseDouble(facilityMsg.getLongitude());
            String cityCode = baseCityService.getCodeByname(facilityMsg.getCity());
            String townCode = baseTownService.getCodeByname(facilityMsg.getCounty());
            facility.setCode(genFacilityCode());
            facility.setCategory(Integer.parseInt(facilityMsg.getCategory()));
            facility.setUserName(facilityMsg.getUserName());
            facility.setUserTelephone(facilityMsg.getUserTelePhone());
            facility.setProvinceId(facilityMsg.getProvince());
            facility.setCityCode(cityCode);
            facility.setCityName(facilityMsg.getCity());
            facility.setCountyCode(townCode);
            facility.setCountyName(facilityMsg.getCounty());
            facility.setStreet(facilityMsg.getStreet());
            facility.setStatus(facilityMsg.getStatus());
            facility.setOrgName(facilityMsg.getOrgName());
            facility.setServiceDay(facilityMsg.getServiceDate());
            facility.setServiceStartTime(facilityMsg.getServiceStartTime());
            facility.setServiceEndTime(facilityMsg.getServiceEndTime());
            facility.setLongitude(longitude);
            facility.setLatitude(latitude);
            data.add(facility);
            if (data.size()>100){
                facilityDao.save(data);
                data.clear();
            }
        }
        if(!data.isEmpty()) {
            facilityDao.save(data);
        }
    }
    /**
     * 设施编码生成
     * @return
     */
    public String genFacilityCode(){
        return "CSHF" + randomString(5);
    }
}

+ 89 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/user/UserService.java

@ -4,10 +4,16 @@ import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.healthyhouse.constant.LoginInfo;
import com.yihu.jw.healthyhouse.dao.user.UserDao;
import com.yihu.jw.healthyhouse.model.user.User;
import com.yihu.jw.healthyhouse.util.poi.ExcelUtils;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.wlyy.HouseUserContant;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.security.MD5;
import jxl.write.Colour;
import jxl.write.WritableCellFormat;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
@ -18,7 +24,9 @@ import org.springframework.util.StringUtils;
import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import javax.servlet.http.HttpServletResponse;
import javax.transaction.Transactional;
import java.io.OutputStream;
import java.util.*;
/**
@ -264,4 +272,85 @@ public class UserService {
    }
   
    //excel中添加固定内容
    private void addStaticCell(Sheet sheet){
        //设置样式
        Workbook workbook = sheet.getWorkbook();
        CellStyle style = workbook.createCellStyle();
        style.setFillForegroundColor(IndexedColors.LIGHT_BLUE.getIndex());//設置背景色
        Font font = workbook.createFont();
        font.setFontName("黑体");
        font.setFontHeightInPoints((short) 12);
        style.setFont(font);
        ExcelUtils.addCellData(sheet,0,0,"序号",style);
        ExcelUtils.addCellData(sheet,1,0,"内部标识",style);
        ExcelUtils.addCellData(sheet,2,0,"登录账号",style);
        ExcelUtils.addCellData(sheet,3,0,"名称",style);
        ExcelUtils.addCellData(sheet,4,0,"身份证号",style);
        ExcelUtils.addCellData(sheet,5,0,"性别",style);
        ExcelUtils.addCellData(sheet,6,0,"电话",style);
        ExcelUtils.addCellData(sheet,7,0,"地址",style);
        ExcelUtils.addCellData(sheet,8,0,"设施使用次数",style);
    }
    /**
     *  导出用户列表excel
     * @param response  响应体
     * @param userList  用户列表
     * @throws ManageException
     */
    public void exportUsersExcel(HttpServletResponse response, List<User> userList) throws ManageException {
        try {
            String fileName = "健康小屋-用户列表";
            //设置下载
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="
                    + new String( fileName.getBytes("gb2312"), "ISO8859-1" )+".xlsx");
            OutputStream os = response.getOutputStream();
            //获取导出数据集
            JSONObject order = new JSONObject();
            order.put("id","asc");
            //写excel
            Workbook workbook = new XSSFWorkbook();
            int k=0;
            User metaData = null;
            int row=0;
            //创建Excel工作表 指定名称和位置
            String streetName = "健康小屋-用户列表";
            Sheet sheet = workbook.createSheet(streetName);
            addStaticCell(sheet);
            //添加数据元信息
            WritableCellFormat wc = new WritableCellFormat();
            wc.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN, Colour.SKY_BLUE);//边框
            for(int j=0;k<userList.size(); j++,k++){
                metaData = userList.get(k);
                row=j+1;
                ExcelUtils.addCellData(sheet,0,row,j+1+"");//序号
                ExcelUtils.addCellData(sheet,1,row, metaData.getId());//内部id
                ExcelUtils.addCellData(sheet,2,row, metaData.getLoginCode());//登录名
                ExcelUtils.addCellData(sheet,3,row, metaData.getName());//名称
                ExcelUtils.addCellData(sheet,4,row, metaData.getIdCardNo());//身份证
                ExcelUtils.addCellData(sheet,5,row, metaData.getGender());//性别
                ExcelUtils.addCellData(sheet,6,row, metaData.getTelephone());//电话
                ExcelUtils.addCellData(sheet,7,row, metaData.getAddress());//地区
                ExcelUtils.addCellData(sheet,8,row, metaData.getFacilityUsedCount().toString());//使用设施次数
            }
            //写入工作表
            workbook.write(os);
            workbook.close();
            os.flush();
            os.close();
        } catch (Exception e) {
            throw new ManageException("导出用户列表异常",e);
        }
    }
}

+ 101 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/util/facility/FacilityMsgReader.java

@ -0,0 +1,101 @@
package com.yihu.jw.healthyhouse.util.facility;
import com.yihu.jw.healthyhouse.util.facility.msg.FacilityMsg;
import com.yihu.jw.healthyhouse.util.poi.AExcelReader;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import java.util.*;
/**
 *  设施列表-excel解析类
 *
 * @author HZY
 * @vsrsion 1.0
 * Created at 2018/9/25.
 */
public class FacilityMsgReader extends AExcelReader {
    @Override
    public void read(Workbook rwb) throws Exception {
        try {
            Iterator<Sheet> sheets = rwb.sheetIterator();
            int j = 0, rows;
            FacilityMsg facilityMsg;
            while (sheets.hasNext()){
                Sheet sheet = sheets.next();
                if ((rows = sheet.getLastRowNum()) == 0) {
                    continue;
                }
                for (int i = 1; i <= rows; i++) {
                    facilityMsg = new FacilityMsg();
                    //设施编码
//                    if(null != getCellCont(sheet, i, 2)){
//                        //去除空格、回车、换行、制表符
//                        facilityMsg.setCode(replaceBlank(getCellCont(sheet, i, 1)));
//                    }else{
//                        facilityMsg.setCode(getCellCont(sheet, i, 1));
//                    }
                    //设施类型名称
                    if(null != getCellCont(sheet, i, 0)){
                        //去除空格、回车、换行、制表符
                        facilityMsg.setCategory(replaceBlank(getCellCont(sheet, i, 0)));
                    }else{
                        facilityMsg.setCategory(getCellCont(sheet, i, 0));
                    }
                    facilityMsg.setUserName(getCellCont(sheet, i, 1));
                    facilityMsg.setUserTelePhone(getCellCont(sheet, i, 2));
                    //省
                    if(null != getCellCont(sheet, i, 3)){
                        //去除空格、回车、换行、制表符
                        facilityMsg.setProvince(replaceBlank(getCellCont(sheet, i, 3)));
                    }else{
                        facilityMsg.setProvince(getCellCont(sheet, i, 3));
                    }
                    //市
                    if(null != getCellCont(sheet, i, 4)){
                        //去除空格、回车、换行、制表符
                        facilityMsg.setCity(replaceBlank(getCellCont(sheet, i, 4)));
                    }else{
                        facilityMsg.setCity(getCellCont(sheet, i, 4));
                    }
                    //区
                    if(null != getCellCont(sheet, i, 5)){
                        //去除空格、回车、换行、制表符
                        facilityMsg.setCounty(replaceBlank(getCellCont(sheet, i, 5)));
                    }else{
                        facilityMsg.setCounty(getCellCont(sheet, i, 5));
                    }
                    facilityMsg.setStreet(getCellCont(sheet, i, 6));
                    facilityMsg.setStatus(getCellCont(sheet, i, 7));
                    facilityMsg.setOrgName(getCellCont(sheet, i, 8));
                    facilityMsg.setServiceDate(getCellCont(sheet, i, 9));
                    facilityMsg.setServiceStartTime(getCellCont(sheet, i, 10));
                    facilityMsg.setServiceEndTime(getCellCont(sheet, i, 11));
                    facilityMsg.setLongitude(getCellCont(sheet, i, 12));
                    facilityMsg.setLatitude(getCellCont(sheet, i, 13));
                    facilityMsg.setExcelSeq(i);
                    correctLs.add(facilityMsg);
                }
                j++;
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        } finally {
            if (rwb != null) {
                rwb.close();
            }
        }
    }
}

+ 267 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/util/facility/msg/FacilityMsg.java

@ -0,0 +1,267 @@
package com.yihu.jw.healthyhouse.util.facility.msg;
import com.yihu.jw.util.excel.ExcelUtil;
import com.yihu.jw.util.excel.Validation;
import com.yihu.jw.util.excel.annotation.Location;
import com.yihu.jw.util.excel.annotation.Row;
import com.yihu.jw.util.excel.annotation.ValidRepeat;
import org.apache.commons.lang.StringUtils;
import java.util.Map;
import java.util.Set;
/**
 *  设施列表-excel实体类
 *
 * @author HZY
 * @vsrsion 1.0
 * Created at 2018/9/25.
 */
@Row
public class FacilityMsg extends ExcelUtil implements Validation {
    @Location(x=1)
    @ValidRepeat
    String code;
    @Location(x=2)
    String category;
    @Location(x=3)
    String userName;
    @Location(x=4)
    String userTelePhone;
    @Location(x=5)
    String province;
    @Location(x=6)
    String city;
    @Location(x=7)
    String county;
    @Location(x=8)
    String street;
    @Location(x=9)
    String status;
    @Location(x=10)
    String orgName;
    @Location(x=11)
    String serviceDate;
    @Location(x=12)
    String serviceStartTime;
    @Location(x=13)
    String serviceEndTime;
    @Location(x=14)
    String longitude; //经度
    @Location(x=15)
    String latitude; //纬度
    int hashCode;
    @Override
    public int validate(Map<String, Set> repeatMap) {
        int rs = 1;
//        if(!RegUtil.regCode(innerCode)){
//            rs = 0;
//            addErrorMsg("innerCode", RegUtil.codeMsg);
//        } else if(!repeatMap.get("innerCode").add(innerCode)) {
//            rs = 0;
//            addErrorMsg("innerCode", "内部代码重复!");
//        }
//
//        if(!RegUtil.regCode(code)){
//            rs = 0;
//            addErrorMsg("code", RegUtil.codeMsg);
//        }
//
//        if(!RegUtil.regLen(name)){
//            rs = 0;
//            addErrorMsg("name", RegUtil.lenMsg);
//        }else if(name.indexOf("'")!=-1){
//            rs = 0;
//            addErrorMsg("name", "不允许输入'");
//        }
//
//        if(!RegUtil.regLength2(0, 200, definition)){
//            rs = 0;
//            addErrorMsg("definition", "不得超过200个字符");
//        }
//
//        if(!RegUtil.regLength2(0, 10, type)){
//            rs = 0;
//            addErrorMsg("type", "不得超过10个字符");
//        }
//
//        if(!RegUtil.regLength2(0, 50, format)){
//            rs = 0;
//            addErrorMsg("format", "不得超过50个字符");
//        }
//
//        if(!RegUtil.regLength2(1, 64, columnName)){
//            rs = 0;
//            addErrorMsg("columnName", "请输入1~64个字符");
//        }else if(!repeatMap.get("columnName").add(columnName)){
//            rs = 0;
//            addErrorMsg("columnName", "列名重复");
//        }
//
//        if(!RegUtil.regLength2(0, 50, columnType)){
//            rs = 0;
//            addErrorMsg("columnType", "不得超过50个字符");
//        }
//
//        if(!RegUtil.regLength2(0, 15, columnLength)){
//            rs = 0;
//            addErrorMsg("columnLength", "不得超过15个字符");
//        }
//
//        if(StringUtils.isEmpty(primaryKey)){
//            primaryKey = "0";
//        }
//
//        if(!primaryKey.equals("0") && !primaryKey.equals("1")){
//            rs = 0;
//            addErrorMsg("primaryKey", "只允许输入0或1, 不填默认为0");
//        }
//
//        if(StringUtils.isEmpty(nullable)){
//            //该数据不填,默认为可以为空  nullable = "1"
//            nullable = "1";
//        }
//
//        if(!nullable.equals("0") && !nullable.equals("1")){
//            rs = 0;
//            addErrorMsg("nullable", "只允许输入0或1, 不填默认为1");
//        }else if(primaryKey.equals("1") && nullable.equals(primaryKey)){
//            addErrorMsg("nullable", "主键不允许为空");
//        }
        return rs;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getCategory() {
        return category;
    }
    public void setCategory(String category) {
        this.category = category;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String getUserTelePhone() {
        return userTelePhone;
    }
    public void setUserTelePhone(String userTelePhone) {
        this.userTelePhone = userTelePhone;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getStreet() {
        return street;
    }
    public void setStreet(String street) {
        this.street = street;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public int getHashCode() {
        return hashCode;
    }
    public void setHashCode(int hashCode) {
        this.hashCode = hashCode;
    }
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
    public String getCounty() {
        return county;
    }
    public void setCounty(String county) {
        this.county = county;
    }
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public String getServiceDate() {
        return serviceDate;
    }
    public void setServiceDate(String serviceDate) {
        this.serviceDate = serviceDate;
    }
    public String getServiceStartTime() {
        return serviceStartTime;
    }
    public void setServiceStartTime(String serviceStartTime) {
        this.serviceStartTime = serviceStartTime;
    }
    public String getServiceEndTime() {
        return serviceEndTime;
    }
    public void setServiceEndTime(String serviceEndTime) {
        this.serviceEndTime = serviceEndTime;
    }
    public String getLongitude() {
        return longitude;
    }
    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }
    public String getLatitude() {
        return latitude;
    }
    public void setLatitude(String latitude) {
        this.latitude = latitude;
    }
}

+ 69 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/util/poi/AExcelReader.java

@ -0,0 +1,69 @@
package com.yihu.jw.healthyhouse.util.poi;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.InputStream;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public abstract class AExcelReader {
    protected List errorLs = new ArrayList<>();
    protected List correctLs = new ArrayList<>();
    protected Map<String, Set> repeat = new HashMap<>();
//    public abstract void read(Workbook rwb) throws Exception;
    public abstract void read(Workbook rwb) throws Exception;
    public void read(MultipartFile file) throws Exception {
        read(ExcelUtils.getWorkBook(file));
    }
    public static String replaceBlank(String str) {
        String dest = "";
        if (str!=null) {
            str = str.replaceAll("\\u00A0" ," ");
            //去除字符串中的空格、回车、换行符、制表符
            Pattern p = Pattern.compile("\\s*|\t|\r|\n");
            Matcher m = p.matcher(str);
            dest = m.replaceAll("");
        }
        return dest;
    }
    protected String getCellCont(Sheet sheet, int row, int col){
        Cell cell = sheet.getRow(row).getCell(col);
        return ExcelUtils.getCellValue(cell);
    }
    public List getErrorLs() {
        return errorLs;
    }
    public void setErrorLs(List errorLs) {
        this.errorLs = errorLs;
    }
    public List getCorrectLs() {
        return correctLs;
    }
    public void setCorrectLs(List correctLs) {
        this.correctLs = correctLs;
    }
    public Map<String, Set> getRepeat() {
        return repeat;
    }
    public void setRepeat(Map<String, Set> repeat) {
        this.repeat = repeat;
    }
}

+ 71 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/util/poi/AExcelWriter.java

@ -0,0 +1,71 @@
package com.yihu.jw.healthyhouse.util.poi;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.ss.usermodel.*;
import java.io.File;
import java.util.List;
public abstract class AExcelWriter {
    public abstract void write(Workbook wwb, List ls, File file) throws Exception;
//    public void write(OutputStream os, List ls) throws Exception{
//        write(Workbook.createWorkbook(os), ls);
//    };
    public void write( File file, List ls) throws Exception{
        write(ExcelUtils.getWorkBook(file),ls,file);
    };
    //添加单元格内容
    public void addCell(Sheet ws, int row, int column, String data )  {
        Row row1 = ws.getRow(row) ;
        row1 = row1==null? ws.createRow(row) : row1;
        Cell cell = row1.createCell(column);
        cell.setCellType(HSSFCell.CELL_TYPE_STRING);
        cell.setCellValue(data);
    }
    //添加单元格内容
    public  void addCell(Sheet ws, int row, int column, String data , String memo)  {
        Row row1 = ws.getRow(row) ;
        row1 = row1==null? ws.createRow(row) : row1;
        Cell cell = row1.createCell(column);
        cell.setCellValue(data);
    }
    //添加单元格内容
    public void addCell(Workbook wb,Sheet ws, int row, int column, String data, String memo)  {
        //1.得到一个POI的工具类
        CreationHelper factory = wb.getCreationHelper();
        //2 得到一个换图的对象
        Drawing drawing = ws.createDrawingPatriarch();
        //3. ClientAnchor是附属在WorkSheet上的一个对象,  其固定在一个单元格的左上角和右下角.
        ClientAnchor anchor = factory.createClientAnchor();
        //4  获取行
        Row row1 = ws.getRow(row) ;
        row1 = row1==null? ws.createRow(row) : row1;
        Cell cell = row1.createCell(column);
        cell.setCellValue(data);
        //5 设置注释
        anchor.setCol1(cell.getColumnIndex());
        anchor.setCol2(cell.getColumnIndex() + 2);
        anchor.setRow1(row1.getRowNum());
        anchor.setRow2(row1.getRowNum() + 3);
        if(!StringUtils.isEmpty(memo)){
            Comment comment0 = drawing.createCellComment(anchor);
            RichTextString richTextString = factory.createRichTextString(memo);
            comment0.setString(richTextString);
            cell.setCellComment(comment0);
        }
    }
}

+ 546 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/util/poi/ExcelUtils.java

@ -0,0 +1,546 @@
package com.yihu.jw.healthyhouse.util.poi;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * excel 工具类
 *
 * @author HZY
 * @vsrsion 1.0
 * Created at 2017/3/2.
 */
public class ExcelUtils extends AExcelWriter {
    private static Logger logger = LoggerFactory.getLogger(ExcelUtils.class);
    private final static String xls = "xls";
    private final static String xlsx = "xlsx";
    /**
     * 总行数
     */
    private int totalRows = 0;
    /**
     * 总列数
     */
    private int totalCells = 0;
    public int getTotalRows() {
        return totalRows;
    }
    public int getTotalCells() {
        return totalCells;
    }
    /**
     * 创建Excel文档
     *
     * @return
     */
    public static HSSFWorkbook createWorkBook() {
        return new HSSFWorkbook();
    }
    /**
     * 创建sheet
     *
     * @param wb
     * @param sheetName
     * @return
     */
    public static HSSFSheet createSheet(HSSFWorkbook wb, String sheetName) {
        return wb.createSheet(sheetName);
    }
    /**
     * 创建一行多列
     *
     * @param sheet
     * @param rowNum
     * @param columnNum
     * @param cellStyle
     * @return
     */
    public static HSSFRow createRow(HSSFSheet sheet, int rowNum, int columnNum, HSSFCellStyle cellStyle) {
        HSSFRow row = sheet.createRow(rowNum);
        if (columnNum > 0) {
            for (int i = 0; i < columnNum; i++) {
                HSSFCell cell = row.createCell(i);
                if (cellStyle != null) {
                    cell.setCellStyle(cellStyle);
                }
            }
        }
        return row;
    }
    /**
     * 创建多行多列
     *
     * @param sheet`
     * @param rowNum
     * @param rowCount
     * @param columnNum
     * @param cellStyle
     * @return
     */
    public static boolean createRows(HSSFSheet sheet, int rowNum, int rowCount, int columnNum, HSSFCellStyle cellStyle) {
        for (int i = 0; i < rowCount; i++) {
            HSSFRow row = sheet.createRow(rowNum + i);
            if (columnNum > 0) {
                for (int j = 0; j < columnNum; j++) {
                    HSSFCell cell = row.createCell(j);
                    if (cellStyle != null) {
                        cell.setCellStyle(cellStyle);
                    }
                }
            }
        }
        return true;
    }
    /**
     * 合并单元格
     *
     * @param sheet
     * @param firstRow
     * @param lastRow
     * @param firstCol
     * @param lastCol
     * @return
     */
    public static int mergeRegion(HSSFSheet sheet, int firstRow, int lastRow, int firstCol, int lastCol) {
        int num = sheet.addMergedRegion(new CellRangeAddress(firstRow, lastRow, firstCol, lastCol));
        return num;
    }
    /**
     * 创建单元格样式
     *
     * @param wb
     * @param align
     * @param bold
     * @param border
     * @param backColor
     * @return
     */
    public static HSSFCellStyle createCellStyle(HSSFWorkbook wb, short align, boolean bold, boolean border, short backColor) {
        HSSFCellStyle style = wb.createCellStyle();
        //字体
        HSSFFont font = wb.createFont();
        font.setBold(bold);
        font.setFontName("宋体");
        font.setFontHeight((short) 220);
        style.setFont(font);
        //设置对齐
//        style.setAlignment(align);
//        style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
        if (border) {
            // 设置边框
//            style.setBottomBorderColor(HSSFColor.BLACK.index);
//            style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
//            style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
//            style.setBorderRight(HSSFCellStyle.BORDER_THIN);
//            style.setBorderTop(HSSFCellStyle.BORDER_THIN);
        }
        if (backColor > 0) {
            style.setFillBackgroundColor((short) backColor);
        }
        return style;
    }
    /* **************************************** Excel 读取 *************************************************************** */
    /**
     * 读取Excel内容
     *
     * @param is       Excel文件流
     * @param fileName excel文件名,包括后缀
     * @return
     * @throws IOException
     */
    public static List<Map<Object, Object>> readExcel(InputStream is, String fileName) throws IOException {
        List<Map<Object, Object>> list = null;
        boolean isExcel2007 = isExcel2007(fileName);
        if (isExcel2007) {
            list = readExcel2007(is);
        } else {
            list = readExcel2003(is);
        }
        return list;
    }
    /**
     *  读取Excel2003内容
     * @param is  Excel文件流
     * @return
     * @throws IOException
     */
    public static List<Map<Object, Object>> readExcel2003(InputStream is) throws IOException {
        HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
        Map<Object, Object> student = null;
        List<Map<Object, Object>> list = new ArrayList<Map<Object, Object>>();
        // 循环工作表Sheet
        for (int numSheet = 0; numSheet < hssfWorkbook.getNumberOfSheets(); numSheet++) {
            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(numSheet);
            if (hssfSheet == null) {
                continue;
            }
            //获取表头字段
            HSSFRow columnName = hssfSheet.getRow(0);
            // 循环行Row
            for (int rowNum = 1; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow != null) {
                    student = setCellVal(columnName, hssfRow);
                    list.add(student);
                }
            }
        }
        return list;
    }
    /**
     * 获取Excel单元格的值
     * @param hssfCell  单元格对象
     * @return
     */
    @SuppressWarnings("static-access")
    public static Object getExcelValue(HSSFCell hssfCell) {
        if(hssfCell==null){
            return null;
        }else  if (hssfCell.getCellType() == hssfCell.CELL_TYPE_BOOLEAN) {
            // 返回布尔类型的值
            return hssfCell.getBooleanCellValue();
        } else if (hssfCell.getCellType() == hssfCell.CELL_TYPE_NUMERIC) {
            // 返回数值类型的值
            return (int)hssfCell.getNumericCellValue();
        } else {
            // 返回字符串类型的值
            return hssfCell.getStringCellValue();
        }
    }
    /**
     * 获取Excel2007的内容
     * @param is    输入流
     * @return
     */
    public static List<Map<Object, Object>> readExcel2007(InputStream is) {
        XSSFWorkbook hssfWorkbook = null;
        List<Map<Object, Object>> list = new ArrayList<Map<Object, Object>>();
        try {
            hssfWorkbook = new XSSFWorkbook(is);
            Map<Object, Object> result = null;
            // 循环工作表Sheet
            for (int numSheet = 0; numSheet < hssfWorkbook.getNumberOfSheets(); numSheet++) {
                XSSFSheet xssfSheet = hssfWorkbook.getSheetAt(numSheet);
                if (xssfSheet == null) {
                    continue;
                }
                //获取表头字段
                XSSFRow columnName = xssfSheet.getRow(0);
                // 循环行Row
                for (int rowNum = 1; rowNum <= xssfSheet.getLastRowNum(); rowNum++) {
                    XSSFRow hssfRow = xssfSheet.getRow(rowNum);
                    if (hssfRow != null) {
                        result = setCellVal(columnName, hssfRow);
                        list.add(result);
                    }
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return list;
    }
    @SuppressWarnings("static-access")
    public static Object getExcelValue(XSSFCell xssfCell) {
        if(xssfCell==null){
            return null;
        }else if (xssfCell.getCellType() == xssfCell.CELL_TYPE_BOOLEAN) {
            // 返回布尔类型的值
            return xssfCell.getBooleanCellValue();
        } else if (xssfCell.getCellType() == xssfCell.CELL_TYPE_NUMERIC) {
            // 返回数值类型的值
            return (int)xssfCell.getNumericCellValue();
        } else {
            // 返回字符串类型的值
            return xssfCell.getStringCellValue();
        }
    }
    public static Map<Object, Object> setCellVal(XSSFRow names, XSSFRow values) {
        Map<Object, Object> map = new HashMap<>();
        Object name = null;
        Object value = null;
        for (int i = 0; i < names.getLastCellNum(); i++) {
            name = getExcelValue(names.getCell(i));
            value = getExcelValue(values.getCell(i));
            map.put(name, value);
        }
        return map;
    }
    public static Map<Object, Object> setCellVal(HSSFRow names, HSSFRow values) {
        Map<Object, Object> map = new HashMap<>();
        Object name = null;
        Object value = null;
        for (int i = 0; i < names.getLastCellNum(); i++) {
            name = getExcelValue(names.getCell(i));
            value = getExcelValue(values.getCell(i));
            map.put(name, value);
        }
        return map;
    }
    public static boolean isExcel2007(String filePath) {
        return filePath.matches("^.+\\.(?i)(xlsx)$");
    }
    /* ********************************  重写poi,2018-05-16 by hzy   ******************************************* */
    /**
     * 获取excel对象
     * @param file
     * @return
     */
    public static Workbook getWorkBook(MultipartFile file) {
        //获得文件名
        String fileName = file.getOriginalFilename();
        //创建Workbook工作薄对象,表示整个excel
        Workbook workbook = null;
        try {
            //获取excel文件的io流
            InputStream is = file.getInputStream();
            //根据文件后缀名不同(xls和xlsx)获得不同的Workbook实现类对象
            if(fileName.toLowerCase().endsWith(xls)){
                //2003
                workbook = new HSSFWorkbook(is);
            }else if(fileName.toLowerCase().endsWith(xlsx)){
                //2007
                workbook = new XSSFWorkbook(is);
            }
        } catch (IOException e) {
            e.printStackTrace();
            logger.info(e.getMessage());
        }
        return workbook;
    }
    /**
     * 获取Excel的内容
     * @param file    上传的文件
     * @return
     */
    public static List<Map<Object, Object>> readExcel (File file) {
        Workbook workBook = null;
        List<Map<Object, Object>> list = new ArrayList<Map<Object, Object>>();
        try {
            workBook = getWorkBook(file);
            Map<Object, Object> result = null;
            // 循环工作表Sheet
            for (int numSheet = 0; numSheet < workBook.getNumberOfSheets(); numSheet++) {
                Sheet sheet = workBook.getSheetAt(numSheet);
                if (sheet == null) {
                    continue;
                }
                //获取表头字段
                Row columnName = sheet.getRow(0);
                // 循环行Row
                for (int rowNum = 1; rowNum <= sheet.getLastRowNum(); rowNum++) {
                    Row hssfRow = sheet.getRow(rowNum);
                    if (hssfRow != null) {
                        result = setCellVal(columnName, hssfRow);
                        list.add(result);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }
    /**
     * 设置单元格值
     * @param names
     * @param values
     * @return
     */
    public static Map<Object, Object> setCellVal(Row names, Row values) {
        Map<Object, Object> map = new HashMap<>();
        Object name = null;
        Object value = null;
        for (int i = 0; i < names.getLastCellNum(); i++) {
            name = getCellValue(names.getCell(i));
            value = getCellValue(values.getCell(i));
            map.put(name, value);
        }
        return map;
    }
    /**
     * 获取excel对象
     * @param file
     * @return
     */
    public static Workbook getWorkBook(File file) throws IOException {
        //创建Workbook工作薄对象,表示整个excel
        Workbook workbook = null;
        FileOutputStream fileOut = null;
        try {
            //获得文件名
            String fileName = file.getName();
            //创建excel文件的out流
             fileOut = new FileOutputStream(file);
            //根据文件后缀名不同(xls和xlsx)获得不同的Workbook实现类对象
            if(fileName.toLowerCase().endsWith(xls)){
                //2003
                workbook = new HSSFWorkbook();
            }else if(fileName.toLowerCase().endsWith(xlsx)){
                //2007
                workbook = new XSSFWorkbook();
            }
            workbook.write(fileOut);
        } catch (IOException e) {
            e.printStackTrace();
            logger.info(e.getMessage());
        }finally {
            if (fileOut!=null){
                fileOut.flush();
                fileOut.close();
            }
        }
        return workbook;
    }
    /**
     * 获取excel对象
     * @param is
     * @return
     */
    public static Workbook getWorkBook(String fileName,InputStream is) {
        //创建Workbook工作薄对象,表示整个excel
        Workbook workbook = null;
        try {
            //根据文件后缀名不同(xls和xlsx)获得不同的Workbook实现类对象
            if(fileName.toLowerCase().endsWith(xls)){
                //2003
                workbook = new HSSFWorkbook(is);
            }else if(fileName.toLowerCase().endsWith(xlsx)){
                //2007
                workbook = new XSSFWorkbook(is);
            }
        } catch (IOException e) {
            logger.info(e.getMessage());
        }
        return workbook;
    }
    /**
     *   获取单元格值
     * @param cell     excel单元格对象
     * @return
     */
    public static String getCellValue(Cell cell){
        String cellValue = "";
        if(cell == null){
            return cellValue;
        }
        //把数字当成String来读,避免出现1读成1.0的情况
        if(cell.getCellType() == Cell.CELL_TYPE_NUMERIC){
            cell.setCellType(Cell.CELL_TYPE_STRING);
        }
        //判断数据的类型
        switch (cell.getCellType()){
            case Cell.CELL_TYPE_NUMERIC: //数字
                cellValue = String.valueOf(cell.getNumericCellValue());
                break;
            case Cell.CELL_TYPE_STRING: //字符串
                cellValue = String.valueOf(cell.getStringCellValue());
                break;
            case Cell.CELL_TYPE_BOOLEAN: //Boolean
                cellValue = String.valueOf(cell.getBooleanCellValue());
                break;
            case Cell.CELL_TYPE_FORMULA: //公式
                cellValue = String.valueOf(cell.getCellFormula());
                break;
            case Cell.CELL_TYPE_BLANK: //空值
                cellValue = "";
                break;
            case Cell.CELL_TYPE_ERROR: //故障
                cellValue = "非法字符";
                break;
            default:
                cellValue = "未知类型";
                break;
        }
        return cellValue;
    }
    public void addCell(Sheet ws, int row, int column, String data )  {
        Row row1 = ws.createRow(row);
        Cell cell = row1.createCell(column);
        cell.setCellType(HSSFCell.CELL_TYPE_STRING);
        cell.setCellValue(data);
    }
    //添加单元格内容
    public static void addCellData(Sheet sheet, int column, int row, String data){
        Row sheetRow = sheet.getRow(row);
        if(sheetRow==null){
            sheetRow = sheet.createRow(row);
        }
        Cell cell= sheetRow.createCell(column);
        cell.setCellValue(data);
    }
    //添加单元格内容带样式
    public static void addCellData(Sheet sheet, int column, int row, String data, CellStyle cellStyle){
        Row sheetRow = sheet.getRow(row);
        if(sheetRow==null){
            sheetRow = sheet.createRow(row);
        }
        Cell cell= sheetRow.createCell(column);
        cell.setCellValue(data);
        cell.setCellStyle(cellStyle);
    }
    @Override
    public void write(Workbook wwb, List ls, File file) throws Exception {
    }
}

+ 5 - 4
svr/svr-healthy-house/src/main/resources/application.yml

@ -7,9 +7,6 @@ security:
    enabled: false
spring:
  application:
    name:  svr-healthy-house
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    max-active: 50
@ -83,16 +80,20 @@ jw:
---
spring:
  profiles: jwtest
  profiles: test
  datasource:
    url: jdbc:mysql://172.19.103.77:3306/healthy_house?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: root
    password: 123456
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
jw:
  smsUrl: http://svr-base:10020/sms_gateway/send
---
spring:
  profiles: jwprod
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
jw:
  smsUrl: http://svr-base:10020/sms_gateway/send

+ 3 - 2
svr/svr-healthy-house/src/main/resources/bootstrap.yml

@ -1,4 +1,6 @@
spring:
  application:
    name:  svr-healthy-house
  #从发现服务里面取配置服务的信息
  cloud:
    config:
@ -9,7 +11,6 @@ spring:
        enabled: true #使用发现服务
        service-id: svr-configurations #配置服务的名字
---
spring:
  profiles: jwdev
@ -23,7 +24,7 @@ eureka:
---
spring:
  profiles: jwtest
  profiles: test
eureka:

+ 6 - 0
wlyy-parent-pom/pom.xml

@ -96,6 +96,7 @@
        <version.zxing>3.2.0</version.zxing>
        <version.fastdfs>1.25</version.fastdfs>
        <version.poi>3.17</version.poi>
        <version.jxl>2.6.10</version.jxl>
        <!-- Version end -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -292,6 +293,11 @@
                <artifactId>poi-ooxml-schemas</artifactId>
                <version>${version.poi}</version>
            </dependency>
            <dependency>
                <groupId>net.sourceforge.jexcelapi</groupId>
                <artifactId>jxl</artifactId>
                <version>${version.jxl}</version>
            </dependency>
            <!--   poi xml导入导出工具 end -->
            <!-- Zipkin 日志追踪 -->