Переглянути джерело

项目归档审核按钮添加

user5 3 роки тому
батько
коміт
4c67ee74ec

+ 17 - 1
src/main/java/com/jeeplus/modules/ruralprojectrecords/dao/RuralProjectMessageAllDao.java

@@ -7,6 +7,8 @@ import com.jeeplus.common.persistence.CrudDao;
 import com.jeeplus.common.persistence.annotation.MyBatisDao;
 import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
 
+import java.util.List;
+
 /**
  * 项目列表DAO接口
  * @author ppt
@@ -14,4 +16,18 @@ import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
  */
 @MyBatisDao
 public interface RuralProjectMessageAllDao extends CrudDao<RuralProjectRecords> {
-}
+
+    /**
+     * 查询归档导出数据信息
+     * @param ruralProjectRecords
+     * @return
+     */
+    List<RuralProjectRecords> findListOnRecordDownload(RuralProjectRecords ruralProjectRecords);
+
+    /**
+     * 根据项目id查询审核通过的缺失文件流程
+     * @param projectId
+     * @return
+     */
+    List<RuralProjectRecords> getProjectMaterialList(List<String> projectId);
+}

+ 64 - 8
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/RuralProjectRecords.java

@@ -206,6 +206,10 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 	private Integer newRecordAuditNotifyFlag; //新归档(审批)判定条件
 	private String newReportedNotifyId; //新上报代办判定条件
 	private Integer newReportedNotifyFlag; //新上报(审批)判定条件
+	private Integer newReportTwoNotifyFlag; //报告签发代办判定条件
+	private Integer newReportTwoAuditNotifyFlag; //报告签发(审批)判定条件
+	private Integer newReportMaterialNotifyFlag; //缺失说明代办判定条件
+	private Integer newReportMaterialAuditNotifyFlag; //缺失说明(审批)判定条件
 
 	private Integer reportDataFlag; //报告号是否存在判定条件
 
@@ -214,6 +218,8 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 	private BigDecimal submitScale;	//送审规模
 	private Boolean createReportFlag;	//生成报告号判断条件
 	private String emergencyProject;	//是否是紧急项目
+	private String recordTypeStr;	//归档类型多选
+	private List<String> recordTypeList;	//归档类型
 
 
 	private List<String> civilProjectList = Lists.newArrayList();
@@ -261,6 +267,7 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 		this.recodeNum = recodeNum;
 	}
 
+	@ExcelField(title="归档状态", align=2, sort=18,dictType = "archive_state")
 	public Integer getProjectReportRecordStatus() {
 		return projectReportRecordStatus;
 	}
@@ -335,7 +342,7 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 		this.projectName = projectName;
 	}
 
-	@ExcelField(title="规模类型", align=2, sort=9)
+	//@ExcelField(title="规模类型", align=2, sort=9)
 	public String getScaleType() {
 		return scaleType;
 	}
@@ -344,7 +351,7 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 		this.scaleType = scaleType;
 	}
 
-	@ExcelField(title="规模单位", align=2, sort=10)
+	//@ExcelField(title="规模单位", align=2, sort=10)
 	public String getScaleUnit() {
 		return scaleUnit;
 	}
@@ -353,7 +360,7 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 		this.scaleUnit = scaleUnit;
 	}
 
-	@ExcelField(title="规模数量", align=2, sort=11)
+	//@ExcelField(title="规模数量", align=2, sort=11)
 	public Double getScaleQuantity() {
 		return scaleQuantity;
 	}
@@ -371,7 +378,7 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 		this.area = area;
 	}
 
-	@ExcelField(title="建设地点", align=2, sort=13)
+	//@ExcelField(title="建设地点", align=2, sort=13)
 	public String getProjectSite() {
 		return projectSite;
 	}
@@ -388,11 +395,11 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 		this.workClientLinkmanList = workClientLinkmanList;
 	}
 
-	@ExcelField(title="工程概况", align=2, sort=14)
+	//@ExcelField(title="工程概况", align=2, sort=14)
 	public String getProjectDesc() {
 		return projectDesc;
 	}
-	@ExcelField(title="特殊要求", align=2, sort=15)
+	//@ExcelField(title="特殊要求", align=2, sort=15)
 	public String getRemarks() {
 		return remarks;
 	}
@@ -438,7 +445,7 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 		this.projectStatus = projectStatus;
 	}
 
-	@ExcelField(title="负责人", align=2, sort=8)
+	//@ExcelField(title="负责人", align=2, sort=8)
 	public String getLeaderNameStr() {
 		return leaderNameStr;
 	}
@@ -574,7 +581,7 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 			return "";
 		}
 	}
-	@ExcelField(title="工程分类", align=2, sort=7)
+	//@ExcelField(title="工程分类", align=2, sort=7)
 	public String getContractType() {
 		if (workContractInfo!=null) {
 			return workContractInfo.getConstructionProjectTypeStr();
@@ -1263,6 +1270,7 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 		this.actType = actType;
 	}
 
+	@ExcelField(title="责任人", align=2, sort=8)
 	public String getProjectMasterName() {
 		return projectMasterName;
 	}
@@ -1534,4 +1542,52 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 	public void setPmdrId(String pmdrId) {
 		this.pmdrId = pmdrId;
 	}
+
+	public String getRecordTypeStr() {
+		return recordTypeStr;
+	}
+
+	public void setRecordTypeStr(String recordTypeStr) {
+		this.recordTypeStr = recordTypeStr;
+	}
+
+	public List<String> getRecordTypeList() {
+		return recordTypeList;
+	}
+
+	public void setRecordTypeList(List<String> recordTypeList) {
+		this.recordTypeList = recordTypeList;
+	}
+
+	public Integer getNewReportTwoNotifyFlag() {
+		return newReportTwoNotifyFlag;
+	}
+
+	public void setNewReportTwoNotifyFlag(Integer newReportTwoNotifyFlag) {
+		this.newReportTwoNotifyFlag = newReportTwoNotifyFlag;
+	}
+
+	public Integer getNewReportTwoAuditNotifyFlag() {
+		return newReportTwoAuditNotifyFlag;
+	}
+
+	public void setNewReportTwoAuditNotifyFlag(Integer newReportTwoAuditNotifyFlag) {
+		this.newReportTwoAuditNotifyFlag = newReportTwoAuditNotifyFlag;
+	}
+
+	public Integer getNewReportMaterialNotifyFlag() {
+		return newReportMaterialNotifyFlag;
+	}
+
+	public void setNewReportMaterialNotifyFlag(Integer newReportMaterialNotifyFlag) {
+		this.newReportMaterialNotifyFlag = newReportMaterialNotifyFlag;
+	}
+
+	public Integer getNewReportMaterialAuditNotifyFlag() {
+		return newReportMaterialAuditNotifyFlag;
+	}
+
+	public void setNewReportMaterialAuditNotifyFlag(Integer newReportMaterialAuditNotifyFlag) {
+		this.newReportMaterialAuditNotifyFlag = newReportMaterialAuditNotifyFlag;
+	}
 }

+ 197 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageAllService.java

@@ -24,6 +24,7 @@ import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
 import com.jeeplus.modules.workcontractinfo.service.WorkContractInfoService;
 import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
 import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import jersey.repackaged.com.google.common.collect.Lists;
 import org.activiti.engine.HistoryService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -89,6 +90,51 @@ public class RuralProjectMessageAllService extends CrudService<RuralProjectMessa
         page.setCountFlag(false);
         projectRecords.setPage(page);
         List<RuralProjectRecords> recordsList = findList(projectRecords);
+
+
+        //查询所有和当前登陆人有关的项目的审核
+        WorkProjectNotify workProjectNotify = new WorkProjectNotify();
+        workProjectNotify.setUser(UserUtils.getUser());
+        workProjectNotify.setCompanyId(UserUtils.getSelectCompany().getId());
+        workProjectNotify.setRemarks("待审批");
+        //添加发票对应编号
+        workProjectNotify.setType("92");
+        //查询所有需要当前登录人进行处理的项目信息
+        List<WorkProjectNotify> notifyList = workProjectNotifyService.findList(workProjectNotify);
+
+        //添加发票对应编号
+        workProjectNotify.setType("51");
+        //查询所有需要当前登录人进行处理的项目信息
+        List<WorkProjectNotify> recordNotifyList = workProjectNotifyService.findList(workProjectNotify);
+
+        //添加发票对应编号
+        workProjectNotify.setType("95");
+        //查询所有需要当前登录人进行处理的项目信息
+        List<WorkProjectNotify> reportedNotifyList = workProjectNotifyService.findList(workProjectNotify);
+
+        //查询新的新增报告流程信息代办
+        workProjectNotify.setType("96");
+        //查询所有需要当前登录人进行处理的项目信息
+        List<WorkProjectNotify> newReportNotifyList = workProjectNotifyService.findList(workProjectNotify);
+        //查询新的新增报告流程信息代办
+        workProjectNotify.setType("97");
+        //查询所有需要当前登录人进行处理的项目信息
+        List<WorkProjectNotify> newReportNotifyListTwo = workProjectNotifyService.findList(workProjectNotify);
+        //查询新的新增报告流程信息代办
+        workProjectNotify.setType("99");
+        //查询所有需要当前登录人进行处理的项目信息
+        List<WorkProjectNotify> materialDefectRecord = workProjectNotifyService.findList(workProjectNotify);
+        //查询新的归档流程信息代办
+        workProjectNotify.setType("101");
+        //查询所有需要当前登录人进行处理的项目信息
+        List<WorkProjectNotify> newRecordNotifyList = workProjectNotifyService.findList(workProjectNotify);
+        //添加上报对应编号
+        workProjectNotify.setType("98");
+        //查询所有需要当前登录人进行处理的项目信息
+        List<WorkProjectNotify> newReportedNotifyList = workProjectNotifyService.findList(workProjectNotify);
+
+
+
         //查询负责人信息
         for (RuralProjectRecords records : recordsList) {
             this.queryContractInfos(records);
@@ -98,6 +144,113 @@ public class RuralProjectMessageAllService extends CrudService<RuralProjectMessa
             records.setLeaderNameStr(Collections3.extractToString(users, "name", ","));
             records.setLeaderIds(Collections3.extractToString(users, "id", ","));
 
+            //新增报告展示
+            for (WorkProjectNotify notify: notifyList) {
+                if(notify.getNotifyId().equals(records.getPrdId())){
+                    records.setReportNotifyId(notify.getId());
+                    if("重新申请".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setReportNotifyFlag(1);
+                    }
+                    if("待审批".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setReportAuditNotifyFlag(1);
+                    }
+                    break;
+                }
+            }
+            //线上归档展示
+            for (WorkProjectNotify notify: recordNotifyList) {
+                if(notify.getNotifyId().equals(records.getPrrId())){
+                    records.setReportNotifyId(notify.getId());
+                    if("重新申请".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setRecordNotifyFlag(1);
+                    }
+                    if("待审批".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setRecordAuditNotifyFlag(1);
+                    }
+                    break;
+                }
+            }
+            //上报展示
+            for (WorkProjectNotify notify: reportedNotifyList) {
+                if(notify.getNotifyId().equals(records.getId())){
+                    records.setReportNotifyId(notify.getId());
+                    if("重新申请".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setReportedNotifyFlag(1);
+                    }
+                    if("待审批".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setReportedAuditNotifyFlag(1);
+                    }
+                    break;
+                }
+            }
+            //新代办修改权限处理
+            for (WorkProjectNotify notify: newReportNotifyList) {
+                if(notify.getNotifyId().equals(records.getPrdId())){
+                    records.setReportNotifyId(notify.getId());
+                    if("重新申请".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setNewReportNotifyFlag(1);
+                    }
+                    if("待审批".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setNewReportAuditNotifyFlag(1);
+                    }
+                    break;
+                }
+            }
+            //新代办流程2修改权限处理
+            for (WorkProjectNotify notify: newReportNotifyListTwo) {
+                if(notify.getNotifyId().equals(records.getPrdtId())){
+                    records.setReportNotifyId(notify.getId());
+                    if("重新申请".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setNewReportTwoNotifyFlag(1);
+                    }
+                    if("待审批".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setNewReportTwoAuditNotifyFlag(1);
+                    }
+                    break;
+                }
+            }
+            //报告归档资料缺失说明修改权限处理
+            for (WorkProjectNotify notify: materialDefectRecord) {
+                if(notify.getNotifyId().equals(records.getPrdtId())){
+                    records.setReportNotifyId(notify.getId());
+                    if("重新申请".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setNewReportMaterialNotifyFlag(1);
+                    }
+                    if("待审批".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setNewReportMaterialAuditNotifyFlag(1);
+                    }
+                    break;
+                }
+            }
+            //新代办修改权限处理
+            for (WorkProjectNotify notify: newRecordNotifyList) {
+                if(notify.getNotifyId().equals(records.getPrrId())){
+                    records.setNewRecordNotifyId(notify.getId());
+                    if("重新申请".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setNewRecordNotifyFlag(1);
+                    }
+                    if("待审批".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setNewRecordAuditNotifyFlag(1);
+                    }
+                    break;
+                }
+            }
+
+            //新代办修改权限处理
+            for (WorkProjectNotify notify: newReportedNotifyList) {
+                if(notify.getNotifyId().equals(records.getId())){
+                    records.setNewRecordNotifyId(notify.getId());
+                    if("重新申请".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setNewReportedNotifyFlag(1);
+                    }
+                    if("待审批".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+                        records.setNewReportedNotifyFlag(1);
+                    }
+                    break;
+                }
+            }
+
+
             //获取归档批次信息
             //项目归档批次
             ProjectFilingbatchRelation relation=filingbatchRelationDao.getProjectId(records.getId());
@@ -423,4 +576,48 @@ public class RuralProjectMessageAllService extends CrudService<RuralProjectMessa
         }
         projectRecords.setWorkContractInfo(workContractInfo);
     }
+
+    public Page<RuralProjectRecords> findPageRecordDownload(Page<RuralProjectRecords> page, RuralProjectRecords projectRecords) {
+        //添加查询类型
+        List<String> typeList = Lists.newArrayList();
+        typeList.add("1");
+        typeList.add("2");
+        //添加查询类型list
+        projectRecords.setTypeList(typeList);
+        //处理归档选择项
+        if(StringUtils.isNotBlank(projectRecords.getRecordTypeStr())) {
+            List<String> list = Arrays.asList(projectRecords.getRecordTypeStr().split(","));
+            list = new ArrayList(list);
+            if (projectRecords.getRecordTypeStr().contains("0")){
+                for (String type: list) {
+                    //判断如果归档状态选择了0 则需要捞取未归档的数据
+                    if("0".equals(type)){
+                        list.remove(type);
+                        projectRecords.setProjectRecordStatus(0);
+                        break;
+                    }
+                }
+            }else{
+                projectRecords.setProjectRecordStatus(1);
+            }
+            projectRecords.setRecordTypeList(list);
+        }
+        //查询项目信息
+        List<RuralProjectRecords> recordsList = dao.findListOnRecordDownload(projectRecords);
+        //查询资料缺失审批完成信息
+        List projectIdList = Lists.newArrayList();
+        for (RuralProjectRecords records: recordsList) {
+            projectIdList.add(records.getId());
+        }
+        //根据已查询的项目id查询资料缺失流程信息
+        if(projectIdList.size()>0){
+            List<RuralProjectRecords> projectMaterialList = dao.getProjectMaterialList(projectIdList);
+            //将获取的数据和项目数据进行比对,对已提交资料缺失申请并通过的并且项目归档已经延期的从列表中删除
+            for (RuralProjectRecords info : projectMaterialList) {
+
+            }
+        }
+        page.setList(recordsList);
+        return page;
+    }
 }

+ 61 - 8
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectMessageAllController.java

@@ -1,9 +1,12 @@
 package com.jeeplus.modules.ruralprojectrecords.web;
 
 import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
 import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
 import com.jeeplus.common.utils.MyBeanUtils;
 import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
 import com.jeeplus.common.web.BaseController;
 import com.jeeplus.modules.historical.entity.HistoricalData;
 import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryRelationInfo;
@@ -21,6 +24,7 @@ import com.jeeplus.modules.ruralprojectrecords.entity.RuralReportConsultant;
 import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageAllService;
 import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageService;
 import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
+import com.jeeplus.modules.sys.entity.Dict;
 import com.jeeplus.modules.sys.entity.MainDictDetail;
 import com.jeeplus.modules.sys.entity.User;
 import com.jeeplus.modules.sys.service.UserService;
@@ -33,17 +37,12 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 项目列表Controller
@@ -122,7 +121,7 @@ public class RuralProjectMessageAllController extends BaseController {
         model.addAttribute("beginDate", projectRecords.getBeginDate());
         model.addAttribute("endDate", projectRecords.getEndDate());
         model.addAttribute("reportSwitch", BaseController.REPORTSWITCH);
-        return "modules/ruralprojectrecords/ruralporjectmessage/all/ruralProjectMessageAllLists";
+        return "modules/ruralprojectrecords/ruralporjectmessage/all/ruralProjectMessageAllList";
     }
 
     /**
@@ -436,4 +435,58 @@ public class RuralProjectMessageAllController extends BaseController {
         }
         return str;
     }
+
+    /**
+     * 跳转归档信息导出信息页
+     */
+    @RequestMapping(value = "skipDownloadRecordForm")
+    public String skipDownloadRecordForm(RuralProjectRecords projectRecords,Model model) {
+        model.addAttribute("projectRecords",projectRecords);
+        return "modules/ruralprojectrecords/ruralporjectmessage/all/downloadRecordForm";
+    }
+
+    /**
+     * 查询归档
+     * @return
+     */
+    @RequestMapping("getRecordType")
+    @ResponseBody
+    public AjaxJson getRecordType(){
+        AjaxJson ajaxJson = new AjaxJson();
+        try {
+            List<Dict> archiveStateList = DictUtils.getDictList("archive_state");
+            List<Map<String, Object>> mapList = new ArrayList<>();
+            for (int i = 0; i < archiveStateList.size(); i++) {
+                Map<String, Object> map = new HashMap<>();
+                map.put("name", archiveStateList.get(i).getLabel());
+                map.put("value", archiveStateList.get(i).getValue());
+                mapList.add(map);
+            }
+            ajaxJson.getBody().put("list", mapList);
+            ajaxJson.setMsg("获取数据成功");
+        } catch (Exception e) {
+            logger.error("获取数据异常!", e);
+            ajaxJson.setSuccess(false);
+            ajaxJson.setMsg("获取数据异常");
+        }
+        return ajaxJson;
+    }
+
+    /**
+     * 导出excel文件
+     */
+    @RequiresPermissions("ruralProject:ruralProjectMessageAll:recordDownload")
+    @RequestMapping(value = "recordDownload", method= RequestMethod.POST)
+    public String recordDownload(RuralProjectRecords projectRecords, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        try {
+            String fileName = "项目"+ DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<RuralProjectRecords> page = ruralProjectMessageAllService.findPageRecordDownload(new Page<RuralProjectRecords>(request, response, -1), projectRecords);
+            new ExportExcel("项目", RuralProjectRecords.class).setDataList(page.getList()).write(response, fileName).dispose();
+            return null;
+        } catch (Exception e) {
+            addMessage(redirectAttributes, "导出项目记录失败!失败信息:"+e.getMessage());
+            logger.error("Exception e:"+e);
+        }
+        return "redirect:"+Global.getAdminPath()+"/ruralProject/ruralProjectRecords/?repage";
+    }
 }

+ 4 - 0
src/main/resources/mappings/modules/bzshbExamin/BzshbExaminDao.xml

@@ -143,6 +143,7 @@
 			<if test="startDate != null and endDate != null and startDate != '' and endDate != ''">
 				AND a.create_date BETWEEN #{startDate} AND DATE_ADD(#{endDate},INTERVAL 1 DAY)
 			</if>
+			and prd.examin_flag is not null
 		</where>
 		order by a.create_date desc
 	</select>
@@ -169,6 +170,7 @@
 			<if test="startDate != null and endDate != null and startDate != '' and endDate != ''">
 				AND a.create_date BETWEEN #{startDate} AND DATE_ADD(#{endDate},INTERVAL 1 DAY)
 			</if>
+			and prd.examin_flag is not null
 		</where>
 	</select>
 
@@ -197,6 +199,7 @@
 			<if test="(userId != null and userId != '') or (userName != null and userName != '')">
 				AND (wpu.user_id = #{userId} or suw.name like concat('%',#{userName},'%'))
 			</if>
+			and prd.examin_flag is not null
 		</where>
 	</select>
 
@@ -234,6 +237,7 @@
 			<if test="(userId != null and userId != '') or (userName != null and userName != '')">
 				AND (wpu.user_id = #{userId} or suw.name like concat('%',#{userName},'%'))
 			</if>
+			and prd.examin_flag is not null
 		</where>
 		order by a.create_date desc
 	</select>

+ 226 - 106
src/main/resources/mappings/modules/ruralprojectrecords/RuralProjectMessageAllDao.xml

@@ -44,7 +44,10 @@
 		a.install_unit_fees AS "installUnitFees",
 		a.total_fees AS "totalFees",
 		ifnull(a.reported_state,0) as "reportedState",
-		a.over_due_status as "overDueStatus"
+		a.over_due_status as "overDueStatus",
+		ifnull(a.record_state,0) as "projectRecordStatus",
+		a.over_record_status as "overRecordStatus",
+		a.emergency_project as "emergencyProject"
 	</sql>
 
 
@@ -92,9 +95,9 @@
 
 	<select id="findList" resultType="RuralProjectRecords" >
 		SELECT
-			<include refid="projectRecordsColumns"/>
-		,
-		a.project_type as projectType,
+		<include refid="projectRecordsColumns"/>
+		,a.submit_money as "submitMoney"
+		,a.project_type as projectType,
 		wci.name AS "workContractInfo.name",
 		wct.id AS "workContractInfo.client.id",
 		wct.name AS "workContractInfo.client.name",
@@ -104,7 +107,7 @@
 		,ifnull(prd.name,"") as "projectReportName"
 		,ifnull(prr.status,0) as "projectReportRecordStatus"
 		,ifnull(prrd.status,0) as "downProjectReportRecordStatus",
-        prrd.file_num as recodeNum,
+		prrd.file_num as recodeNum,
 		prr.process_instance_id as prrProcessInstanceId,
 		prrd.process_instance_id as prrdProcessInstanceId
 		,prd.id as prdId
@@ -125,15 +128,15 @@
 		LEFT JOIN sys_area area ON area.id = a.area_id
 		left join rural_project_records_reported rprr on rprr.id = a.id
 		LEFT JOIN project_flingbatch_relation pfp on pfp.project_id=a.id
-
-        <if test="leaderNameStr !=null and leaderNameStr !=''">
-            LEFT JOIN work_project_user w on a.id = w.project_id
-            LEFT JOIN sys_user su on w.user_id = su.id
-        </if>
-        LEFT JOIN work_project_user w1 on a.id = w1.project_id
+		LEFT JOIN sys_user sua on a.create_by = sua.id
+		<if test="leaderNameStr !=null and leaderNameStr !=''">
+			LEFT JOIN work_project_user w on a.id = w.project_id
+			LEFT JOIN sys_user su on w.user_id = su.id
+		</if>
+		LEFT JOIN work_project_user w1 on a.id = w1.project_id
 		LEFT JOIN work_contract_info wci on a.contract_id = wci.id
 		LEFT JOIN work_client_info wct on wci.client_id = wct.id
-        LEFT JOIN sys_office o ON o.id = a.office_id
+		LEFT JOIN sys_office o ON o.id = a.office_id
 		left join project_report_data prd on prd.project_id = a.id
 		left join project_report_data_two prdt on prdt.project_id = a.id
 		left join rural_project_report_record prr on prr.report_id = prd.id
@@ -141,6 +144,9 @@
 		left join rural_project_report_record_down prrd on prrd.report_id = prd.id
 		<where>
 			a.status = 5
+			<if test="bzshbUserId!=null and bzshbUserId!=''">
+				and prd.bzshb_user_id=#{bzshbUserId}
+			</if>
 			<if test="projectId != null and projectId != ''">
 				AND a.project_id like concat('%',#{projectId},'%')
 			</if>
@@ -183,8 +189,11 @@
 			<if test="workContractInfo!=null and workContractInfo.client !=null and workContractInfo.client.name !=null and workContractInfo.client.name !=''">
 				AND wct.name like concat(concat('%',#{workContractInfo.client.name}),'%')
 			</if>
-			<if test="leaderNameStr !=null and leaderNameStr !=''">
-				AND su.name like concat(concat('%',#{leaderNameStr}),'%') AND w.is_master = '1' AND w.del_flag='0'
+			<!--<if test="leaderNameStr !=null and leaderNameStr !=''">
+                AND su.name like concat(concat('%',#{leaderNameStr}),'%') AND w.is_master = '1' AND w.del_flag='0'
+            </if>-->
+			<if test="(leaderNameStr != null and leaderNameStr != '') or (leaderId != null and leaderId != '')">
+				AND ((w.user_id = #{leaderId}) or su.name like concat('%',#{leaderNameStr},'%')) AND w.is_master = '1' AND w.del_flag='0'
 			</if>
 			<if test="projectStatus !=null">
 				AND a.status = #{projectStatus}
@@ -195,11 +204,11 @@
 			<if test="endDate !=null">
 				AND a.create_date &lt; #{endDate}
 			</if>
-			<if test="createBy != null and createBy.id !=null and createBy.id !=''">
+			<!--<if test="createBy != null and createBy.id !=null and createBy.id !=''">
 				AND a.create_by = #{createBy.id}
-			</if>
-			<if test="bzshbUserId!=null and bzshbUserId!=''">
-				and prd.bzshb_user_id=#{bzshbUserId}
+ 			</if>-->
+			<if test="createBy != null and((createBy.id != null and createBy.id != '') or (createBy.name != null and createBy.name != ''))">
+				AND (a.create_by = #{createBy.id} or sua.name like concat('%',#{createBy.name},'%'))
 			</if>
 			<choose>
 				<when test="filingProjectStatus == 0">
@@ -217,15 +226,14 @@
 			<!--<if test="office!=null and office.id!=null and office.id!=''">
 				and  a.office_id = #{office.id}
 			</if>-->
+
 			<if test="officeIdList!=null and officeIdList.size!=0">
 				and a.office_id in
 				<foreach collection="officeIdList" item="officeId" separator="," open="(" close=")">
 					#{officeId}
 				</foreach>
 			</if>
-			<if test="projectReportStatus != null and projectReportStatus != ''">
-				AND prd.status = #{projectReportStatus}
-			</if>
+
 			<if test="reportedState !=null and reportedState !=''">
 				<choose>
 					<when test="reportedState == 0">
@@ -237,6 +245,13 @@
 				</choose>
 			</if>
 
+
+			<if test="projectReportStatus != null and projectReportStatus != ''">
+				AND prd.status = #{projectReportStatus}
+			</if>
+			<if test="submitMoney != null and submitMoney != ''">
+				AND a.submit_money = #{submitMoney}
+			</if>
 			<choose>
 				<when test="projectReportRecordStatus != null and projectReportRecordStatus != '' and projectReportRecordStatus != 0">
 					AND prr.status = #{projectReportRecordStatus}
@@ -249,6 +264,13 @@
 					</choose>
 				</otherwise>
 			</choose>
+
+			<if test="typeList !=null and typeList !=''">
+				and a.project_type in
+				<foreach collection="typeList" item="id" index="index" open="(" close=")" separator=",">
+					#{id}
+				</foreach>
+			</if>
 			<choose>
 				<when test="projectReportStatusTwo == 0">
 					AND prdt.status is null
@@ -259,12 +281,6 @@
 					</if>
 				</otherwise>
 			</choose>
-			<if test="typeList !=null and typeList !=''">
-				and project_type in
-				<foreach collection="typeList" item="id" index="index" open="(" close=")" separator=",">
-					#{id}
-				</foreach>
-			</if>
 
 			AND  a.status != 7 AND a.del_flag = #{DEL_FLAG_NORMAL}
 			<if test="sqlMap.dsf !=null and sqlMap.dsf!=''">
@@ -282,89 +298,97 @@
 	</select>
 
     <select id="queryCount" resultType="int" >
-        SELECT count(DISTINCT a.id)
-        FROM rural_project_records a
+		SELECT count(DISTINCT a.id)
+		FROM rural_project_records a
 
-        <if test="leaderNameStr !=null and leaderNameStr !=''">
-            LEFT JOIN work_project_user w on a.id = w.project_id
-            LEFT JOIN sys_user su on w.user_id = su.id
-        </if>
-        LEFT JOIN work_project_user w1 on a.id = w1.project_id
-        <if test="workContractInfo !=null">
-            LEFT JOIN work_contract_info wci on a.contract_id = wci.id
-        </if>
-        <if test="workContractInfo!=null and workContractInfo.client !=null and workContractInfo.client.name !=null and workContractInfo.client.name !=''">
-            LEFT JOIN work_client_info wct on wci.client_id = wct.id
-        </if>
+		<if test="leaderNameStr !=null and leaderNameStr !=''">
+			LEFT JOIN work_project_user w on a.id = w.project_id
+			LEFT JOIN sys_user su on w.user_id = su.id
+		</if>
+		LEFT JOIN work_project_user w1 on a.id = w1.project_id
+		<if test="workContractInfo !=null">
+			LEFT JOIN work_contract_info wci on a.contract_id = wci.id
+		</if>
+		<if test="workContractInfo!=null and workContractInfo.client !=null and workContractInfo.client.name !=null and workContractInfo.client.name !=''">
+			LEFT JOIN work_client_info wct on wci.client_id = wct.id
+		</if>
 		left join project_report_data prd on prd.project_id = a.id
 		left join project_report_data_two prdt on prdt.project_id = a.id
 		left join rural_project_report_record prr on prr.report_id = prd.id
 		LEFT JOIN project_material_defect_record pmdr on prd.id = pmdr.report_id
 		left join rural_project_report_record_down prrd on prrd.report_id = prd.id
 		LEFT JOIN project_flingbatch_relation pfp on pfp.project_id= a.id
+		LEFT JOIN sys_user sua on a.create_by = sua.id
 
 		<where>
-            a.status = 5
-            <if test="projectId != null and projectId != ''">
-                AND a.project_id like concat('%',#{projectId},'%')
-            </if>
-            <if test="projectName != null and projectName != ''">
-                AND a.project_name like concat(concat('%',#{projectName}),'%')
-            </if>
-            <if test="scaleType != null and scaleType != ''">
-                AND a.scale_type = #{scaleType}
-            </if>
-            <if test="scaleUnit != null and scaleUnit != ''">
-                AND a.scale_unit = #{scaleUnit}
-            </if>
-            <if test="scaleQuantity != null and scaleQuantity != ''">
-                AND a.scale_quantity = #{scaleQuantity}
-            </if>
-            <if test="projectSite != null and projectSite != ''">
-                AND a.project_site LIKE concat('%',#{projectSite},'%')
-            </if>
-            <if test="remarks != null and remarks != ''">
-                AND a.remarks LIKE concat('%',#{remarks},'%')
-            </if>
-            <if test="projectDesc != null and projectDesc != ''">
-                AND a.project_desc LIKE concat('%',#{projectDesc},'%')
-            </if>
-            <if test="area != null and area.id != null and area.id != ''">
-                AND a.area_id = #{area.id}
-            </if>
-            <if test="workContractInfo !=null and workContractInfo.name !=null and workContractInfo.name !=''">
-                AND wci.name like concat(concat('%',#{workContractInfo.name}),'%')
-            </if>
-            <if test="workContractInfo !=null and workContractInfo.contractNum !=null and workContractInfo.contractNum !=''">
-                AND wci.contract_num like concat(concat('%',#{workContractInfo.contractNum}),'%')
-            </if>
-            <if test="workContractInfo !=null and workContractInfo.contractPrice !=null and workContractInfo.contractPrice !=''">
-                AND wci.contract_price = #{workContractInfo.contractPrice}
-            </if>
-            <if test="workContractInfo !=null and workContractInfo.contractType !=null and workContractInfo.contractType !=''">
-                AND wci.contract_type = #{workContractInfo.contractType}
-            </if>
-            <if test="workContractInfo!=null and workContractInfo.client !=null and workContractInfo.client.name !=null and workContractInfo.client.name !=''">
-                AND wct.name like concat(concat('%',#{workContractInfo.client.name}),'%')
-            </if>
-            <if test="leaderNameStr !=null and leaderNameStr !=''">
-                AND su.name like concat(concat('%',#{leaderNameStr}),'%') AND w.is_master = '1' AND w.del_flag='0'
-            </if>
-            <if test="projectStatus !=null">
-                AND a.status = #{projectStatus}
-            </if>
-            <if test="beginDate !=null">
-                AND a.create_date >= #{beginDate}
-            </if>
-            <if test="endDate !=null">
-                AND a.create_date &lt; #{endDate}
-            </if>
-			<if test="createBy != null and createBy.id !=null and createBy.id !=''">
-				AND a.create_by = #{createBy.id}
-			</if>
+			a.status = 5
 			<if test="bzshbUserId!=null and bzshbUserId!=''">
 				and prd.bzshb_user_id=#{bzshbUserId}
 			</if>
+			<if test="projectId != null and projectId != ''">
+				AND a.project_id like concat('%',#{projectId},'%')
+			</if>
+			<if test="projectName != null and projectName != ''">
+				AND a.project_name like concat(concat('%',#{projectName}),'%')
+			</if>
+			<if test="scaleType != null and scaleType != ''">
+				AND a.scale_type = #{scaleType}
+			</if>
+			<if test="scaleUnit != null and scaleUnit != ''">
+				AND a.scale_unit = #{scaleUnit}
+			</if>
+			<if test="scaleQuantity != null and scaleQuantity != ''">
+				AND a.scale_quantity = #{scaleQuantity}
+			</if>
+			<if test="projectSite != null and projectSite != ''">
+				AND a.project_site LIKE concat('%',#{projectSite},'%')
+			</if>
+			<if test="remarks != null and remarks != ''">
+				AND a.remarks LIKE concat('%',#{remarks},'%')
+			</if>
+			<if test="projectDesc != null and projectDesc != ''">
+				AND a.project_desc LIKE concat('%',#{projectDesc},'%')
+			</if>
+			<if test="area != null and area.id != null and area.id != ''">
+				AND a.area_id = #{area.id}
+			</if>
+			<if test="workContractInfo !=null and workContractInfo.name !=null and workContractInfo.name !=''">
+				AND wci.name like concat(concat('%',#{workContractInfo.name}),'%')
+			</if>
+			<if test="workContractInfo !=null and workContractInfo.contractNum !=null and workContractInfo.contractNum !=''">
+				AND wci.contract_num like concat(concat('%',#{workContractInfo.contractNum}),'%')
+			</if>
+			<if test="workContractInfo !=null and workContractInfo.contractPrice !=null and workContractInfo.contractPrice !=''">
+				AND wci.contract_price = #{workContractInfo.contractPrice}
+			</if>
+			<if test="workContractInfo !=null and workContractInfo.contractType !=null and workContractInfo.contractType !=''">
+				AND wci.contract_type = #{workContractInfo.contractType}
+			</if>
+			<if test="workContractInfo!=null and workContractInfo.client !=null and workContractInfo.client.name !=null and workContractInfo.client.name !=''">
+				AND wct.name like concat(concat('%',#{workContractInfo.client.name}),'%')
+			</if>
+			<!--<if test="leaderNameStr !=null and leaderNameStr !=''">
+                AND su.name like concat(concat('%',#{leaderNameStr}),'%') AND w.is_master = '1' AND w.del_flag='0'
+            </if>-->
+			<if test="(leaderNameStr != null and leaderNameStr != '') or (leaderId != null and leaderId != '')">
+				AND ((w.user_id = #{leaderId}) or su.name like concat('%',#{leaderNameStr},'%')) AND w.is_master = '1' AND w.del_flag='0'
+			</if>
+			<if test="projectStatus !=null">
+				AND a.status = #{projectStatus}
+			</if>
+			<if test="beginDate !=null">
+				AND a.create_date >= #{beginDate}
+			</if>
+			<if test="endDate !=null">
+				AND a.create_date &lt; #{endDate}
+			</if>
+			<!--<if test="createBy != null and createBy.id !=null and createBy.id !=''">
+				AND a.create_by = #{createBy.id}
+			</if>-->
+			<if test="createBy != null and((createBy.id != null and createBy.id != '') or (createBy.name != null and createBy.name != ''))">
+				AND (a.create_by = #{createBy.id} or sua.name like concat('%',#{createBy.name},'%'))
+			</if>
+
 			<choose>
 				<when test="filingProjectStatus == 0">
 					AND pfp.status is null
@@ -400,7 +424,9 @@
 					</otherwise>
 				</choose>
 			</if>
-
+			<if test="submitMoney != null and submitMoney != ''">
+				AND a.submit_money = #{submitMoney}
+			</if>
 			<choose>
 				<when test="projectReportRecordStatus != null and projectReportRecordStatus != '' and projectReportRecordStatus != 0">
 					AND prr.status = #{projectReportRecordStatus}
@@ -424,16 +450,110 @@
 				</otherwise>
 			</choose>
 			<if test="typeList !=null and typeList !=''">
-				and project_type in
+				and a.project_type in
 				<foreach collection="typeList" item="id" index="index" open="(" close=")" separator=",">
 					#{id}
 				</foreach>
 			</if>
-
-            AND  a.status != 7 AND a.del_flag = #{DEL_FLAG_NORMAL}
-            <if test="sqlMap.dsf !=null and sqlMap.dsf!=''">
-                AND ((w1.user_id = #{currentUser.id} AND w1.del_flag='0' AND a.company_id = #{currentUser.company.id})${sqlMap.dsf} )
-            </if>
-        </where>
+			AND  a.status != 7 AND a.del_flag = #{DEL_FLAG_NORMAL}
+			<if test="sqlMap.dsf !=null and sqlMap.dsf!=''">
+				AND ((w1.user_id = #{currentUser.id} AND w1.del_flag='0' AND a.company_id = #{currentUser.company.id})${sqlMap.dsf} )
+			</if>
+		</where>
     </select>
+
+
+
+	<select id="findListOnRecordDownload" resultType="RuralProjectRecords" >
+		SELECT
+		<include refid="projectRecordsColumns"/>
+		,a.project_master_id as "projectMasterId"
+		,sub.name as "projectMasterName"
+		,a.submit_money as "submitMoney"
+		,a.project_type as projectType,
+		wci.name AS "workContractInfo.name",
+		wct.id AS "workContractInfo.client.id",
+		wct.name AS "workContractInfo.client.name",
+		o.top_company AS "office.name",
+		ifnull(prd.number ,"") as "projectReportNumber"
+		,ifnull(prd.status,0) as "projectReportStatus"
+		,ifnull(prd.name,"") as "projectReportName"
+		,ifnull(prr.status,0) as "projectReportRecordStatus"
+		,ifnull(prrd.status,0) as "downProjectReportRecordStatus",
+		prrd.file_num as recodeNum,
+		prr.process_instance_id as prrProcessInstanceId,
+		prrd.process_instance_id as prrdProcessInstanceId
+		,prd.id as prdId
+		,prr.id as prrId
+		,prrd.id as prrdId
+		,prd.audit_pass_date as auditPassDate
+		,ifnull(rprr.report_status,0) as "reportStatus"
+		,ifnull(rprr.sync_status,0) as "syncStatus"
+		,rprr.process_instance_id as "reportedProcessInstanceId"
+		,ifnull(prdt.status,0) as "projectReportStatusTwo"
+		,prdt.id as prdtId
+		,prdt.process_instance_id as prdtProcessinstanceId
+		,ifnull(pmdr.status,0) as "defectRecordStatus"
+		,pmdr.process_instance_id as "pmdrProcessInstanceId"
+		,pmdr.id as pmdrId
+		,wci.contract_num as "workContractInfo.contractNum"
+		,wci.contract_price as "workContractInfo.contractPrice"
+		FROM rural_project_records a
+		LEFT JOIN sys_area area ON area.id = a.area_id
+		left join rural_project_records_reported rprr on rprr.id = a.id
+		LEFT JOIN project_flingbatch_relation pfp on pfp.project_id=a.id
+		LEFT JOIN sys_user sua on a.create_by = sua.id
+		LEFT JOIN sys_user sub on a.project_master_id = sub.id
+		LEFT JOIN work_project_user w on a.id = w.project_id
+		LEFT JOIN sys_user su on w.user_id = su.id
+		LEFT JOIN work_project_user w1 on a.id = w1.project_id
+		LEFT JOIN work_contract_info wci on a.contract_id = wci.id
+		LEFT JOIN work_client_info wct on wci.client_id = wct.id
+		LEFT JOIN sys_office o ON o.id = a.office_id
+		left join project_report_data prd on prd.project_id = a.id
+		left join project_report_data_two prdt on prdt.project_id = a.id
+		left join rural_project_report_record prr on prr.report_id = prd.id
+		LEFT JOIN project_material_defect_record pmdr on prd.id = pmdr.report_id
+		left join rural_project_report_record_down prrd on prrd.report_id = prd.id
+
+		<where>
+			a.status = 5
+			AND  a.status != 7 AND a.del_flag = #{DEL_FLAG_NORMAL}
+			<if test="beginDate !=null">
+				AND a.create_date >= #{beginDate}
+			</if>
+			<if test="endDate !=null">
+				AND a.create_date &lt; #{endDate}
+			</if>
+			<if test="recordTypeList !=null and recordTypeList !=''">
+				and (prr.status in
+				<foreach collection="recordTypeList" item="status" index="index" open="(" close=")" separator=",">
+					#{status}
+				</foreach>
+				<if test="projectRecordStatus == 0">
+					or prr.status is null)
+				</if>
+				<if test="projectRecordStatus == 1">
+					)
+				</if>
+			</if>
+
+		</where>
+	</select>
+
+	<select id="getProjectMaterialList" resultType="RuralProjectRecords" >
+		select a.id,a.project_name as "projectName"
+		from rural_project_record a
+		left join project_report_data prd on a.id = prd.project_id
+		left join project_material_defect_record pmdr on prd.id = pmdr.report_id
+		<where>
+			<if test="projectIdList!=null and projectIdList.size!=0">
+				and a.id in
+				<foreach collection="projectIdList" item="id" separator="," open="(" close=")">
+					#{id}
+				</foreach>
+			</if>
+			and pmrd.status = 5
+		</where>
+	</select>
 </mapper>