蔡德晨 5 rokov pred
rodič
commit
7aedd5bf14

+ 23 - 0
src/main/java/com/jeeplus/modules/sg/overheadline/service/OverheadLineService.java

@@ -44,6 +44,11 @@ public class OverheadLineService {
 
 public List<JkxlDetailFee> findList(String id,String type){
     List<JkxlDetailFee> list = overheadLineMapper.findList(id,type);
+    double integrityFee = 0.00;
+    WbsItem wbsItem = itemService.getState(id);
+    if(wbsItem != null){
+        integrityFee = wbsItem.getIntegrityFee() * -1;
+    }
     for(JkxlDetailFee jkxlDetailFee : list){
         double totalFee  = jkxlDetailFee.getTotalFee()!=null? jkxlDetailFee.getTotalFee():0.00;
         //建筑
@@ -80,6 +85,7 @@ public List<JkxlDetailFee> findList(String id,String type){
                 qtTotal += jkxlDetailFee.getTotalFee();
             }
         }
+        qtTotal = qtTotal + integrityFee;
         for (JkxlDetailFee jkxlDetailFee : list) {
             if(jkxlDetailFee.getWbsCode().equals("20000000")){
                 jkxlDetailFee.setJzFee(jz2);
@@ -95,6 +101,11 @@ public List<JkxlDetailFee> findList(String id,String type){
             }
             if(jkxlDetailFee.getWbsCode().equals("24000000")){
                 jkxlDetailFee.setTotalFee(qtTotal);
+                jkxlDetailFee.setQtFee(qtTotal);
+            }
+            if(jkxlDetailFee.getWbsCode().equals("24260000")){
+                jkxlDetailFee.setTotalFee(integrityFee);
+                jkxlDetailFee.setQtFee(integrityFee);
             }
         }
     }
@@ -115,6 +126,7 @@ public List<JkxlDetailFee> findList(String id,String type){
                 qtTotal += jkxlDetailFee.getTotalFee();
             }
         }
+        qtTotal = qtTotal + integrityFee;
         for (JkxlDetailFee jkxlDetailFee : list) {
             if(jkxlDetailFee.getWbsCode().equals("40000000")){
                 jkxlDetailFee.setJzFee(jz2);
@@ -144,6 +156,11 @@ public List<JkxlDetailFee> findList(String id,String type){
             }
             if(jkxlDetailFee.getWbsCode().equals("44000000")){
                 jkxlDetailFee.setTotalFee(qtTotal);
+                jkxlDetailFee.setQtFee(qtTotal);
+            }
+            if(jkxlDetailFee.getWbsCode().equals("44260000")){
+                jkxlDetailFee.setTotalFee(integrityFee);
+                jkxlDetailFee.setQtFee(integrityFee);
             }
         }
 
@@ -160,6 +177,7 @@ public List<JkxlDetailFee> findList(String id,String type){
                 qtTotal += jkxlDetailFee.getTotalFee();
             }
         }
+        qtTotal = qtTotal + integrityFee;
         for (JkxlDetailFee jkxlDetailFee : list) {
             if(jkxlDetailFee.getWbsCode().equals("30000000")){
                 jkxlDetailFee.setTotalFee(az1+qtTotal);
@@ -177,6 +195,11 @@ public List<JkxlDetailFee> findList(String id,String type){
             }
             if(jkxlDetailFee.getWbsCode().equals("34000000")){
                 jkxlDetailFee.setTotalFee(qtTotal);
+                jkxlDetailFee.setQtFee(qtTotal);
+            }
+            if(jkxlDetailFee.getWbsCode().equals("34260000")){
+                jkxlDetailFee.setTotalFee(integrityFee);
+                jkxlDetailFee.setQtFee(integrityFee);
             }
         }
     }

+ 28 - 0
src/main/java/com/jeeplus/modules/sg/project/entity/WbsItem.java

@@ -18,6 +18,34 @@ public class WbsItem extends DataEntity<WbsItem> {
     private String delFlag;//是否删除
     private String projectName; //所属工程
     private String projectNo;  //工程编号
+    private String unitType;
+    private Double integrityFee; //诚信扣款
+    private String state; //是否扣款 (1:扣 0:不扣)
+
+
+    public String getUnitType() {
+        return unitType;
+    }
+
+    public void setUnitType(String unitType) {
+        this.unitType = unitType;
+    }
+
+    public Double getIntegrityFee() {
+        return integrityFee;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public void setIntegrityFee(Double integrityFee) {
+        this.integrityFee = integrityFee;
+    }
 
     @Override
     public String getDelFlag() {

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

@@ -52,4 +52,8 @@ public interface ItemMapper extends BaseMapper<WbsItem> {
      * 根据id查找当前所有项目
      */
     WbsItem findItemById(String id);
+
+    void updateFee(@Param("list") List<WbsItem> list);
+
+    WbsItem getState(String id);
 }

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

@@ -13,7 +13,10 @@
 		a.item_name AS "itemName",
 		a.unit AS "unit",
 	    a.project_id AS "projectId",
-		a.type AS "type"
+		a.type AS "type",
+		a.unit_type AS "unitType",
+		a.integrity_fee AS "integrityFee",
+	    a.state AS "state"
 	</sql>
 
 	
@@ -24,6 +27,8 @@
 		FROM sg_wbs_item a
 		WHERE a.id = #{id}
 	</select>
+
+
 	
 	<select id="getList" resultType="WbsItem" parameterType="com.jeeplus.modules.sg.project.entity.WbsProject">
 		SELECT 
@@ -183,4 +188,23 @@
 		FROM sg_wbs_item
 		WHERE id=#{id}
 	</select>
+
+	<update id="updateFee" parameterType="java.util.List">
+		<foreach collection="list" item="item" index="index" separator=";">
+			update sg_wbs_item set
+			unit_type = #{item.unitType},
+			state = #{item.state},
+			integrity_fee = #{item.integrityFee}
+			<where>
+				id = #{item.id}
+			</where>
+		</foreach>
+	</update>
+
+	<select id="getState" resultType="WbsItem" >
+		SELECT
+		<include refid="infoColumns"/>
+		FROM sg_wbs_item a
+		WHERE a.id = #{id} and a.state = '1'
+	</select>
 </mapper>

+ 36 - 24
src/main/java/com/jeeplus/modules/sg/project/service/ItemService.java

@@ -7,12 +7,13 @@ import com.jeeplus.modules.sg.project.entity.WbsProject;
 import com.jeeplus.modules.sg.project.entity.WbsSelection;
 import com.jeeplus.modules.sg.project.mapper.ItemMapper;
 import com.jeeplus.modules.sg.project.mapper.ProjectMapper;
+import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Date;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 @Transactional(readOnly = true)
@@ -27,6 +28,10 @@ public class ItemService extends CrudService<ItemMapper, WbsItem> {
         return super.get(id);
     }
 
+    public WbsItem getState(String id){
+        return itemMapper.getState(id);
+    }
+
 
     public List<WbsItem> findList(WbsProject wbsProject) {
         return itemMapper.getList(wbsProject);
@@ -86,27 +91,34 @@ public class ItemService extends CrudService<ItemMapper, WbsItem> {
         return j;
     }
 
+    @Transactional(readOnly = false)
+    public void updateFee(List<WbsItem> list){
+//        List<WbsItem> newlist = list.stream().collect(Collectors.collectingAndThen(Collectors.
+//                toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getUnitType()))), ArrayList::new));
+      List<WbsItem> list1 = getNew(list);
+       itemMapper.updateFee(list1);
+    }
+
+
+    private List<WbsItem> getNew(List<WbsItem> list){
+        for(int i=0;i<list.size();i++){
+            String unitType = list.get(i).getUnitType();
+            if(unitType == null){
+                continue;
+            }
+            String state = list.get(i).getState();
+            if(state.equals("0")){
+                continue;
+            }
+            for(int j=i+1;j<list.size();j++){
+                if(unitType.equals(list.get(j).getUnitType())){
+                    list.get(j).setState("0");
+                }
+            }
+        }
+        return list;
+    }
+
+
 
-    //    //根据项目删除结算
-//    @Transactional(readOnly = false)
-//    public Integer deleteCount(String itemId){
-//        return itemMapper.deleteCount(itemId);
-//    }
-//    //根据工程删除 项目
-//    @Transactional(readOnly = false)
-//    public Integer deleteAdjust(String itemId){
-//        return itemMapper.deleteAdjust(itemId);
-//    }
-//    //根据工程删除 项目
-//    @Transactional(readOnly = false)
-//    public Integer deleteDetail(String itemId){
-//        return itemMapper.deleteDetail(itemId);
-//    }
-//
-//    public List<WbsItem> findItem(String parentId){
-//        return itemMapper.findItem(parentId);
-//    }
-//    public WbsItem findItemById(String id){
-//        return itemMapper.findItemById(id);
-//    }
 }

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

@@ -287,6 +287,8 @@ public class ProjectService extends CrudService<ProjectMapper, WbsProject> {
         super.delete(wbsProject);
     }
 
+
+
     //修改工程下项目数量
     @Transactional(readOnly = false)
     public Integer updateProjectNumber(WbsProject wbsProject){
@@ -313,4 +315,6 @@ public class ProjectService extends CrudService<ProjectMapper, WbsProject> {
         }
         return j;
     }
+
+
 }

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

@@ -1,5 +1,6 @@
 package com.jeeplus.modules.sg.project.web;
 
+import com.alibaba.fastjson.JSONArray;
 import com.jeeplus.common.json.AjaxJson;
 import com.jeeplus.common.utils.DateUtils;
 import com.jeeplus.common.utils.StringUtils;
@@ -45,6 +46,8 @@ public class ProjectController extends BaseController {
     private OverheadLineService overheadLineService;
     @Autowired
     private SubstationService substationService;
+    @Autowired
+    private ItemService itemService;
 
 
 
@@ -237,6 +240,65 @@ public class ProjectController extends BaseController {
         return "redirect:/a/project/list";
     }
 
+    /**
+     * 诚信扣款调整页面
+     */
+    @RequestMapping("withholdform")
+    public String withholdForm(String id,Model model){
+        WbsProject wbsProject = projectService.get(id);
+        List<WbsItem> list = null;
+        if(wbsProject != null){
+            list = wbsProject.getWbsItems();
+        }
+        model.addAttribute("list",list);
+        return "modules/sg/project/withholdForm";
+    }
+
+
+
+    /**
+     * 诚信扣款
+     */
+    @ResponseBody
+    @RequestMapping("withhold")
+    public AjaxJson withhold(String ids,String fees,String unitTypes){
+        AjaxJson j = new AjaxJson();
+        List<WbsItem> ts = new ArrayList<>();
+        WbsItem wbsItem = null;
+        try {
+            String[] idss = ids.split(",");
+            String[] feess = fees.split(",");
+            String[] unitTypess = unitTypes.split(",");
+            for(int i=0;i<idss.length;i++){
+                wbsItem = new WbsItem();
+                wbsItem.setId(idss[i]);
+                wbsItem.setState("1");
+                String unitType = unitTypess[i];
+                if(unitType.equals("null")){
+                    unitType = null;
+                }
+                wbsItem.setUnitType(unitType);
+                String fee = feess[i];
+                double fe = 0.00;
+                if(fee.equals("null")){
+//                    fe = Double.valueOf(fee);
+                    wbsItem.setIntegrityFee(null);
+                }else {
+                    wbsItem.setIntegrityFee(Double.valueOf(fee));
+                }
+                ts.add(wbsItem);
+            }
+            itemService.updateFee(ts);
+            j.setSuccess(true);
+            j.setMsg("操作成功");
+        }catch (Exception e){
+            j.setSuccess(false);
+            j.setMsg("操作失败");
+        }
+        return j;
+    }
+
+
 
     /**
      * 数据去重合并

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

@@ -55,7 +55,7 @@ layui.config({
                                 +"<a style='margin-top: 3px;' class='layui-btn layui-btn-xs layui-btn-danger' id=delPro"+d.id+" onclick=\"deleteProject('"+d.id+"')\">删除</a>"
                                 // +"<br>"
                                 +"<a style='margin-top: 3px;' class='layui-btn layui-btn-warm layui-btn-xs' lay-event=''href=\"${ctx}/project/exportone?id=" + d.id+"\">导出wbs工程</a>"
-                                // +"<a style='margin-top: 3px;' class='layui-btn layui-btn-warm layui-btn-xs' lay-event=''href=\"${ctx}/project/export?id=" + d.id+"\">导出</a><div>";
+                                +"<a style='margin-top: 3px;' class='layui-btn layui-btn-normal layui-btn-xs'onclick=\"withhold( '${ctx}/project/withholdform?id=" + d.id + "&tabId=1')\">诚信扣款</a><div>";
 
                         }
                         if(d.status==2){ //项目表头操作
@@ -194,6 +194,30 @@ function look(url) { //工程 查看
         btn: ['关闭']
     })
 }
+
+    function withhold(url) { //诚信扣款
+       layer.open({
+        type: 2,
+        title: '诚信扣款',
+        area: ['70%', '90%'],
+        offset:['7%','14%'],
+        shade: 0.8,
+        shadeClose: true,
+        fixed: true, //不固定
+        maxmin: true,
+        content: url,//查看的路径
+        btn: ['确定','关闭'],
+           yes: function(index, layero){
+                 var bodyparent = layer.getChildFrame('body', index); //获取子类页面body下内容
+                 bodyparent.find('#updatebtn').click(); // 点击修改页面隐藏的按钮
+               }
+           ,btn2: function(index, layero){
+               layer.close(index);
+               }
+
+    })
+}
+
 function update(url) { //修改
     layer.open({
         type: 2,

+ 122 - 0
src/main/webapp/webpage/modules/sg/project/withholdForm.js

@@ -0,0 +1,122 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<script type="text/javascript">
+    var str = ''
+    layui.use(['table','form','layedit', 'laydate'], function(){
+        var table = layui.table //生产数据表格
+        ,form = layui.form;
+        form.render();//表格渲染
+        table.render({
+        elem: '#longtable'
+        ,title: '诚信扣款'
+        ,id:'checktable'
+        ,limit:Number.MAX_VALUE
+        ,cols: [[ //生产表头
+            {field:'itemName',title:'项目名称'}
+            ,{field:'unitType',title:'单位工程',edit: 'text'}
+            ,{field:'integrityFee',title:'诚信扣款'}
+
+        ]]
+        ,data:[ //数据导入
+        <c:if test="${ not empty list}">
+        <c:forEach items="${list}" var="data" varStatus="index">
+        {
+            "id":"${data.id}",
+            "unitType": "${data.unitType}",
+            "integrityFee": "${data.integrityFee}",
+            "itemName": "${data.itemName}"
+        },
+        </c:forEach>
+        </c:if>
+        ]
+        ,page: false
+        ,done: function(res, curr, count){
+                    for(var p in res.data){
+                        str = str+res.data[p].id+',';
+                     }
+                 $('table tr').each(function () {
+                      var unitType = $(this).find('td:eq(1)').text()
+                      if(unitType != null && unitType != ''){
+                         $(this).find('td:eq(2)').attr("data-edit","text")
+                      }
+                })
+              }
+          });
+
+    table.on('edit(longtable)', function(obj){ //注:edit是固定事件名,test是table原始容器的属性 lay-filter="对应的值"
+       // console.log(obj.data); //所在行的所有相关数据
+       var field = obj.field;
+       if(field === 'unitType'){
+           var value = obj.value;
+           var flag = false;
+           var fee1 = '';
+           // $(this).closest("tr").find("td").eq("2").find("div").html(value);
+           $(this).closest("tr").find("td").eq("2").attr("data-edit","text");
+
+           if(value == ''){
+               obj.data.integrityFee = ''
+               // $('table tr').each(function () {
+               //     var unitType = $(this).find('td:eq(1)').text()
+               //      if(unitType == ''){
+               //        $(this).find('td:eq(2)').text('')
+               //     }
+               //  })
+              $(this).closest("tr").find("td").eq("2").find("div").html('');
+              $(this).closest("tr").find("td").eq("2").removeAttr("data-edit");
+           }else{
+              $('table tr').each(function () {
+                  var unitType = $(this).find('td:eq(1)').text()
+                  var fee = $(this).find('td:eq(2)').text()
+                   if(unitType == value){
+    // $(this).closest("tr").find("td").eq("2").find("div").html(fee);
+                    flag = true;
+                    fee1 = fee;
+                   }
+               })
+              if(flag){
+                    $(this).closest("tr").find("td").eq("2").find("div").html(fee1);
+            }
+
+          }
+        }
+        if(field === 'integrityFee'){
+           var value = obj.value;
+           if(isNaN(value)){ //判断输入是否是数字
+                layer.msg('请输入有效数字',{icon: 5,offset:['40%','40%']});
+                 return false;
+           }
+        }
+    });
+    });
+    function updateProject(){
+    var nameString = "";
+    var nameString1 = "";
+    $('table tr').each(function () {
+        var unitType = $(this).find('td:eq(1)').text();
+        var fee = $(this).find('td:eq(2)').text();
+        if(unitType == ''){
+           unitType = null
+        }
+        if(fee == ''){
+            fee = null
+        }
+        nameString += unitType+",";
+        nameString1 += fee+",";
+    })
+    var unitTypes = nameString.substring(5,nameString.length);
+    var fees = nameString1.substring(5,nameString1.length);
+    var ids = str.substring(0,str.length-1);
+    $.ajax({
+    type:"post",
+    url:"${ctx}/project/withhold",
+    data:{'ids':ids,'fees':fees,'unitTypes':unitTypes},
+    success:function(result){
+       layer.msg(result.msg, {icon: 6,offset:['38%','38%']},function () {
+        parent.location.reload();
+     });
+     }
+    });
+}
+
+
+
+</script>

+ 38 - 0
src/main/webapp/webpage/modules/sg/project/withholdForm.jsp

@@ -0,0 +1,38 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+    <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>
+    <script src="${ctxp}/static/plugin/assets/layui/layui.js"></script>
+    <%@include file="withholdForm.js"%>
+</head>
+<style>
+    .layui-table-view .layui-table {width:100%}
+    .layui-table-cell .layui-form-checkbox[lay-skin="primary"]{top: 50%;transform: translateY(-50%);}
+    .mydiv{padding: 5px 7px;border: whitesmoke;line-height: 98%;margin-top: 2px}
+</style>
+<body>
+<div class="layui-btn-group suretable" style="display: none;">
+    <button class="layui-btn"  data-type="getCheckData" id="freenl">确定</button>
+</div>
+<input id="updatebtn" type="button" onclick="updateProject()" style="display: none" />
+    <%--<div class="layui-form-item">--%>
+        <%--<div class="" style="margin-left: 10px;margin-top: 10px;">--%>
+            <%--<span id="mylable2">项目调整</span>--%>
+            <%--<span>:</span>--%>
+            <%--<span id="readid2">200</span>--%>
+        <%--</div>--%>
+        <%--<div class="" style="margin-left: 10px;">--%>
+            <%--<input type="radio" name="mydiv" value="1" title="增加" checked="">--%>
+            <%--<input type="radio" name="mydiv" value="2" title="减少">--%>
+        <%--</div>--%>
+    <%--</div>--%>
+
+<div style="margin-left: 7px;margin-right: 7px">
+<table class="layui-hide" id="longtable" lay-filter="longtable"></table>
+</div>
+</body>
+</html>

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

@@ -31,7 +31,8 @@
     if(d.status==1){ //工程 表头
     xml += "<a class='layui-btn layui-btn-primary layui-btn-xs' onclick=\"look( '${ctx}/project/tem/form?id=" + d.id + "&tabId=1')\">查看</a>"
         +"<a class='layui-btn layui-btn-xs'  onclick=\"update( '${ctx}/project/tem/form?id=" + d.id + "&tabId=2')\">修改</a>"
-        +"<a class='layui-btn layui-btn-normal layui-btn-xs' lay-event='add'>添加结算书</a>";
+        +"<a class='layui-btn layui-btn-normal layui-btn-xs' lay-event='add'>添加结算书</a>"
+    +"<a  class='layui-btn layui-btn-warm layui-btn-xs'onclick=\"withhold( '${ctx}/project/withholdform?id=" + d.id + "&tabId=1')\">诚信扣款</a><div>";
     }
     if(d.status==2){
         xml +="<span class='myspan'>操作</span>";
@@ -168,5 +169,28 @@ function update(url) {//修改工程下项目
         }
     })
 }
+
+    function withhold(url) { //诚信扣款
+    layer.open({
+        type: 2,
+        title: '诚信扣款',
+        area: ['70%', '90%'],
+        offset:['7%','14%'],
+        shade: 0.8,
+        shadeClose: true,
+        fixed: true, //不固定
+        maxmin: true,
+        content: url,//查看的路径
+        btn: ['确定','关闭'],
+        yes: function(index, layero){
+            var bodyparent = layer.getChildFrame('body', index); //获取子类页面body下内容
+            bodyparent.find('#updatebtn').click(); // 点击修改页面隐藏的按钮
+        }
+        ,btn2: function(index, layero){
+            layer.close(index);
+        }
+
+    })
+}
 </script>