蔡德晨 5 anni fa
parent
commit
f1ec3b3ec5

+ 1 - 0
src/main/java/com/jeeplus/modules/sg/entity/TzData.java

@@ -11,6 +11,7 @@ public class TzData {
     private String data1;
 
 
+
     public String getData1() {
         return data1;
     }

+ 2 - 0
src/main/java/com/jeeplus/modules/sg/mapper/JkxlMapper.java

@@ -5,6 +5,7 @@ import com.jeeplus.modules.sg.entity.JkxlData;
 import com.jeeplus.modules.sg.entity.RuleRatio;
 import com.jeeplus.modules.sg.entity.TzData;
 import com.jeeplus.modules.sg.entity.WbsProject;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -12,6 +13,7 @@ import java.util.List;
 public interface JkxlMapper {
     RuleRatio getValue(String ratioName);
     List<JkxlData> getList(String id);
+    JkxlData getData(@Param("id")String id,@Param("wbsCode")String wbsCode);
     void save(JkxlData jkxlData);
     void saveProject(WbsProject project);
     List<JkxlData> findList(String id);

+ 36 - 0
src/main/java/com/jeeplus/modules/sg/mapper/xml/JkxlMapper.xml

@@ -42,6 +42,42 @@
          and b.id = #{id}
 	</select>
 
+	<select id="getData"  resultType="com.jeeplus.modules.sg.entity.JkxlData">
+        SELECT
+         a.describe,
+         a.short_id as wbsCode,
+         a.parent_node as parentNode,
+         a.state,
+         b.id,
+         b.original_total_cost as originalTotalCost,
+         b.original_rg_cost as originalRgCost,
+         b.original_cbr_cost as originalCbrCost,
+         b.original_fbr_cost as originalFbrCost,
+         b.original_jx_cost as originalJxCost,
+         b.rg_cost as rgCost,
+         b.cbr_cost as cbrCost,
+         b.fbr_cost as fbrCost,
+         b.jx_cost as jxCost,
+         b.measures_fee1 as measuresFee1,
+         b.measures_fee2 as measuresFee2,
+         b.other_cost as otherCost,
+         b.tex as tex,
+         b.fees as fees,
+         b.zjgc_fee as zjgcFee,
+         b.total_fee as totalFee,
+         b.original_rate as originalRate,
+         b.bz_fee as bzFee,
+         b.jk_fee as jkFee,
+      b.rg_fee_ft      as rgFtFee,
+       b.cbr_fee_ft    as cbrFtFee,
+       b.fbr_fee_ft    as fbrFtFee,
+       b.jx_fee_ft   as jxFtFee
+         FROM sg_wbs_elements_data a LEFT JOIN sg_wbs_fee b on a.short_id = b.wbs_code
+         <where>
+         b.id = #{id}  and a.short_id = #{wbsCode}
+		 </where>
+	</select>
+
 
 	<select id="findList" parameterType="String" resultType="com.jeeplus.modules.sg.entity.JkxlData">
 		 SELECT

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

@@ -29,6 +29,10 @@ public class JkxlService {
        return jkxlMapper.findList(id);
    }
 
+   public JkxlData getDate(String id,String wbsCode){
+       return jkxlMapper.getData(id,wbsCode);
+   }
+
    @Transactional
    public void save(JkxlData jkxlData){
        jkxlMapper.save(jkxlData);

+ 25 - 10
src/main/java/com/jeeplus/modules/sg/web/JkxlController.java

@@ -6,10 +6,7 @@ import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.common.utils.excel.ExportExcel;
 import com.jeeplus.common.utils.excel.ImportExcel;
 import com.jeeplus.core.web.BaseController;
-import com.jeeplus.modules.sg.entity.FtData;
-import com.jeeplus.modules.sg.entity.JkxlData;
-import com.jeeplus.modules.sg.entity.TzData;
-import com.jeeplus.modules.sg.entity.WbsProject;
+import com.jeeplus.modules.sg.entity.*;
 import com.jeeplus.modules.sg.service.JkxlService;
 import com.jeeplus.modules.sg.util.BashInfo;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
@@ -341,15 +338,33 @@ public class JkxlController extends BaseController {
   public String ddtz(TzData tzData, Model model, RedirectAttributes redirectAttributes){
     String id = tzData.getId();
     String type = tzData.getType();
+    String state  = tzData.getState();
     double fee = tzData.getFee();
     String data1 = tzData.getData1();
-    List<TzData> ts = (List<TzData>) JSONArray.parseArray(data1, TzData.class);
-    List<JkxlData> lists = jkxlService.getList(id);
-
+    String row = data1.replaceAll("&quot;","\\\"");
+    List<DdtzData> ts = (List<DdtzData>) JSONArray.parseArray(row, DdtzData.class);
     try {
-//      for (JkxlData jkxlData: list){
-//
-//      }
+      for(DdtzData ddtzData: ts){
+        double tzFee = Double.valueOf(ddtzData.getFee());
+        String wbsCode = ddtzData.getWbsCode();
+        double otherFee = jkxlService.getDate(id,wbsCode).getOtherCost();
+        double totalFee = jkxlService.getDate(id,wbsCode).getTotalFee();
+        if(state.equals("1")){
+          otherFee = otherFee+tzFee;
+          totalFee = totalFee+tzFee;
+        }
+        if(state.equals("2")){
+          otherFee = otherFee-tzFee;
+          totalFee = totalFee-tzFee;
+        }
+        JkxlData jkxlData = new JkxlData();
+        jkxlData.setId(id);
+        jkxlData.setWbsCode(wbsCode);
+        jkxlData.setOtherCost(otherFee);
+        jkxlData.setTotalFee(otherFee);
+        jkxlService.updataDate(jkxlData);
+      }
+      jkxlService.updateFee(tzData);
 
     }catch (Exception e){
       addMessage(redirectAttributes, "调整失败");

+ 3 - 3
src/main/webapp/webpage/modules/sg/free/alongst.jsp

@@ -27,8 +27,8 @@
             <span id="readid2">200</span>
         </div>
         <div class="" style="margin-left: 10px;">
-            <input type="radio" name="mydiv" value="增加" title="增加">
-            <input type="radio" name="mydiv" value="减少" title="减少">
+            <input type="radio" name="mydiv" value="1" title="增加">
+            <input type="radio" name="mydiv" value="2" title="减少">
         </div>
     </div>
 </form>
@@ -179,7 +179,7 @@
                     type:"post",
                     url:"${ctx}/jkxl/ddtz",
                     // data:JSON.stringify({id:newid2,type:xmmc2,fee:fyje2}),
-                    data:{id:newid2,type:xmmc2,fee:fyje2,data1:jsondata },
+                    data:{id:newid2,type:xmmc2,fee:fyje2,data1:jsondata,state:val },
                     success:function(result){
                         parent.location.reload();
                     }

+ 1 - 1
src/main/webapp/webpage/modules/sg/free/wbslist.jsp

@@ -28,7 +28,7 @@
 
      .layui-table-view .layui-table {width:100%}
 </style>
-<body style="background-color: white">
+<body style="background-color: white ;height: 100%">
     <sys:message content="${message}"/>
     <!-----------本体部分--------->
     <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">