蔡德晨 5 lat temu
rodzic
commit
dede85445f

+ 165 - 0
src/main/java/com/jeeplus/modules/sg/financial/settlement/entity/MaintainData.java

@@ -0,0 +1,165 @@
+package com.jeeplus.modules.sg.financial.settlement.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.core.persistence.DataEntity;
+
+import java.util.Date;
+
+public class MaintainData extends DataEntity<MaintainData> {
+    private String projectId;     //项目定义号
+    private Date startDate;      //开工时间
+    private Date endDate;        //竣工时间
+    private String approvalNumber;     //审批文号
+    private Double buildingFee;      //建筑费
+    private Double installFee;       //安装费
+    private Double equipmentFee;     //设备购置费
+    private Double materialFee;     //主材费
+    private Double designFee;      //设计费
+    private Double supervisionFee;  //监理费
+    private Double preliminaryWorkFee;   //前期工作费
+    private Double damages;      //线路施工赔偿费
+    private Double managementFee;   //法人管理费
+    private Double totalFee;      //合计
+
+
+    private String[] projectIds;  //项目定义号数组
+
+    public String[] getProjectIds() {
+        return projectIds;
+    }
+
+    public void setProjectIds(String[] projectIds) {
+        this.projectIds = projectIds;
+    }
+
+    @ExcelField(title="项目定义号", align=2, sort=1)
+    public String getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    @ExcelField(title="开工时间", align=2, sort=2)
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    public Date getStartDate() {
+        return startDate;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    public void setStartDate(Date startDate) {
+        this.startDate = startDate;
+    }
+
+    @ExcelField(title="竣工时间", align=2, sort=3)
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    public Date getEndDate() {
+        return endDate;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    public void setEndDate(Date endDate) {
+        this.endDate = endDate;
+    }
+
+    @ExcelField(title="批准文号", align=2, sort=4)
+    public String getApprovalNumber() {
+        return approvalNumber;
+    }
+
+    public void setApprovalNumber(String approvalNumber) {
+        this.approvalNumber = approvalNumber;
+    }
+
+    @ExcelField(title="建筑费", align=2, sort=5)
+    public Double getBuildingFee() {
+        return buildingFee;
+    }
+
+    public void setBuildingFee(Double buildingFee) {
+        this.buildingFee = buildingFee;
+    }
+
+    @ExcelField(title="安装费", align=2, sort=6)
+    public Double getInstallFee() {
+        return installFee;
+    }
+
+    public void setInstallFee(Double installFee) {
+        this.installFee = installFee;
+    }
+
+    @ExcelField(title="设备购置费", align=2, sort=7)
+    public Double getEquipmentFee() {
+        return equipmentFee;
+    }
+
+    public void setEquipmentFee(Double equipmentFee) {
+        this.equipmentFee = equipmentFee;
+    }
+
+    @ExcelField(title="主材费", align=2, sort=8)
+    public Double getMaterialFee() {
+        return materialFee;
+    }
+
+    public void setMaterialFee(Double materialFee) {
+        this.materialFee = materialFee;
+    }
+
+    @ExcelField(title="设计费", align=2, sort=9)
+    public Double getDesignFee() {
+        return designFee;
+    }
+
+    public void setDesignFee(Double designFee) {
+        this.designFee = designFee;
+    }
+
+    @ExcelField(title="监理费", align=2, sort=10)
+    public Double getSupervisionFee() {
+        return supervisionFee;
+    }
+
+    public void setSupervisionFee(Double supervisionFee) {
+        this.supervisionFee = supervisionFee;
+    }
+
+    @ExcelField(title="项目前期工作费", align=2, sort=11)
+    public Double getPreliminaryWorkFee() {
+        return preliminaryWorkFee;
+    }
+
+    public void setPreliminaryWorkFee(Double preliminaryWorkFee) {
+        this.preliminaryWorkFee = preliminaryWorkFee;
+    }
+
+    @ExcelField(title="线路施工赔偿费", align=2, sort=12)
+    public Double getDamages() {
+        return damages;
+    }
+
+    public void setDamages(Double damages) {
+        this.damages = damages;
+    }
+
+    @ExcelField(title="法人管理费(余物清理费)", align=2, sort=13)
+    public Double getManagementFee() {
+        return managementFee;
+    }
+
+    public void setManagementFee(Double managementFee) {
+        this.managementFee = managementFee;
+    }
+
+    @ExcelField(title="合计", align=2, sort=14)
+    public Double getTotalFee() {
+        return totalFee;
+    }
+
+    public void setTotalFee(Double totalFee) {
+        this.totalFee = totalFee;
+    }
+}

+ 17 - 0
src/main/java/com/jeeplus/modules/sg/financial/settlement/mapper/DataMaintenanceMapper.java

@@ -0,0 +1,17 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.financial.settlement.mapper;
+
+import com.jeeplus.core.persistence.BaseMapper;
+import com.jeeplus.core.persistence.annotation.MyBatisMapper;
+import com.jeeplus.modules.sg.financial.settlement.entity.MaintainData;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+@MyBatisMapper
+public interface DataMaintenanceMapper extends BaseMapper<MaintainData> {
+	int insertList(@Param("list") List<MaintainData> list);
+}

+ 219 - 0
src/main/java/com/jeeplus/modules/sg/financial/settlement/mapper/xml/DataMaintenanceMapper.xml

@@ -0,0 +1,219 @@
+<?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.jeeplus.modules.sg.financial.settlement.mapper.DataMaintenanceMapper">
+    
+	<sql id="infoColumns">
+		a.id AS "id",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.project_id AS "projectId",
+		a.start_date AS "startDate",
+		a.end_date AS "endDate",
+		a.approval_number AS "approvalNumber",
+		a.building_fee AS "buildingFee",
+		a.install_fee AS "installFee",
+		a.equipment_fee AS "equipmentFee",
+		a.material_fee AS "materialFee",
+		a.design_fee AS "designFee",
+		a.supervision_fee AS "supervisionFee",
+		a.preliminaryWork_fee AS "preliminaryWorkFee",
+		a.damages AS "damages",
+		a.management_fee AS "managementFee",
+		a.total_fee AS "totalFee"
+	</sql>
+
+    
+	<select id="get" resultType="MaintainData" >
+		SELECT 
+			<include refid="infoColumns"/>
+		FROM js_maintain_data a
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="MaintainData" >
+		SELECT 
+			<include refid="infoColumns"/>
+		FROM js_maintain_data a
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			${dataScope}
+			<if test="projectIds != null ">
+				AND a.project_id in
+                <foreach collection="projectIds" index="index" item="item" open="(" separator="," close=")">
+                #{item}
+                </foreach>
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="MaintainData" >
+		SELECT 
+			<include refid="infoColumns"/>
+		FROM js_maintain_data a
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			${dataScope}
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<insert id="insert">
+		INSERT INTO js_maintain_data(
+			id,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+			project_id,
+			start_date,
+			end_date,
+			approval_number,
+			building_fee,
+			install_fee,
+			equipment_fee,
+			material_fee,
+			design_fee,
+			supervision_fee,
+			preliminaryWork_fee,
+			damages,
+			management_fee,
+			total_fee
+		) VALUES (
+			#{id},
+			#{createBy.id},
+			#{createDate},
+			#{updateBy.id},
+			#{updateDate},
+			#{remarks},
+			#{delFlag},
+			#{projectId},
+			#{startDate},
+			#{endDate},
+			#{approvalNumber},
+			#{buildingFee},
+			#{installFee},
+			#{equipmentFee},
+			#{materialFee},
+			#{designFee},
+			#{supervisionFee},
+			#{preliminaryWorkFee},
+			#{damages},
+			#{managementFee},
+			#{totalFee}
+		)
+	</insert>
+
+    <insert id="insertList">
+        replace INTO js_maintain_data(
+			id,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+			project_id,
+			start_date,
+			end_date,
+			approval_number,
+			building_fee,
+			install_fee,
+			equipment_fee,
+			material_fee,
+			design_fee,
+			supervision_fee,
+			preliminaryWork_fee,
+			damages,
+			management_fee,
+			total_fee
+		) VALUES
+        <foreach collection="list" item="item" index="index" separator="," >
+		(
+			#{item.id},
+			#{item.createBy.id},
+			#{item.createDate},
+			#{item.updateBy.id},
+			#{item.updateDate},
+			#{item.remarks},
+			#{item.delFlag},
+			#{item.projectId},
+			#{item.startDate},
+			#{item.endDate},
+			#{item.approvalNumber},
+			#{item.buildingFee},
+			#{item.installFee},
+			#{item.equipmentFee},
+			#{item.materialFee},
+			#{item.designFee},
+			#{item.supervisionFee},
+			#{item.preliminaryWorkFee},
+			#{item.damages},
+			#{item.managementFee},
+			#{item.totalFee}
+		)
+        </foreach>
+	</insert>
+	
+	<update id="update">
+		UPDATE js_maintain_data SET
+			update_by = #{updateBy.id},
+			update_date = #{updateDate},
+			remarks = #{remarks},
+			start_date = #{startDate},
+			end_date = #{endDate},
+			approval_number = #{approvalNumber},
+			building_fee = #{buildingFee},
+			install_fee = #{installFee},
+			equipment_fee = #{equipmentFee},
+			material_fee = #{materialFee},
+			design_fee = #{designFee},
+			supervision_fee = #{supervisionFee},
+			preliminaryWork_fee = #{preliminaryWorkFee},
+			damages = #{damages},
+			management_fee = #{managementFee},
+			total_fee = #{totalFee}
+		WHERE id = #{id}
+	</update>
+	
+	
+	<!--物理删除-->
+	<update id="delete">
+		DELETE FROM js_maintain_data
+		WHERE id = #{id}
+	</update>
+	
+	<!--逻辑删除-->
+	<update id="deleteByLogic">
+		UPDATE js_maintain_data SET
+			del_flag = #{DEL_FLAG_DELETE}
+		WHERE id = #{id}
+	</update>
+	
+	
+	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
+	<select id="findUniqueByProperty" resultType="TestNote" statementType="STATEMENT">
+		select * FROM js_maintain_data  where ${propertyName} = '${value}'
+	</select>
+	
+</mapper>

+ 61 - 0
src/main/java/com/jeeplus/modules/sg/financial/settlement/service/DataMaintenanceService.java

@@ -0,0 +1,61 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.financial.settlement.service;
+
+import com.jeeplus.core.persistence.Page;
+import com.jeeplus.core.service.CrudService;
+import com.jeeplus.modules.sg.financial.settlement.entity.MaintainData;
+import com.jeeplus.modules.sg.financial.settlement.mapper.DataMaintenanceMapper;
+import org.apache.poi.ss.usermodel.Workbook;
+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.util.List;
+
+
+@Service
+@Transactional(readOnly = true)
+public class DataMaintenanceService extends CrudService<DataMaintenanceMapper, MaintainData> {
+
+	@Autowired
+	private DataMaintenanceMapper dataMaintenanceMapper;
+
+	public MaintainData get(String id) {
+		return super.get(id);
+	}
+	
+	public List<MaintainData> findList(MaintainData maintainData) {
+		return super.findList(maintainData);
+	}
+	
+	public Page<MaintainData> findPage(Page<MaintainData> page, MaintainData maintainData) {
+		return super.findPage(page, maintainData);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(MaintainData maintainData) {
+		super.save(maintainData);
+	}
+
+	@Transactional(readOnly = false)
+	public void saveList(List<MaintainData> list) {
+		for(MaintainData maintainData : list){
+			maintainData.preInsert();
+		}
+		dataMaintenanceMapper.insertList(list);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(MaintainData maintainData) {
+		super.delete(maintainData);
+	}
+
+
+	public void export(MaintainData maintainData , HttpServletResponse response){
+		Workbook workbook = null;
+        	}
+	
+}

+ 458 - 0
src/main/java/com/jeeplus/modules/sg/financial/settlement/util/ExportUtil.java

@@ -0,0 +1,458 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.financial.settlement.util;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.Encodes;
+import com.jeeplus.common.utils.Reflections;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.utils.DictUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.streaming.SXSSFWorkbook;
+import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
+import org.apache.poi.xssf.usermodel.XSSFRichTextString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.*;
+
+
+public class ExportUtil {
+
+	private static Logger log = LoggerFactory.getLogger(ExportUtil.class);
+
+	/**
+	 * 工作薄对象
+	 */
+	private SXSSFWorkbook wb;
+
+	/**
+	 * 工作表对象
+	 */
+	private Sheet sheet;
+
+	/**
+	 * 样式列表
+	 */
+	private Map<String, CellStyle> styles;
+
+	/**
+	 * 当前行号
+	 */
+	private int rownum;
+
+	/**
+	 * 注解列表(Object[]{ ExcelField, Field/Method })
+	 */
+	List<Object[]> annotationList = Lists.newArrayList();
+
+	/**
+	 * 构造函数
+	 * @param title 表格标题,传“空值”,表示无标题
+	 * @param cls 实体对象,通过annotation.ExportField获取标题
+	 */
+	public ExportUtil(String title, Class<?> cls){
+		this(title, cls, 1);
+	}
+
+	/**
+	 * 构造函数
+	 * @param title 表格标题,传“空值”,表示无标题
+	 * @param cls 实体对象,通过annotation.ExportField获取标题
+	 * @param type 导出类型(1:导出数据;2:导出模板)
+	 * @param groups 导入分组
+	 */
+	public ExportUtil(String title, Class<?> cls, int type, int... groups){
+		// Get annotation field
+		Field[] fs = cls.getDeclaredFields();
+		for (Field f : fs){
+			ExcelField ef = f.getAnnotation(ExcelField.class);
+			if (ef != null && (ef.type()==0 || ef.type()==type)){
+				if (groups!=null && groups.length>0){
+					boolean inGroup = false;
+					for (int g : groups){
+						if (inGroup){
+							break;
+						}
+						for (int efg : ef.groups()){
+							if (g == efg){
+								inGroup = true;
+								annotationList.add(new Object[]{ef, f});
+								break;
+							}
+						}
+					}
+				}else{
+					annotationList.add(new Object[]{ef, f});
+				}
+			}
+		}
+		// Get annotation method
+		Method[] ms = cls.getDeclaredMethods();
+		for (Method m : ms){
+			ExcelField ef = m.getAnnotation(ExcelField.class);
+			if (ef != null && (ef.type()==0 || ef.type()==type)){
+				if (groups!=null && groups.length>0){
+					boolean inGroup = false;
+					for (int g : groups){
+						if (inGroup){
+							break;
+						}
+						for (int efg : ef.groups()){
+							if (g == efg){
+								inGroup = true;
+								annotationList.add(new Object[]{ef, m});
+								break;
+							}
+						}
+					}
+				}else{
+					annotationList.add(new Object[]{ef, m});
+				}
+			}
+		}
+		// Field sorting
+		Collections.sort(annotationList, new Comparator<Object[]>() {
+			public int compare(Object[] o1, Object[] o2) {
+				return new Integer(((ExcelField)o1[0]).sort()).compareTo(
+						new Integer(((ExcelField)o2[0]).sort()));
+			};
+		});
+		// Initialize
+		List<String> headerList = Lists.newArrayList();
+		for (Object[] os : annotationList){
+			String t = ((ExcelField)os[0]).title();
+			// 如果是导出,则去掉注释
+			if (type==1){
+				String[] ss = StringUtils.split(t, "**", 2);
+				if (ss.length==2){
+					t = ss[0];
+				}
+			}
+			headerList.add(t);
+		}
+		initialize(title, headerList);
+	}
+
+	/**
+	 * 构造函数
+	 * @param title 表格标题,传“空值”,表示无标题
+	 * @param headers 表头数组
+	 */
+	public ExportUtil(String title, String[] headers) {
+		initialize(title, Lists.newArrayList(headers));
+	}
+
+	/**
+	 * 构造函数
+	 * @param title 表格标题,传“空值”,表示无标题
+	 * @param headerList 表头列表
+	 */
+	public ExportUtil(String title, List<String> headerList) {
+		initialize(title, headerList);
+	}
+	
+	/**
+	 * 初始化函数
+	 * @param title 表格标题,传“空值”,表示无标题
+	 * @param headerList 表头列表
+	 */
+	private void initialize(String title, List<String> headerList) {
+		this.wb = new SXSSFWorkbook(500);
+		this.sheet = wb.createSheet("维护数据");
+		this.styles = createStyles(wb);
+		// Create title
+		if (StringUtils.isNotBlank(title)){
+			Row titleRow = sheet.createRow(rownum++);
+			titleRow.setHeightInPoints(30);
+			Cell titleCell = titleRow.createCell(0);
+			titleCell.setCellStyle(styles.get("title"));
+			titleCell.setCellValue(title);
+			sheet.addMergedRegion(new CellRangeAddress(titleRow.getRowNum(),
+					titleRow.getRowNum(), titleRow.getRowNum(), headerList.size()-1));
+		}
+		// Create header
+		if (headerList == null){
+			throw new RuntimeException("headerList not null!");
+		}
+		Row headerRow = sheet.createRow(rownum++);
+		headerRow.setHeightInPoints(16);
+		for (int i = 0; i < headerList.size(); i++) {
+			Cell cell = headerRow.createCell(i);
+			cell.setCellStyle(styles.get("header"));
+			String[] ss = StringUtils.split(headerList.get(i), "**", 2);
+			if (ss.length==2){
+				cell.setCellValue(ss[0]);
+				Comment comment = this.sheet.createDrawingPatriarch().createCellComment(
+						new XSSFClientAnchor(0, 0, 0, 0, (short) 3, 3, (short) 5, 6));
+				comment.setString(new XSSFRichTextString(ss[1]));
+				cell.setCellComment(comment);
+			}else{
+				cell.setCellValue(headerList.get(i));
+			}
+			sheet.autoSizeColumn(i);
+		}
+		for (int i = 0; i < headerList.size(); i++) {  
+			int colWidth = sheet.getColumnWidth(i)*2;
+	        sheet.setColumnWidth(i, colWidth < 3000 ? 3000 : colWidth);  
+		}
+		log.debug("Initialize success.");
+	}
+	
+	/**
+	 * 创建表格样式
+	 * @param wb 工作薄对象
+	 * @return 样式列表
+	 */
+	private Map<String, CellStyle> createStyles(Workbook wb) {
+		Map<String, CellStyle> styles = new HashMap<String, CellStyle>();
+		
+		CellStyle style = wb.createCellStyle();
+		style.setAlignment(CellStyle.ALIGN_CENTER);
+		style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
+		Font titleFont = wb.createFont();
+		titleFont.setFontName("Arial");
+		titleFont.setFontHeightInPoints((short) 16);
+		titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
+		style.setFont(titleFont);
+		styles.put("title", style);
+
+		style = wb.createCellStyle();
+		style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
+		style.setBorderRight(CellStyle.BORDER_THIN);
+		style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+		style.setBorderLeft(CellStyle.BORDER_THIN);
+		style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+		style.setBorderTop(CellStyle.BORDER_THIN);
+		style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+		style.setBorderBottom(CellStyle.BORDER_THIN);
+		style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+		Font dataFont = wb.createFont();
+		dataFont.setFontName("Arial");
+		dataFont.setFontHeightInPoints((short) 10);
+		style.setFont(dataFont);
+		styles.put("data", style);
+		
+		style = wb.createCellStyle();
+		style.cloneStyleFrom(styles.get("data"));
+		style.setAlignment(CellStyle.ALIGN_LEFT);
+		styles.put("data1", style);
+
+		style = wb.createCellStyle();
+		style.cloneStyleFrom(styles.get("data"));
+		style.setAlignment(CellStyle.ALIGN_CENTER);
+		styles.put("data2", style);
+
+		style = wb.createCellStyle();
+		style.cloneStyleFrom(styles.get("data"));
+		style.setAlignment(CellStyle.ALIGN_RIGHT);
+		styles.put("data3", style);
+		
+		style = wb.createCellStyle();
+		style.cloneStyleFrom(styles.get("data"));
+//		style.setWrapText(true);
+		style.setAlignment(CellStyle.ALIGN_CENTER);
+		style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
+		style.setFillPattern(CellStyle.SOLID_FOREGROUND);
+		Font headerFont = wb.createFont();
+		headerFont.setFontName("Arial");
+		headerFont.setFontHeightInPoints((short) 10);
+		headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
+		headerFont.setColor(IndexedColors.WHITE.getIndex());
+		style.setFont(headerFont);
+		styles.put("header", style);
+		
+		return styles;
+	}
+
+	/**
+	 * 添加一行
+	 * @return 行对象
+	 */
+	public Row addRow(){
+		return sheet.createRow(rownum++);
+	}
+	
+
+	/**
+	 * 添加一个单元格
+	 * @param row 添加的行
+	 * @param column 添加列号
+	 * @param val 添加值
+	 * @return 单元格对象
+	 */
+	public Cell addCell(Row row, int column, Object val){
+		return this.addCell(row, column, val, 0, Class.class);
+	}
+	
+	/**
+	 * 添加一个单元格
+	 * @param row 添加的行
+	 * @param column 添加列号
+	 * @param val 添加值
+	 * @param align 对齐方式(1:靠左;2:居中;3:靠右)
+	 * @return 单元格对象
+	 */
+	public Cell addCell(Row row, int column, Object val, int align, Class<?> fieldType){
+		Cell cell = row.createCell(column);
+		CellStyle style = styles.get("data"+(align>=1&&align<=3?align:""));
+		try {
+			if (val == null){
+				cell.setCellValue("");
+			} else if (val instanceof String) {
+				cell.setCellValue((String) val);
+			} else if (val instanceof Integer) {
+				cell.setCellValue((Integer) val);
+			} else if (val instanceof Long) {
+				cell.setCellValue((Long) val);
+			} else if (val instanceof Double) {
+				cell.setCellValue((Double) val);
+			} else if (val instanceof Float) {
+				cell.setCellValue((Float) val);
+			} else if (val instanceof Date) {
+				DataFormat format = wb.createDataFormat();
+	            style.setDataFormat(format.getFormat("yyyy-MM-dd"));
+				cell.setCellValue((Date) val);
+			} else {
+				if (fieldType != Class.class){
+					cell.setCellValue((String)fieldType.getMethod("setValue", Object.class).invoke(null, val));
+				}else{
+					cell.setCellValue((String)Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(), 
+						"fieldtype."+val.getClass().getSimpleName()+"Type")).getMethod("setValue", Object.class).invoke(null, val));
+				}
+			}
+		} catch (Exception ex) {
+			log.info("Set cell value ["+row.getRowNum()+","+column+"] error: " + ex.toString());
+			cell.setCellValue(val.toString());
+		}
+		cell.setCellStyle(style);
+		return cell;
+	}
+
+	/**
+	 * 添加数据(通过annotation.ExportField添加数据)
+	 * @return list 数据列表
+	 */
+	public <E> ExportUtil setDataList(List<E> list){
+		for (E e : list){
+			int colunm = 0;
+			Row row = this.addRow();
+			StringBuilder sb = new StringBuilder();
+			for (Object[] os : annotationList){
+				ExcelField ef = (ExcelField)os[0];
+				Object val = null;
+				// Get entity value
+				try{
+					if (StringUtils.isNotBlank(ef.value())){
+						val = Reflections.invokeGetter(e, ef.value());
+					}else{
+						if (os[1] instanceof Field){
+							val = Reflections.invokeGetter(e, ((Field)os[1]).getName());
+						}else if (os[1] instanceof Method){
+							val = Reflections.invokeMethod(e, ((Method)os[1]).getName(), new Class[] {}, new Object[] {});
+						}
+					}
+					// If is dict, get dict label
+					if (StringUtils.isNotBlank(ef.dictType())){
+						val = DictUtils.getDictLabel(val==null?"":val.toString(), ef.dictType(), "");
+					}
+				}catch(Exception ex) {
+					// Failure to ignore
+					log.info(ex.toString());
+					val = "";
+				}
+				this.addCell(row, colunm++, val, ef.align(), ef.fieldType());
+				sb.append(val + ", ");
+			}
+			log.debug("Write success: ["+row.getRowNum()+"] "+sb.toString());
+		}
+		return this;
+	}
+	
+	/**
+	 * 输出数据流
+	 * @param os 输出数据流
+	 */
+	public ExportUtil write(OutputStream os) throws IOException{
+		wb.write(os);
+		return this;
+	}
+	
+	/**
+	 * 输出到客户端
+	 * @param fileName 输出文件名
+	 */
+	public ExportUtil write(HttpServletResponse response, String fileName) throws IOException{
+		response.reset();
+        response.setContentType("application/octet-stream; charset=utf-8");
+        response.setHeader("Content-Disposition", "attachment; filename="+Encodes.urlEncode(fileName));
+		write(response.getOutputStream());
+		return this;
+	}
+	
+	/**
+	 * 输出到文件
+	 * @param name 输出文件名
+	 */
+	public ExportUtil writeFile(String name) throws FileNotFoundException, IOException{
+		FileOutputStream os = new FileOutputStream(name);
+		this.write(os);
+		return this;
+	}
+	
+	/**
+	 * 清理临时文件
+	 */
+	public ExportUtil dispose(){
+		wb.dispose();
+		return this;
+	}
+	
+//	/**
+//	 * 导出测试
+//	 */
+//	public static void main(String[] args) throws Throwable {
+//		
+//		List<String> headerList = Lists.newArrayList();
+//		for (int i = 1; i <= 10; i++) {
+//			headerList.add("表头"+i);
+//		}
+//		
+//		List<String> dataRowList = Lists.newArrayList();
+//		for (int i = 1; i <= headerList.size(); i++) {
+//			dataRowList.add("数据"+i);
+//		}
+//		
+//		List<List<String>> dataList = Lists.newArrayList();
+//		for (int i = 1; i <=1000000; i++) {
+//			dataList.add(dataRowList);
+//		}
+//
+//		ExportExcel ee = new ExportExcel("表格标题", headerList);
+//		
+//		for (int i = 0; i < dataList.size(); i++) {
+//			Row row = ee.addRow();
+//			for (int j = 0; j < dataList.get(i).size(); j++) {
+//				ee.addCell(row, j, dataList.get(i).get(j));
+//			}
+//		}
+//		
+//		ee.writeFile("target/export.xlsx");
+//
+//		ee.dispose();
+//		
+//		log.debug("Export success.");
+//		
+//	}
+
+}

+ 263 - 0
src/main/java/com/jeeplus/modules/sg/financial/settlement/web/DataMaintenanceController.java

@@ -0,0 +1,263 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.financial.settlement.web;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.core.persistence.Page;
+import com.jeeplus.core.web.BaseController;
+import com.jeeplus.modules.sg.financial.settlement.entity.MaintainData;
+import com.jeeplus.modules.sg.financial.settlement.service.DataMaintenanceService;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 数据维护
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/sg/settlement")
+public class DataMaintenanceController extends BaseController {
+
+	@Autowired
+	private DataMaintenanceService dataMaintenanceService;
+	
+	@ModelAttribute
+	public MaintainData get(@RequestParam(required=false) String id) {
+		MaintainData entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = dataMaintenanceService.get(id);
+		}
+		if (entity == null){
+			entity = new MaintainData();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 列表页面
+	 */
+	@RequiresPermissions("sg:settlement:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(MaintainData maintainData, Model model) {
+		model.addAttribute("maintainData", maintainData);
+		return "modules/sg/settlement/dataMaintenanceList";
+	}
+	
+		/**
+	 * 列表数据
+	 */
+	@ResponseBody
+	@RequiresPermissions("sg:settlement:list")
+	@RequestMapping(value = "data")
+	public Map<String, Object> data(MaintainData maintainData, HttpServletRequest request, HttpServletResponse response, Model model) {
+		String projectId = maintainData.getProjectId();
+		if(StringUtils.isNotBlank(projectId)){
+			String[] sts = projectId.split("\\s+");
+			maintainData.setProjectIds(sts);
+		}
+		Page<MaintainData> page = dataMaintenanceService.findPage(new Page<MaintainData>(request, response), maintainData);
+		return getBootstrapData(page);
+	}
+
+	/**
+	 * 查看,增加,编辑表单页面
+	 */
+	@RequiresPermissions(value={"sg:settlement:view","sg:settlement:add","sg:settlement:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(MaintainData maintainData, Model model) {
+		model.addAttribute("maintainData", maintainData);
+		return "modules/sg/settlement/dataMaintenanceForm";
+	}
+
+	/**
+	 * 保存
+	 */
+	@ResponseBody
+	@RequiresPermissions(value={"sg:settlement:add","sg:settlement:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public AjaxJson save(MaintainData maintainData, Model model) throws Exception{
+		AjaxJson j = new AjaxJson();
+		/**
+		 * 后台hibernate-validation插件校验
+		 */
+		String errMsg = beanValidator(maintainData);
+		if (StringUtils.isNotBlank(errMsg)){
+			j.setSuccess(false);
+			j.setMsg(errMsg);
+			return j;
+		}
+		//新增或编辑表单保存
+		dataMaintenanceService.save(maintainData);//保存
+		j.setSuccess(true);
+		j.setMsg("保存成功");
+		return j;
+	}
+	
+	/**
+	 * 删除
+	 */
+	@ResponseBody
+	@RequiresPermissions("sg:settlement:del")
+	@RequestMapping(value = "delete")
+	public AjaxJson delete(MaintainData maintainData) {
+		AjaxJson j = new AjaxJson();
+		dataMaintenanceService.delete(maintainData);
+		j.setMsg("删除成功");
+		return j;
+	}
+	
+	/**
+	 * 批量删除
+	 */
+	@ResponseBody
+	@RequiresPermissions("sg:settlement:del")
+	@RequestMapping(value = "deleteAll")
+	public AjaxJson deleteAll(String ids) {
+		AjaxJson j = new AjaxJson();
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			dataMaintenanceService.delete(dataMaintenanceService.get(id));
+		}
+		j.setMsg("删除成功");
+		return j;
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@ResponseBody
+	@RequiresPermissions("sg:settlement:export")
+    @RequestMapping(value = "export")
+    public AjaxJson exportFile(MaintainData maintainData, HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j = new AjaxJson();
+		try {
+            String fileName = DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<MaintainData> page = dataMaintenanceService.findPage(new Page<MaintainData>(request, response, -1), maintainData);
+    		new ExportExcel(null, MaintainData.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		j.setSuccess(true);
+    		j.setMsg("导出成功!");
+    		return j;
+		} catch (Exception e) {
+			j.setSuccess(false);
+			j.setMsg("导出失败!失败信息:"+e.getMessage());
+		}
+			return j;
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@ResponseBody
+	@RequiresPermissions("sg:settlement:import")
+    @RequestMapping(value = "import")
+   	public AjaxJson importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request) throws IOException, InvalidFormatException, IllegalAccessException, InstantiationException, ParseException {
+		AjaxJson j = new AjaxJson();
+//		try {
+			ImportExcel ei = new ImportExcel(file, 2, 0);
+			List<MaintainData> list = getData(ei);
+			dataMaintenanceService.saveList(list);
+			j.setMsg("导入成功");
+//		} catch (Exception e) {
+//			j.setSuccess(false);
+//			j.setMsg("导入失败!失败信息:"+e.getMessage());
+//		}
+		return j;
+    }
+
+
+
+	/**
+	 * 下载导入数据模板
+	 */
+	@ResponseBody
+	@RequiresPermissions("sg:settlement:import")
+    @RequestMapping(value = "import/template")
+     public AjaxJson importFileTemplate(HttpServletResponse response) {
+		AjaxJson j = new AjaxJson();
+		try {
+            String fileName = "维护数据导入模板.xlsx";
+    		List<MaintainData> list = Lists.newArrayList();
+    		new ExportExcel(null, MaintainData.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			j.setSuccess(false);
+			j.setMsg( "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return j;
+    }
+
+
+	private List<MaintainData> getData(ImportExcel importExcel) throws ParseException {
+		int lastRow = importExcel.getLastDataRowNum();
+		List<MaintainData> list = new ArrayList<>();
+		MaintainData maintainData = null;
+		for(int i=3; i<lastRow;i++){
+			maintainData = new MaintainData();
+			Row row = importExcel.getRow(i);
+			String projectId = (String) importExcel.getCellValue(row,0);
+			if(StringUtils.isNotBlank(projectId)) {
+				maintainData.setProjectId(projectId);
+			    maintainData.setStartDate(getDate(importExcel,row,1));
+			    maintainData.setEndDate(getDate(importExcel,row,2));
+				maintainData.setApprovalNumber((String) importExcel.getCellValue(row, 3));
+				maintainData.setBuildingFee(getDouble(importExcel,row,4));
+				maintainData.setInstallFee(getDouble(importExcel,row,5));
+				maintainData.setEquipmentFee(getDouble(importExcel,row,6));
+				maintainData.setMaterialFee(getDouble(importExcel,row,7));
+				maintainData.setDesignFee(getDouble(importExcel,row,8));
+				maintainData.setSupervisionFee(getDouble(importExcel,row,9));
+				maintainData.setPreliminaryWorkFee(getDouble(importExcel,row,10));
+				maintainData.setDamages(getDouble(importExcel,row,11));
+				maintainData.setManagementFee(getDouble(importExcel,row,12));
+				maintainData.setTotalFee(getDouble(importExcel,row,13));
+				list.add(maintainData);
+			}
+		}
+		return list;
+	}
+
+	private double getDouble(ImportExcel importExcel,Row row,int col){
+		double d = 0.00;
+        Object o = importExcel.getCellValue(row,col);
+        if(!o.equals("")){
+        	d = Double.parseDouble(o.toString());
+		}
+      return d;
+	}
+
+	private Date getDate(ImportExcel importExcel,Row row,int col) throws ParseException {
+		Date d = null;
+		Object o = importExcel.getCellValue(row,col);
+		if(!o.equals("")){
+			SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
+			d = simpleDateFormat.parse(o.toString());
+		}
+		return d;
+	}
+
+
+
+}

+ 1 - 1
src/main/java/com/jeeplus/modules/sys/entity/Office.java

@@ -33,7 +33,7 @@ public class Office extends TreeEntity<Office> {
 	private User primaryPerson;//主负责人
 	private User deputyPerson;//副负责人
 	private List<String> childDeptList;//快速添加子部门
-	
+
 	public Office(){
 		super();
 		this.type = "2";

+ 2 - 1
src/main/resources/j2cache/j2cache.properties

@@ -88,7 +88,8 @@ redis.cluster_name = j2cache
 redis.namespace = 
 
 ## connection
-redis.hosts = 192.168.2.4:6379
+#redis.hosts = 192.168.2.4:6379
+redis.hosts = 127.0.0.1:6379
 redis.timeout = 2000
 redis.password =
 redis.database = 0

+ 128 - 0
src/main/webapp/webpage/modules/sg/settlement/dataMaintenanceForm.jsp

@@ -0,0 +1,128 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>数据维护</title>
+	<meta name="decorator" content="ani"/>
+	<script type="text/javascript">
+
+		$(document).ready(function() {
+			$('#startDate').datetimepicker({
+				format: "YYYY-MM-DD"
+			});
+			$('#endDate').datetimepicker({
+				format: "YYYY-MM-DD"
+			});
+		});
+		function save() {
+            var isValidate = jp.validateForm('#inputForm');//校验表单
+            if(!isValidate){
+                return false;
+			}else{
+                jp.loading();
+                jp.post("${ctx}/sg/settlement/save",$('#inputForm').serialize(),function(data){
+                    if(data.success){
+                        jp.getParent().refresh();
+                        var dialogIndex = parent.layer.getFrameIndex(window.name); // 获取窗口索引
+                        parent.layer.close(dialogIndex);
+                        jp.success(data.msg)
+
+                    }else{
+                        jp.error(data.msg);
+                    }
+                })
+			}
+
+        }
+	</script>
+</head>
+<body class="bg-white">
+		<form:form id="inputForm" modelAttribute="maintainData" class="form-horizontal">
+		<form:hidden path="id"/>	
+		<table class="table table-bordered">
+		   <tbody>
+				<tr>
+					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>项目定义号:</label></td>
+					<td class="width-35">
+						<form:input path="projectId" htmlEscape="false"    class="form-control required"/>
+					</td>
+					<td class="width-15 active"><label class="pull-right">开工时间:</label></td>
+					<td class="width-35">
+					<div class='input-group form_datetime' id='startDate'>
+						<input type='text'  name="startDate" class="form-control required"  value="<fmt:formatDate value="${maintainData.startDate}" pattern="yyyy-MM-dd"/>"/>
+						<span class="input-group-addon">
+			                        <span class="glyphicon glyphicon-calendar"></span>
+			                    </span>
+					</div>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="pull-right">竣工时间:</label></td>
+					<td class="width-35">
+						<div class='input-group form_datetime' id='endDate'>
+						<input type='text'  name="endDate" class="form-control required"  value="<fmt:formatDate value="${maintainData.endDate}" pattern="yyyy-MM-dd"/>"/>
+						<span class="input-group-addon">
+			                        <span class="glyphicon glyphicon-calendar"></span>
+			                    </span>
+						</div>
+					</td>
+					<td class="width-15 active"><label class="pull-right">批准文号:</label></td>
+					<td class="width-35">
+						<form:input path="approvalNumber" htmlEscape="false"    class="form-control required"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="pull-right">建筑费:</label></td>
+					<td class="width-35">
+						<form:input path="buildingFee" htmlEscape="false"    class="form-control required"/>
+					</td>
+					<td class="width-15 active"><label class="pull-right">安装费:</label></td>
+					<td class="width-35">
+						<form:input path="installFee" htmlEscape="false"    class="form-control required"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="pull-right">设备购置费:</label></td>
+					<td class="width-35">
+						<form:input path="equipmentFee" htmlEscape="false"    class="form-control required"/>
+					</td>
+					<td class="width-15 active"><label class="pull-right">主材费:</label></td>
+					<td class="width-35">
+						<form:input path="materialFee" htmlEscape="false"    class="form-control required"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="pull-right">设计费:</label></td>
+					<td class="width-35">
+						<form:input path="designFee" htmlEscape="false"    class="form-control required"/>
+					</td>
+					<td class="width-15 active"><label class="pull-right">监理费:</label></td>
+					<td class="width-35">
+						<form:input path="supervisionFee" htmlEscape="false"    class="form-control required"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="pull-right">前期工作费:</label></td>
+					<td class="width-35">
+						<form:input path="preliminaryWorkFee" htmlEscape="false"    class="form-control required"/>
+					</td>
+					<td class="width-15 active"><label class="pull-right">线路施工赔偿费:</label></td>
+					<td class="width-35">
+						<form:input path="damages" htmlEscape="false"    class="form-control required"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="pull-right">法人管理费:</label></td>
+					<td class="width-35">
+						<form:input path="managementFee" htmlEscape="false"    class="form-control required"/>
+					</td>
+					<td class="width-15 active"><label class="pull-right">合计:</label></td>
+					<td class="width-35">
+						<form:input path="totalFee" htmlEscape="false"    class="form-control required"/>
+					</td>
+				</tr>
+		 	</tbody>
+		</table>
+	</form:form>
+</body>
+</html>

+ 279 - 0
src/main/webapp/webpage/modules/sg/settlement/dataMaintenanceList.js

@@ -0,0 +1,279 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<script>
+$(document).ready(function() {
+	$('#dataTable').bootstrapTable({
+		 
+		  //请求方法
+               method: 'post',
+               //类型json
+               dataType: "json",
+               contentType: "application/x-www-form-urlencoded",
+               //显示检索按钮
+	           showSearch: true,
+               //显示刷新按钮
+               showRefresh: true,
+               //显示切换手机试图按钮
+               showToggle: true,
+               //显示 内容列下拉框
+    	       showColumns: true,
+    	       //显示到处按钮
+    	       showExport: true,
+    	       //显示切换分页按钮
+    	       showPaginationSwitch: true,
+    	       //最低显示2行
+    	       minimumCountColumns: 2,
+               //是否显示行间隔色
+               striped: true,
+               //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)     
+               cache: false,    
+               //是否显示分页(*)  
+               pagination: true,   
+                //排序方式 
+               sortOrder: "asc",  
+               //初始化加载第一页,默认第一页
+               pageNumber:1,   
+               //每页的记录行数(*)   
+               pageSize: 10,  
+               //可供选择的每页的行数(*)    
+               pageList: [10, 25, 50, 100],
+               //这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据  
+               url: "${ctx}/sg/settlement/data",
+               //默认值为 'limit',传给服务端的参数为:limit, offset, search, sort, order Else
+               //queryParamsType:'',   
+               ////查询参数,每次调用是会带上这个参数,可自定义                         
+               queryParams : function(params) {
+               	var searchParam = $("#searchForm").serializeJSON();
+               	searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;
+               	searchParam.pageSize = params.limit === undefined? -1 : params.limit;
+               	searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+  params.order;
+                   return searchParam;
+               },
+               //分页方式:client客户端分页,server服务端分页(*)
+               sidePagination: "server",
+               contextMenuTrigger:"right",//pc端 按右键弹出菜单
+               contextMenuTriggerMobile:"press",//手机端 弹出菜单,click:单击, press:长按。
+               contextMenu: '#context-menu',
+               onContextMenuItem: function(row, $el){
+                   if($el.data("item") == "edit"){
+                   		edit(row.id);
+                   }else if($el.data("item") == "view"){
+                       view(row.id);
+                   } else if($el.data("item") == "delete"){
+                        jp.confirm('确认要删除该数据记录吗?', function(){
+                       	jp.loading();
+                       	jp.get("${ctx}/sg/settlement/delete?id="+row.id, function(data){
+                   	  		if(data.success){
+                   	  			$('#dataTable').bootstrapTable('refresh');
+                   	  			jp.success(data.msg);
+                   	  		}else{
+                   	  			jp.error(data.msg);
+                   	  		}
+                   	  	})
+                   	   
+                   	});
+                      
+                   } 
+               },
+              
+               onClickRow: function(row, $el){
+               },
+               	onShowSearch: function () {
+			$("#search-collapse").slideToggle();
+		},
+               columns: [{
+		        checkbox: true
+
+		    }
+			,{
+		        field: 'projectId',
+		        title: '项目定义号'
+		        ,formatter:function(value, row , index){
+		        	value = jp.unescapeHTML(value);
+				   <c:choose>
+					   <c:when test="${fns:hasPermission('sg:settlement:edit')}">
+					      return "<a href='javascript:edit(\""+row.id+"\")'>"+value+"</a>";
+				      </c:when>
+					  <c:when test="${fns:hasPermission('sg:settlement:view')}">
+					      return "<a href='javascript:view(\""+row.id+"\")'>"+value+"</a>";
+				      </c:when>
+					  <c:otherwise>
+					      return value;
+				      </c:otherwise>
+				   </c:choose>
+		         }
+		       
+		    }
+			,{
+		              field: 'startDate',
+		              title: '开工时间',
+		              sortable: true,
+		              sortName: 'startDate'
+		    }
+			,{
+		              field: 'endDate',
+		              title: '竣工时间',
+		              sortable: true,
+		              sortName: 'endDate'
+		    }
+		    ,{
+					   field: 'approvalNumber',
+					   title: '审批文号'
+               }
+             ,{
+					   field: 'buildingFee',
+					   title: '建筑费'
+               }
+             ,{
+					   field: 'installFee',
+					   title: '安装费'
+               }
+             ,{
+					   field: 'equipmentFee',
+					   title: '设备购置费'
+               }
+            ,{
+					   field: 'materialFee',
+					   title: '主材费'
+               }
+             ,{
+					   field: 'designFee',
+					   title: '设计费'
+               }
+             ,{
+                       field: 'supervisionFee',
+                       title: '监理费'
+                   }
+            ,{
+					   field: 'preliminaryWorkFee',
+					   title: '前期工作费'
+				   }
+            ,{
+					   field: 'damages',
+					   title: '线路施工赔偿费'
+               }
+            ,{
+					   field: 'managementFee',
+					   title: '法人管理费'
+               }
+             ,{
+					   field: 'totalFee',
+					   title: '合计'
+               }
+		     ]
+		
+		});
+		
+		  
+	  if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端
+
+		 
+		  $('#dataTable').bootstrapTable("toggleView");
+		}
+	  
+	  $('#dataTable').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
+                'check-all.bs.table uncheck-all.bs.table', function () {
+            $('#remove').prop('disabled', ! $('#dataTable').bootstrapTable('getSelections').length);
+            $('#view,#edit').prop('disabled', $('#dataTable').bootstrapTable('getSelections').length!=1);
+        });
+		  
+		$("#btnImport").click(function(){
+			jp.open({
+			    type: 2,
+                area: [500, 200],
+                auto: true,
+			    title:"导入数据",
+			    content: "${ctx}/tag/importExcel" ,
+			    btn: ['下载模板','确定', '关闭'],
+				    btn1: function(index, layero){
+					  jp.downloadFile('${ctx}/sg/settlement/import/template');
+				  },
+			    btn2: function(index, layero){
+				        var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+						iframeWin.contentWindow.importExcel('${ctx}/sg/settlement/import', function (data) {
+							if(data.success){
+								jp.success(data.msg);
+								refresh();
+							}else{
+								jp.error(data.msg);
+							}
+                            jp.close(index);
+                        });//调用保存事件
+                    return false;
+				  },
+				 
+				  btn3: function(index){ 
+					  jp.close(index);
+	    	       }
+			}); 
+		});
+		
+		
+	 $("#export").click(function(){//导出Excel文件
+			jp.downloadFile('${ctx}/sg/settlement/export');
+	  });
+
+		    
+	  $("#search").click("click", function() {// 绑定查询按扭
+		  $('#dataTable').bootstrapTable('refresh');
+		});
+	 
+	 $("#reset").click("click", function() {// 绑定查询按扭
+		  $("#searchForm  input").val("");
+		  $("#searchForm  select").val("");
+		  $("#searchForm  .select-item").html("");
+		  $('#dataTable').bootstrapTable('refresh');
+		});
+		
+		
+	});
+		
+  function getIdSelections() {
+        return $.map($("#dataTable").bootstrapTable('getSelections'), function (row) {
+            return row.id
+        });
+    }
+  
+  function deleteAll(){
+
+		jp.confirm('确认要删除该数据记录吗?', function(){
+			jp.loading();  	
+			jp.get("${ctx}/sg/settlement/deleteAll?ids=" + getIdSelections(), function(data){
+         	  		if(data.success){
+         	  			$('#dataTable').bootstrapTable('refresh');
+         	  			jp.success(data.msg);
+         	  		}else{
+         	  			jp.error(data.msg);
+         	  		}
+         	  	})
+          	   
+		})
+  }
+
+    //刷新列表
+  function refresh(){
+  	$('#dataTable').bootstrapTable('refresh');
+  }
+  
+   function add(){
+	  jp.openSaveDialog('新增', "${ctx}/sg/settlement/form",'800px', '500px');
+  }
+
+
+  
+   function edit(id){//没有权限时,不显示确定按钮
+       if(id == undefined){
+	      id = getIdSelections();
+	}
+	jp.openSaveDialog('编辑', "${ctx}/sg/settlement/form?id=" + id, '800px', '500px');
+  }
+  
+ function view(id){//没有权限时,不显示确定按钮
+      if(id == undefined){
+             id = getIdSelections();
+      }
+        jp.openViewDialog('查看', "${ctx}/sg/settlement/form?id=" + id, '800px', '500px');
+ }
+
+
+
+</script>

+ 90 - 0
src/main/webapp/webpage/modules/sg/settlement/dataMaintenanceList.jsp

@@ -0,0 +1,90 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>数据维护</title>
+	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
+	<meta name="decorator" content="ani"/>
+	<%@ include file="/webpage/include/bootstraptable.jsp"%>
+	<%@include file="/webpage/include/treeview.jsp" %>
+	<%@include file="dataMaintenanceList.js" %>
+</head>
+<body>
+	<div class="wrapper wrapper-content">
+	<div class="panel panel-primary">
+	<div class="panel-heading">
+		<h3 class="panel-title">数据维护</h3>
+	</div>
+	<div class="panel-body">
+	
+	<!-- 搜索 -->
+	<div id="search-collapse" class="collapse">
+		<div class="accordion-inner">
+			<form:form id="searchForm" modelAttribute="maintainData" class="form form-horizontal well clearfix">
+			 <div class="col-xs-12 col-sm-6 col-md-4">
+				<label class="label-item single-overflow pull-left" title="项目定义号:">项目定义号:</label>
+				<form:input path="projectId" htmlEscape="false" maxlength="64"  class=" form-control"/>
+			</div>
+		 <div class="col-xs-12 col-sm-6 col-md-4">
+			<div style="margin-top:26px">
+			  <a  id="search" class="btn btn-primary btn-rounded  btn-bordered btn-sm"><i class="fa fa-search"></i> 查询</a>
+			  <a  id="reset" class="btn btn-primary btn-rounded  btn-bordered btn-sm" ><i class="fa fa-refresh"></i> 重置</a>
+			 </div>
+	    </div>	
+	</form:form>
+	</div>
+	</div>
+	
+	<!-- 工具栏 -->
+	<div id="toolbar">
+			<shiro:hasPermission name="sg:settlement:add">
+				<button id="add" class="btn btn-primary" onclick="add()">
+					<i class="glyphicon glyphicon-plus"></i> 新建
+				</button>
+			</shiro:hasPermission>
+			<shiro:hasPermission name="sg:settlement:edit">
+			    <button id="edit" class="btn btn-success" disabled onclick="edit()">
+	            	<i class="glyphicon glyphicon-edit"></i> 修改
+	        	</button>
+			</shiro:hasPermission>
+			<shiro:hasPermission name="sg:settlement:del">
+				<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">
+	            	<i class="glyphicon glyphicon-remove"></i> 删除
+	        	</button>
+			</shiro:hasPermission>
+			<shiro:hasPermission name="sg:settlement:import">
+				<button id="btnImport" class="btn btn-info"><i class="fa fa-folder-open-o"></i> 导入</button>
+			</shiro:hasPermission>
+			<shiro:hasPermission name="sg:settlement:export">
+	        		<button id="export" class="btn btn-warning">
+					<i class="fa fa-file-excel-o"></i> 导出
+				</button>
+			 </shiro:hasPermission>
+	                 <shiro:hasPermission name="sg:settlement:view">
+				<button id="view" class="btn btn-default" disabled onclick="view()">
+					<i class="fa fa-search-plus"></i> 查看
+				</button>
+			</shiro:hasPermission>
+		    </div>
+		
+	<!-- 表格 -->
+	<table id="dataTable"   data-toolbar="#toolbar"></table>
+
+    <!-- context menu -->
+    <ul id="context-menu" class="dropdown-menu">
+    	<shiro:hasPermission name="sg:settlement:add">
+        <li data-item="view"><a>查看</a></li>
+        </shiro:hasPermission>
+    	<shiro:hasPermission name="sg:settlement:edit">
+        <li data-item="edit"><a>编辑</a></li>
+        </shiro:hasPermission>
+        <shiro:hasPermission name="sg:settlement:del">
+        <li data-item="delete"><a>删除</a></li>
+        </shiro:hasPermission>
+        <li data-item="action1"><a>取消</a></li>
+    </ul>  
+	</div>
+	</div>
+	</div>
+</body>
+</html>