jzdsh před 4 roky
rodič
revize
aef32a6bb8

+ 34 - 4
src/main/java/com/yc/education/controller/admin/AdminsBackController.java

@@ -60,6 +60,9 @@ public class AdminsBackController extends BaseController {
     @Autowired
     private IUserInfoService iUserInfoService;//用户
 
+    @Autowired
+    private ICityService iCityService;
+
     /**
      * 跳转到后台管理登录页面   Lock-玄清
      *
@@ -578,18 +581,45 @@ public class AdminsBackController extends BaseController {
         return pathString;
     }
 
-
+    /**
+     * 省市导出
+     * @param response
+     */
     @RequestMapping("cityExport.html")
     public void cityExport(HttpServletResponse response){
 
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet  sheet = wb.createSheet("省市信息表");
-        HSSFRow row = sheet.createRow(0);
-        HSSFCell cell = row.createCell(0);
+        HSSFRow row;
+        row= sheet.createRow(0);
+        HSSFCell cell;
+        cell= row.createCell(0);
         sheet.addMergedRegion(new CellRangeAddress(0,0,0,3));
         cell.setCellValue("省市信息");
-        OutputStream  outputStream = null;
 
+        List<City> list = iCityService.provinceList();
+
+        for (int i=0;i<list.size();i++){
+            row = sheet.createRow(i+1);
+            sheet.setColumnWidth(i,20*256);
+            row.createCell(0).setCellValue(list.get(i).getAddrName());
+
+            List<City> cityList = iCityService.cityList(list.get(i).getAddrCode());
+            for (int j = 2; j <= cityList.size() + 1; j++) {
+                row.createCell(j-1).setCellValue(cityList.get(j - 2).getAddrName());
+            }
+        }
+     /*  if (list.size()!=0) {
+            for (int k = 0;k<list.size();k++) {
+                List<City> cityList = iCityService.cityList(list.get(k).getAddrCode());
+                for (int j = 2; j <= cityList.size() + 1; j++) {
+                    row.getRowNum();
+                    row.createCell(j).setCellValue(cityList.get(j - 2).getAddrName());
+                }
+            }
+       }*/
+
+        OutputStream  outputStream = null;
         try {
             response.setContentType("application/msexcel");
             response.setHeader("Content-Disposition", "attachment;filename=" + new String("省市信息表.xls".getBytes("utf-8"), "ISO-8859-1"));

+ 234 - 0
src/main/java/com/yc/education/controller/admin/CommercialCarTypeController.java

@@ -0,0 +1,234 @@
+package com.yc.education.controller.admin;
+
+import com.yc.education.model.CommercialCarType;
+import com.yc.education.model.Provider;
+import com.yc.education.service.ICommercialCarTypeService;
+import com.yc.education.util.AjaxMessage;
+import com.yc.education.util.MapUtils;
+import com.yc.education.util.PinYin2Abbreviation;
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @ClassName CommercialCarTypeController  商用车车型数据导入
+ * @Description TODO
+ * @Author QuZhangJing
+ * @Date 2019/12/19 9:35
+ * @Version 1.0
+ */
+@Controller
+@RequestMapping("admin")
+public class CommercialCarTypeController {
+
+    @Autowired
+    private ICommercialCarTypeService iCommercialCarTypeService;
+
+    @RequestMapping("commercialCarTypeExcel.html")
+    public ModelAndView commercialCarTypeExcel(){
+        return new ModelAndView();
+    }
+
+
+    @ResponseBody
+    @RequestMapping("commercialCarTypeExcelIn.html")
+    public AjaxMessage< Object > providerExcelIn(String url, HttpServletRequest request) throws IOException {
+
+        System.err.println("url:" + url);
+
+        Date begindata = new Date( );
+
+        String contextPath = request.getSession( ).getServletContext( ).getContextPath( );
+
+        List<CommercialCarType> list = new ArrayList< CommercialCarType>();
+
+        if (url.endsWith(".xls")) {
+            //2003版本的excel,用.xls结尾
+
+            InputStream is = new FileInputStream(url);
+            //得到工作簿
+
+            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
+            //表格
+
+            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
+
+            for (int rowNum = 1; rowNum <= hssfSheet.getLastRowNum( ); rowNum++) {
+                HSSFRow hssfRow = (HSSFRow) hssfSheet.getRow(rowNum);
+                //获取表格数据
+                if (hssfRow != null) {
+                    CommercialCarType commercialCarType = new CommercialCarType();
+                    commercialCarType.setKind(getValue(hssfRow.getCell(0)));
+                    commercialCarType.setFactory(getValue(hssfRow.getCell(1)));
+                    commercialCarType.setBrand(getValue(hssfRow.getCell(2)));
+                    commercialCarType.setSaleVersion(getValue(hssfRow.getCell(3)));
+                    commercialCarType.setNoticeType(getValue(hssfRow.getCell(4)));
+                    commercialCarType.setNoticeBatch(getValue(hssfRow.getCell(5)));
+                    commercialCarType.setEngineType(getValue(hssfRow.getCell(6)));
+                    commercialCarType.setFuelKind(getValue(hssfRow.getCell(7)));
+                    commercialCarType.setBlowdownStandard(getValue(hssfRow.getCell(8)));
+                    commercialCarType.setBrandLetter(PinYin2Abbreviation.cn2py(commercialCarType.getBrand().substring(0,1)).toUpperCase());
+                    commercialCarType.setCreateDate(new Date());
+                    list.add(commercialCarType);
+                }
+
+            }
+        } else {
+            FileInputStream fis = new FileInputStream(url);
+            //2007版本的excel,用.xlsx结尾
+            Workbook wookbook = new XSSFWorkbook(fis);//得到工作簿
+
+            //得到一个工作表
+            Sheet sheet = wookbook.getSheetAt(0);
+            //获得数据的总行数
+            int totalRowNum = sheet.getLastRowNum( );
+            //获得所有数据
+            for (int i = 1; i <= totalRowNum; i++) {
+                //获得第i行对象
+                Row row = sheet.getRow(i);
+                //获取表格数据
+                CommercialCarType commercialCarType = new CommercialCarType();
+                commercialCarType.setKind(getValue(row.getCell(0)));
+                commercialCarType.setFactory(getValue(row.getCell(1)));
+                commercialCarType.setBrand(getValue(row.getCell(2)));
+                commercialCarType.setSaleVersion(getValue(row.getCell(3)));
+                commercialCarType.setNoticeType(getValue(row.getCell(4)));
+                commercialCarType.setNoticeBatch(getValue(row.getCell(5)));
+                commercialCarType.setEngineType(getValue(row.getCell(6)));
+                commercialCarType.setFuelKind(getValue(row.getCell(7)));
+                commercialCarType.setBlowdownStandard(getValue(row.getCell(8)));
+                commercialCarType.setBrandLetter(PinYin2Abbreviation.cn2py(commercialCarType.getBrand().substring(0,1)).toUpperCase());
+                commercialCarType.setCreateDate(new Date());
+                list.add(commercialCarType);
+            }
+        }
+        //批量导入数据
+        if (list.size( ) != 0) {
+            for (int i = 0; i < list.size( ) / 400 + 1; i++) {
+                int end = (i + 1) * 400;
+                if (end >= list.size( )) {
+                    end = list.size( );
+                }
+                List< CommercialCarType > serviceList = list.subList(i * 400, end);
+                if (serviceList != null && serviceList.size( ) > 0) {
+                    iCommercialCarTypeService.addByList(serviceList);
+
+                }
+            }
+        }
+        Date endtime = new Date( );
+        System.err.println("耗时:" + (endtime.getTime( ) - begindata.getTime( )));
+        AjaxMessage< Object > ajax = new AjaxMessage<>( );
+        //删除重复的
+        List< String > repeatList = iCommercialCarTypeService.queryId( );
+        iCommercialCarTypeService.deleteByRepeat(repeatList);
+        return ajax;
+
+
+    }
+
+    @SuppressWarnings({"static-access"})
+    public static String getValue(Cell cell) {
+        String value = "";
+        if (null == cell) {
+            return value;
+        }
+        switch (cell.getCellType( )) {
+            //数值型
+            case Cell.CELL_TYPE_NUMERIC:
+                if (HSSFDateUtil.isCellDateFormatted(cell)) {// 处理日期格式、时间格式
+                    SimpleDateFormat sdf = null;
+                    if (cell.getCellStyle( ).getDataFormat( ) == HSSFDataFormat
+                            .getBuiltinFormat("h:mm")) {
+                        sdf = new SimpleDateFormat("HH:mm");
+                    } else {// 日期
+                        sdf = new SimpleDateFormat("yyyy/MM/dd");
+                    }
+                    Date date = cell.getDateCellValue( );
+                    value = sdf.format(date);
+                    break;
+                } else {
+
+                    value = String.valueOf(cell.getNumericCellValue( ));
+
+                    String isdouble[] = value.split("\\.");
+                    if (value.length( ) > 3) {
+                        DecimalFormat df = new DecimalFormat("0");
+                        String whatYourWant = df.format(cell.getNumericCellValue( ));
+                        value = whatYourWant;
+                    } else if (isdouble.length > 1) {
+                        if ("0".equals(isdouble[1])) {
+                            DecimalFormat df = new DecimalFormat("0");
+                            String whatYourWant = df.format(cell.getNumericCellValue( ));
+                            value = whatYourWant;
+                        } else {
+                            double d = Double.valueOf(value);
+                            d = getdouble(d);
+                            value = Double.toString(d);
+                        }
+                    }
+                    break;
+                }
+                //字符串类型
+            case Cell.CELL_TYPE_STRING:
+                value = cell.getStringCellValue( ).toString( );
+                break;
+            // 公式类型
+            case Cell.CELL_TYPE_FORMULA:
+                //读公式计算值
+                value = String.valueOf(cell.getNumericCellValue( ));
+                if (value.equals("NaN")) {// 如果获取的数据值为非法值,则转换为获取字符串
+                    value = cell.getStringCellValue( ).toString( );
+                }
+                break;
+            // 布尔类型
+            case Cell.CELL_TYPE_BOOLEAN:
+                value = " " + cell.getBooleanCellValue( );
+                break;
+            // 空值
+            case Cell.CELL_TYPE_BLANK:
+                value = "";
+
+                break;
+            // 故障
+            case Cell.CELL_TYPE_ERROR:
+                value = "";
+                break;
+            default:
+                value = cell.getStringCellValue( ).toString( );
+        }
+        if ("null".endsWith(value.trim( ))) {
+            value = "";
+        }
+        return value;
+    }
+
+
+    public static double getdouble(double d) {
+        BigDecimal b = new BigDecimal(d);
+        double f1 = b.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue( );
+        return f1;
+    }
+
+    //=================   适用poi导入表格数据   结束  ===========================
+
+}

+ 16 - 0
src/main/java/com/yc/education/mapper/CommercialCarTypeMapper.java

@@ -0,0 +1,16 @@
+package com.yc.education.mapper;
+
+import com.yc.education.model.CommercialCarType;
+import com.yc.education.util.MyMapper;
+import org.apache.ibatis.annotations.Param;
+import tk.mybatis.mapper.common.Mapper;
+
+import java.util.List;
+
+public interface CommercialCarTypeMapper extends MyMapper<CommercialCarType> {
+    int addByList(@Param("list") List<CommercialCarType> list);
+
+    List<String> queryId();
+
+    int deleteByRepeat(@Param("list") List<String> list);
+}

+ 293 - 0
src/main/java/com/yc/education/model/CommercialCarType.java

@@ -0,0 +1,293 @@
+package com.yc.education.model;
+
+import java.util.Date;
+import javax.persistence.*;
+
+@Table(name = "commercial_car_type")
+public class CommercialCarType {
+    /**
+     * 商用车车型数据表主键
+     */
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Long id;
+
+    /**
+     * 类别
+     */
+    private String kind;
+
+    /**
+     * 生产厂家
+     */
+    private String factory;
+
+    /**
+     * 品牌
+     */
+    private String brand;
+
+    /**
+     * 销售版本
+     */
+    @Column(name = "sale_version")
+    private String saleVersion;
+
+    /**
+     * 公告型号
+     */
+    @Column(name = "notice_type")
+    private String noticeType;
+
+    /**
+     * 公告批次
+     */
+    @Column(name = "notice_batch")
+    private String noticeBatch;
+
+    /**
+     * 发动机型号
+     */
+    @Column(name = "engine_type")
+    private String engineType;
+
+    /**
+     * 燃料种类
+     */
+    @Column(name = "fuel_kind")
+    private String fuelKind;
+
+    /**
+     * 排放标准
+     */
+    @Column(name = "blowdown_standard")
+    private String blowdownStandard;
+
+    /**
+     * 品牌首字母
+     */
+    @Column(name = "brand_letter")
+    private String brandLetter;
+
+    /**
+     * 创建时间
+     */
+    @Column(name = "create_date")
+    private Date createDate;
+
+    /**
+     * 获取商用车车型数据表主键
+     *
+     * @return id - 商用车车型数据表主键
+     */
+    public Long getId() {
+        return id;
+    }
+
+    /**
+     * 设置商用车车型数据表主键
+     *
+     * @param id 商用车车型数据表主键
+     */
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取类别
+     *
+     * @return kind - 类别
+     */
+    public String getKind() {
+        return kind;
+    }
+
+    /**
+     * 设置类别
+     *
+     * @param kind 类别
+     */
+    public void setKind(String kind) {
+        this.kind = kind;
+    }
+
+    /**
+     * 获取生产厂家
+     *
+     * @return factory - 生产厂家
+     */
+    public String getFactory() {
+        return factory;
+    }
+
+    /**
+     * 设置生产厂家
+     *
+     * @param factory 生产厂家
+     */
+    public void setFactory(String factory) {
+        this.factory = factory;
+    }
+
+    /**
+     * 获取品牌
+     *
+     * @return brand - 品牌
+     */
+    public String getBrand() {
+        return brand;
+    }
+
+    /**
+     * 设置品牌
+     *
+     * @param brand 品牌
+     */
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    /**
+     * 获取销售版本
+     *
+     * @return sale_version - 销售版本
+     */
+    public String getSaleVersion() {
+        return saleVersion;
+    }
+
+    /**
+     * 设置销售版本
+     *
+     * @param saleVersion 销售版本
+     */
+    public void setSaleVersion(String saleVersion) {
+        this.saleVersion = saleVersion;
+    }
+
+    /**
+     * 获取公告型号
+     *
+     * @return notice_type - 公告型号
+     */
+    public String getNoticeType() {
+        return noticeType;
+    }
+
+    /**
+     * 设置公告型号
+     *
+     * @param noticeType 公告型号
+     */
+    public void setNoticeType(String noticeType) {
+        this.noticeType = noticeType;
+    }
+
+    /**
+     * 获取公告批次
+     *
+     * @return notice_batch - 公告批次
+     */
+    public String getNoticeBatch() {
+        return noticeBatch;
+    }
+
+    /**
+     * 设置公告批次
+     *
+     * @param noticeBatch 公告批次
+     */
+    public void setNoticeBatch(String noticeBatch) {
+        this.noticeBatch = noticeBatch;
+    }
+
+    /**
+     * 获取发动机型号
+     *
+     * @return engine_type - 发动机型号
+     */
+    public String getEngineType() {
+        return engineType;
+    }
+
+    /**
+     * 设置发动机型号
+     *
+     * @param engineType 发动机型号
+     */
+    public void setEngineType(String engineType) {
+        this.engineType = engineType;
+    }
+
+    /**
+     * 获取燃料种类
+     *
+     * @return fuel_kind - 燃料种类
+     */
+    public String getFuelKind() {
+        return fuelKind;
+    }
+
+    /**
+     * 设置燃料种类
+     *
+     * @param fuelKind 燃料种类
+     */
+    public void setFuelKind(String fuelKind) {
+        this.fuelKind = fuelKind;
+    }
+
+    /**
+     * 获取排放标准
+     *
+     * @return blowdown_standard - 排放标准
+     */
+    public String getBlowdownStandard() {
+        return blowdownStandard;
+    }
+
+    /**
+     * 设置排放标准
+     *
+     * @param blowdownStandard 排放标准
+     */
+    public void setBlowdownStandard(String blowdownStandard) {
+        this.blowdownStandard = blowdownStandard;
+    }
+
+    /**
+     * 获取品牌首字母
+     *
+     * @return brand_letter - 品牌首字母
+     */
+    public String getBrandLetter() {
+        return brandLetter;
+    }
+
+    /**
+     * 设置品牌首字母
+     *
+     * @param brandLetter 品牌首字母
+     */
+    public void setBrandLetter(String brandLetter) {
+        this.brandLetter = brandLetter;
+    }
+
+    /**
+     * 获取创建时间
+     *
+     * @return create_date - 创建时间
+     */
+    public Date getCreateDate() {
+        return createDate;
+    }
+
+    /**
+     * 设置创建时间
+     *
+     * @param createDate 创建时间
+     */
+    public void setCreateDate(Date createDate) {
+        this.createDate = createDate;
+    }
+}

+ 20 - 0
src/main/java/com/yc/education/service/ICommercialCarTypeService.java

@@ -0,0 +1,20 @@
+package com.yc.education.service;
+
+import com.yc.education.model.CommercialCarType;
+
+import java.util.List;
+
+/**
+ * @ClassName ICommercialCarTypeService
+ * @Description TODO
+ * @Author QuZhangJing
+ * @Date 2019/12/19 9:37
+ * @Version 1.0
+ */
+public interface ICommercialCarTypeService extends IService<CommercialCarType> {
+    int addByList(List<CommercialCarType> serviceList);
+
+    List<String> queryId();
+
+    int deleteByRepeat(List<String> repeatList);
+}

+ 38 - 0
src/main/java/com/yc/education/service/impl/CommercialCarTypeServiceImpl.java

@@ -0,0 +1,38 @@
+package com.yc.education.service.impl;
+
+import com.yc.education.mapper.CommercialCarTypeMapper;
+import com.yc.education.model.CommercialCarType;
+import com.yc.education.service.ICommercialCarTypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @ClassName CommercialCarTypeServiceImpl
+ * @Description TODO
+ * @Author QuZhangJing
+ * @Date 2019/12/19 9:37
+ * @Version 1.0
+ */
+@Service
+public class CommercialCarTypeServiceImpl extends  BaseService<CommercialCarType> implements ICommercialCarTypeService {
+
+    @Autowired
+    private CommercialCarTypeMapper   mapper;
+
+    @Override
+    public int addByList(List<CommercialCarType> serviceList) {
+        return mapper.addByList(serviceList);
+    }
+
+    @Override
+    public List<String> queryId() {
+        return mapper.queryId();
+    }
+
+    @Override
+    public int deleteByRepeat(List<String> repeatList) {
+        return mapper.deleteByRepeat(repeatList);
+    }
+}

+ 45 - 0
src/main/resources/mapper/CommercialCarTypeMapper.xml

@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.yc.education.mapper.CommercialCarTypeMapper" >
+  <resultMap id="BaseResultMap" type="com.yc.education.model.CommercialCarType" >
+    <!--
+      WARNING - @mbggenerated
+    -->
+    <id column="id" property="id" jdbcType="BIGINT" />
+    <result column="kind" property="kind" jdbcType="VARCHAR" />
+    <result column="factory" property="factory" jdbcType="VARCHAR" />
+    <result column="brand" property="brand" jdbcType="VARCHAR" />
+    <result column="sale_version" property="saleVersion" jdbcType="VARCHAR" />
+    <result column="notice_type" property="noticeType" jdbcType="VARCHAR" />
+    <result column="notice_batch" property="noticeBatch" jdbcType="VARCHAR" />
+    <result column="engine_type" property="engineType" jdbcType="VARCHAR" />
+    <result column="fuel_kind" property="fuelKind" jdbcType="VARCHAR" />
+    <result column="blowdown_standard" property="blowdownStandard" jdbcType="VARCHAR" />
+    <result column="brand_letter" property="brandLetter" jdbcType="CHAR" />
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
+  </resultMap>
+
+  <!-- 添加集合数据 -->
+  <insert id="addByList" useGeneratedKeys="true" parameterType="java.util.List">
+    insert into commercial_car_type(kind,factory,brand,sale_version,notice_type,notice_batch,engine_type,fuel_kind,blowdown_standard,brand_letter,create_date)
+    values
+    <foreach collection="list" item="item" index="index" separator=",">
+      (#{item.kind},#{item.factory},#{item.brand},#{item.saleVersion},#{item.noticeType},#{item.noticeBatch},#{item.engineType},#{item.fuelKind},#{item.blowdownStandard},#{item.brandLetter},#{item.createDate})
+    </foreach>
+  </insert>
+
+  <!-- 查询重复 -->
+  <select id="queryId" resultType="java.lang.String">
+  	select min(id) from commercial_car_type group by kind,factory,brand,sale_version,notice_type,notice_batch,engine_type,fuel_kind,blowdown_standard  desc order by id desc
+  </select>
+
+  <!--删除集合数据-->
+  <delete id="deleteByRepeat" parameterType="java.util.List">
+    delete from commercial_car_type
+    where id not in(
+    <foreach collection="list" item="item" index="index" separator=",">
+      #{item}
+    </foreach>
+    )
+  </delete>
+</mapper>

+ 2 - 2
src/main/resources/mapper/ProviderMapper.xml

@@ -577,14 +577,14 @@
     <!--服务商切换至经销商-->
     <update id="changeToSupplier">
         update provider set role_type = 2,param_type = 1,p_main_business=null ,mian_business=null,company_type=null,main_brand = null,
-        intelligence = null,photos = 0,business_introduce=null,service_item='0条',repair = null,maintain = null,consmetology = null,
+        intelligence = null,photos = 0,service_item='0条',repair = null,maintain = null,consmetology = null,
         wash_car = null,refit=null,road_rescue = null where id = #{id}
     </update>
 
     <!--经销商切换至服务商-->
     <update id="changeToProvider">
         update provider set role_type=1,param_type = 1,p_main_business=null,mian_business=null,company_type='快修连锁店',main_brand='各种车型',
-        intelligence = '三类',photos='0张',business_introduce=null,service_item='0条',repair=null,maintain=null,consmetology=null,
+        intelligence = '三类',photos='0张',service_item='0条',repair=null,maintain=null,consmetology=null,
         wash_car=null,refit=null,road_rescue=null where id = #{id}
     </update>
 </mapper>

+ 138 - 0
src/main/webapp/WEB-INF/jsp/admin/commercialCarTypeExcel.jsp

@@ -0,0 +1,138 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java"%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/admin/manage/h-ui/css/H-ui.min.css" />
+<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/admin/manage/h-ui.admin/css/H-ui.admin.css" />
+<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/admin/manage/Hui-iconfont/1.0.7/iconfont.css" />
+<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/admin/manage/icheck/icheck.css" />
+<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/admin/manage/h-ui.admin/skin/default/skin.css" id="skin" />
+<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/admin/manage/h-ui.admin/css/style.css" />
+<link rel="stylesheet" href="${pageContext.request.contextPath}/static/admin/css/jquery.mloading.css">
+<link rel="stylesheet" href="${pageContext.request.contextPath}/static/admin/css/jquery.mloading.css">
+<script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/manage/js/jquery.min.js"></script> 
+<script src="${pageContext.request.contextPath}/static/admin/js/jquery.mloading.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/manage/js/layer.js"></script> 
+<script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/js/ajaxfileupload.js"></script> 
+<script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/manage/js/jquery.validate.min.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/manage/js/validate-methods.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/manage/js/messages_zh.min.js"></script>
+
+<title>后台管理</title>
+</head>
+<body>
+<nav class="breadcrumb">
+	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
+</nav>
+<div class="">
+	<div class="page-container">
+		<div style="width:1120px;height:100px;margin:5px auto;">
+			<p style="color:red;">注意:* 为了防止操作不当,请您在导入数据前先下载我们规定表格格式,然后将您的数据复制到规定表格中再导入!</p>
+			<a href="${pageContext.request.contextPath}/ajaxexcel/excel/商用车车型数据导入格式.xlsx" style="color:#0066CC;text-decoration:underline;"><h3>下载表格&nbsp;<i class="Hui-iconfont">&#xe641;</i></h3></a>
+		</div>
+		<form action="addcarbyexcel.html" method="post" enctype="multipart/form-data" class="form form-horizontal" id="form-admin-add">
+			<div class="row cl">
+				<label class="form-label col-xs-4 col-sm-2">选择表格:</label>
+				<div class="formControls col-xs-8 col-sm-9">
+					<div style="width:100%;height:30px;border:1px solid #EEEEEE;">
+						<button type="button"  onclick="$('#fileToUpload').click();" style="margin:5px;">选择表格</button>&nbsp;&nbsp;<span style="margin:5px;" id="filexls">未选择表格</span>
+					</div>
+					<input type="file" style="display: none;" id="fileToUpload" class="input-text" name="fileToUpload">
+					<input type="hidden"    name="url" id="url">
+				</div>
+			</div>
+			<div class="row cl">
+				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
+					<input class="btn btn-primary radius" type="button" id="bt" value="提交">
+				</div>
+			</div>
+		</form>
+		<div  class="moban">
+		
+		</div>
+	</div>
+</div>
+	<script type="text/javascript">
+		
+		$("#bt").click(function(){
+			var url=$("#url").val();
+			
+			add();
+			$.ajax({
+				type:"post",
+				url:"commercialCarTypeExcelIn.html",
+				data:{
+					url:url					
+				},
+				dataType:"json",
+				success:function(){
+					rom();
+
+					
+					layer.confirm('数据导入成功!',function(index){
+						window.location.href="commercialCarTypeExcel.html";
+					});
+					
+				}		
+			})
+			
+		})
+	
+	
+	
+		function add(){
+			$(".moban").mLoading();
+		}
+		function rom(){
+			$(".moban").mLoading().remove();
+		}
+	
+		$("#fileToUpload").change(function(){			
+			var f = document.getElementById('fileToUpload').files[0];
+			var filexlsc = $("#fileToUpload").val();
+			$("#filexls").html(filexlsc);
+			$.ajaxFileUpload({  
+		        fileElementId : 'fileToUpload',
+		        url : 'uploadexcel.html',  
+		        dataType : 'text',  
+		        data : {},  
+		        async : true,  
+		        error : function(data) {  
+		        	alert("网络异常,请重试");
+		        },  
+		        success : function(message) {
+		        	$("#url").val(message);
+		        	chen();
+		        }  
+		    }); 
+		});
+		function chen(){
+			$("#fileToUpload").change(function(){		
+				var f = document.getElementById('fileToUpload').files[0];
+				var filexlsc = $("#fileToUpload").val();
+				$("#filexls").html(filexlsc);
+				$.ajaxFileUpload({  
+			        fileElementId : 'fileToUpload',
+			        url : 'uploadexcel.html',  
+			        dataType : 'text',  
+			        data : {},  
+			        async : true,  
+			        error : function(data) {  
+			        	alert("网络异常,请重试");
+			        },  
+			        success : function(message) {
+			        	$("#url").val(message);
+			        	chen();
+			        }  
+			    }); 
+			});
+		}
+		
+	</script>
+</body>
+</html>

+ 1 - 0
src/main/webapp/WEB-INF/jsp/admin/index.jsp

@@ -269,6 +269,7 @@
 						<li><a data-href="helpTypeList.html" data-title="帮助中心类别" href="javascript:void(0)">帮助中心类别</a></li>
 						<li><a data-href="messageList.html" data-title="系统消息" href="javascript:void(0)">系统消息</a></li>
 						<%--<li><a data-href="providerPurchaseLibraryExcel.html" data-title="修理厂采购车型库导入" href="javascript:void(0)">修理厂采购车型库导入</a></li>--%>
+						<%--<li><a data-href="commercialCarTypeExcel.html" data-title="商用车车型数据导入" href="javascript:void(0)">商用车车型数据导入</a></li>--%>
 					</ul>
 				</dd>
 			</dl>

+ 1 - 0
src/main/webapp/WEB-INF/jsp/admin/welcome.jsp

@@ -66,6 +66,7 @@
             <button class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
         </div>
     </form>
+    <%--<a class="btn btn-success" href="cityExport.html">导出</a>--%>
     <div class="cl pd-5 bg-1 bk-gray mt-20">
         <%--<span class="l">
             <a class="btn btn-danger radius"  href="javascript:;"  id="delete"    ><i class="Hui-iconfont">&#xe6e2;</i>批量删除</a>

binární
src/main/webapp/ajaxexcel/excel/商用车车型数据.xls