Sfoglia il codice sorgente

模板管理,经费收入,经费支出,部门管理,模板部门填报后台实体类,基础功能

yanliming 1 anno fa
parent
commit
402005fe61
32 ha cambiato i file con 3616 aggiunte e 2 eliminazioni
  1. 18 0
      common/src/main/java/com/jpsoft/employment/modules/base/dao/DepartmentInfoDAO.java
  2. 18 0
      common/src/main/java/com/jpsoft/employment/modules/base/dao/ExpensesInfoDAO.java
  3. 24 0
      common/src/main/java/com/jpsoft/employment/modules/base/dao/FundIncomeInfoDAO.java
  4. 22 0
      common/src/main/java/com/jpsoft/employment/modules/base/dao/TemplateOptionDAO.java
  5. 13 0
      common/src/main/java/com/jpsoft/employment/modules/base/dto/TemplateOptionDTO.java
  6. 44 0
      common/src/main/java/com/jpsoft/employment/modules/base/entity/DepartmentInfo.java
  7. 88 0
      common/src/main/java/com/jpsoft/employment/modules/base/entity/ExpensesInfo.java
  8. 113 0
      common/src/main/java/com/jpsoft/employment/modules/base/entity/FundIncomeInfo.java
  9. 8 0
      common/src/main/java/com/jpsoft/employment/modules/base/entity/TemplateInfo.java
  10. 91 0
      common/src/main/java/com/jpsoft/employment/modules/base/entity/TemplateOption.java
  11. 17 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/DepartmentInfoService.java
  12. 19 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/ExpensesInfoService.java
  13. 22 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/FundIncomeInfoService.java
  14. 23 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/TemplateOptionService.java
  15. 70 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/impl/DepartmentInfoServiceImpl.java
  16. 127 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/impl/ExpensesInfoServiceImpl.java
  17. 165 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/impl/FundIncomeInfoServiceImpl.java
  18. 124 0
      common/src/main/java/com/jpsoft/employment/modules/base/service/impl/TemplateOptionServiceImpl.java
  19. 34 0
      common/src/main/java/com/jpsoft/employment/modules/common/utils/PojoUtils.java
  20. 7 0
      common/src/main/java/com/jpsoft/employment/modules/sys/entity/User.java
  21. 87 0
      common/src/main/resources/mapper/base/DepartmentInfo.xml
  22. 151 0
      common/src/main/resources/mapper/base/ExpensesInfo.xml
  23. 209 0
      common/src/main/resources/mapper/base/FundIncomeInfo.xml
  24. 15 1
      common/src/main/resources/mapper/base/TemplateInfo.xml
  25. 155 0
      common/src/main/resources/mapper/base/TemplateOption.xml
  26. 7 1
      common/src/main/resources/mapper/sys/User.xml
  27. 239 0
      web/src/main/java/com/jpsoft/employment/modules/base/controller/DepartmentInfoController.java
  28. 414 0
      web/src/main/java/com/jpsoft/employment/modules/base/controller/ExpensesInfoController.java
  29. 729 0
      web/src/main/java/com/jpsoft/employment/modules/base/controller/FundIncomeInfoController.java
  30. 89 0
      web/src/main/java/com/jpsoft/employment/modules/base/controller/TemplateInfoController.java
  31. 412 0
      web/src/main/java/com/jpsoft/employment/modules/base/controller/TemplateOptionController.java
  32. 62 0
      web/src/main/java/com/jpsoft/employment/modules/sys/controller/RoleController.java

+ 18 - 0
common/src/main/java/com/jpsoft/employment/modules/base/dao/DepartmentInfoDAO.java

@@ -0,0 +1,18 @@
+package com.jpsoft.employment.modules.base.dao;
+
+import java.util.List;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.employment.modules.base.entity.DepartmentInfo;
+import java.util.Map;
+import com.jpsoft.employment.modules.common.dto.Sort;
+
+@Repository
+public interface DepartmentInfoDAO {
+	int insert(DepartmentInfo entity);
+	int update(DepartmentInfo entity);
+	int exist(String id);
+	DepartmentInfo get(String id);
+	int delete(String id);
+	List<DepartmentInfo> list();
+	List<DepartmentInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
+}

+ 18 - 0
common/src/main/java/com/jpsoft/employment/modules/base/dao/ExpensesInfoDAO.java

@@ -0,0 +1,18 @@
+package com.jpsoft.employment.modules.base.dao;
+
+import java.util.List;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.employment.modules.base.entity.ExpensesInfo;
+import java.util.Map;
+import com.jpsoft.employment.modules.common.dto.Sort;
+
+@Repository
+public interface ExpensesInfoDAO {
+	int insert(ExpensesInfo entity);
+	int update(ExpensesInfo entity);
+	int exist(String id);
+	ExpensesInfo get(String id);
+	int delete(String id);
+	List<ExpensesInfo> list();
+	List<ExpensesInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
+}

+ 24 - 0
common/src/main/java/com/jpsoft/employment/modules/base/dao/FundIncomeInfoDAO.java

@@ -0,0 +1,24 @@
+package com.jpsoft.employment.modules.base.dao;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.employment.modules.base.entity.FundIncomeInfo;
+import java.util.Map;
+import com.jpsoft.employment.modules.common.dto.Sort;
+
+@Repository
+public interface FundIncomeInfoDAO {
+	int insert(FundIncomeInfo entity);
+	int update(FundIncomeInfo entity);
+	int exist(String id);
+	FundIncomeInfo get(String id);
+	int delete(String id);
+	List<FundIncomeInfo> list();
+	List<FundIncomeInfo> findByYear(@Param("startDate")String startDate,@Param("endDate")String endDate);
+	BigDecimal sumBySerialNumber(@Param("serialNumber") String serialNumber,@Param("curMonth") String curMonth);
+	BigDecimal sumBudgetRevenue(@Param("serialNumber")String serialNumber,@Param("startDate")String startDate,@Param("endDate")String endDate);
+	List<FundIncomeInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
+}

+ 22 - 0
common/src/main/java/com/jpsoft/employment/modules/base/dao/TemplateOptionDAO.java

@@ -0,0 +1,22 @@
+package com.jpsoft.employment.modules.base.dao;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.employment.modules.base.entity.TemplateOption;
+import java.util.Map;
+import com.jpsoft.employment.modules.common.dto.Sort;
+
+@Repository
+public interface TemplateOptionDAO {
+	int insert(TemplateOption entity);
+	int update(TemplateOption entity);
+	int exist(String id);
+	TemplateOption get(String id);
+	int delete(String id);
+	List<TemplateOption> list();
+	List<TemplateOption> findByTemplateId(String templateId);
+	List<TemplateOption> findByConditions(@Param("searchParams") Map<String, Object> searchParams);
+	List<TemplateOption> search(Map<String, Object> searchParams, List<Sort> sortList);
+}

+ 13 - 0
common/src/main/java/com/jpsoft/employment/modules/base/dto/TemplateOptionDTO.java

@@ -0,0 +1,13 @@
+package com.jpsoft.employment.modules.base.dto;
+
+import com.jpsoft.employment.modules.base.entity.TemplateOption;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class TemplateOptionDTO {
+    String templateId;
+    String status;
+    List<TemplateOption> templateOptionList;
+}

+ 44 - 0
common/src/main/java/com/jpsoft/employment/modules/base/entity/DepartmentInfo.java

@@ -0,0 +1,44 @@
+package com.jpsoft.employment.modules.base.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+import java.math.BigDecimal;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+  描述:base_department_info的实体类
+ */
+@Data
+@ApiModel(value = "base_department_info的实体类")
+public class DepartmentInfo {
+		@ApiModelProperty(value = "ID")
+	private String id;
+	
+				@ApiModelProperty(value = "部门名称")
+	private String name;
+	
+					@ApiModelProperty(value = "创建时间")
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	private Date createTime;
+	
+				@ApiModelProperty(value = "更新时间")
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	private Date updateTime;
+	
+			@ApiModelProperty(value = "创建人")
+	private String createBy;
+	
+				@ApiModelProperty(value = "更新人")
+	private String updateBy;
+	
+				@ApiModelProperty(value = "删除标示")
+	private Boolean delFlag;
+	
+		}

+ 88 - 0
common/src/main/java/com/jpsoft/employment/modules/base/entity/ExpensesInfo.java

@@ -0,0 +1,88 @@
+package com.jpsoft.employment.modules.base.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+import java.math.BigDecimal;
+
+import org.springframework.data.annotation.Transient;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+  描述:base_expenses_info的实体类
+ */
+@Data
+@ApiModel(value = "base_expenses_info的实体类")
+public class ExpensesInfo {
+		@ApiModelProperty(value = "ID")
+	private String id;
+	
+				@ApiModelProperty(value = "序号")
+	private String serialNumber;
+	
+				@ApiModelProperty(value = "项目名称")
+	private String name;
+	
+				@ApiModelProperty(value = "金额")
+	private BigDecimal amount;
+	
+				@ApiModelProperty(value = "执行人")
+	private String executor;
+	
+				@ApiModelProperty(value = "责任人")
+	private String responsiblePerson;
+	
+				@ApiModelProperty(value = "完成时间")
+	private String completionTime;
+	
+					@ApiModelProperty(value = "催费启动时间")
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	private Date feeStartDate;
+	
+			@ApiModelProperty(value = "督办员")
+	private String supervisor;
+	
+				@ApiModelProperty(value = "相关资料")
+	private String aboutTopic;
+	
+					@ApiModelProperty(value = "创建时间")
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	private Date createTime;
+	
+				@ApiModelProperty(value = "更新时间")
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	private Date updateTime;
+	
+			@ApiModelProperty(value = "创建人")
+	private String createBy;
+	
+				@ApiModelProperty(value = "更新人")
+	private String updateBy;
+	
+				@ApiModelProperty(value = "删除标示")
+	private Boolean delFlag;
+	
+					@ApiModelProperty(value = "所属年月")
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	private Date year;
+	
+			@ApiModelProperty(value = "排序号")
+	private Integer index;
+	
+				@ApiModelProperty(value = "生成模板ID")
+	private String templateId;
+
+
+	@Transient
+	@ApiModelProperty(value = "催费启动时间字符串")
+	private String feeStartDateStr;
+	
+		}

+ 113 - 0
common/src/main/java/com/jpsoft/employment/modules/base/entity/FundIncomeInfo.java

@@ -0,0 +1,113 @@
+package com.jpsoft.employment.modules.base.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+import java.math.BigDecimal;
+
+import org.springframework.data.annotation.Transient;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+  描述:base_fund_income_info的实体类
+ */
+@Data
+@ApiModel(value = "base_fund_income_info的实体类")
+public class FundIncomeInfo {
+		@ApiModelProperty(value = "ID")
+	private String id;
+	
+				@ApiModelProperty(value = "序号")
+	private String serialNumber;
+	
+				@ApiModelProperty(value = "项目名称")
+	private String name;
+	
+				@ApiModelProperty(value = "预算收入")
+	private BigDecimal budgetRevenue;
+	
+				@ApiModelProperty(value = "账户名称")
+	private String accountName;
+	
+				@ApiModelProperty(value = "本月到账资金")
+	private BigDecimal curMonthReceived;
+	
+				@ApiModelProperty(value = "实际总收入")
+	private BigDecimal actualTotalRevenue;
+	
+				@ApiModelProperty(value = "累计欠费")
+	private BigDecimal accumulatedArrears;
+	
+				@ApiModelProperty(value = "收入时间区间")
+	private String incomeTimeRange;
+	
+				@ApiModelProperty(value = "收入类型(按月/按年/按季/按学期)")
+	private String incomeType;
+	
+					@ApiModelProperty(value = "终止日")
+	@DateTimeFormat(pattern="yyyy-MM-dd")
+	@JsonFormat(pattern = "yyyy-MM-dd",timezone ="GMT+8")
+	private Date endDate;
+	
+			@ApiModelProperty(value = "收入实现部门")
+	private String incomeDepartment;
+	
+				@ApiModelProperty(value = "附件")
+	private String attachment;
+	
+				@ApiModelProperty(value = "会计主体名称")
+	private String accountingName;
+	
+				@ApiModelProperty(value = "备注")
+	private String bak;
+
+	@ApiModelProperty(value = "创建时间")
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	private Date createTime;
+
+	@ApiModelProperty(value = "更新时间")
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	private Date updateTime;
+
+	@ApiModelProperty(value = "创建人")
+	private String createBy;
+
+	@ApiModelProperty(value = "更新人")
+	private String updateBy;
+
+	@ApiModelProperty(value = "删除标示")
+	private Boolean delFlag;
+
+	@ApiModelProperty(value = "排序号")
+	private Integer index;
+
+	@ApiModelProperty(value = "模板ID")
+	private String templateId;
+
+	@DateTimeFormat(pattern="yyyy-MM-dd")
+	@JsonFormat(pattern = "yyyy-MM-dd",timezone ="GMT+8")
+	@ApiModelProperty(value = "所属年月")
+	private Date year;
+
+	@ApiModelProperty(value = "是否合计")
+	private Boolean isSum;
+
+	@Transient
+	@ApiModelProperty(value = "终止日页面显示字符串日期")
+	private String endDateStr;
+
+	@Transient
+	@ApiModelProperty(value = "收入类型字符串")
+	private String incomeTypeN;
+
+	@Transient
+	@ApiModelProperty(value = "年月字符串用于显示")
+	private String yearMonthStr;
+	
+		}

+ 8 - 0
common/src/main/java/com/jpsoft/employment/modules/base/entity/TemplateInfo.java

@@ -49,5 +49,13 @@ public class TemplateInfo {
 	
 				@ApiModelProperty(value = "删除标示")
 	private Boolean delFlag;
+
+	@ApiModelProperty(value = "状态(0:未审核,1:已审核)")
+	private String status;
+
+
+	@ApiModelProperty(value = "附件")
+	private String attachment;
+
 	
 		}

+ 91 - 0
common/src/main/java/com/jpsoft/employment/modules/base/entity/TemplateOption.java

@@ -0,0 +1,91 @@
+package com.jpsoft.employment.modules.base.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+import java.math.BigDecimal;
+
+import org.springframework.data.annotation.Transient;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+  描述:base_template_option的实体类
+ */
+@Data
+@ApiModel(value = "base_template_option的实体类")
+public class TemplateOption {
+		@ApiModelProperty(value = "ID")
+	private String id;
+	
+				@ApiModelProperty(value = "模板ID")
+	private String templateId;
+	
+				@ApiModelProperty(value = "序号")
+	private String serialNum;
+	
+				@ApiModelProperty(value = "名称")
+	private String name;
+
+	@ApiModelProperty(value = "预算收入")
+	private BigDecimal budgetRevenue;
+	
+				@ApiModelProperty(value = "排序号")
+	private Integer index;
+	
+					@ApiModelProperty(value = "创建时间")
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	private Date createTime;
+	
+				@ApiModelProperty(value = "更新时间")
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	private Date updateTime;
+	
+			@ApiModelProperty(value = "创建人")
+	private String createBy;
+	
+				@ApiModelProperty(value = "更新人")
+	private String updateBy;
+	
+				@ApiModelProperty(value = "删除标示")
+	private Boolean delFlag;
+
+	@ApiModelProperty(value = "部门Id")
+	private String departmentIds;
+
+	@ApiModelProperty(value = "是否合计")
+	private Boolean isSum;
+
+	@ApiModelProperty(value = "收入时间区间")
+	private String incomeTimeRange;
+
+	@ApiModelProperty(value = "收入类型(按月/按年/按季/按学期)")
+	private String incomeType;
+
+	@ApiModelProperty(value = "终止日")
+	@DateTimeFormat(pattern="yyyy-MM-dd")
+	@JsonFormat(pattern = "yyyy-MM-dd",timezone ="GMT+8")
+	private Date endDate;
+
+	@Transient
+	@ApiModelProperty(value = "收入时间区间")
+	private String[] incomeTimeRangeArr;
+
+	@Transient
+	@ApiModelProperty(value = "部门名称字符串")
+	private String departmentNames;
+
+	@Transient
+	@ApiModelProperty(value = "部门ID数组")
+	private String[] departmentIdArr;
+
+	@Transient
+	@ApiModelProperty(value = "收入类型字符串")
+	private String incomeTypeN;
+	
+		}

+ 17 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/DepartmentInfoService.java

@@ -0,0 +1,17 @@
+package com.jpsoft.employment.modules.base.service;
+
+import java.util.List;
+import java.util.Map;
+import com.jpsoft.employment.modules.base.entity.DepartmentInfo;
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.common.dto.Sort;
+
+public interface DepartmentInfoService {
+	DepartmentInfo get(String id);
+	boolean exist(String id);
+	int insert(DepartmentInfo model);
+	int update(DepartmentInfo model);
+	int delete(String id);
+	List<DepartmentInfo> list();
+	Page<DepartmentInfo> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+}

+ 19 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/ExpensesInfoService.java

@@ -0,0 +1,19 @@
+package com.jpsoft.employment.modules.base.service;
+
+import java.text.ParseException;
+import java.util.List;
+import java.util.Map;
+import com.jpsoft.employment.modules.base.entity.ExpensesInfo;
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.common.dto.Sort;
+
+public interface ExpensesInfoService {
+	ExpensesInfo get(String id);
+	boolean exist(String id);
+	int insert(ExpensesInfo model);
+	int update(ExpensesInfo model);
+	int delete(String id);
+	List<ExpensesInfo> list();
+	int generateData(String templateId,String subject) throws ParseException;
+	Page<ExpensesInfo> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+}

+ 22 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/FundIncomeInfoService.java

@@ -0,0 +1,22 @@
+package com.jpsoft.employment.modules.base.service;
+
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.util.List;
+import java.util.Map;
+import com.jpsoft.employment.modules.base.entity.FundIncomeInfo;
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.common.dto.Sort;
+
+public interface FundIncomeInfoService {
+	FundIncomeInfo get(String id);
+	boolean exist(String id);
+	int insert(FundIncomeInfo model);
+	int update(FundIncomeInfo model);
+	int generateData(String templateId,String year,String subject) throws ParseException;
+	int delete(String id);
+	List<FundIncomeInfo> list();
+	BigDecimal sumBySerialNumber(String serialNumber,String curMonth);
+	BigDecimal sumBudgetRevenue(String serialNumber,String startDate,String endDate);
+	Page<FundIncomeInfo> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+}

+ 23 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/TemplateOptionService.java

@@ -0,0 +1,23 @@
+package com.jpsoft.employment.modules.base.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.jpsoft.employment.modules.base.dto.TemplateOptionDTO;
+import com.jpsoft.employment.modules.base.entity.TemplateOption;
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.common.dto.Sort;
+
+
+public interface TemplateOptionService {
+	TemplateOption get(String id);
+	boolean exist(String id);
+	int insert(TemplateOption model);
+	int update(TemplateOption model);
+	int updateList(TemplateOptionDTO dto,String subject);
+	int delete(String id);
+	List<TemplateOption> list();
+	List<TemplateOption> findByTemplateId(String templateId);
+	List<TemplateOption> findByConditions(Map<String, Object> searchParams);
+	Page<TemplateOption> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+}

+ 70 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/impl/DepartmentInfoServiceImpl.java

@@ -0,0 +1,70 @@
+package com.jpsoft.employment.modules.base.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.employment.modules.base.dao.DepartmentInfoDAO;
+import com.jpsoft.employment.modules.base.entity.DepartmentInfo;
+import com.jpsoft.employment.modules.base.service.DepartmentInfoService;
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="departmentInfoService")
+public class DepartmentInfoServiceImpl implements DepartmentInfoService {
+	@Resource(name="departmentInfoDAO")
+	private DepartmentInfoDAO departmentInfoDAO;
+
+	@Override
+	public DepartmentInfo get(String id) {
+		// TODO Auto-generated method stub
+		return departmentInfoDAO.get(id);
+	}
+
+	@Override
+	public int insert(DepartmentInfo model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return departmentInfoDAO.insert(model);
+	}
+
+	@Override
+	public int update(DepartmentInfo model) {
+		// TODO Auto-generated method stub
+		return departmentInfoDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return departmentInfoDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = departmentInfoDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<DepartmentInfo> list() {
+		// TODO Auto-generated method stub
+		return departmentInfoDAO.list();
+	}
+		
+	@Override
+	public Page<DepartmentInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+        Page<DepartmentInfo> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            departmentInfoDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+}

+ 127 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/impl/ExpensesInfoServiceImpl.java

@@ -0,0 +1,127 @@
+package com.jpsoft.employment.modules.base.service.impl;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.annotation.Resource;
+
+import com.jpsoft.employment.modules.base.dao.TemplateOptionDAO;
+import com.jpsoft.employment.modules.base.entity.TemplateOption;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.employment.modules.base.dao.ExpensesInfoDAO;
+import com.jpsoft.employment.modules.base.entity.ExpensesInfo;
+import com.jpsoft.employment.modules.base.service.ExpensesInfoService;
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="expensesInfoService")
+public class ExpensesInfoServiceImpl implements ExpensesInfoService {
+	@Resource(name="expensesInfoDAO")
+	private ExpensesInfoDAO expensesInfoDAO;
+
+	@Resource(name = "templateOptionDAO")
+	private TemplateOptionDAO templateOptionDAO;
+
+	@Override
+	public ExpensesInfo get(String id) {
+		// TODO Auto-generated method stub
+		return expensesInfoDAO.get(id);
+	}
+
+	@Override
+	public int insert(ExpensesInfo model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return expensesInfoDAO.insert(model);
+	}
+
+	@Override
+	public int update(ExpensesInfo model) {
+		// TODO Auto-generated method stub
+		return expensesInfoDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return expensesInfoDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = expensesInfoDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<ExpensesInfo> list() {
+		// TODO Auto-generated method stub
+		return expensesInfoDAO.list();
+	}
+		
+	@Override
+	public Page<ExpensesInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+        Page<ExpensesInfo> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            expensesInfoDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+
+
+	@Override
+	public int generateData(String templateId, String subject) throws ParseException {
+		int count = 0;
+		Date now = new Date();
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
+		SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
+		String year = sdf.format(now);
+
+		List<ExpensesInfo> expensesInfoList = expensesInfoDAO.list();
+
+		for (ExpensesInfo item : expensesInfoList) {
+			item.setDelFlag(true);
+			item.setUpdateBy(subject);
+			item.setUpdateTime(new Date());
+			expensesInfoDAO.update(item);
+		}
+
+		List<TemplateOption> templateOptionList = templateOptionDAO.findByTemplateId(templateId);
+
+		//生成一年的数据
+		for (int i = 1; i <= 12; i++) {
+			String yearMonth = year;
+			if (i < 10) {
+				yearMonth += "-0" + String.valueOf(i) + "-01";
+			} else {
+				yearMonth += "-" + String.valueOf(i) + "-01";
+			}
+
+			for (TemplateOption templateOption : templateOptionList) {
+				ExpensesInfo expensesInfo = new ExpensesInfo();
+				expensesInfo.setId(UUID.randomUUID().toString());
+				expensesInfo.setName(templateOption.getName());
+				expensesInfo.setDelFlag(false);
+				expensesInfo.setCreateBy(subject);
+				expensesInfo.setCreateTime(new Date());
+				expensesInfo.setSerialNumber(templateOption.getSerialNum());
+				expensesInfo.setYear(sdf2.parse(yearMonth));
+				expensesInfo.setIndex(templateOption.getIndex());
+				expensesInfo.setTemplateId(templateId);
+
+				count += expensesInfoDAO.insert(expensesInfo);
+			}
+		}
+
+		return count;
+	}
+}

+ 165 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/impl/FundIncomeInfoServiceImpl.java

@@ -0,0 +1,165 @@
+package com.jpsoft.employment.modules.base.service.impl;
+
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.annotation.Resource;
+
+import com.jpsoft.employment.modules.base.dao.TemplateInfoDAO;
+import com.jpsoft.employment.modules.base.dao.TemplateOptionDAO;
+import com.jpsoft.employment.modules.base.entity.TemplateInfo;
+import com.jpsoft.employment.modules.base.entity.TemplateOption;
+import com.jpsoft.employment.modules.common.utils.StringUtils;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.employment.modules.base.dao.FundIncomeInfoDAO;
+import com.jpsoft.employment.modules.base.entity.FundIncomeInfo;
+import com.jpsoft.employment.modules.base.service.FundIncomeInfoService;
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value = "fundIncomeInfoService")
+public class FundIncomeInfoServiceImpl implements FundIncomeInfoService {
+    @Resource(name = "fundIncomeInfoDAO")
+    private FundIncomeInfoDAO fundIncomeInfoDAO;
+
+    @Resource(name = "templateOptionDAO")
+    private TemplateOptionDAO templateOptionDAO;
+
+    @Resource(name = "templateInfoDAO")
+    private TemplateInfoDAO templateInfoDAO;
+
+    @Override
+    public FundIncomeInfo get(String id) {
+        // TODO Auto-generated method stub
+        return fundIncomeInfoDAO.get(id);
+    }
+
+    @Override
+    public int insert(FundIncomeInfo model) {
+        // TODO Auto-generated method stub
+        //model.setId(UUID.randomUUID().toString());
+
+        return fundIncomeInfoDAO.insert(model);
+    }
+
+    @Override
+    public int update(FundIncomeInfo model) {
+        // TODO Auto-generated method stub
+        return fundIncomeInfoDAO.update(model);
+    }
+
+
+    @Override
+    public int generateData(String templateId, String year, String subject) throws ParseException {
+        int count = 0;
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
+        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
+
+        String startDate = year + "-01" + "-01";
+        String endDate = year + "-12" + "-31";
+
+        List<FundIncomeInfo> fundIncomeInfoList = fundIncomeInfoDAO.findByYear(startDate,endDate);
+
+        for (FundIncomeInfo item : fundIncomeInfoList) {
+            item.setDelFlag(true);
+            item.setUpdateBy(subject);
+            item.setUpdateTime(new Date());
+            fundIncomeInfoDAO.update(item);
+        }
+
+        TemplateInfo templateInfo = templateInfoDAO.get(templateId);
+
+        List<TemplateOption> templateOptionList = templateOptionDAO.findByTemplateId(templateId);
+
+        //生成一年的数据
+        for (int i = 1; i <= 12; i++) {
+            String yearMonth = year;
+            if (i < 10) {
+                yearMonth += "-0" + String.valueOf(i) + "-01";
+            } else {
+                yearMonth += "-" + String.valueOf(i) + "-01";
+            }
+
+            for (TemplateOption templateOption : templateOptionList) {
+                FundIncomeInfo fundIncomeInfo = new FundIncomeInfo();
+                fundIncomeInfo.setId(UUID.randomUUID().toString());
+                fundIncomeInfo.setName(templateOption.getName());
+                fundIncomeInfo.setDelFlag(false);
+                fundIncomeInfo.setCreateBy(subject);
+                fundIncomeInfo.setCreateTime(new Date());
+                fundIncomeInfo.setSerialNumber(templateOption.getSerialNum());
+                fundIncomeInfo.setYear(sdf2.parse(yearMonth));
+                fundIncomeInfo.setIndex(templateOption.getIndex());
+                fundIncomeInfo.setBudgetRevenue(templateOption.getBudgetRevenue());
+                fundIncomeInfo.setTemplateId(templateId);
+                fundIncomeInfo.setIncomeTimeRange(templateOption.getIncomeTimeRange());
+                fundIncomeInfo.setEndDate(templateOption.getEndDate());
+                fundIncomeInfo.setIncomeType(templateOption.getIncomeType());
+
+                if (StringUtils.isNotEmpty(templateInfo.getAttachment())) {
+                    fundIncomeInfo.setAttachment(templateInfo.getAttachment());
+                }
+
+                if (templateOption.getIsSum() != null) {
+                    fundIncomeInfo.setIsSum(templateOption.getIsSum());
+                }
+
+                if (StringUtils.isNotEmpty(templateOption.getDepartmentIds())) {
+                    fundIncomeInfo.setIncomeDepartment(templateOption.getDepartmentIds());
+                }
+
+                count += fundIncomeInfoDAO.insert(fundIncomeInfo);
+            }
+        }
+
+        return count;
+    }
+
+    @Override
+    public int delete(String id) {
+        // TODO Auto-generated method stub
+        return fundIncomeInfoDAO.delete(id);
+    }
+
+    @Override
+    public boolean exist(String id) {
+        // TODO Auto-generated method stub
+        int count = fundIncomeInfoDAO.exist(id);
+
+        return count > 0 ? true : false;
+    }
+
+    @Override
+    public List<FundIncomeInfo> list() {
+        // TODO Auto-generated method stub
+        return fundIncomeInfoDAO.list();
+    }
+
+
+    @Override
+    public BigDecimal sumBySerialNumber(String serialNumber, String curMonth) {
+        return fundIncomeInfoDAO.sumBySerialNumber(serialNumber, curMonth);
+    }
+
+
+    @Override
+    public BigDecimal sumBudgetRevenue(String serialNumber, String startDate, String endDate) {
+        return fundIncomeInfoDAO.sumBudgetRevenue(serialNumber, startDate, endDate);
+    }
+
+    @Override
+    public Page<FundIncomeInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize, boolean count, List<Sort> sortList) {
+        Page<FundIncomeInfo> page = PageHelper.startPage(pageNumber, pageSize, count).doSelectPage(() -> {
+            fundIncomeInfoDAO.search(searchParams, sortList);
+        });
+
+        return page;
+    }
+}

+ 124 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/impl/TemplateOptionServiceImpl.java

@@ -0,0 +1,124 @@
+package com.jpsoft.employment.modules.base.service.impl;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.annotation.Resource;
+
+import com.jpsoft.employment.modules.base.dto.TemplateOptionDTO;
+import com.jpsoft.employment.modules.common.utils.StringUtils;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.employment.modules.base.dao.TemplateOptionDAO;
+import com.jpsoft.employment.modules.base.entity.TemplateOption;
+import com.jpsoft.employment.modules.base.service.TemplateOptionService;
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value = "templateOptionService")
+public class TemplateOptionServiceImpl implements TemplateOptionService {
+    @Resource(name = "templateOptionDAO")
+    private TemplateOptionDAO templateOptionDAO;
+
+    @Override
+    public TemplateOption get(String id) {
+        // TODO Auto-generated method stub
+        return templateOptionDAO.get(id);
+    }
+
+    @Override
+    public int insert(TemplateOption model) {
+        // TODO Auto-generated method stub
+        //model.setId(UUID.randomUUID().toString());
+
+        return templateOptionDAO.insert(model);
+    }
+
+    @Override
+    public int update(TemplateOption model) {
+        // TODO Auto-generated method stub
+        return templateOptionDAO.update(model);
+    }
+
+    @Override
+    public int updateList(TemplateOptionDTO dto, String subject) {
+        String templateId = dto.getTemplateId();
+        Date now = new Date();
+
+        int affectCount = 0;
+
+        List<TemplateOption> curList = templateOptionDAO.findByTemplateId(templateId);
+        for (TemplateOption templateOption : curList) {
+            templateOption.setDelFlag(true);
+            templateOption.setUpdateBy(subject);
+            templateOption.setUpdateTime(now);
+            templateOptionDAO.update(templateOption);
+        }
+
+        List<TemplateOption> templateOptionList = dto.getTemplateOptionList();
+
+        for (TemplateOption templateOption : templateOptionList) {
+            templateOption.setId(UUID.randomUUID().toString());
+            templateOption.setTemplateId(templateId);
+            templateOption.setCreateTime(now);
+            templateOption.setCreateBy(subject);
+            templateOption.setDelFlag(false);
+
+            String[] arr = templateOption.getDepartmentIdArr();
+            String departmentId = "";
+            for (String departId : arr) {
+                departmentId += departId + ",";
+            }
+            if(StringUtils.isNotEmpty(departmentId)){
+                departmentId.substring(0,departmentId.lastIndexOf(","));
+                templateOption.setDepartmentIds(departmentId);
+            }
+            affectCount += templateOptionDAO.insert(templateOption);
+        }
+
+        return affectCount;
+    }
+
+    @Override
+    public int delete(String id) {
+        // TODO Auto-generated method stub
+        return templateOptionDAO.delete(id);
+    }
+
+    @Override
+    public boolean exist(String id) {
+        // TODO Auto-generated method stub
+        int count = templateOptionDAO.exist(id);
+
+        return count > 0 ? true : false;
+    }
+
+    @Override
+    public List<TemplateOption> list() {
+        // TODO Auto-generated method stub
+        return templateOptionDAO.list();
+    }
+
+
+    @Override
+    public List<TemplateOption> findByTemplateId(String templateId) {
+        return templateOptionDAO.findByTemplateId(templateId);
+    }
+
+    @Override
+    public List<TemplateOption> findByConditions(Map<String, Object> searchParams) {
+        return templateOptionDAO.findByConditions(searchParams);
+    }
+
+    @Override
+    public Page<TemplateOption> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize, boolean count, List<Sort> sortList) {
+        Page<TemplateOption> page = PageHelper.startPage(pageNumber, pageSize, count).doSelectPage(() -> {
+            templateOptionDAO.search(searchParams, sortList);
+        });
+
+        return page;
+    }
+}

+ 34 - 0
common/src/main/java/com/jpsoft/employment/modules/common/utils/PojoUtils.java

@@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
 import java.beans.BeanInfo;
 import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
+import java.lang.reflect.Field;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -81,4 +82,37 @@ public class PojoUtils {
 
         return newPage;
     }
+
+
+
+    public static Map ConvertObjToMap(Object obj){
+        Map<String,Object> reMap = new HashMap<String,Object>();
+        if (obj == null)
+            return null;
+        Field[] fields = obj.getClass().getDeclaredFields();
+        try {
+            for(int i=0;i<fields.length;i++){
+                try {
+                    Field f = obj.getClass().getDeclaredField(fields[i].getName());
+                    f.setAccessible(true);
+                    Object o = f.get(obj);
+                    reMap.put(fields[i].getName(), o);
+                } catch (NoSuchFieldException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                } catch (IllegalArgumentException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                } catch (IllegalAccessException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
+        } catch (SecurityException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        return reMap;
+    }
+
 }

+ 7 - 0
common/src/main/java/com/jpsoft/employment/modules/sys/entity/User.java

@@ -24,6 +24,7 @@ public class User {
 	private String openId;
 	private String companyId;
 	private String companyName;
+	private String departmentId;
 
 
 	@ApiModelProperty(value = "头像")
@@ -217,5 +218,11 @@ public class User {
 		this.photo = photo;
 	}
 
+	public String getDepartmentId() {
+		return departmentId;
+	}
 
+	public void setDepartmentId(String departmentId) {
+		this.departmentId = departmentId;
+	}
 }

+ 87 - 0
common/src/main/resources/mapper/base/DepartmentInfo.xml

@@ -0,0 +1,87 @@
+<?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">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.employment.modules.base.dao.DepartmentInfoDAO">
+	<resultMap id="DepartmentInfoMap" type="com.jpsoft.employment.modules.base.entity.DepartmentInfo">
+		<id property="id" column="id_" />
+			<result property="name" column="name_" />
+			<result property="createTime" column="create_time" />
+			<result property="updateTime" column="update_time" />
+			<result property="createBy" column="create_by" />
+			<result property="updateBy" column="update_by" />
+			<result property="delFlag" column="del_flag" />
+			</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.employment.modules.base.entity.DepartmentInfo">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into base_department_info
+	    (id_,name_,create_time,update_time,create_by,update_by,del_flag)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{name,jdbcType=VARCHAR}
+,#{createTime,jdbcType= TIMESTAMP }
+,#{updateTime,jdbcType= TIMESTAMP }
+,#{createBy,jdbcType=VARCHAR}
+,#{updateBy,jdbcType=VARCHAR}
+,#{delFlag,jdbcType= NUMERIC }
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from base_department_info where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.employment.modules.base.entity.DepartmentInfo">
+		update base_department_info
+		<set>
+				<if test="name!=null">
+		name_=#{name,jdbcType=VARCHAR},
+		</if>
+				<if test="createTime!=null">
+		create_time=#{createTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="updateTime!=null">
+		update_time=#{updateTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="createBy!=null">
+		create_by=#{createBy,jdbcType=VARCHAR},
+		</if>
+				<if test="updateBy!=null">
+		update_by=#{updateBy,jdbcType=VARCHAR},
+		</if>
+				<if test="delFlag!=null">
+		del_flag=#{delFlag,jdbcType= NUMERIC },
+		</if>
+		</set>
+	where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="DepartmentInfoMap">
+		select 
+id_,name_,create_time,update_time,create_by,update_by,del_flag		from base_department_info where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from base_department_info where id_=#{0}
+	</select>
+	<select id="list" resultMap="DepartmentInfoMap">
+		select * from base_department_info where del_flag=false order by create_time desc
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="DepartmentInfoMap">
+		<![CDATA[
+			select * from base_department_info
+		]]>
+		<where>
+			del_flag=false
+			<if test="searchParams.id != null">
+				and ID_ like #{searchParams.id}
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+	        ${sort.name} ${sort.order}
+	 	</foreach>
+	</select>
+</mapper>

+ 151 - 0
common/src/main/resources/mapper/base/ExpensesInfo.xml

@@ -0,0 +1,151 @@
+<?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">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.employment.modules.base.dao.ExpensesInfoDAO">
+	<resultMap id="ExpensesInfoMap" type="com.jpsoft.employment.modules.base.entity.ExpensesInfo">
+		<id property="id" column="id_" />
+			<result property="serialNumber" column="serial_number" />
+			<result property="name" column="name_" />
+			<result property="amount" column="amount_" />
+			<result property="executor" column="executor_" />
+			<result property="responsiblePerson" column="responsible_person" />
+			<result property="completionTime" column="completion_time" />
+			<result property="feeStartDate" column="fee_start_date" />
+			<result property="supervisor" column="supervisor" />
+			<result property="aboutTopic" column="about_topic" />
+			<result property="createTime" column="create_time" />
+			<result property="updateTime" column="update_time" />
+			<result property="createBy" column="create_by" />
+			<result property="updateBy" column="update_by" />
+			<result property="delFlag" column="del_flag" />
+			<result property="year" column="year_" />
+			<result property="index" column="index_" />
+			<result property="templateId" column="template_id" />
+			</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.employment.modules.base.entity.ExpensesInfo">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into base_expenses_info
+	    (id_,serial_number,name_,amount_,executor_,responsible_person,completion_time,fee_start_date,supervisor,about_topic,create_time,update_time,create_by,update_by,del_flag,year_,index_,template_id)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{serialNumber,jdbcType=VARCHAR}
+,#{name,jdbcType=VARCHAR}
+,#{amount,jdbcType= NUMERIC }
+,#{executor,jdbcType=VARCHAR}
+,#{responsiblePerson,jdbcType=VARCHAR}
+,#{completionTime,jdbcType=VARCHAR}
+,#{feeStartDate,jdbcType= TIMESTAMP }
+,#{supervisor,jdbcType=VARCHAR}
+,#{aboutTopic,jdbcType=VARCHAR}
+,#{createTime,jdbcType= TIMESTAMP }
+,#{updateTime,jdbcType= TIMESTAMP }
+,#{createBy,jdbcType=VARCHAR}
+,#{updateBy,jdbcType=VARCHAR}
+,#{delFlag,jdbcType= NUMERIC }
+,#{year,jdbcType= TIMESTAMP }
+,#{index,jdbcType= NUMERIC }
+,#{templateId,jdbcType=VARCHAR}
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from base_expenses_info where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.employment.modules.base.entity.ExpensesInfo">
+		update base_expenses_info
+		<set>
+				<if test="serialNumber!=null">
+		serial_number=#{serialNumber,jdbcType=VARCHAR},
+		</if>
+				<if test="name!=null">
+		name_=#{name,jdbcType=VARCHAR},
+		</if>
+				<if test="amount!=null">
+		amount_=#{amount,jdbcType= NUMERIC },
+		</if>
+				<if test="executor!=null">
+		executor_=#{executor,jdbcType=VARCHAR},
+		</if>
+				<if test="responsiblePerson!=null">
+		responsible_person=#{responsiblePerson,jdbcType=VARCHAR},
+		</if>
+				<if test="completionTime!=null">
+		completion_time=#{completionTime,jdbcType=VARCHAR},
+		</if>
+				<if test="feeStartDate!=null">
+		fee_start_date=#{feeStartDate,jdbcType= TIMESTAMP },
+		</if>
+				<if test="supervisor!=null">
+		supervisor=#{supervisor,jdbcType=VARCHAR},
+		</if>
+				<if test="aboutTopic!=null">
+		about_topic=#{aboutTopic,jdbcType=VARCHAR},
+		</if>
+				<if test="createTime!=null">
+		create_time=#{createTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="updateTime!=null">
+		update_time=#{updateTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="createBy!=null">
+		create_by=#{createBy,jdbcType=VARCHAR},
+		</if>
+				<if test="updateBy!=null">
+		update_by=#{updateBy,jdbcType=VARCHAR},
+		</if>
+				<if test="delFlag!=null">
+		del_flag=#{delFlag,jdbcType= NUMERIC },
+		</if>
+				<if test="year!=null">
+		year_=#{year,jdbcType= TIMESTAMP },
+		</if>
+				<if test="index!=null">
+		index_=#{index,jdbcType= NUMERIC },
+		</if>
+				<if test="templateId!=null">
+		template_id=#{templateId,jdbcType=VARCHAR},
+		</if>
+		</set>
+	where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="ExpensesInfoMap">
+		select * from base_expenses_info where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from base_expenses_info where id_=#{0}
+	</select>
+	<select id="list" resultMap="ExpensesInfoMap">
+		select * from base_expenses_info
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="ExpensesInfoMap">
+		<![CDATA[
+			select * from base_expenses_info
+		]]>
+		<where>
+			del_flag = false
+			<if test="searchParams.startDate != null">
+				<![CDATA[
+					and year_>=#{searchParams.startDate}
+				]]>
+			</if>
+			<if test="searchParams.endDate != null">
+				<![CDATA[
+					and year_<=#{searchParams.endDate}
+				]]>
+			</if>
+			<if test="searchParams.name != null">
+				and name_ = #{searchParams.name}
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+	        ${sort.name} ${sort.order}
+	 	</foreach>
+	</select>
+</mapper>

+ 209 - 0
common/src/main/resources/mapper/base/FundIncomeInfo.xml

@@ -0,0 +1,209 @@
+<?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">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.employment.modules.base.dao.FundIncomeInfoDAO">
+	<resultMap id="FundIncomeInfoMap" type="com.jpsoft.employment.modules.base.entity.FundIncomeInfo">
+		<id property="id" column="id_" />
+			<result property="serialNumber" column="serial_number" />
+			<result property="name" column="name_" />
+			<result property="budgetRevenue" column="budget_revenue" />
+			<result property="accountName" column="account_name" />
+			<result property="curMonthReceived" column="cur_month_received" />
+			<result property="actualTotalRevenue" column="actual_total_revenue" />
+			<result property="accumulatedArrears" column="accumulated_arrears" />
+			<result property="incomeTimeRange" column="income_time_range" />
+			<result property="incomeType" column="income_type" />
+			<result property="endDate" column="end_date" />
+			<result property="incomeDepartment" column="income_department" />
+			<result property="attachment" column="attachment_" />
+			<result property="accountingName" column="accounting_Name" />
+			<result property="bak" column="bak_" />
+			<result property="createTime" column="create_time" />
+			<result property="updateTime" column="update_time" />
+			<result property="createBy" column="create_by" />
+			<result property="updateBy" column="update_by" />
+			<result property="delFlag" column="del_flag" />
+			<result property="year" column="year_" />
+			<result property="index" column="index_" />
+			<result property="templateId" column="template_id" />
+			<result property="isSum" column="is_sum" />
+			</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.employment.modules.base.entity.FundIncomeInfo">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into base_fund_income_info
+	    (id_,serial_number,name_,budget_revenue,account_name,cur_month_received,
+	    actual_total_revenue,accumulated_arrears,income_time_range,income_type,
+	    end_date,income_department,attachment_,accounting_Name,bak_,
+	    create_time,update_time,create_by,update_by,del_flag,year_,index_,template_id,is_sum)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{serialNumber,jdbcType=VARCHAR}
+,#{name,jdbcType=VARCHAR}
+,#{budgetRevenue,jdbcType= NUMERIC }
+,#{accountName,jdbcType=VARCHAR}
+,#{curMonthReceived,jdbcType= NUMERIC }
+,#{actualTotalRevenue,jdbcType= NUMERIC }
+,#{accumulatedArrears,jdbcType= NUMERIC }
+,#{incomeTimeRange,jdbcType=VARCHAR}
+,#{incomeType,jdbcType=VARCHAR}
+,#{endDate,jdbcType= TIMESTAMP }
+,#{incomeDepartment,jdbcType=VARCHAR}
+,#{attachment,jdbcType=VARCHAR}
+,#{accountingName,jdbcType=VARCHAR}
+,#{bak,jdbcType=VARCHAR}
+,#{createTime,jdbcType= TIMESTAMP }
+,#{updateTime,jdbcType= TIMESTAMP }
+,#{createBy,jdbcType=VARCHAR}
+,#{updateBy,jdbcType=VARCHAR}
+,#{delFlag,jdbcType= NUMERIC }
+,#{year,jdbcType=TIMESTAMP}
+,#{index,jdbcType= NUMERIC }
+,#{templateId,jdbcType=VARCHAR}
+,#{isSum,jdbcType= NUMERIC }
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from base_fund_income_info where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.employment.modules.base.entity.FundIncomeInfo">
+		update base_fund_income_info
+		<set>
+				<if test="serialNumber!=null">
+		serial_number=#{serialNumber,jdbcType=VARCHAR},
+		</if>
+				<if test="name!=null">
+		name_=#{name,jdbcType=VARCHAR},
+		</if>
+				<if test="budgetRevenue!=null">
+		budget_revenue=#{budgetRevenue,jdbcType= NUMERIC },
+		</if>
+				<if test="accountName!=null">
+		account_name=#{accountName,jdbcType=VARCHAR},
+		</if>
+				<if test="curMonthReceived!=null">
+		cur_month_received=#{curMonthReceived,jdbcType= NUMERIC },
+		</if>
+				<if test="actualTotalRevenue!=null">
+		actual_total_revenue=#{actualTotalRevenue,jdbcType= NUMERIC },
+		</if>
+				<if test="accumulatedArrears!=null">
+		accumulated_arrears=#{accumulatedArrears,jdbcType= NUMERIC },
+		</if>
+				<if test="incomeTimeRange!=null">
+		income_time_range=#{incomeTimeRange,jdbcType=VARCHAR},
+		</if>
+				<if test="incomeType!=null">
+		income_type=#{incomeType,jdbcType=VARCHAR},
+		</if>
+				<if test="endDate!=null">
+		end_date=#{endDate,jdbcType= TIMESTAMP },
+		</if>
+				<if test="incomeDepartment!=null">
+		income_department=#{incomeDepartment,jdbcType=VARCHAR},
+		</if>
+				<if test="attachment!=null">
+		attachment_=#{attachment,jdbcType=VARCHAR},
+		</if>
+				<if test="accountingName!=null">
+		accounting_Name=#{accountingName,jdbcType=VARCHAR},
+		</if>
+				<if test="bak!=null">
+		bak_=#{bak,jdbcType=VARCHAR},
+		</if>
+			<if test="createTime!=null">
+				create_time=#{createTime,jdbcType= TIMESTAMP },
+			</if>
+			<if test="updateTime!=null">
+				update_time=#{updateTime,jdbcType= TIMESTAMP },
+			</if>
+			<if test="createBy!=null">
+				create_by=#{createBy,jdbcType=VARCHAR},
+			</if>
+			<if test="updateBy!=null">
+				update_by=#{updateBy,jdbcType=VARCHAR},
+			</if>
+			<if test="delFlag!=null">
+				del_flag=#{delFlag,jdbcType= NUMERIC },
+			</if>
+			<if test="year!=null">
+				year_=#{year,jdbcType=TIMESTAMP},
+			</if>
+			<if test="index!=null">
+				index_=#{index,jdbcType= NUMERIC },
+			</if>
+			<if test="isSum!=null">
+				is_sum=#{isSum,jdbcType=NUMERIC},
+			</if>
+		</set>
+	where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="FundIncomeInfoMap">
+		select * from base_fund_income_info where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from base_fund_income_info where id_=#{0}
+	</select>
+	<select id="list" resultMap="FundIncomeInfoMap">
+		select * from base_fund_income_info where del_flag=false order by create_time
+	</select>
+	<select id="findByYear" resultMap="FundIncomeInfoMap">
+		<![CDATA[
+			select * from base_fund_income_info
+			where del_flag=false
+			and year_>=#{startDate}
+			and year_<=#{endDate}
+			order by create_time
+		]]>
+	</select>
+	<select id="sumBySerialNumber" resultType="java.math.BigDecimal">
+		<![CDATA[
+			select IFNULL(sum(cur_month_received),0) from base_fund_income_info
+			where del_flag=false
+			and serial_number=#{serialNumber}
+			and year_<=#{curMonth}
+			order by create_time
+		]]>
+	</select>
+	<select id="sumBudgetRevenue" resultType="java.math.BigDecimal">
+		<![CDATA[
+			select IFNULL(sum(budget_revenue),0) from base_fund_income_info
+			where del_flag=false
+			and serial_number like #{serialNumber}
+			and year_>=#{startDate}
+			and year_<=#{endDate}
+			order by create_time
+		]]>
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="FundIncomeInfoMap">
+		<![CDATA[
+			select * from base_fund_income_info
+		]]>
+		<where>
+			del_flag=false
+			<if test="searchParams.startDate != null">
+				<![CDATA[
+					and year_>=#{searchParams.startDate}
+				]]>
+			</if>
+			<if test="searchParams.endDate != null">
+				<![CDATA[
+					and year_<=#{searchParams.endDate}
+				]]>
+			</if>
+			<if test="searchParams.name != null">
+				and name_ = #{searchParams.name}
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+	        ${sort.name} ${sort.order}
+	 	</foreach>
+	</select>
+</mapper>

+ 15 - 1
common/src/main/resources/mapper/base/TemplateInfo.xml

@@ -14,6 +14,10 @@
 			<result property="createBy" column="create_by" />
 			<result property="updateBy" column="update_by" />
 			<result property="delFlag" column="del_flag" />
+			<result property="status" column="status_" />
+			<result property="attachment" column="attachment_" />
+
+
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.employment.modules.base.entity.TemplateInfo">
 	<!--
@@ -23,7 +27,7 @@
 	-->
 	<![CDATA[
 		insert into base_template_info
-	    (id_,title_,subtitle_,type_,serial_num,create_time,update_time,create_by,update_by,del_flag)
+	    (id_,title_,subtitle_,type_,serial_num,create_time,update_time,create_by,update_by,del_flag,status_,attachment_)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -36,6 +40,8 @@
 ,#{createBy,jdbcType=VARCHAR}
 ,#{updateBy,jdbcType=VARCHAR}
 ,#{delFlag,jdbcType= NUMERIC }
+,#{status,jdbcType=VARCHAR}
+,#{attachment,jdbcType=VARCHAR}
 		)
 	]]>
 	</insert>
@@ -72,6 +78,12 @@
 				<if test="delFlag!=null">
 		del_flag=#{delFlag,jdbcType= NUMERIC },
 		</if>
+			<if test="status!=null">
+				status_=#{status,jdbcType=VARCHAR},
+			</if>
+			<if test="attachment!=null">
+				attachment_=#{attachment,jdbcType=VARCHAR},
+			</if>
 		</set>
 	where id_=#{id}
 	</update>
@@ -83,6 +95,8 @@
 	</select>
 	<select id="list" resultMap="TemplateInfoMap">
 		select * from base_template_info
+		where del_flag = false and status_='1'
+		order by create_time asc
 	</select>
 	<select id="search" parameterType="hashmap" resultMap="TemplateInfoMap">
 		<![CDATA[

+ 155 - 0
common/src/main/resources/mapper/base/TemplateOption.xml

@@ -0,0 +1,155 @@
+<?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">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.employment.modules.base.dao.TemplateOptionDAO">
+    <resultMap id="TemplateOptionMap" type="com.jpsoft.employment.modules.base.entity.TemplateOption">
+        <id property="id" column="id_"/>
+        <result property="templateId" column="template_id"/>
+        <result property="serialNum" column="serial_num"/>
+        <result property="name" column="name_"/>
+        <result property="budgetRevenue" column="budget_revenue"/>
+        <result property="index" column="index_"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="createBy" column="create_by"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="departmentIds" column="department_ids"/>
+        <result property="isSum" column="is_sum"/>
+        <result property="incomeTimeRange" column="income_time_range" />
+        <result property="incomeType" column="income_type" />
+        <result property="endDate" column="end_date" />
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.employment.modules.base.entity.TemplateOption">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
+		insert into base_template_option
+	    (id_,template_id,serial_num,name_,budget_revenue,index_,create_time,update_time,
+	    create_by,update_by,del_flag,department_ids,is_sum,income_time_range,income_type,
+	    end_date)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{templateId,jdbcType=VARCHAR}
+,#{serialNum,jdbcType=VARCHAR}
+,#{name,jdbcType=VARCHAR}
+,#{budgetRevenue,jdbcType=NUMERIC}
+,#{index,jdbcType= NUMERIC }
+,#{createTime,jdbcType= TIMESTAMP }
+,#{updateTime,jdbcType= TIMESTAMP }
+,#{createBy,jdbcType=VARCHAR}
+,#{updateBy,jdbcType=VARCHAR}
+,#{delFlag,jdbcType= NUMERIC }
+,#{departmentIds,jdbcType=VARCHAR}
+,#{isSum,jdbcType= NUMERIC }
+,#{incomeTimeRange,jdbcType=VARCHAR}
+,#{incomeType,jdbcType=VARCHAR}
+,#{endDate,jdbcType= TIMESTAMP }
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+		delete from base_template_option where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+    <update id="update" parameterType="com.jpsoft.employment.modules.base.entity.TemplateOption">
+        update base_template_option
+        <set>
+            <if test="templateId!=null">
+                template_id=#{templateId,jdbcType=VARCHAR},
+            </if>
+            <if test="serialNum!=null">
+                serial_num=#{serialNum,jdbcType=VARCHAR},
+            </if>
+            <if test="name!=null">
+                name_=#{name,jdbcType=VARCHAR},
+            </if>
+            <if test="budgetRevenue!=null">
+                budget_revenue=#{budgetRevenue,jdbcType=NUMERIC},
+            </if>
+            <if test="index!=null">
+                index_=#{index,jdbcType= NUMERIC },
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateTime!=null">
+                update_time=#{updateTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+            <if test="departmentIds!=null">
+                department_ids=#{departmentIds,jdbcType=VARCHAR},
+            </if>
+            <if test="isSum!=null">
+                is_sum=#{isSum,jdbcType= NUMERIC },
+            </if>
+            <if test="incomeTimeRange!=null">
+                income_time_range=#{incomeTimeRange,jdbcType=VARCHAR},
+            </if>
+            <if test="incomeType!=null">
+                income_type=#{incomeType,jdbcType=VARCHAR},
+            </if>
+            <if test="endDate!=null">
+                end_date=#{endDate,jdbcType= TIMESTAMP },
+            </if>
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="TemplateOptionMap">
+		select * from base_template_option where id_=#{0}
+	</select>
+    <select id="exist" parameterType="string" resultType="int">
+		select count(*) from base_template_option where id_=#{0}
+	</select>
+    <select id="list" resultMap="TemplateOptionMap">
+		select * from base_template_option
+	</select>
+    <select id="findByTemplateId" resultMap="TemplateOptionMap">
+		select * from base_template_option
+		where del_flag=false
+		and template_id=#{templateId}
+		order by index_ asc
+	</select>
+    <select id="search" parameterType="hashmap" resultMap="TemplateOptionMap">
+        <![CDATA[
+			select * from base_template_option
+		]]>
+        <where>
+            del_flag=false
+            <if test="searchParams.id != null">
+                and ID_ like #{searchParams.id}
+            </if>
+        </where>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
+    <select id="findByConditions" parameterType="hashmap" resultMap="TemplateOptionMap">
+        <![CDATA[
+			select * from base_template_option
+		]]>
+        <where>
+            del_flag=false
+            <if test="searchParams.templateId != null">
+                and template_id = #{searchParams.templateId}
+            </if>
+            <if test="searchParams.departmentId != null">
+                and department_ids like #{searchParams.departmentId}
+            </if>
+        </where>
+        order by index_ asc
+    </select>
+
+</mapper>

+ 7 - 1
common/src/main/resources/mapper/sys/User.xml

@@ -17,6 +17,8 @@
         <result property="companyId" column="company_id"/>
         <result property="companyName" column="company_name"/>
         <result property="photo" column="photo_"/>
+        <result property="departmentId" column="department_id"/>
+
     </resultMap>
 
     <resultMap id="UserVOMap" type="com.jpsoft.employment.modules.sys.entity.UserVO" extends="UserMap">
@@ -34,7 +36,7 @@
         <![CDATA[
 		insert into sys_user
 	    (id_,user_name,password_,real_name,create_time,update_time,
-	    del_flag,create_by,update_by,open_id,company_id,photo_)
+	    del_flag,create_by,update_by,open_id,company_id,photo_,department_id)
 		values
 		(
             #{id,jdbcType=VARCHAR}
@@ -49,6 +51,7 @@
             ,#{openId,jdbcType=VARCHAR}
             ,#{companyId,jdbcType=VARCHAR}
             ,#{photo,jdbcType=VARCHAR}
+            ,#{departmentId,jdbcType=VARCHAR}
 		)
 	]]>
     </insert>
@@ -91,6 +94,9 @@
             <if test="photo!=null">
                 photo_=#{photo,jdbcType=VARCHAR},
             </if>
+            <if test="departmentId!=null">
+                department_id=#{departmentId,jdbcType=VARCHAR},
+            </if>
         </set>
         where id_=#{id}
     </update>

+ 239 - 0
web/src/main/java/com/jpsoft/employment/modules/base/controller/DepartmentInfoController.java

@@ -0,0 +1,239 @@
+package com.jpsoft.employment.modules.base.controller;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import com.jpsoft.employment.modules.common.dto.MessageResult;
+import com.jpsoft.employment.modules.base.entity.DepartmentInfo;
+import com.jpsoft.employment.modules.base.service.DepartmentInfoService;
+import com.jpsoft.employment.modules.common.utils.PojoUtils;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/base/departmentInfo")
+public class DepartmentInfoController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private DepartmentInfoService departmentInfoService;
+
+
+    @ApiOperation(value = "创建空记录")
+    @GetMapping("create")
+    public MessageResult<DepartmentInfo> create() {
+        MessageResult<DepartmentInfo> msgResult = new MessageResult<>();
+
+        DepartmentInfo departmentInfo = new DepartmentInfo();
+
+        msgResult.setData(departmentInfo);
+        msgResult.setResult(true);
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "添加信息")
+    @PostMapping("add")
+    public MessageResult<DepartmentInfo> add(@RequestBody DepartmentInfo departmentInfo, @RequestAttribute String subject) {
+        MessageResult<DepartmentInfo> msgResult = new MessageResult<>();
+
+        try {
+            departmentInfo.setId(UUID.randomUUID().toString());
+            departmentInfo.setDelFlag(false);
+            departmentInfo.setCreateBy(subject);
+            departmentInfo.setCreateTime(new Date());
+
+            int affectCount = departmentInfoService.insert(departmentInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(departmentInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "获取信息")
+    @GetMapping("edit/{id}")
+    public MessageResult<DepartmentInfo> edit(@PathVariable("id") String id) {
+        MessageResult<DepartmentInfo> msgResult = new MessageResult<>();
+
+        try {
+            DepartmentInfo departmentInfo = departmentInfoService.get(id);
+
+            if (departmentInfo != null) {
+                msgResult.setResult(true);
+                msgResult.setData(departmentInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "更新用户")
+    @PostMapping("update")
+    public MessageResult<DepartmentInfo> update(@RequestBody DepartmentInfo departmentInfo, @RequestAttribute String subject) {
+        MessageResult<DepartmentInfo> msgResult = new MessageResult<>();
+
+        try {
+            departmentInfo.setUpdateBy(subject);
+            departmentInfo.setUpdateTime(new Date());
+
+            int affectCount = departmentInfoService.update(departmentInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(departmentInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "删除用户")
+    @PostMapping("delete/{id}")
+    public MessageResult<DepartmentInfo> delete(@PathVariable("id") String id, @RequestAttribute String subject) {
+        MessageResult<DepartmentInfo> msgResult = new MessageResult<>();
+
+        try {
+
+            DepartmentInfo departmentInfo = departmentInfoService.get(id);
+            departmentInfo.setDelFlag(true);
+            departmentInfo.setUpdateBy(subject);
+            departmentInfo.setUpdateTime(new Date());
+
+            int affectCount = departmentInfoService.update(departmentInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库删除失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value = "批量删除")
+    @PostMapping("batchDelete")
+    public MessageResult<Integer> batchDelete(@RequestBody List<String> idList, @RequestAttribute String subject) {
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            int affectCount = 0;
+
+            for (String id : idList) {
+                DepartmentInfo departmentInfo = departmentInfoService.get(id);
+                departmentInfo.setDelFlag(true);
+                departmentInfo.setUpdateBy(subject);
+                departmentInfo.setUpdateTime(new Date());
+
+                affectCount += departmentInfoService.update(departmentInfo);
+            }
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "列表")
+    @RequestMapping(value = "pageList", method = RequestMethod.POST)
+    public MessageResult<Map> pageList(
+            String id,
+            @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
+            @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
+            HttpServletRequest request) {
+        String subject = (String) request.getAttribute("subject");
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String, Object> searchParams = new HashMap<>();
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("create_time", "desc"));
+
+        if (StringUtils.isNotEmpty(id)) {
+            searchParams.put("id", "%" + id + "%");
+        }
+
+
+        Page<DepartmentInfo> page = departmentInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
+
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value = "列表")
+    @RequestMapping(value = "list", method = RequestMethod.POST)
+    public MessageResult<List<DepartmentInfo>> list() {
+
+        MessageResult<List<DepartmentInfo>> msgResult = new MessageResult<>();
+
+
+        List<DepartmentInfo> departmentInfoList = departmentInfoService.list();
+
+
+        msgResult.setResult(true);
+        msgResult.setData(departmentInfoList);
+
+        return msgResult;
+    }
+}

+ 414 - 0
web/src/main/java/com/jpsoft/employment/modules/base/controller/ExpensesInfoController.java

@@ -0,0 +1,414 @@
+package com.jpsoft.employment.modules.base.controller;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.config.OSSConfig;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import com.jpsoft.employment.modules.common.dto.MessageResult;
+import com.jpsoft.employment.modules.base.entity.ExpensesInfo;
+import com.jpsoft.employment.modules.base.service.ExpensesInfoService;
+import com.jpsoft.employment.modules.common.utils.OSSUtil;
+import com.jpsoft.employment.modules.common.utils.PojoUtils;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.ibatis.mapping.ResultMap;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/base/expensesInfo")
+public class ExpensesInfoController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private ExpensesInfoService expensesInfoService;
+
+    @Autowired
+    private OSSConfig ossConfig;
+	
+	
+	@ApiOperation(value="创建空记录")
+    @GetMapping("create")
+    public MessageResult<ExpensesInfo> create(){
+        MessageResult<ExpensesInfo> msgResult = new MessageResult<>();
+
+        ExpensesInfo expensesInfo = new ExpensesInfo();
+
+        msgResult.setData(expensesInfo);
+        msgResult.setResult(true);
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="添加信息")
+    @PostMapping("add")
+    public MessageResult<ExpensesInfo> add(@RequestBody ExpensesInfo expensesInfo,@RequestAttribute String subject){
+        MessageResult<ExpensesInfo> msgResult = new MessageResult<>();
+
+        try {
+            expensesInfo.setId(UUID.randomUUID().toString());
+			expensesInfo.setDelFlag(false);
+            expensesInfo.setCreateBy(subject);
+            expensesInfo.setCreateTime(new Date());
+
+            int affectCount = expensesInfoService.insert(expensesInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(expensesInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="获取信息")
+    @GetMapping("edit/{id}")
+    public MessageResult<ExpensesInfo> edit(@PathVariable("id") String id){
+        MessageResult<ExpensesInfo> msgResult = new MessageResult<>();
+
+        try {
+            ExpensesInfo expensesInfo = expensesInfoService.get(id);
+
+            if (expensesInfo != null) {
+                msgResult.setResult(true);
+                msgResult.setData(expensesInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="更新用户")
+    @PostMapping("update")
+    public MessageResult<ExpensesInfo> update(@RequestBody ExpensesInfo expensesInfo,@RequestAttribute String subject){
+        MessageResult<ExpensesInfo> msgResult = new MessageResult<>();
+
+        try {
+		    expensesInfo.setUpdateBy(subject);
+            expensesInfo.setUpdateTime(new Date());
+
+            if (StringUtils.isNotEmpty(expensesInfo.getFeeStartDateStr())) {
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                expensesInfo.setFeeStartDate(sdf.parse(expensesInfo.getFeeStartDateStr()));
+            }
+		
+            int affectCount = expensesInfoService.update(expensesInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(expensesInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="删除用户")
+    @PostMapping("delete/{id}")
+    public MessageResult<ExpensesInfo> delete(@PathVariable("id") String id,@RequestAttribute String subject){
+        MessageResult<ExpensesInfo> msgResult = new MessageResult<>();
+
+        try {
+			
+			ExpensesInfo expensesInfo = expensesInfoService.get(id);
+            expensesInfo.setDelFlag(true);
+            expensesInfo.setUpdateBy(subject);
+            expensesInfo.setUpdateTime(new Date());
+			
+			int affectCount = expensesInfoService.update(expensesInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value="批量删除")
+    @PostMapping("batchDelete")
+    public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            int affectCount = 0;
+
+            for (String id : idList) {
+                ExpensesInfo expensesInfo = expensesInfoService.get(id);
+                expensesInfo.setDelFlag(true);
+                expensesInfo.setUpdateBy(subject);
+                expensesInfo.setUpdateTime(new Date());
+
+                affectCount += expensesInfoService.update(expensesInfo);
+            }
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="列表")
+    @RequestMapping(value = "pageList",method = RequestMethod.POST)
+    public MessageResult<Object> pageList(
+            String yearMonth, String name,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20000") int pageSize,
+            @RequestParam(value = "exportFlag", defaultValue = "false") Boolean exportFlag,
+            HttpServletRequest request){
+        String subject = (String)request.getAttribute("subject");
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<Object> msgResult = new MessageResult<>();
+
+        try {
+
+            Map<String, Object> searchParams = new HashMap<>();
+
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("index_", "asc"));
+
+            String curMonth = "";
+
+            if (StringUtils.isNotEmpty(yearMonth)) {
+                String startDate = yearMonth + "-01";
+                String endDate = yearMonth + "-31";
+
+                searchParams.put("startDate", startDate);
+                searchParams.put("endDate", endDate);
+
+                curMonth = endDate;
+            }
+
+            if (StringUtils.isNotEmpty(name)) {
+                searchParams.put("name", name);
+            }
+
+
+            Page<ExpensesInfo> page = expensesInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
+
+            SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM");
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+            List<Map> mapList = new ArrayList<>();
+
+            for (ExpensesInfo expensesInfo : page) {
+                Map<String, Object> map = new HashMap<>();
+                map.put("id", expensesInfo.getId());
+                map.put("name", expensesInfo.getName());
+                map.put("serialNumber", expensesInfo.getSerialNumber());
+                map.put("amount", expensesInfo.getAmount());
+                map.put("executor", expensesInfo.getExecutor());
+                map.put("responsiblePerson", expensesInfo.getResponsiblePerson());
+                map.put("completionTime", expensesInfo.getCompletionTime());
+
+                map.put("supervisor", expensesInfo.getSupervisor());
+                map.put("aboutTopic", expensesInfo.getAboutTopic());
+
+                String yearMonthStr = "";
+                String updateTime = "";
+                String createTime = "";
+                String year = "";
+                String feeStartDateStr="";
+
+                if (expensesInfo.getYear() != null) {
+                    year = sdf3.format(expensesInfo.getYear());
+                }
+
+                if (expensesInfo.getCreateTime() != null) {
+                    createTime = sdf3.format(expensesInfo.getCreateTime());
+                }
+
+                if (expensesInfo.getUpdateTime() != null) {
+                    updateTime = sdf3.format(expensesInfo.getUpdateTime());
+                }
+
+                if (expensesInfo.getYear() != null) {
+                    yearMonthStr = sdf2.format(expensesInfo.getYear());
+                }
+
+                if (expensesInfo.getFeeStartDate() != null) {
+                    expensesInfo.setFeeStartDateStr(sdf.format(expensesInfo.getFeeStartDate()));
+                    feeStartDateStr = sdf.format(expensesInfo.getFeeStartDate());
+                }
+                map.put("feeStartDateStr", feeStartDateStr);
+                //map.put("feeStartDate", feeStartDateStr);
+                map.put("yearMonthStr", yearMonthStr);
+                map.put("yearMonth", yearMonthStr);
+
+                map.put("createTime", createTime);
+                map.put("updateTime", updateTime);
+
+                map.put("year", year);
+
+
+                mapList.add(map);
+            }
+
+            if (exportFlag) {
+                String filePath = exportXls(mapList);
+                msgResult.setData(filePath);
+            } else {
+                Map<String, Object> dataMap = PojoUtils.pageWrapper(page);
+                dataMap.put("data", mapList);
+                msgResult.setData(dataMap);
+            }
+
+            msgResult.setResult(true);
+        }
+        catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+            msgResult.setResult(false);
+        }
+
+        return msgResult;
+    }
+
+
+    //导出
+    private String exportXls(List<Map> mapList) {
+        String downloadUrl = "";
+
+        Workbook workbook = new HSSFWorkbook();
+        Sheet sheet = workbook.createSheet();
+
+        //表头
+        Row rowTitle = sheet.createRow(0);
+
+        String[] titles = new String[]{"序号", "项目名称", "金额(元)", "执行人", "责任人", "完成时间", "催费启动时间",
+                "督办员", "相关资料", "所属年份"};
+
+        for (int i = 0; i < titles.length; i++) {
+            Cell cell = rowTitle.createCell(i);
+            cell.setCellValue(titles[i]);
+        }
+
+        for (int i = 0; i < mapList.size(); i++) {
+            Map<String, Object> map = mapList.get(i);
+
+            Row row = sheet.createRow(i + 1);
+
+            int colIndex = 0;
+            //row.createCell(colIndex++).setCellValue(i + 1);
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("serialNumber"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("name"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("amount"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("executor"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("responsiblePerson"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("completionTime"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("feeStartDateStr"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("supervisor"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("aboutTopic"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("yearMonthStr"), ""));
+        }
+
+        ByteArrayOutputStream output = new ByteArrayOutputStream();
+
+        try {
+            workbook.write(output);
+
+            byte[] buffer = output.toByteArray();
+            ByteArrayInputStream input = new ByteArrayInputStream(buffer);
+
+            downloadUrl = OSSUtil.upload(ossConfig, "ExpensesInfo", "收入支出列表.xls", input);
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+        }
+
+        return downloadUrl;
+    }
+
+
+
+    @ApiOperation(value = "生成数据")
+    @PostMapping("generateData/{templateId}")
+    public MessageResult<ExpensesInfo> generateData(@PathVariable("templateId") String templateId, @RequestAttribute String subject) {
+        MessageResult<ExpensesInfo> msgResult = new MessageResult<>();
+
+        try {
+
+            int affectCount = expensesInfoService.generateData(templateId, subject);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库删除失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+}

+ 729 - 0
web/src/main/java/com/jpsoft/employment/modules/base/controller/FundIncomeInfoController.java

@@ -0,0 +1,729 @@
+package com.jpsoft.employment.modules.base.controller;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.config.OSSConfig;
+import com.jpsoft.employment.modules.base.entity.DepartmentInfo;
+import com.jpsoft.employment.modules.base.entity.TemplateOption;
+import com.jpsoft.employment.modules.base.service.DepartmentInfoService;
+import com.jpsoft.employment.modules.base.service.TemplateInfoService;
+import com.jpsoft.employment.modules.base.service.TemplateOptionService;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import com.jpsoft.employment.modules.common.dto.MessageResult;
+import com.jpsoft.employment.modules.base.entity.FundIncomeInfo;
+import com.jpsoft.employment.modules.base.service.FundIncomeInfoService;
+import com.jpsoft.employment.modules.common.utils.OSSUtil;
+import com.jpsoft.employment.modules.common.utils.POIUtils;
+import com.jpsoft.employment.modules.common.utils.PojoUtils;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/base/fundIncomeInfo")
+public class FundIncomeInfoController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private FundIncomeInfoService fundIncomeInfoService;
+
+    @Autowired
+    private TemplateOptionService templateOptionService;
+
+    @Autowired
+    private DepartmentInfoService departmentInfoService;
+
+    @Autowired
+    private OSSConfig ossConfig;
+
+
+    @ApiOperation(value = "创建空记录")
+    @GetMapping("create")
+    public MessageResult<FundIncomeInfo> create() {
+        MessageResult<FundIncomeInfo> msgResult = new MessageResult<>();
+
+        FundIncomeInfo fundIncomeInfo = new FundIncomeInfo();
+
+        msgResult.setData(fundIncomeInfo);
+        msgResult.setResult(true);
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "添加信息")
+    @PostMapping("add")
+    public MessageResult<FundIncomeInfo> add(@RequestBody FundIncomeInfo fundIncomeInfo, @RequestAttribute String subject) {
+        MessageResult<FundIncomeInfo> msgResult = new MessageResult<>();
+
+        try {
+            Date now = new Date();
+            fundIncomeInfo.setId(UUID.randomUUID().toString());
+            fundIncomeInfo.setDelFlag(false);
+            fundIncomeInfo.setCreateBy(subject);
+            fundIncomeInfo.setCreateTime(now);
+
+            if (StringUtils.isNotEmpty(fundIncomeInfo.getEndDateStr())) {
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                fundIncomeInfo.setEndDate(sdf.parse(fundIncomeInfo.getEndDateStr()));
+            }
+
+            fundIncomeInfo.setYear(now);
+
+            int affectCount = fundIncomeInfoService.insert(fundIncomeInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(fundIncomeInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "获取信息")
+    @GetMapping("edit/{id}")
+    public MessageResult<FundIncomeInfo> edit(@PathVariable("id") String id) {
+        MessageResult<FundIncomeInfo> msgResult = new MessageResult<>();
+
+        try {
+            FundIncomeInfo fundIncomeInfo = fundIncomeInfoService.get(id);
+
+            if (fundIncomeInfo != null) {
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                if (fundIncomeInfo.getEndDate() != null) {
+                    fundIncomeInfo.setEndDateStr(sdf.format(fundIncomeInfo.getEndDate()));
+                }
+                if (StringUtils.isNotEmpty(fundIncomeInfo.getIncomeType())) {
+                    String type = fundIncomeInfo.getIncomeType();
+                    switch (type) {
+                        case "1":
+                            fundIncomeInfo.setIncomeTypeN("按月");
+                        case "2":
+                            fundIncomeInfo.setIncomeTypeN("按年");
+                        case "3":
+                            fundIncomeInfo.setIncomeTypeN("按季");
+                        case "4":
+                            fundIncomeInfo.setIncomeTypeN("按学期");
+                    }
+                }
+                msgResult.setResult(true);
+                msgResult.setData(fundIncomeInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "更新用户")
+    @PostMapping("update")
+    public MessageResult<FundIncomeInfo> update(@RequestBody FundIncomeInfo fundIncomeInfo, @RequestAttribute String subject) {
+        MessageResult<FundIncomeInfo> msgResult = new MessageResult<>();
+
+        try {
+            fundIncomeInfo.setUpdateBy(subject);
+            fundIncomeInfo.setUpdateTime(new Date());
+
+            if (StringUtils.isNotEmpty(fundIncomeInfo.getEndDateStr())) {
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                fundIncomeInfo.setEndDate(sdf.parse(fundIncomeInfo.getEndDateStr()));
+            }
+
+            int affectCount = fundIncomeInfoService.update(fundIncomeInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(fundIncomeInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "删除用户")
+    @PostMapping("delete/{id}")
+    public MessageResult<FundIncomeInfo> delete(@PathVariable("id") String id, @RequestAttribute String subject) {
+        MessageResult<FundIncomeInfo> msgResult = new MessageResult<>();
+
+        try {
+
+            FundIncomeInfo fundIncomeInfo = fundIncomeInfoService.get(id);
+            fundIncomeInfo.setDelFlag(true);
+            fundIncomeInfo.setUpdateBy(subject);
+            fundIncomeInfo.setUpdateTime(new Date());
+
+            int affectCount = fundIncomeInfoService.update(fundIncomeInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库删除失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value = "批量删除")
+    @PostMapping("batchDelete")
+    public MessageResult<Integer> batchDelete(@RequestBody List<String> idList, @RequestAttribute String subject) {
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            int affectCount = 0;
+
+            for (String id : idList) {
+                FundIncomeInfo fundIncomeInfo = fundIncomeInfoService.get(id);
+                fundIncomeInfo.setDelFlag(true);
+                fundIncomeInfo.setUpdateBy(subject);
+                fundIncomeInfo.setUpdateTime(new Date());
+
+                affectCount += fundIncomeInfoService.update(fundIncomeInfo);
+            }
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "生成数据")
+    @PostMapping("generateData")
+    public MessageResult<FundIncomeInfo> generateData(
+            String templateId,String year,
+            @RequestAttribute String subject) {
+        MessageResult<FundIncomeInfo> msgResult = new MessageResult<>();
+
+        try {
+
+            int affectCount = fundIncomeInfoService.generateData(templateId, year,subject);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库删除失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value = "列表")
+    @RequestMapping(value = "pageList", method = RequestMethod.POST)
+    public MessageResult<Object> pageList(
+            String yearMonth, String name,
+            @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
+            @RequestParam(value = "pageSize", defaultValue = "20000") int pageSize,
+            @RequestParam(value = "exportFlag", defaultValue = "false") Boolean exportFlag,
+            HttpServletRequest request) {
+        String subject = (String) request.getAttribute("subject");
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<Object> msgResult = new MessageResult<>();
+
+        try {
+
+            Map<String, Object> searchParams = new HashMap<>();
+
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("index_", "asc"));
+
+            String curMonth = "";
+            String startDate = "";
+            String endDate = "";
+            if (StringUtils.isNotEmpty(yearMonth)) {
+                startDate = yearMonth + "-01";
+                endDate = yearMonth + "-31";
+
+                searchParams.put("startDate", startDate);
+                searchParams.put("endDate", endDate);
+
+                curMonth = endDate;
+            }
+
+            if (StringUtils.isNotEmpty(name)) {
+                searchParams.put("name", name);
+            }
+
+
+            Page<FundIncomeInfo> page = fundIncomeInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
+
+            SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM");
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+            List<Map> mapList = new ArrayList<>();
+
+            for (FundIncomeInfo fundIncomeInfo : page) {
+                Map<String, Object> map = new HashMap<>();
+                map.put("id", fundIncomeInfo.getId());
+                map.put("name", fundIncomeInfo.getName());
+                map.put("serialNumber", fundIncomeInfo.getSerialNumber());
+                map.put("isSum", fundIncomeInfo.getIsSum());
+                BigDecimal budgetRevenue = fundIncomeInfo.getBudgetRevenue();
+                if(fundIncomeInfo.getIsSum()!=null) {
+                    if (fundIncomeInfo.getIsSum()) {
+                        String serialNumber = fundIncomeInfo.getSerialNumber();
+                        BigDecimal sumBudget = fundIncomeInfoService.sumBudgetRevenue(serialNumber + ".%", startDate, endDate);
+                        budgetRevenue = sumBudget;
+                    }
+                }
+
+                map.put("budgetRevenue", budgetRevenue);
+                map.put("accountName", fundIncomeInfo.getAccountName());
+                map.put("curMonthReceived", fundIncomeInfo.getCurMonthReceived());
+                //map.put("actualTotalRevenue", fundIncomeInfo.getActualTotalRevenue());
+                map.put("accumulatedArrears", fundIncomeInfo.getAccumulatedArrears());
+
+                String endDateStr = "";
+                String incomeTypeN = "";
+                String yearMonthStr = "";
+                String updateTime = "";
+                String createTime = "";
+                String year = "";
+
+                if (fundIncomeInfo.getYear() != null) {
+                    year = sdf3.format(fundIncomeInfo.getYear());
+                }
+
+                if (fundIncomeInfo.getCreateTime() != null) {
+                    createTime = sdf3.format(fundIncomeInfo.getCreateTime());
+                }
+
+                if (fundIncomeInfo.getUpdateTime() != null) {
+                    updateTime = sdf3.format(fundIncomeInfo.getUpdateTime());
+                }
+
+                if (fundIncomeInfo.getEndDate() != null) {
+                    fundIncomeInfo.setEndDateStr(sdf.format(fundIncomeInfo.getEndDate()));
+                    endDateStr = sdf.format(fundIncomeInfo.getEndDate());
+                }
+
+                if (fundIncomeInfo.getEndDate() != null) {
+                    fundIncomeInfo.setEndDateStr(sdf.format(fundIncomeInfo.getEndDate()));
+                    endDateStr = sdf.format(fundIncomeInfo.getEndDate());
+                }
+                if (StringUtils.isNotEmpty(fundIncomeInfo.getIncomeType())) {
+                    String type = fundIncomeInfo.getIncomeType();
+                    switch (type) {
+                        case "1":
+                            fundIncomeInfo.setIncomeTypeN("按月");
+                            incomeTypeN = "按月";
+                            break;
+                        case "2":
+                            fundIncomeInfo.setIncomeTypeN("按年");
+                            incomeTypeN = "按年";
+                            break;
+                        case "3":
+                            fundIncomeInfo.setIncomeTypeN("按季");
+                            incomeTypeN = "按季";
+                            break;
+                        case "4":
+                            fundIncomeInfo.setIncomeTypeN("按学期");
+                            incomeTypeN = "按学期";
+                            break;
+                    }
+                }
+
+                map.put("endDateStr", endDateStr);
+                map.put("endDate", endDateStr);
+                map.put("incomeTypeN", incomeTypeN);
+
+                if (fundIncomeInfo.getYear() != null) {
+                    yearMonthStr = sdf2.format(fundIncomeInfo.getYear());
+                }
+
+                map.put("yearMonthStr", yearMonthStr);
+                map.put("yearMonth", yearMonthStr);
+
+                map.put("createTime", createTime);
+                map.put("updateTime", updateTime);
+                map.put("incomeTimeRange", fundIncomeInfo.getIncomeTimeRange());
+
+                map.put("attachment", fundIncomeInfo.getAttachment());
+
+                String incomeDepartment="";
+                if(StringUtils.isNotEmpty(fundIncomeInfo.getIncomeDepartment())){
+                    String[] incomeDepartmentArr = fundIncomeInfo.getIncomeDepartment().split(",");
+                    for (String departId:incomeDepartmentArr) {
+                        DepartmentInfo departmentInfo = departmentInfoService.get(departId);
+                        if(departmentInfo!=null){
+                            incomeDepartment+=departmentInfo.getName()+",";
+                        }
+                    }
+                    if(StringUtils.isNotEmpty(incomeDepartment)){
+                        incomeDepartment = incomeDepartment.substring(0,incomeDepartment.lastIndexOf(","));
+                    }
+                }
+
+                map.put("incomeDepartment", incomeDepartment);
+                map.put("accountingName", fundIncomeInfo.getAccountingName());
+                map.put("bak", fundIncomeInfo.getBak());
+                map.put("year", year);
+
+                BigDecimal total = fundIncomeInfoService.sumBySerialNumber(fundIncomeInfo.getSerialNumber(), curMonth);
+
+                map.put("total", total);
+
+                BigDecimal accumulatedArrears = fundIncomeInfo.getBudgetRevenue();
+                if (total != null) {
+                    accumulatedArrears = accumulatedArrears.subtract(total);
+                }
+
+                //累计欠费
+                map.put("accumulatedArrears", accumulatedArrears);
+
+                //实际总收入
+                map.put("actualTotalRevenue", total);
+
+                mapList.add(map);
+            }
+
+            if (exportFlag) {
+                String filePath = exportXls(mapList);
+                msgResult.setData(filePath);
+            } else {
+                Map<String, Object> dataMap = PojoUtils.pageWrapper(page);
+                dataMap.put("data", mapList);
+                msgResult.setData(dataMap);
+            }
+
+            msgResult.setResult(true);
+
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+            msgResult.setResult(false);
+        }
+
+        return msgResult;
+    }
+
+
+    //导出
+    private String exportXls(List<Map> mapList) {
+        String downloadUrl = "";
+
+        Workbook workbook = new HSSFWorkbook();
+        Sheet sheet = workbook.createSheet();
+
+        //表头
+        Row rowTitle = sheet.createRow(0);
+
+        String[] titles = new String[]{"序号", "项目名称", "预算收入", "账户名称", "本月到账资金", "实际总收入", "累计欠费",
+                "收入时间区间", "收入类型", "终止日", "收入实现部门", "会计主体名称", "备注", "所属年份"};
+
+        for (int i = 0; i < titles.length; i++) {
+            Cell cell = rowTitle.createCell(i);
+            cell.setCellValue(titles[i]);
+        }
+
+        for (int i = 0; i < mapList.size(); i++) {
+            Map<String, Object> map = mapList.get(i);
+
+            Row row = sheet.createRow(i + 1);
+
+            int colIndex = 0;
+            //row.createCell(colIndex++).setCellValue(i + 1);
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("serialNumber"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("name"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("budgetRevenue"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("accountName"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("curMonthReceived"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("actualTotalRevenue"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("accumulatedArrears"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("incomeTimeRange"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("incomeTypeN"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("endDateStr"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("incomeDepartment"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("accountingName"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("bak"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("year"), ""));
+        }
+
+        ByteArrayOutputStream output = new ByteArrayOutputStream();
+
+        try {
+            workbook.write(output);
+
+            byte[] buffer = output.toByteArray();
+            ByteArrayInputStream input = new ByteArrayInputStream(buffer);
+
+            downloadUrl = OSSUtil.upload(ossConfig, "FundIncomeList", "预算收入列表.xls", input);
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+        }
+
+        return downloadUrl;
+    }
+
+
+    @ApiOperation(value = "导入数据")
+    @PostMapping("importXls")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "uploadFile", value = "上传文件", required = true, paramType = "form", dataType = "__file")
+    })
+    public MessageResult<String> importXls(MultipartFile uploadFile, @RequestAttribute String subject) {
+        MessageResult<String> msgResult = new MessageResult<>();
+
+        try {
+            POIUtils poiUtils = new POIUtils(uploadFile.getInputStream());
+            int sheetIndex = 0;
+            Sheet sheet1 = poiUtils.getSheetAt(sheetIndex);
+
+            int affectCount = 0;
+            int failCount = 0;
+            int validateColIndex = 5;
+
+            int count = sheet1.getLastRowNum();
+
+            Date now = new Date();
+
+            for (int rowIndex = 1; rowIndex <= count; rowIndex++) {
+                try {
+
+                    String serialNumber = poiUtils.getCellValue(sheetIndex, rowIndex, 0).toString().replace(" ", "");
+
+                    String name = poiUtils.getCellValue(sheetIndex, rowIndex, 1).toString().replace(" ", "");
+
+                    String year = poiUtils.getCellValue(sheetIndex, rowIndex, 2).toString().replace(" ", "");
+                    String budgetRevenue = poiUtils.getCellValue(sheetIndex, rowIndex, 3).toString().replace(" ", "");
+                    String accountName = poiUtils.getCellValue(sheetIndex, rowIndex, 4).toString().replace(" ", "");
+                    String curMonthReceived = poiUtils.getCellValue(sheetIndex, rowIndex, 5).toString().replace(" ", "");
+                    String actualTotalRevenue = poiUtils.getCellValue(sheetIndex, rowIndex, 6).toString().replace(" ", "");
+                    String accumulatedArrears = poiUtils.getCellValue(sheetIndex, rowIndex, 7).toString().replace(" ", "");
+                    String incomeTimeRange = poiUtils.getCellValue(sheetIndex, rowIndex, 8).toString().replace(" ", "");
+                    String incomeType = poiUtils.getCellValue(sheetIndex, rowIndex, 9).toString().replace(" ", "");
+                    String endDate = poiUtils.getCellValue(sheetIndex, rowIndex, 10).toString().replace(" ", "");
+                    String incomeDepartment = poiUtils.getCellValue(sheetIndex, rowIndex, 11).toString().replace(" ", "");
+                    String accountingName = poiUtils.getCellValue(sheetIndex, rowIndex, 12).toString().replace(" ", "");
+                    String bak = poiUtils.getCellValue(sheetIndex, rowIndex, 13).toString().replace(" ", "");
+
+
+                    if (StringUtils.isEmpty(serialNumber)) {
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("未填写用序号!");
+                        failCount++;
+                        continue;
+                    }
+
+
+                    if (StringUtils.isEmpty(name)) {
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("未填写项目名称!");
+                        failCount++;
+                        continue;
+                    }
+
+
+                    if (StringUtils.isEmpty(year)) {
+                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("未填写所属年份!");
+                        failCount++;
+                        continue;
+                    }
+
+                    //用户身份
+                    FundIncomeInfo fundIncomeInfo = new FundIncomeInfo();
+                    fundIncomeInfo.setId(UUID.randomUUID().toString());
+                    fundIncomeInfo.setSerialNumber(serialNumber);
+                    fundIncomeInfo.setName(name);
+                    if (StringUtils.isNotEmpty(budgetRevenue)) {
+                        fundIncomeInfo.setBudgetRevenue(new BigDecimal(budgetRevenue));
+                    }
+
+                    if (StringUtils.isNotEmpty(curMonthReceived)) {
+                        fundIncomeInfo.setBudgetRevenue(new BigDecimal(curMonthReceived));
+                    }
+
+                    if (StringUtils.isNotEmpty(actualTotalRevenue)) {
+                        fundIncomeInfo.setBudgetRevenue(new BigDecimal(actualTotalRevenue));
+                    }
+
+                    if (StringUtils.isNotEmpty(accumulatedArrears)) {
+                        fundIncomeInfo.setBudgetRevenue(new BigDecimal(accumulatedArrears));
+                    }
+
+                    fundIncomeInfo.setAccountName(accountName);
+                    fundIncomeInfo.setIncomeTimeRange(incomeTimeRange);
+
+                    String incomeTypeNum = "";
+                    if (StringUtils.isNotEmpty(incomeType)) {
+                        switch (incomeType) {
+                            case "按月":
+                                incomeTypeNum = "1";
+                                break;
+                            case "按年":
+                                incomeTypeNum = "2";
+                                break;
+                            case "按季":
+                                incomeTypeNum = "3";
+                                break;
+                            case "按学期":
+                                incomeTypeNum = "4";
+                                break;
+                        }
+                    }
+
+                    fundIncomeInfo.setIncomeType(incomeTypeNum);
+
+                    if (StringUtils.isNotEmpty(endDate)) {
+                        String s = dateFormate(endDate);
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                        fundIncomeInfo.setEndDate(sdf.parse(s));
+                    }
+
+                    fundIncomeInfo.setIncomeDepartment(incomeDepartment);
+                    fundIncomeInfo.setAccountingName(accountingName);
+                    fundIncomeInfo.setBak(bak);
+
+                    if (StringUtils.isNotEmpty(year)) {
+                        String s = dateFormate(year + "-01");
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                        fundIncomeInfo.setYear(sdf.parse(s));
+                    }
+
+                    fundIncomeInfo.setCreateBy(subject);
+                    fundIncomeInfo.setCreateTime(now);
+                    fundIncomeInfo.setDelFlag(false);
+
+                    //保存新数据
+                    fundIncomeInfoService.insert(fundIncomeInfo);
+                    affectCount++;
+                } catch (Exception innerEx) {
+                    logger.error(innerEx.getMessage(), innerEx);
+                }
+            }
+
+            if (failCount > 0) {
+                //有导入失败的记录
+                msgResult.setResult(false);
+                msgResult.setMessage("数据成功导入" + affectCount + "条,有" + failCount + "条数据未导入成功,错误原因请查看报表。");
+
+                //todo 只保留错误数据的sheet
+                Workbook wb = poiUtils.exportErrorXls(sheetIndex, validateColIndex, 1 + affectCount + failCount);
+
+                //todo 将wb保存到oss
+                ByteArrayOutputStream output = new ByteArrayOutputStream();
+                wb.write(output);
+
+                byte[] buffer = output.toByteArray();
+                ByteArrayInputStream input = new ByteArrayInputStream(buffer);
+
+                String downloadUrl = OSSUtil.upload(ossConfig, "import", "error.xls", input);
+
+                //todo 返回导入失败报表下载链接
+                msgResult.setData(downloadUrl);
+            } else {
+                msgResult.setResult(true);
+                msgResult.setMessage("数据成功导入" + affectCount + "条");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    private String dateFormate(String str) {
+        //String s="45292.0";    //举例日期为2024-01-01 / 45292.0
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date date;
+        boolean b;
+        try {
+            Double.parseDouble(str);
+            b = true;
+        } catch (Exception e) {
+            b = false;
+        }
+        String format = "";
+        //如果是double 则HSSF工具类处理
+        if (b) {
+            date = HSSFDateUtil.getJavaDate(new Double(String.valueOf(str)));
+            format = dateFormat.format(date);
+            System.out.println(date.getTime() / 1000);
+            System.out.println(format);
+        }
+        //如果是日期字符串则直接获取想要的属性
+        else {
+            //如果是错误的日期比如2024-01-51  建议用封装的Util类先校验一下日期
+            try {
+                Date parse = dateFormat.parse(str);
+                format = dateFormat.format(parse);
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+
+        return format;
+    }
+}

+ 89 - 0
web/src/main/java/com/jpsoft/employment/modules/base/controller/TemplateInfoController.java

@@ -225,4 +225,93 @@ public class TemplateInfoController {
 
         return msgResult;
     }
+
+
+
+    @ApiOperation(value="列表")
+    @RequestMapping(value = "list",method = RequestMethod.POST)
+    public MessageResult<List<TemplateInfo>> pageList(HttpServletRequest request){
+        String subject = (String)request.getAttribute("subject");
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<List<TemplateInfo>> msgResult = new MessageResult<>();
+
+        List<TemplateInfo> templateInfoList = templateInfoService.list();
+
+
+        msgResult.setResult(true);
+        msgResult.setData(templateInfoList);
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value="审核")
+    @PostMapping("checked/{id}")
+    public MessageResult<TemplateInfo> checked(@PathVariable("id") String id,@RequestAttribute String subject){
+        MessageResult<TemplateInfo> msgResult = new MessageResult<>();
+
+        try {
+
+            TemplateInfo templateInfo = templateInfoService.get(id);
+            templateInfo.setStatus("1");
+            templateInfo.setUpdateBy(subject);
+            templateInfo.setUpdateTime(new Date());
+
+            int affectCount = templateInfoService.update(templateInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库审核失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value="保存附件")
+    @RequestMapping(value = "saveAttachment",method = RequestMethod.POST)
+    public MessageResult<TemplateInfo> saveAttachment(
+            String id,String attachment,
+            @RequestAttribute String subject){
+
+        MessageResult<TemplateInfo> msgResult = new MessageResult<>();
+
+        try {
+            TemplateInfo templateInfo = templateInfoService.get(id);
+            templateInfo.setAttachment(attachment);
+            templateInfo.setUpdateBy(subject);
+            templateInfo.setUpdateTime(new Date());
+
+            int affectCount = templateInfoService.update(templateInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库审核失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
 }

+ 412 - 0
web/src/main/java/com/jpsoft/employment/modules/base/controller/TemplateOptionController.java

@@ -0,0 +1,412 @@
+package com.jpsoft.employment.modules.base.controller;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.employment.modules.base.dto.TemplateOptionDTO;
+import com.jpsoft.employment.modules.base.entity.DepartmentInfo;
+import com.jpsoft.employment.modules.base.entity.TemplateInfo;
+import com.jpsoft.employment.modules.base.service.DepartmentInfoService;
+import com.jpsoft.employment.modules.base.service.TemplateInfoService;
+import com.jpsoft.employment.modules.common.dto.Sort;
+import com.jpsoft.employment.modules.common.dto.MessageResult;
+import com.jpsoft.employment.modules.base.entity.TemplateOption;
+import com.jpsoft.employment.modules.base.service.TemplateOptionService;
+import com.jpsoft.employment.modules.common.utils.PojoUtils;
+import com.jpsoft.employment.modules.sys.entity.User;
+import com.jpsoft.employment.modules.sys.service.UserService;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/base/templateOption")
+public class TemplateOptionController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private TemplateOptionService templateOptionService;
+
+    @Autowired
+    private TemplateInfoService templateInfoService;
+
+    @Autowired
+    private DepartmentInfoService departmentInfoService;
+
+    @Autowired
+    private UserService userService;
+
+    @ApiOperation(value = "创建空记录")
+    @GetMapping("create")
+    public MessageResult<List<TemplateOption>> create() {
+        MessageResult<List<TemplateOption>> msgResult = new MessageResult<>();
+
+        List<TemplateOption> templateOptionList = new ArrayList<>();
+
+        msgResult.setData(templateOptionList);
+        msgResult.setResult(true);
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "添加信息")
+    @PostMapping("add")
+    public MessageResult<TemplateOption> add(@RequestBody TemplateOption templateOption, @RequestAttribute String subject) {
+        MessageResult<TemplateOption> msgResult = new MessageResult<>();
+
+        try {
+            templateOption.setId(UUID.randomUUID().toString());
+            templateOption.setDelFlag(false);
+            templateOption.setCreateBy(subject);
+            templateOption.setCreateTime(new Date());
+
+            int affectCount = templateOptionService.insert(templateOption);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(templateOption);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "获取信息")
+    @GetMapping("edit/{id}")
+    public MessageResult<TemplateOptionDTO> edit(@PathVariable("id") String id) {
+        MessageResult<TemplateOptionDTO> msgResult = new MessageResult<>();
+
+        try {
+            TemplateOptionDTO dto = new TemplateOptionDTO();
+
+            List<TemplateOption> templateOptionList = templateOptionService.findByTemplateId(id);
+
+            if (templateOptionList.size() == 0) {
+                templateOptionList = new ArrayList<>();
+            } else {
+                for (TemplateOption item : templateOptionList) {
+                    if (StringUtils.isNotEmpty(item.getDepartmentIds())) {
+                        String[] arrayId = item.getDepartmentIds().split(",");
+                        String departmentNames = "";
+                        for (String departmentId : arrayId) {
+                            DepartmentInfo departmentInfo = departmentInfoService.get(departmentId);
+                            departmentNames += departmentInfo.getName() + ",";
+                        }
+
+                        if (StringUtils.isNotEmpty(departmentNames)) {
+                            departmentNames = departmentNames.substring(0, departmentNames.lastIndexOf(","));
+                        }
+                        item.setDepartmentNames(departmentNames);
+                        item.setDepartmentIdArr(arrayId);
+                    }
+
+
+                }
+            }
+
+            dto.setTemplateId(id);
+            dto.setTemplateOptionList(templateOptionList);
+
+            msgResult.setResult(true);
+            msgResult.setData(dto);
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "更新用户")
+    @PostMapping("update")
+    public MessageResult<Integer> update(@RequestBody TemplateOptionDTO dto, @RequestAttribute String subject) {
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+
+            int affectCount = templateOptionService.updateList(dto, subject);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "删除用户")
+    @PostMapping("delete/{id}")
+    public MessageResult<TemplateOption> delete(@PathVariable("id") String id, @RequestAttribute String subject) {
+        MessageResult<TemplateOption> msgResult = new MessageResult<>();
+
+        try {
+
+            TemplateOption templateOption = templateOptionService.get(id);
+            templateOption.setDelFlag(true);
+            templateOption.setUpdateBy(subject);
+            templateOption.setUpdateTime(new Date());
+
+            int affectCount = templateOptionService.update(templateOption);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库删除失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value = "批量删除")
+    @PostMapping("batchDelete")
+    public MessageResult<Integer> batchDelete(@RequestBody List<String> idList, @RequestAttribute String subject) {
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            int affectCount = 0;
+
+            for (String id : idList) {
+                TemplateOption templateOption = templateOptionService.get(id);
+                templateOption.setDelFlag(true);
+                templateOption.setUpdateBy(subject);
+                templateOption.setUpdateTime(new Date());
+
+                affectCount += templateOptionService.update(templateOption);
+            }
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "列表")
+    @RequestMapping(value = "pageList", method = RequestMethod.POST)
+    public MessageResult<Map> pageList(
+            String id,
+            @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
+            @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
+            HttpServletRequest request) {
+        String subject = (String) request.getAttribute("subject");
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String, Object> searchParams = new HashMap<>();
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("id_", "asc"));
+
+        if (StringUtils.isNotEmpty(id)) {
+            searchParams.put("id", "%" + id + "%");
+        }
+
+
+        Page<TemplateOption> page = templateOptionService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
+
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value = "模版部门填写获取列表信息")
+    @GetMapping("templateDepartmentEdit/{id}")
+    public MessageResult<TemplateOptionDTO> templateDepartmentEdit(@PathVariable("id") String id, @RequestAttribute String subject) {
+        MessageResult<TemplateOptionDTO> msgResult = new MessageResult<>();
+
+        try {
+            User user = userService.get(subject);
+
+            DepartmentInfo departmentUser = departmentInfoService.get(user.getDepartmentId());
+
+            Map<String, Object> searchParams = new HashMap<>();
+
+            if (departmentUser != null) {
+                searchParams.put("departmentId", "%" + departmentUser.getId() + "%");
+            }
+
+            searchParams.put("templateId", id);
+
+            TemplateOptionDTO dto = new TemplateOptionDTO();
+
+            TemplateInfo templateInfo = templateInfoService.get(id);
+            if(templateInfo!=null){
+                dto.setStatus(templateInfo.getStatus());
+            }
+
+            List<TemplateOption> templateOptionList = templateOptionService.findByConditions(searchParams);
+
+            if (templateOptionList.size() == 0) {
+                templateOptionList = new ArrayList<>();
+            } else {
+                for (TemplateOption item : templateOptionList) {
+                    if (StringUtils.isNotEmpty(item.getDepartmentIds())) {
+                        String[] arrayId = item.getDepartmentIds().split(",");
+                        String departmentNames = "";
+                        for (String departmentId : arrayId) {
+                            DepartmentInfo departmentInfo = departmentInfoService.get(departmentId);
+                            departmentNames += departmentInfo.getName() + ",";
+                        }
+
+                        if (StringUtils.isNotEmpty(departmentNames)) {
+                            departmentNames = departmentNames.substring(0, departmentNames.lastIndexOf(","));
+                        }
+                        item.setDepartmentNames(departmentNames);
+                    }
+
+                    if (StringUtils.isNotEmpty(item.getIncomeType())) {
+                        String type = item.getIncomeType();
+                        switch (type) {
+                            case "1":
+                                item.setIncomeTypeN("按月");
+                                break;
+                            case "2":
+                                item.setIncomeTypeN("按年");
+                                break;
+                            case "3":
+                                item.setIncomeTypeN("按季");
+                                break;
+                            case "4":
+                                item.setIncomeTypeN("按学期");
+                                break;
+                        }
+                    }
+                }
+            }
+
+            dto.setTemplateId(id);
+            dto.setTemplateOptionList(templateOptionList);
+
+            msgResult.setResult(true);
+            msgResult.setData(dto);
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value = "获取信息")
+    @GetMapping("departmentDetailEdit/{id}")
+    public MessageResult<TemplateOption> departmentDetailEdit(@PathVariable("id") String id) {
+        MessageResult<TemplateOption> msgResult = new MessageResult<>();
+
+        try {
+            TemplateOption templateOption = templateOptionService.get(id);
+
+            if (templateOption != null) {
+                if(StringUtils.isNotEmpty(templateOption.getIncomeTimeRange())){
+                    String[] incomeTimeRangeArr = templateOption.getIncomeTimeRange().split(",");
+                    templateOption.setIncomeTimeRangeArr(incomeTimeRangeArr);
+                }
+
+                msgResult.setResult(true);
+                msgResult.setData(templateOption);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value = "更新用户")
+    @PostMapping("updateItem")
+    public MessageResult<Integer> updateItem(@RequestBody TemplateOption templateOption, @RequestAttribute String subject) {
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            templateOption.setUpdateTime(new Date());
+            templateOption.setUpdateBy(subject);
+
+            if (templateOption.getIncomeTimeRangeArr().length != 0) {
+                String[] incomeTimeRangeArr = templateOption.getIncomeTimeRangeArr();
+                String incomeTimeRange = "";
+                for (String item : incomeTimeRangeArr) {
+                    incomeTimeRange += item + ",";
+                }
+                if (StringUtils.isNotEmpty(incomeTimeRange)) {
+                    incomeTimeRange = incomeTimeRange.substring(0, incomeTimeRange.lastIndexOf(","));
+                }
+                templateOption.setIncomeTimeRange(incomeTimeRange);
+            }
+
+            int affectCount = templateOptionService.update(templateOption);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+}

+ 62 - 0
web/src/main/java/com/jpsoft/employment/modules/sys/controller/RoleController.java

@@ -7,7 +7,9 @@ import com.jpsoft.employment.modules.common.utils.PojoUtils;
 import com.jpsoft.employment.modules.sys.dto.RoleRelatedDTO;
 import com.jpsoft.employment.modules.sys.entity.Role;
 import com.jpsoft.employment.modules.sys.entity.RoleMenu;
+import com.jpsoft.employment.modules.sys.entity.RolePermission;
 import com.jpsoft.employment.modules.sys.service.RoleMenuService;
+import com.jpsoft.employment.modules.sys.service.RolePermissionService;
 import com.jpsoft.employment.modules.sys.service.RoleService;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
@@ -30,6 +32,9 @@ public class RoleController {
     @Autowired
     private RoleMenuService roleMenuService;
 
+    @Autowired
+    private RolePermissionService rolePermissionService;
+
     @ApiOperation(value="创建空记录")
     @GetMapping("create")
     public MessageResult<Role> create(){
@@ -311,4 +316,61 @@ public class RoleController {
 
         return msgResult;
     }
+
+    @ApiOperation(value="获取已分配接口权限列表")
+    @GetMapping(value = "queryRelatedPerms")
+    @Transactional(rollbackFor = Exception.class)
+    public MessageResult<List> queryRelatedPerms(String roleId){
+        MessageResult<List> msgResult = new MessageResult<>();
+
+        try {
+            List<RolePermission> list = rolePermissionService.findByRoleId(roleId);
+
+            msgResult.setResult(true);
+            msgResult.setData(list);
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="保存关联接口权限")
+    @PostMapping(value = "saveRelatedPermission")
+    public MessageResult<Integer> saveRelatedPermission(@RequestBody RoleRelatedDTO dto,String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            rolePermissionService.deleteByRoleId(dto.getRoleId());
+
+            int affectCount = 0;
+
+            for (String permissionId : dto.getRelatedList()) {
+                RolePermission rp = new RolePermission();
+                rp.setId(UUID.randomUUID().toString());
+                rp.setRoleId(dto.getRoleId());
+                rp.setPermId(permissionId);
+                rp.setDelFlag(false);
+                rp.setCreateBy(subject);
+                rp.setCreateTime(new Date());
+
+                affectCount+= rolePermissionService.insert(rp);
+            }
+
+            msgResult.setResult(true);
+            msgResult.setData(affectCount);
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
 }