Browse Source

Merge remote-tracking branch 'origin/master'

蔡德晨 5 năm trước cách đây
mục cha
commit
9fb1a87293

+ 20 - 8
src/main/java/com/jeeplus/modules/sg/overheadline/util/SettementUtil.java

@@ -759,9 +759,13 @@ public class SettementUtil {
         }
         return reason;
     }
-    /*
-      措施费对比
-   */
+
+    /**
+     * 措施费对比
+     * @param csxm  措施费常量
+     * @param settlement bean
+     * @return reason
+     */
     public static String getCsfJoint(String csxm,Settlement settlement){
         String status =settlement.getStatus();
         String[] amout=settlement.getTheAmount().split(",");
@@ -836,9 +840,13 @@ public class SettementUtil {
         }
         return reason;
     }
-    /*
-      投标报价
-   */
+
+    /**
+     * 工程投标价格匹配方法
+     * @param settlement bean
+     * @param booleans 判断 匹配字段 是否存在
+     * @return reason
+     */
     public static String getBDZJoint(Settlement settlement,boolean[] booleans){
         String reason="";
         String[] amout=settlement.getTheAmount().split(",");
@@ -872,8 +880,12 @@ public class SettementUtil {
         }
         return reason;
     }
-    /*
-        结算汇总拼接
+
+    /**
+     * 工程结算
+     * @param settlement bean
+     * @param booleans 判断工程结算 对比 字段 是否存在
+     * @return bean rason
      */
     public static String getJshzJoint(Settlement settlement,boolean[] booleans){
         String reason="";

+ 3 - 0
src/main/java/com/jeeplus/modules/sg/project/mapper/ItemMapper.java

@@ -4,6 +4,7 @@ import com.jeeplus.core.persistence.BaseMapper;
 import com.jeeplus.core.persistence.annotation.MyBatisMapper;
 import com.jeeplus.modules.sg.project.entity.WbsItem;
 import com.jeeplus.modules.sg.project.entity.WbsSelection;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -13,4 +14,6 @@ public interface ItemMapper extends BaseMapper<WbsItem> {
     List<WbsItem> findList(WbsSelection wbsSelection);
     int insert(WbsItem wbsItem);
 
+    //根据名称获取项目
+    List<WbsItem> findItemByName(@Param("itemName")String itemName,@Param("projectId") String projectId);
 }

+ 12 - 1
src/main/java/com/jeeplus/modules/sg/project/mapper/xml/ItemMapper.xml

@@ -131,5 +131,16 @@
 	<select id="findUniqueByProperty" resultType="Goods" statementType="STATEMENT">
 		select * FROM sg_wbs_item  where ${propertyName} = '${value}'
 	</select>
-	
+
+	<select id="findItemByName" parameterType="String" resultType="com.jeeplus.modules.sg.project.entity.WbsItem">
+		SELECT
+		id AS id,
+		unit AS unit,
+		item_name AS itemName,
+		project_id AS projectId,
+		parent_node AS parentNode,
+		create_date AS createDate
+		FROM sg_wbs_item
+		WHERE item_name = #{itemName} and project_id =#{projectId}
+	</select>
 </mapper>

+ 2 - 2
src/main/java/com/jeeplus/modules/sg/project/mapper/xml/ProjectMapper.xml

@@ -36,7 +36,7 @@
 		a.number AS "number"
 		FROM sg_wbs_project a
 		<where>
-			a.project_name = #{projectName} and a.number = 0
+			a.project_name = #{projectName}
 		</where>
 		order by a.create_date DESC
 	</select>
@@ -147,5 +147,5 @@
 	<select id="findUniqueByProperty" resultType="Goods" statementType="STATEMENT">
 		select * FROM sg_wbs_project  where ${propertyName} = '${value}'
 	</select>
-	
+
 </mapper>

+ 4 - 0
src/main/java/com/jeeplus/modules/sg/project/service/ItemService.java

@@ -45,4 +45,8 @@ public class ItemService extends CrudService<ItemMapper, WbsItem> {
     public void delete(WbsItem wbsItem) {
         super.delete(wbsItem);
     }
+
+    public List<WbsItem> findItemByName(String itemName,String projectId){
+        return itemMapper.findItemByName(itemName,projectId);
+    }
 }

+ 6 - 0
src/main/java/com/jeeplus/modules/sg/project/web/ProjectController.java

@@ -68,6 +68,12 @@ public class ProjectController extends BaseController {
     @RequestMapping("/save")
     public AjaxJson save(WbsProject wbsProject, Model model, RedirectAttributes redirectAttributes){
         AjaxJson j = new AjaxJson();
+        List<WbsProject> projects =  projectService.findByName(wbsProject.getProjectName());
+        if (projects!=null&&!projects.isEmpty()){
+           j.setSuccess(false);
+           j.setMsg("添加失败! 工程名称:"+wbsProject.getProjectName()+" 已存在");
+           return j;
+        }
         //数据验证
         String errMsg = beanValidator(wbsProject);
         if (StringUtils.isNotBlank(errMsg)){

+ 29 - 4
src/main/java/com/jeeplus/modules/sg/project/web/ProjectTemController.java

@@ -2,8 +2,10 @@ package com.jeeplus.modules.sg.project.web;
 
 import com.jeeplus.core.web.BaseController;
 import com.jeeplus.modules.sg.overheadline.service.OverheadLineService;
+import com.jeeplus.modules.sg.project.entity.WbsItem;
 import com.jeeplus.modules.sg.project.entity.WbsProject;
 import com.jeeplus.modules.sg.project.entity.WbsSelection;
+import com.jeeplus.modules.sg.project.service.ItemService;
 import com.jeeplus.modules.sg.project.service.ProjectService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -29,6 +31,8 @@ public class ProjectTemController extends BaseController {
     private ProjectService projectService;
     @Autowired
     private OverheadLineService overheadLineService;
+    @Autowired
+    private ItemService itemService;
 
 
 
@@ -55,13 +59,20 @@ public class ProjectTemController extends BaseController {
     @ResponseBody
     @RequestMapping("/import")
     public HashMap importFile(@RequestParam(value = "file")MultipartFile[] file,String projectName,String[] itemNames,String[] itemTypes)  {
+        HashMap map = new HashMap();
+        List<WbsProject> projects =  projectService.findByName(projectName);
+        if (projects!=null&&!projects.isEmpty()){
+            map.put("code",0);
+            map.put("msg","添加失败! 工程名称: "+projectName+" 已存在");
+            return map;
+        }
         WbsProject wbsProject = new WbsProject();
         wbsProject.setProjectName(projectName);
         projectService.save(wbsProject);
-        List<WbsProject> wbsProjects = projectService.findByName(projectName);
-        WbsProject wbsProject1 = wbsProjects.get(0);
-        String projectId = wbsProject1.getId();
-        HashMap map = new HashMap();
+//        List<WbsProject> wbsProjects = projectService.findByName(projectName);
+//        WbsProject wbsProject1 = wbsProjects.get(0);
+        String projectId = wbsProject.getId();
+
         try {
             for(int i = 0;i<itemTypes.length;i++) {
 //            保存数据到数据库
@@ -170,4 +181,18 @@ public class ProjectTemController extends BaseController {
         return newDate+result;
     }
 
+    @RequestMapping("/verfiy")
+    @ResponseBody
+    public HashMap getVerfiy(String projectName,String projectId){
+        HashMap map = new HashMap();
+        List<WbsItem> wbsItemList = itemService.findItemByName(projectName,projectId);
+        if (wbsItemList!=null&&!wbsItemList.isEmpty()){
+            map.put("code",1);
+            map.put("msg","导入失败! 项目名称:"+projectName+" 已存在");
+            return map;
+        }
+        map.put("msg","导入成功");
+        return map;
+    }
+
 }

+ 25 - 2
src/main/webapp/webpage/modules/sg/project/addItemForm.js

@@ -14,8 +14,31 @@
     var newText1 = parent.$('#addtext').val();
     $("#newText1").val(newText1);
 })
-    function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
-    $("#inputForm").submit();
+    function doSubmit(obj){
+    if ($("#myfile").val()==null||$("#myfile").val()==""){
+    layer.msg("请选择文件",{icon: 3});
+    throw SyntaxError;
+}
+    if ($("#inputwrite").val()==null||$("#inputwrite").val()==""){
+    layer.msg("请输入项目名称",{icon:3});
+    throw SyntaxError;
+}
+    //获取项目名称
+    var project_name=$("#inputwrite").val();
+    //获取工程id
+    var project_id=$("#newText1").val();
+    $.ajax({
+        url: "${ctx}/project/tem/verfiy",
+        type: "post",
+        data: {"projectName":project_name,"projectId":project_id},
+        success:function (result) {
+            if (result.code == 1){
+                layer.msg(result.msg,{icon:5});
+            }else {
+                $("#inputForm").submit();
+            }
+        }
+    });
 }
 $("#btnxz").click(function(){
     $("#myfile").trigger("click");

+ 3 - 3
src/main/webapp/webpage/modules/sg/project/addItemForm.jsp

@@ -4,7 +4,6 @@
 <link rel="stylesheet" href="${ctxp}/static/plugin/assets/common.css"/>
 <script type="text/javascript" src="${ctxp}/static/plugin/assets/jquery-3.2.1.min.js"></script>
 <script src="${ctxp}/static/plugin/assets/layui/layui.js"></script>
-<%@include file="addItemForm.js"%>
 <html>
 <head>
     <title>添加工程</title>
@@ -39,7 +38,7 @@
         <div class="layui-inline">
             <label class="layui-form-label">项目名称</label>
             <div class="layui-input-inline">
-                <input type="text" name="name"  class="layui-input" id="inputwrite">
+                <input type="text" name="name" autocomplete="off" class="layui-input" id="inputwrite">
             </div>
         </div>
     </div>
@@ -47,7 +46,7 @@
         <div class="layui-inline">
             <label class="layui-form-label">项目编号</label>
             <div class="layui-input-inline">
-                <input type="text" name="" class="layui-input">
+                <input type="text" name="" autocomplete="off" class="layui-input">
             </div>
         </div>
     </div>
@@ -58,5 +57,6 @@
         </div>
     </div>
 </form>
+<%@include file="addItemForm.js"%>
 </body>
 </html>

+ 2 - 2
src/main/webapp/webpage/modules/sg/project/management.js

@@ -165,10 +165,10 @@ function addProject(){
             dataType: "json",
             success: function(data){
                 if(data.success){
-                    layer.msg(data.msg, {icon: 1});
+                    layer.msg(data.msg, {icon: 6});
                     window.location.reload();
                 }else{
-                    layer.msg('添加失败', {icon: 1});
+                    layer.msg(data.msg, {icon: 5});
                 }
             }
         });

+ 33 - 18
src/main/webapp/webpage/modules/sg/projecttem/addItem.js

@@ -1,27 +1,42 @@
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<script type="text/javascript">
+    <script type="text/javascript">
     layui.use(['form', 'layedit', 'laydate'], function(){
-    var form = layui.form;
-    form.render();
-    var newText1 = parent.$('#addtext').val();
-    $("#newText1").val(newText1);
-})
-    function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
+        var form = layui.form;
+        form.render();
+        var newText1 = parent.$('#addtext').val();
+        $("#newText1").val(newText1);
+    })
+function doSubmit(obj){
     if ($("#myfile").val()==null||$("#myfile").val()==""){
-    layer.msg("请选择文件",{icon: 5});
-    throw SyntaxError;
-}
+        layer.msg("请选择文件",{icon: 3});
+        throw SyntaxError;
+    }
     if ($("#inputwrite").val()==null||$("#inputwrite").val()==""){
-    layer.msg("请输入项目名称",{icon:5});
-    throw SyntaxError;
+        layer.msg("请输入项目名称",{icon:3});
+        throw SyntaxError;
+    }
+    //获取项目名称
+    var project_name=$("#inputwrite").val();
+    //获取工程id
+    var project_id=$("#newText1").val();
+    $.ajax({
+        url: "${ctx}/project/tem/verfiy",
+        type: "post",
+        data: {"projectName":project_name,"projectId":project_id},
+        success:function (result) {
+            if (result.code == 1){
+                layer.msg(result.msg,{icon:5});
+            }else {
+                $("#inputForm").submit();
+            }
+        }
+    });
 }
-    $("#inputForm").submit();
-}
-    $("#btnxz").click(function(){
+$("#btnxz").click(function(){
     $("#myfile").trigger("click");
 })
-    $("#myfile").bind("change",function(){
+$("#myfile").bind("change",function(){
     var solr_file= $("#myfile").val();
-    $("#myspan").html('&nbsp;'+solr_file);
-});
+    $("#view_input").val(solr_file);
+})
 </script>

+ 39 - 44
src/main/webapp/webpage/modules/sg/projecttem/addItem.jsp

@@ -1,61 +1,56 @@
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
 <%@ include file="/webpage/include/taglib.jsp"%>
-<link rel="stylesheet" href="${ctxp}/static/plugin/assets/layui/css/layui.css">
-<link rel="stylesheet" href="${ctxp}/static/plugin/assets/common.css"/>
-<script type="text/javascript" src="${ctxp}/static/plugin/assets/jquery-3.2.1.min.js"></script>
-<script src="${ctxp}/static/plugin/assets/layui/layui.js"></script>
+<%--<%@include file="/static/"%>--%>
 <html>
 <head>
-    <title>添加工程</title>
+    <title>添加项目</title>
+    <link rel="stylesheet" href="${ctxp}/static/plugin/assets/layui/css/layui.css">
+    <link rel="stylesheet" href="${ctxp}/static/plugin/assets/common.css"/>
+    <script type="text/javascript" src="${ctxp}/static/plugin/assets/jquery-3.2.1.min.js"></script>
+    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
+    <%--<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>--%>
     <style>
         .layui-input{ height: 28px;margin-top: 6px;}
+        .layui_td{text-align: center;font-size: 14px;margin-top: 20px}
     </style>
 </head>
 <body>
 <form id="inputForm"class="layui-form" action="${ctx}/project/tem/importfile" method="post" enctype="multipart/form-data">
-    <input id="newText1" hidden name="projectId" value=""/>
-    <div class="layui-form-item">
-        <div class="layui-inline" style="margin-left:30px;margin-top: 10px;display: flex">
-            <input type="button" class="layui-btn-primary layui-btn-sm layui-btn-radius" value="选择结算文件" id="btnxz"/>
-            <span id="myspan" style="flex: 1;margin-top: 4px">&nbsp;*结算书文件为博微导出xls/xlsx格式文件</span>
-            <input type="file" style="display: none;" accept=".xls,.xlsx"  name="file" id="myfile"/>
-        </div>
-    </div>
-    <!---------列表---------->
-    <div class="layui-form-item">
-        <div class="layui-inline">
-            <label class="layui-form-label">*项目划分</label>
-            <div class="layui-input-inline">
-                <select name="type" lay-verify="required" lay-search="">
+    <div class="modal-body">
+        <%--<fieldset class="layui-elem-field layui-field-title">--%>
+            <%--<legend>222</legend>--%>
+        <%--</fieldset>--%>
+        <table class="table table-bordered table-striped"  width="800px">
+            <tr>
+                <td class="layui_td"><input type="button" class="layui-btn layui-btn-normal" value="选择结算文件" id="btnxz"/></td>
+                <td><input id="view_input" readonly="readonly" class="form-control" placeholder="*结算书文件为博微导出xls/xlsx格式文件">  </td>
+            </tr>
+            <tr>
+                <td class="layui_td">*项目划分</td>
+                <td style="color: #555;font-size: 14px"><select name="type" lay-verify="required" lay-search="">
                     <option value="">请选择</option>
                     <option value="1">架空线路工程</option>
                     <option value="2">电缆工程</option>
-                </select>
-            </div>
-        </div>
-    </div>
-    <div class="layui-form-item">
-        <div class="layui-inline">
-            <label class="layui-form-label">项目名称</label>
-            <div class="layui-input-inline">
-                <input type="text" name="name" autocomplete="off" class="layui-input" id="inputwrite">
-            </div>
-        </div>
-    </div>
-    <div class="layui-form-item">
-        <div class="layui-inline">
-            <label class="layui-form-label">项目编号</label>
-            <div class="layui-input-inline">
-                <input type="text" name="" class="layui-input">
-            </div>
-        </div>
-    </div>
-    <div class="layui-form-item">
-        <div class="layui-input-block">
-            <button class="layui-btn" lay-submit="" lay-filter="mysubmit" type="submit" id="newProject" style="display: none;">创建</button>
-        </div>
+                </select></td>
+            </tr>
+            <tr>
+                <td class="layui_td">*项目名称</td>
+                <td class="layui_td">
+                    <input type="text" name="name" autocomplete="off" class="layui-input" id="inputwrite">
+                </td>
+            </tr>
+            <tr>
+                <td class="layui_td">项目编号</td>
+                <td class="layui_td">
+                    <input type="text" name="" autocomplete="off" class="layui-input">
+                </td>
+            </tr>
+        </table>
     </div>
+    <input type="file" style="display: none;" accept=".xls,.xlsx"  name="file" id="myfile"/>
+    <input id="newText1" hidden name="projectId" value=""/>
 </form>
-<%@include file="addItem.js"%>
 </body>
+<script src="${ctxp}/static/plugin/assets/layui/layui.js"></script>
+<%@include file="addItem.js"%>
 </html>

+ 2 - 2
src/main/webapp/webpage/modules/sg/projecttem/lookItem.jsp

@@ -32,13 +32,13 @@
     <div class="layui-inline">
         <label class="layui-form-label">工程名称</label>
         <div class="layui-input-inline">
-            <input type="text" name="projectName" lay-verify="" autocomplete="off" class="layui-input" readonly="readonly" value="${data.projectName}">
+            <input type="text" name="projectName" autocomplete="off" class="layui-input" readonly="readonly" value="${data.projectName}">
         </div>
     </div>
     <div class="layui-inline">
         <label class="layui-form-label">创建时间</label>
         <div class="layui-input-inline">
-            <input type="text" name="createDate" id="beginDate1" lay-verify="" readonly="readonly" placeholder="yyyy-MM-dd" autocomplete="off"
+            <input type="text" name="createDate" id="beginDate1" readonly="readonly" placeholder="yyyy-MM-dd" autocomplete="off"
                    class="layui-input" value="<fmt:formatDate value="${data.createDate}" pattern="yyyy/MM/dd "/>">
         </div>
     </div>

+ 1 - 1
src/main/webapp/webpage/modules/sg/projecttem/manageList.js

@@ -100,7 +100,7 @@
     layer.open({
     type: 2,
     title: '添加工程',
-    area: ['40%', '80%'],
+    area: ['60%', '80%'],
     shade: 0.8,
     shadeClose: true,
     content: '${ctxp}/webpage/modules/sg/projecttem/addItem.jsp'

+ 6 - 25
src/main/webapp/webpage/modules/sg/projecttem/manageList.jsp

@@ -12,31 +12,12 @@
     <%@ include file="manageList.js"%>
 </head>
 <style>
-    .layui-input{
-        height: 28px;
-        margin-top: 5px;
-        width: 260px;
-    }
-    .input-meself-time{
-        font-size: 13px;
-        width: 140px;
-    }
-    .btn_out{
-        width: 100px;
-        margin: 0;
-        float: right;
-        margin-right:2%;
-    }
-    .div_main_form{
-        width: 50%;
-        margin-left: 10px;
-    }
-    .layui-icon-layer{
-        display: none;
-    }
-    .layui-icon-file{
-        display: none;
-    }
+    .layui-input{height: 28px; margin-top: 5px;width: 260px;}
+    .input-meself-time{font-size: 13px;width: 140px;}
+    .btn_out{ width: 100px; margin: 0;float: right;margin-right:2%;}
+    .div_main_form{width: 50%;margin-left: 10px;}
+    .layui-icon-layer{ display: none;}
+    .layui-icon-file{display: none;}
     .layui-table-view .layui-table {width:100%}
 </style>
 <body style="height:100%">