소스 검색

合同审核完成向陈红星添加一个通知

user5 4 년 전
부모
커밋
85ced4c796

+ 28 - 3
src/main/java/com/jeeplus/common/utils/ResponseUtil.java

@@ -1,13 +1,13 @@
 package com.jeeplus.common.utils;
 
+import com.jeeplus.modules.utils.SftpClientUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
+import java.io.*;
 import java.net.URLEncoder;
 
 public class ResponseUtil {
@@ -43,4 +43,29 @@ public class ResponseUtil {
 
         }
     }
+    public static String preViewResponse(String fileName, File file, HttpServletResponse response) {
+        String path = "D:/attachment-file/"+fileName;
+        try {
+            SftpClientUtil sftpClientUtil = new SftpClientUtil();
+            //File转MultipartFile文件
+            MultipartFile mFile = sftpClientUtil.transformFile(file);
+            InputStream in = mFile.getInputStream();
+            byte[] buffer = new byte[1024];
+            int len = 0;
+            File newFile = new File(path);
+            File fileParent = newFile.getParentFile();
+            if (!fileParent.exists()) {
+                fileParent.mkdirs();
+            }
+            OutputStream out = new FileOutputStream(path);
+            while ((len = in.read(buffer)) != -1) {
+                out.write(buffer, 0, len);
+            }
+            out.close();
+            in.close();
+        } catch (Exception e) {
+            logger.error("导出模板文件发生错误!",e);
+        }
+        return path;
+    }
 }

+ 8 - 1
src/main/java/com/jeeplus/modules/workcontractinfo/dao/WorkContractInfoDao.java

@@ -5,6 +5,7 @@ package com.jeeplus.modules.workcontractinfo.dao;
 
 import com.jeeplus.common.persistence.CrudDao;
 import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.sys.entity.User;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
 import com.jeeplus.modules.workcontractinfo.entity.WorkContractAnnex;
 import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
@@ -83,4 +84,10 @@ public interface WorkContractInfoDao extends CrudDao<WorkContractInfo> {
      * @return
      */
     List<Integer> getYear(WorkContractListInfo workContractListInfo);
-}
+
+    /**
+     * 查询总经理下的所有角色
+     * @return
+     */
+    List<User> getUserByRole(String roleName);
+}

+ 28 - 1
src/main/java/com/jeeplus/modules/workcontractinfo/service/WorkContractInfoService.java

@@ -1067,6 +1067,7 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
 		boolean state = actTaskService.isProcessEnd(workContractInfo.getAct().getProcInsId());
 		List<User> users = new ArrayList<>();
 		List<User> userList = new ArrayList<>();
+		List<User> zjlList = dao.getUserByRole("总经理");
 		if(!state) {
 			str = "合同编号:" + workContractInfo.getContractNum() + ",主委托方:" + workContractInfo.getClient().getName() + ",合同所属部门:"+office.getName();
 			title = "合同名称:"+workContractInfo.getName();
@@ -1090,6 +1091,19 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
 										"0",
 										"待通知",
 										notifyRole));
+				for (User user : zjlList) {
+					workProjectNotifyService
+							.save(UtilNotify
+									.saveNotify(workContractInfo.getId(),
+											user,
+											workContractInfo.getCompanyId(),
+											titleStr,
+											content,
+											"16",
+											"0",
+											"待通知",
+											notifyRole));
+				}
 
 			} else {
 				WorkProjectNotify notify = new WorkProjectNotify();
@@ -1108,6 +1122,19 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
 											"0",
 											"待通知",
 											notifyRole));
+					for (User user : zjlList) {
+						workProjectNotifyService
+								.save(UtilNotify
+										.saveNotify(workContractInfo.getId(),
+												user,
+												workContractInfo.getCompanyId(),
+												title,
+												str,
+												"16",
+												"0",
+												"待通知",
+												notifyRole));
+					}
 				}
 			}
 			workActivityProcessService.deleteProcessIdAuditUsers(workContractInfo.getProcessInstanceId());
@@ -3243,4 +3270,4 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
 	public List<Integer> getYear(WorkContractListInfo workContractListInfo){
 		return dao.getYear(workContractListInfo);
 	}
-}
+}

+ 68 - 23
src/main/java/com/jeeplus/modules/workfullmanage/web/WorkFullManageController.java

@@ -66,10 +66,7 @@ import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 import javax.validation.ConstraintViolationException;
 import java.io.*;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
+import java.net.*;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import freemarker.template.Template;
@@ -872,6 +869,44 @@ public class WorkFullManageController extends BaseController {
 	}
 
 	/**
+	 * 预览工程造价咨询质量控制流程单信息
+	 * @param response
+	 * @param projectReportData
+	 */
+	@RequestMapping(value="preViewMassControl")
+	@ResponseBody
+	public String preViewMassControl(HttpServletResponse response, ProjectReportData projectReportData)  {
+		Map data = disposeProjectReportdata(projectReportData);
+
+
+		//模板对象
+		Template template=null;
+		//freemaker模板路径
+		File path = new File(this.getClass().getResource("/").getPath()+"/freemarker");
+		Configuration cfg = new Configuration();
+		try {
+			cfg.setDirectoryForTemplateLoading(path);
+			//选择对应的ftl文件
+			template = cfg.getTemplate("massControl.ftl","UTF-8");
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		File docFile = new File("工程造价咨询质量控制流程单.doc");
+		FreemarkerUtil.generateFile(data,template,docFile);
+		String pathStr = ResponseUtil.preViewResponse("工程造价咨询质量控制流程单.doc", docFile, response);
+		File newFile = new File(pathStr);
+		String url = "";
+		try {
+			url = newFile.toURI().toURL().getPath();
+			System.out.println();
+		} catch (MalformedURLException e) {
+			e.printStackTrace();
+		}
+		return "http://4pwi9k.natappfree.cc" + url;
+	}
+
+	/**
 	 * 下载工程造价咨询质量控制流程单信息
 	 * @param response
 	 * @param projectReportData
@@ -879,6 +914,34 @@ public class WorkFullManageController extends BaseController {
 	@RequestMapping(value="downloadMassControl")
 	@ResponseBody
 	public void downloadMassControl(HttpServletResponse response, ProjectReportData projectReportData)  {
+		Map data = disposeProjectReportdata(projectReportData);
+
+
+		//模板对象
+		Template template=null;
+		//freemaker模板路径
+		File path = new File(this.getClass().getResource("/").getPath()+"/freemarker");
+		Configuration cfg = new Configuration();
+		try {
+			cfg.setDirectoryForTemplateLoading(path);
+			//选择对应的ftl文件
+			template = cfg.getTemplate("massControl.ftl","UTF-8");
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		File docFile = new File("工程造价咨询质量控制流程单.doc");
+		FreemarkerUtil.generateFile(data,template,docFile);
+		ResponseUtil.docResponse("工程造价咨询质量控制流程单.doc",docFile,response);
+
+	}
+
+	/**
+	 * 质量流程控制单文件数据处理
+	 * @param projectReportData
+	 * @return
+	 */
+	private Map<String,Object> disposeProjectReportdata(ProjectReportData projectReportData){
 		//获取报告信息
 		projectReportData = projectReportDataService.get(projectReportData.getId());
 		//获取项目信息
@@ -1155,25 +1218,7 @@ public class WorkFullManageController extends BaseController {
 			data.put("technicistMonth","");
 			data.put("technicistDay","");
 		}
-
-
-		//模板对象
-		Template template=null;
-		//freemaker模板路径
-		File path = new File(this.getClass().getResource("/").getPath()+"/freemarker");
-		Configuration cfg = new Configuration();
-		try {
-			cfg.setDirectoryForTemplateLoading(path);
-			//选择对应的ftl文件
-			template = cfg.getTemplate("massControl.ftl","UTF-8");
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-
-		File docFile = new File("工程造价咨询质量控制流程单.doc");
-		FreemarkerUtil.generateFile(data,template,docFile);
-		ResponseUtil.docResponse("工程造价咨询质量控制流程单.doc",docFile,response);
-
+		return data;
 	}
 
 	/**

+ 8 - 8
src/main/java/com/jeeplus/modules/workstaff/web/WorkStaffBasicInfoController.java

@@ -100,7 +100,7 @@ public class WorkStaffBasicInfoController extends BaseController {
 		}
 		return entity;
 	}
-	
+
 	/**
 	 * 员工信息列表页面
 	 */
@@ -397,7 +397,7 @@ public class WorkStaffBasicInfoController extends BaseController {
 		addMessage(redirectAttributes, "删除员工信息成功");
 		return "redirect:"+Global.getAdminPath()+"/workstaff/workStaffBasicInfo/?repage";
 	}
-	
+
 	/**
 	 * 批量删除员工信息
 	 */
@@ -411,16 +411,16 @@ public class WorkStaffBasicInfoController extends BaseController {
 		addMessage(redirectAttributes, "删除员工信息成功");
 		return "redirect:"+Global.getAdminPath()+"/workstaff/workStaffBasicInfo/?repage";
 	}
-	
+
 	/**
 	 * 导出excel文件
 	 */
-	@RequiresPermissions("workstaff:workStaffBasicInfo:achiveExport")
+	@RequiresPermissions("workstaff:workStaffBasicInfo:export")
     @RequestMapping(value = "exportAchive", method=RequestMethod.POST)
     public String exportFile(WorkStaffBasicInfo workStaffBasicInfo, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
 		try {
             String fileName = "员工信息"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
-            Page<WorkStaffBasicInfo> page = workStaffBasicInfoService.findAchivePage(new Page<WorkStaffBasicInfo>(request, response, -1), workStaffBasicInfo);
+            Page<WorkStaffBasicInfo> page = workStaffBasicInfoService.findPage(new Page<WorkStaffBasicInfo>(request, response, -1), workStaffBasicInfo);
     		new ExportExcel(true,"员工信息", WorkStaffBasicInfo.class,1).setDataList(page.getList()).write(response, fileName).dispose();
             addMessage(redirectAttributes, "导出员工信息记录成功!");
     		return null;
@@ -511,7 +511,7 @@ public class WorkStaffBasicInfoController extends BaseController {
 		}
 		return "redirect:"+Global.getAdminPath()+"/workstaff/workStaffBasicInfo/achivelist?repage";
     }
-	
+
 	/**
 	 * 下载导入员工信息数据模板
 	 */
@@ -520,7 +520,7 @@ public class WorkStaffBasicInfoController extends BaseController {
     public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
 		try {
             String fileName = "员工档案信息导入模板.xlsx";
-    		List<WorkStaffBasicInfo> list = Lists.newArrayList(); 
+    		List<WorkStaffBasicInfo> list = Lists.newArrayList();
     		new ExportExcel(true,"员工档案信息", WorkStaffBasicInfo.class, 2).setDataList(list).write(response, fileName).dispose();
     		return null;
 		} catch (Exception e) {
@@ -882,4 +882,4 @@ public class WorkStaffBasicInfoController extends BaseController {
 		model.addAttribute("page", page);
 		return "modules/workstaff/workAddressBookList";
 	}
-}
+}

+ 24 - 17
src/main/resources/mappings/modules/workcontractinfo/WorkContractInfoDao.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.jeeplus.modules.workcontractinfo.dao.WorkContractInfoDao">
-    
+
 	<sql id="workContractInfoColumns">
 		a.id AS "id",
 		a.create_by AS "createBy.id",
@@ -64,7 +64,7 @@
 		(select count(1) from work_contract_info c where c.total_contract_id = a.id)  cnt,
 		a.contract_information AS "contractInformation"
 	</sql>
-	
+
 	<sql id="workContractInfoJoins">
 		LEFT JOIN work_client_info client ON client.id = a.client_id
 		LEFT JOIN sys_user u on u.id = a.create_by
@@ -72,8 +72,8 @@
 		LEFT JOIN work_bid_project p ON  p.id = a.project_id
 		LEFT JOIN sys_office s ON s.id = a.company_id
 	</sql>
-	
-    
+
+
 	<select id="get" resultType="WorkContractInfo" >
 		SELECT
 		a.id AS "id",
@@ -279,7 +279,7 @@
 				AND a.contract_date BETWEEN #{beginContractDate} AND #{endContractDate}
 			</if>
 			<if test="name != null and name != ''">
-				AND a.name LIKE 
+				AND a.name LIKE
 					<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
 					<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
 					<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
@@ -837,7 +837,7 @@
 			</otherwise>
 		</choose>
 	</select>
-	
+
 	<select id="findAllList" resultType="WorkContractInfo" >
 		SELECT
 			<include refid="workContractInfoColumns"/>
@@ -845,7 +845,7 @@
 		<include refid="workContractInfoJoins"/>
 		<where>
 			a.del_flag = #{DEL_FLAG_NORMAL}
-		</where>		
+		</where>
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
 				ORDER BY ${page.orderBy}
@@ -855,7 +855,7 @@
 			</otherwise>
 		</choose>
 	</select>
-	
+
 	<insert id="insert">
 		INSERT INTO work_contract_info(
 			id,
@@ -975,9 +975,9 @@
 			#{contractInformation}
 		)
 	</insert>
-	
+
 	<update id="update">
-		UPDATE work_contract_info SET 	
+		UPDATE work_contract_info SET
 			update_by = #{updateBy.id},
 			project_id = #{project.id},
 			project_name = #{projectName},
@@ -1051,10 +1051,10 @@
 			contract_state = 7
 		WHERE id = #{id}
 	</update>
-	
+
 	<!--逻辑删除-->
 	<update id="deleteByLogic">
-		UPDATE work_contract_info SET 
+		UPDATE work_contract_info SET
 			del_flag = #{DEL_FLAG_DELETE}
 		WHERE id = #{id}
 	</update>
@@ -1081,15 +1081,15 @@
 		</foreach>
 
 	</insert>
-	
-	
+
+
 	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
 	<select id="findUniqueByProperty" resultType="WorkContractInfo" statementType="STATEMENT">
 		select * FROM work_contract_info  where ${propertyName} = '${value}'
 	</select>
-	
+
 	<select id="findListByclient" resultType="WorkClientInfo">
-		SELECT 
+		SELECT
 			a.*
 		FROM work_client_info a
 		LEFT JOIN work_client_linkman b on a.id = b.client_id
@@ -1313,4 +1313,11 @@
 		</where>
 	</select>
 
-</mapper>
+	<select id="getUserByRole" resultType="com.jeeplus.modules.sys.entity.User">
+		select * from sys_user su
+		left join sys_user_role sur on sur.user_id = su.id
+		left join sys_role sr on sr.id = sur.role_id
+		where sr.name = #{roleName}
+	</select>
+
+</mapper>

+ 1 - 1
src/main/webapp/webpage/modules/ruralprojectrecords/cost/projectcontentinfo/reportView.jsp

@@ -697,4 +697,4 @@
 	}
 </script>
 </body>
-</html>
+</html>

+ 34 - 0
src/main/webapp/webpage/modules/ruralprojectrecords/view/reportView.jsp

@@ -260,6 +260,7 @@
 			</div>
 			<div class="form-group layui-row">
 				<div style="float: right"> <a href="${ctx}/workfullmanage/workFullManage/downloadMassControl?id=${projectReportData.id}"  onclick="return confirmx('确认要下载控制流程单吗?', this.href)" class="nav-btn layui-btn" ><i class="fa fa-file-excel-o"></i> 下载流程单</a></div>
+				<%--<div style="float: right"> <a href="javascript:void(0)" onclick="preview('预览','${ctx}/workfullmanage/workFullManage/preViewMassControl?id=${projectReportData.id}','80%','80%')">预览流程单</a></div>--%>
 				<div class="form-group-label"><h2><span class="require-item">*</span>项目组成员</h2></div>
 				<div class="layui-item layui-col-sm12 lw6">
 					<div class="layui-item nav-btns">
@@ -326,6 +327,39 @@
 	</c:if>
 </div>
 <script>
+
+	function preview(title,url,width,height,type){
+		$.ajax({
+			type : "POST",
+			url : url,
+			//请求成功
+			success : function(result) {
+				if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+					width='auto';
+					height='auto';
+				}else{//如果是PC端,根据用户设置的width和height显示。
+
+				}
+				var u = 'http://ow365.cn/?i=14411&furl='+result;
+				if(type == 1){
+					u = result;
+				}
+				parent.layer.open({
+					type: 2,
+					area: [width, height],
+					title: title,
+					maxmin: true, //开启最大化最小化按钮
+					content:  u,
+					btn: ['关闭'],
+					cancel: function(index){
+					}
+				});
+			},
+
+		});
+
+	}
+
 	function openBill2(title,url,width,height,target,formId,tableId){
 		var rows = $(this).parent().prevAll().length + 1;
 		var frameIndex = parent.layer.getFrameIndex(window.name);

+ 5 - 2
src/main/webapp/webpage/modules/workstaff/workStaffBasicInfoList.jsp

@@ -142,7 +142,7 @@
                         <label class="layui-form-label">部门:</label>
                         <div class="layui-input-block with-icon">
                             <sys:treeselect id="office" name="office.id" value="${workStaffBasicInfo.office.id}" labelName="office.name" labelValue="${workStaffBasicInfo.office.name}"
-                                            title="部门" url="/sys/office/treeData?type=2" cssClass="form-control layui-input required" notAllowSelectParent="true"/>
+                                            title="部门" url="/sys/office/treeData?type=2" cssClass="form-control layui-input required" notAllowSelectParent="false"/>
                         </div>
                     </div>
                     <%--<div class="layui-item query athird">
@@ -188,6 +188,9 @@
                         <shiro:hasPermission name="workstaff:workStaffBasicInfo:import">
                             <table:importExcelBasic url="${ctx}/workstaff/workStaffBasicInfo/import"></table:importExcelBasic><!-- 导入按钮 -->
                         </shiro:hasPermission>
+                        <shiro:hasPermission name="workstaff:workStaffBasicInfo:export">
+                            <table:exportExcel url="${ctx}/workstaff/workStaffBasicInfo/exportAchive"></table:exportExcel><!-- 导出按钮 -->
+                        </shiro:hasPermission>
                         <button class="layui-btn layui-btn-sm" data-toggle="tooltip" data-placement="left" onclick="sortOrRefresh()" title="刷新"> 刷新</button>
                     </div>
 <%--                    <shiro:hasPermission name="workstaff:workStaffBasicInfo:add">--%>
@@ -353,4 +356,4 @@
     });
 </script>
 </body>
-</html>
+</html>