Bläddra i källkod

添加月报模板下载功能。内容优化处理
合同客户选择框添加客户类型展示

user5 4 år sedan
förälder
incheckning
3888c7625e

+ 62 - 0
src/main/java/com/jeeplus/common/utils/ThisLocalityDownloadUtil.java

@@ -0,0 +1,62 @@
+package com.jeeplus.common.utils;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+/**
+ * 本地服务器文件下载工具类
+ */
+public class ThisLocalityDownloadUtil {
+
+    public void download( String fileName,HttpServletRequest request, HttpServletResponse response) {
+        try {
+            //读取服务器的文件下载路径
+            String paths = this.getClass().getResource("/").getPath();
+            String filePath = paths.substring(1, paths.length() - 16);
+            System.out.println("===========os.name:"+System.getProperties().getProperty("os.name"));
+            //判定当前系统是否为linux版本
+            Boolean isWindows = System.getProperty("os.name").toLowerCase().contains("linux");
+            String path = "";
+            if(!isWindows){
+                path = filePath+"WEB-INF/classes/dot/"+fileName;
+            }else{
+                //如果是linux系统 则需要在路径前加上一个 /
+                path = "/"+filePath+"WEB-INF/classes/dot/"+fileName;
+            }
+            downCfg(fileName, request, response);
+            OutputStream out;
+            FileInputStream inputStream = new FileInputStream(path);
+            out = response.getOutputStream();
+            byte[] buffer = new byte[1024];
+            int len;
+            while ((len = inputStream.read(buffer)) != -1) {
+                out.write(buffer, 0, len);
+            }
+            inputStream.close();
+            out.close();
+            out.flush();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void downCfg(String fileName, HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException {
+        // 判断浏览器,进行不同的加密,这样下载的时候保存的文件名就不会乱码
+        String userAgent = request.getHeader("User-Agent");
+        // 针对IE或者以IE为内核的浏览器:
+        if (userAgent.contains("MSIE") || userAgent.contains("Trident")) {
+            fileName = URLEncoder.encode(fileName, "UTF-8");
+        } else {
+            // 非IE浏览器的处理:
+            fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
+        }
+        response.setHeader("Content-disposition", String.format("attachment; filename=\"%s\"", fileName));
+        response.setContentType("application/octet-stream;charset=utf-8");
+        response.setCharacterEncoding("UTF-8");
+    }
+}

+ 11 - 1
src/main/java/com/jeeplus/modules/projectConstruction/web/ContractController.java

@@ -459,8 +459,18 @@ public class ContractController extends BaseController {
                         treeNew.setProcessInstanceId(report.getProcessInstanceId());
                         User user = UserUtils.get(report.getCreateBy().getId());
                         treeNew.setProjectRegistrant(user.getName());
-                        treeNew.setOperationSign(1);
+                        //如果当前登录人为项目登记者或项目负责人则允许其添加子节点信息
+                        for (String masterId : masterIdList) {
+                            if (masterId.equals(UserUtils.getUser().getId())) {
+                                treeNew.setOperationSign(1);
+                                break;
+                            } else {
+                                treeNew.setOperationSign(0);
+                            }
+                        }
+
                         projectRecordTreeDataList.add(treeNew);
+
                     }
                 }
             }

+ 13 - 1
src/main/java/com/jeeplus/modules/projectrecord/web/monthly/MonthlyConsultationReportController.java

@@ -5,6 +5,7 @@ import com.jeeplus.common.oss.OSSClientUtil;
 import com.jeeplus.common.persistence.Page;
 import com.jeeplus.common.utils.MyBeanUtils;
 import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.ThisLocalityDownloadUtil;
 import com.jeeplus.common.web.BaseController;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectContentData;
 import com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo;
@@ -31,6 +32,8 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.URLEncoder;
 import java.util.*;
 
 /**
@@ -271,7 +274,6 @@ public class MonthlyConsultationReportController extends BaseController {
     /**
      * 下载导入项目数据模板
      */
-    @RequestMapping(value = "downloadTemplate")
     public void downloadTemplate(HttpServletRequest request,HttpServletResponse response) {
         try {
             new OSSClientUtil().downByStream(template_path,template_name,response,request.getHeader("USER-AGENT"));
@@ -279,4 +281,14 @@ public class MonthlyConsultationReportController extends BaseController {
             logger.error("月报模板下载失败!",e);
         }
     }
+
+    @RequestMapping(value = "downloadTemplate")
+    public void thisLocalityDownloadUtil(HttpServletRequest request,HttpServletResponse response) {
+        try {
+            ThisLocalityDownloadUtil download = new ThisLocalityDownloadUtil();
+            download.download("工程造价咨询月报.docx",request,response);
+        } catch (Exception e) {
+            logger.error("月报模板下载失败!",e);
+        }
+    }
 }

+ 7 - 0
src/main/java/com/jeeplus/modules/workclientinfo/dao/WorkClientInfoDao.java

@@ -42,4 +42,11 @@ public interface WorkClientInfoDao extends CrudDao<WorkClientInfo> {
     WorkClientInfo findWorkClientInfo(WorkClientInfo workClientInfo);
     //根据客户信息表查出来对应的联系人类型
     List<Map> getJopType(WorkClientInfo work);
+
+    /**
+     * 根据客户id查询客户的相关客户类型
+     * @param clientId
+     * @return
+     */
+    String getJobTypeStr(String clientId);
 }

+ 4 - 0
src/main/java/com/jeeplus/modules/workclientinfo/service/WorkClientInfoService.java

@@ -193,6 +193,10 @@ public class WorkClientInfoService extends CrudService<WorkClientInfoDao, WorkCl
         page.setCountFlag(false);
         workClientInfo.setPage(page);
         List<WorkClientInfo> list = findList(workClientInfo);
+        //根据客户id查询客户的相关客户类型
+        for (WorkClientInfo clientInfo: list) {
+            clientInfo.setJobTypeStr(workClientInfoDao.getJobTypeStr(clientInfo.getId()));
+        }
         long t3 = System.currentTimeMillis();
         logger.info("查询客户列表耗时:{}",t3-t2);
         if(list!=null && list.size()>0){

+ 9 - 0
src/main/resources/mappings/modules/workclientinfo/WorkClientInfoDao.xml

@@ -545,4 +545,13 @@
 
 		</where>
 	</select>
+
+	<select id="getJobTypeStr" resultType="java.lang.String">
+		select group_concat(md.detail_name) as "jobTypeStr"
+		from work_client_job_type_info a
+		left join main_dict_detail md on md.detail_key = a.job_type_id
+		left join main_dict c on md.type_id = c.id
+		where md.del_flag = 0 and c.type_name = 'job_type' and a.work_client_id = #{clientId}
+
+	</select>
 </mapper>

+ 14 - 6
src/main/webapp/webpage/modules/projectrecord/claim/projectClaimList.jsp

@@ -334,13 +334,21 @@
                     '',
                 ].join('');
             } else if(d.condition ==2) {
-                return [
-                    '<a href="javascript:void(0)" onclick="openDialogreAudit(\'新增索赔内容\', \'${ctx}/project/projectClaim/form?type=3&project.id='+d.pid+'&contract.id='+d.id+'&projectContentId='+d.projectContentId+'&contract.contractName='+d.contractName+' \',\'95%\',\'95%\')" style=\"color: white;background: darkseagreen\" class="op-btn op-btn-add" ><i class="fa fa-plus"></i> 新增</a>',
-                ].join('');
+                if(1 == d.operationSign) {
+                    return [
+                        '<a href="javascript:void(0)" onclick="openDialogreAudit(\'新增索赔内容\', \'${ctx}/project/projectClaim/form?type=3&project.id='+d.pid+'&contract.id='+d.id+'&projectContentId='+d.projectContentId+'&contract.contractName='+d.contractName+' \',\'95%\',\'95%\')" style=\"color: white;background: darkseagreen\" class="op-btn op-btn-add" ><i class="fa fa-plus"></i> 新增</a>',
+                    ].join('');
+                }else{
+                    return[''].join('');
+                }
             } else if (d.condition ==3){
-                return [
-                    '<a href="javascript:void(0)" onclick="openDialogreAudit(\'修改索赔信息\', \'${ctx}/projectcontentinfo/projectcontentinfo/form?view=content&condition=claim&flag=modify&dictType=${dictType}&infoId='+d.id+'&id='+d.contentPId+'\',\'95%\',\'95%\')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>',
-                ].join('');
+                if(1 == d.operationSign) {
+                    return [
+                        '<a href="javascript:void(0)" onclick="openDialogreAudit(\'修改索赔信息\', \'${ctx}/projectcontentinfo/projectcontentinfo/form?view=content&condition=claim&flag=modify&dictType=${dictType}&infoId='+d.id+'&id='+d.contentPId+'\',\'95%\',\'95%\')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>',
+                    ].join('');
+                }else{
+                    return[''].join('');
+                }
 
             }else{
                 return [

+ 14 - 6
src/main/webapp/webpage/modules/projectrecord/implementStage/projectDesignList.jsp

@@ -336,13 +336,21 @@
                     '',
                 ].join('');
             } else if(d.condition ==2) {
-                return [
-                    '<a href="javascript:void(0)" onclick="openDialogreAudit(\'新增设计变更内容\', \'${ctx}/project/projectDesignChange/form?type=2&project.id='+d.pid+'&contract.id='+d.id+'&projectContentId='+d.projectContentId+'&contract.contractName='+d.contractName+' \',\'95%\',\'95%\')" style=\"color: white;background: darkseagreen\" class="op-btn op-btn-add" ><i class="fa fa-plus"></i> 新增</a>',
-                ].join('');
+                if(1 == d.operationSign) {
+                    return [
+                        '<a href="javascript:void(0)" onclick="openDialogreAudit(\'新增设计变更内容\', \'${ctx}/project/projectDesignChange/form?type=2&project.id='+d.pid+'&contract.id='+d.id+'&projectContentId='+d.projectContentId+'&contract.contractName='+d.contractName+' \',\'95%\',\'95%\')" style=\"color: white;background: darkseagreen\" class="op-btn op-btn-add" ><i class="fa fa-plus"></i> 新增</a>',
+                    ].join('');
+                }else{
+                    return[''].join('');
+                }
             } else if (d.condition ==3){
-                return [
-                    '<a href="javascript:void(0)" onclick="openDialogreAudit(\'修改设计变更信息\', \'${ctx}/projectcontentinfo/projectcontentinfo/form?view=content&condition=design&flag=modify&dictType=${dictType}&infoId='+d.id+'&id='+d.contentPId+'\',\'95%\',\'95%\')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>',
-                ].join('');
+                if(1 == d.operationSign) {
+                    return [
+                        '<a href="javascript:void(0)" onclick="openDialogreAudit(\'修改设计变更信息\', \'${ctx}/projectcontentinfo/projectcontentinfo/form?view=content&condition=design&flag=modify&dictType=${dictType}&infoId='+d.id+'&id='+d.contentPId+'\',\'95%\',\'95%\')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>',
+                    ].join('');
+                }else{
+                    return[''].join('');
+                }
 
             }else{
                 return [

+ 14 - 6
src/main/webapp/webpage/modules/projectrecord/implementStage/projectVisaList.jsp

@@ -331,13 +331,21 @@
                     '',
                 ].join('');
             } else if(d.condition ==2) {
-                return [
-                    '<a href="javascript:void(0)" onclick="openDialogreAudit(\'新增签证内容\', \'${ctx}/project/projectVisa/form?type=1&project.id='+d.pid+'&contract.id='+d.id+'&projectContentId='+d.projectContentId+'&contract.contractName='+d.contractName+' \',\'95%\',\'95%\')" style=\"color: white;background: darkseagreen\" class="op-btn op-btn-add" ><i class="fa fa-plus"></i> 新增</a>',
-                ].join('');
+                if(1 == d.operationSign) {
+                    return [
+                        '<a href="javascript:void(0)" onclick="openDialogreAudit(\'新增签证内容\', \'${ctx}/project/projectVisa/form?type=1&project.id='+d.pid+'&contract.id='+d.id+'&projectContentId='+d.projectContentId+'&contract.contractName='+d.contractName+' \',\'95%\',\'95%\')" style=\"color: white;background: darkseagreen\" class="op-btn op-btn-add" ><i class="fa fa-plus"></i> 新增</a>',
+                    ].join('');
+                }else{
+                    return[''].join('');
+                }
             } else if (d.condition ==3){
-                return [
-                    '<a href="javascript:void(0)" onclick="openDialogreAudit(\'修改签证信息\', \'${ctx}/projectcontentinfo/projectcontentinfo/form?view=content&condition=visa&flag=modify&dictType=${dictType}&infoId='+d.id+'&id='+d.contentPId+'\',\'95%\',\'95%\')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>',
-                ].join('');
+                if(1 == d.operationSign) {
+                    return [
+                        '<a href="javascript:void(0)" onclick="openDialogreAudit(\'修改签证信息\', \'${ctx}/projectcontentinfo/projectcontentinfo/form?view=content&condition=visa&flag=modify&dictType=${dictType}&infoId='+d.id+'&id='+d.contentPId+'\',\'95%\',\'95%\')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 编辑</a>',
+                    ].join('');
+                }else{
+                    return[''].join('');
+                }
 
             }else{
                 return [

+ 3 - 3
src/main/webapp/webpage/modules/projectrecord/monthly/monthlyContentForm.jsp

@@ -38,7 +38,7 @@
                 var length = document.getElementById("file_monthly");
                 var rows = length.rows.length;
                 if(rows<=0){
-                    layer.msg('请上传月报附件信息', {icon: 5});
+                    layer.msg('请上传月报信息', {icon: 5});
                     return false;
                 }
 
@@ -766,9 +766,9 @@
             </div>--%>
 
             <div class="form-group layui-row">
-                <div class="form-group-label"><h2><span class="require-item">*</span>月报附件信息</h2></div>
+                <div class="form-group-label"><h2><span class="require-item">*</span>月报</h2></div>
                 <div class="layui-item nav-btns">
-                    <a id="monthly_btn" class="nav-btn nav-btn-add" title="添加月报附件"><i class="fa fa-plus"></i>&nbsp;添加月报附件</a>
+                    <a id="monthly_btn" class="nav-btn nav-btn-add" title="添加月报"><i class="fa fa-plus"></i>&nbsp;添加月报</a>
                     <a class="nav-btn nav-btn-export" title="下载月报模板"  onclick="window.location.href='${ctx}/project/monthlyConsultationReport/downloadTemplate';"><i class="fa fa-download"></i>&nbsp;下载模板</a>
                 </div>
                 <div id="addFile_monthly" style="display: none" class="upload-progress">

+ 2 - 2
src/main/webapp/webpage/modules/projectrecord/monthly/monthlyContentView.jsp

@@ -38,7 +38,7 @@
                 var length = document.getElementById("file_monthly");
                 var rows = length.rows.length;
                 if(rows<=0){
-                    layer.msg('请上传月报附件信息', {icon: 5});
+                    layer.msg('请上传月报信息', {icon: 5});
                     return false;
                 }
 
@@ -748,7 +748,7 @@
             </div>--%>
 
             <div class="form-group layui-row">
-                <div class="form-group-label"><h2><span class="require-item">*</span>月报附件信息</h2></div>
+                <div class="form-group-label"><h2><span class="require-item">*</span>月报</h2></div>
                 <div id="addFile_monthly" style="display: none" class="upload-progress">
                     <span id="fileName_monthly" ></span>
                     <b><span id="baifenbi_monthly" ></span></b>

+ 2 - 0
src/main/webapp/webpage/modules/sys/gridselectAhref.jsp

@@ -85,6 +85,7 @@
 						<th>客户名称</th>
 						<th>客户性质</th>
 						<th>客户行业</th>
+						<th>客户类型</th>
 						<th>统一社会信用代码</th>
 						</c:forEach>
 
@@ -108,6 +109,7 @@
 								</c:forEach>--%>
 								<td class="codelabel">${fns:getMainDictLabel(obj.companyType, 'company_type', '')}</td>
 								<td class="codelabel">${fns:getMainDictLabel(obj.companyIndustry, 'company_industry', '')}</td>
+								<td class="codelabel">${obj.jobTypeStr}</td>
 								<td class="codelabel">${obj.uscCode}</td>
 							</tr>
 						</c:forEach>