ljy121 пре 1 година
родитељ
комит
b0453591b0

+ 21 - 0
zjugis-business/src/main/java/com/zjugis/business/controller/CommonController.java

@@ -1,5 +1,7 @@
 package com.zjugis.business.controller;
 
+import com.zjugis.business.flow.commoncost.service.CommonCostService;
+import com.zjugis.business.flow.travelcost.service.TravelCostService;
 import com.zjugis.business.service.CommonService;
 import com.zjugis.framework.common.pojo.CommonResult;
 import com.zjugis.framework.workflow.model.SerialNumberDto;
@@ -13,7 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
+import java.math.BigDecimal;
+import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author ljy
@@ -92,5 +97,21 @@ public class CommonController {
         return CommonResult.success(dingResp);
     }
 
+    @Autowired
+    CommonCostService commonCostService;
+
+    @Autowired
+    TravelCostService travelCostService;
+
+    @GetMapping("/mytest")
+    public void test(){
+        String id = "064fc66f-5196-4a1f-aafa-61bb89220264";
+        List<String> ids = Collections.singletonList(id);
+        Map<String, BigDecimal> projectCostMap = commonCostService.getProjectCostMap(ids);
+        Map<String, BigDecimal> projectCostMap1 = travelCostService.getProjectCostMap(ids);
+        System.out.println(projectCostMap);
+        System.out.println("travel:"+projectCostMap1);
+    }
+
 }
 

+ 1 - 1
zjugis-business/src/main/java/com/zjugis/business/flow/contractinvoice/service/FlowContractInvoiceService.java

@@ -94,7 +94,7 @@ public class FlowContractInvoiceService {
         Map<String, Object> map = new HashMap<>();
         List<ContractReturnMoney> returnMoneyList = contractReturnMoneyService.selectByInoviceId(entity.getId());
         BigDecimal totalReturn = returnMoneyList.stream().map(ContractReturnMoney::getReturnAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-        map.put("invoiceReceivable",entity.getInvoiceAmount().subtract(totalReturn));
+        map.put("invoiceReceivable",entity.getInvoiceAmount() == null? BigDecimal.ZERO: entity.getInvoiceAmount().subtract(totalReturn));
         List<ContractInvoiceRelationDto> contractInvoiceRelations = contractInvoiceRelationService.selectByInvoiceId(entity.getId());
         map.put("returnMoneyListJson",JSON.toJSONString(returnMoneyList));
         map.put("contractListJson",JSON.toJSONString(contractInvoiceRelations));

+ 1 - 1
zjugis-business/src/main/java/com/zjugis/business/mapper/ProjectMapper.java

@@ -28,7 +28,7 @@ import java.util.List;
 @Repository
 public interface ProjectMapper extends BaseMapperX<Project> {
 
-    ProjectCalculateResponse calculate(ProjectDto projectDto);
+    ProjectCalculateResponse calculate(@Param("params") ProjectDto projectDto);
 
     List<ProjectResponse> selectWithChildren(@Param("id") String id);
 

+ 48 - 2
zjugis-business/src/main/resources/mapper/oracle/ProjectMapper.xml

@@ -5,8 +5,54 @@
 
 
     <select id="calculate" resultType="com.zjugis.business.bean.response.ProjectCalculateResponse">
-        SELECT NVL(SUM(NVL(OUTPUT_VALUE, 0)), 0) as output
-        FROM project
+        SELECT COALESCE(SUM(COALESCE(PA.VIRTUAL_AMOUNT, 0)), 0) as output,
+        COALESCE(SUM(COALESCE(PA.PROJECT_COST, 0)), 0) as cost
+        FROM PROJECT P
+        LEFT JOIN PROJECT_AMOUNT PA on PA.PROJECT_ID = P.ID
+        <if test="params != null and params.userId != null  and params.userId != ''">
+            LEFT JOIN PROJECT_WORKER_RELATION PW ON PW.PROJECT_ID = P.ID
+        </if>
+        <where>
+            P.ISVALID = 1 AND P.FLOW_STATUS IN (90,99)
+            <if test="params != null and params.hyId != null">
+                AND P.HY_ID = #{params.hyId}
+            </if>
+            <if test="params != null and params.xzqdm != null and params.xzqdm != ''">
+                AND P.XZQDM = #{params.xzqdm}
+            </if>
+            <if test="params != null and params.projectTypeId != null and params.projectTypeId != ''">
+                AND P.PROJECT_TYPE_ID = #{params.projectTypeId}
+            </if>
+            <if test="params != null and params.xmzt != null">
+                AND P.XMZT = #{params.xmzt}
+            </if>
+            <if test="params != null and params.lxsjOn != null">
+                AND P.LXSJ &gt;= #{params.lxsjOn}
+            </if>
+            <if test="params != null and params.lxsjOff != null">
+                AND P.LXSJ &lt;= #{params.lxsjOff}
+            </if>
+            <if test="params != null and params.isSign != null">
+                AND P.IS_SIGN = #{params.isSign}
+            </if>
+            <if test="params != null and params.xmmc != null and params.xmmc != ''">
+                <bind name="xmmc" value="'%'+params.xmmc+'%'"/>
+                AND P.XMMC LIKE #{xmmc}
+            </if>
+            <if test="params != null and params.xmbh != null and params.xmbh != ''">
+                <bind name="xmbh" value="'%'+params.xmbh+'%'"/>
+                AND P.XMBH LIKE #{xmbh}
+            </if>
+            <if test="params != null and params.userId != null  and params.userId != ''">
+                AND PW.WORKER_ID = #{params.userId}
+            </if>
+            <if test="params != null and params.deptId != null and params.deptId != ''">
+                AND P.ZRBM_ID = #{params.deptId}
+            </if>
+            <if test="params != null and params.xmjlId != null and params.xmjlId != ''">
+                AND P.XMJL_ID = #{params.xmjlId}
+            </if>
+        </where>
     </select>
 
     <select id="selectWithChildren" resultType="com.zjugis.business.bean.response.ProjectResponse">

+ 32 - 5
zjugis-business/src/main/resources/templates/FlowContract/js/apply.js

@@ -2,6 +2,7 @@
     var lists = [];
     let flowInstanceId = "";
     let viewState = z.ui.comm.getUrlParam("_o");
+    let isFirst = z.ui.comm.getUrlParam("first");
     var contractId = $("[name='contract$id']").val()
     var contractAmount = $("[name='contract$contractAmount'] input").val()
     window.onload = function () {
@@ -242,6 +243,28 @@
         $("[name='contract$assigneeId']").val(treeNode.id);
     }
 
+    function updateList(){
+        lists = [];
+        var postData = z.ui.form.getFormFields("[name=flow-form]", {validatorRequired: false});
+        var milestoneList = new Array()
+        for (let key of Object.keys(postData)) {
+            let mealName = postData[key];
+            if (key.startsWith("ContractMilestone")) {
+                var dataObj = {
+                    name: mealName.name,
+                    returnAmount: mealName.returnAmount,
+                    actualReturnAmount: mealName.actualReturnAmount,
+                    planReturnTime: mealName.planReturnTime,
+                    description: mealName.description,
+                    id: mealName.id,
+                    contractId: contractId,
+                    sortnum: lists.length - 1
+                }
+                lists.push(dataObj);
+            }
+        }
+    }
+
     function addContractMilestone(){
         var trFragment = document.createDocumentFragment();
         let tbody = document.querySelectorAll('.tbody tr')
@@ -265,6 +288,7 @@
             z.ui.confirm("compid").init({
                 content: "确定删除吗?",
                 onConfirm: function () {
+                    updateList();
                     var element = document.getElementById("contract_milestone_" +  i);
                     element.remove();
                     buildSeq();
@@ -384,24 +408,26 @@
             + '</div>'
             + '</td>'
             + '<td>'
-            if(viewState !== 'v') {
-                html += '<div id="editBtn_' + (i) + '" class="table-btn editBtn_' + (i) + '" data-index="' + (i) + '">'
+            if(isFirst === '1' && viewState !== 'v') {
+                html += "<div style='display: flex;white-space: nowrap'>"
+                +'<div id="editBtn_' + (i) + '" class="table-btn editBtn_' + (i) + '" data-index="' + (i) + '">'
                 + '<span>编辑</span>'
                 + '</div>'
                 + '<div id="delBtn_' + (i) + '" class="table-btn delBtn_' + (i) + '" data-index="' + (i) + '">'
                 + '<span>删除</span>'
-                + '</div>'
+                + '</div></div>'
             }
             html += '</td></tr>';
         }
         tbodyQjsq.innerHTML = html
         for (let i = 0; i < lists.length; i++) {
             z.ui.date("[name='ContractMilestone[" + i + "]$planReturnTime']").init()
-            if(viewState !== 'v') {
+            if(isFirst === '1' && viewState !== 'v') {
                 $("#delBtn_" + i).click(function () {
                     z.ui.confirm("compid").init({
                         content: "确定删除吗?",
                         onConfirm: function () {
+                            updateList();
                             var element = document.getElementById("contract_milestone_" + i);
                             element.remove();
                             buildSeq();
@@ -506,12 +532,13 @@
             + '</div>'
             + '</td>'
             + '<td>'
+            + '<div style="display: flex;white-space: nowrap">'
             + '<div id="editBtn_' + (index) + '" class="table-btn editBtn_' + (index) + '" data-index="' + (index) + '">'
             + '<span>保存</span>'
             + '</div>'
             + '<div id="delBtn_' + (index) + '" class="table-btn delBtn_' + (index) + '" data-index="' + (index) + '">'
             + '<span>删除</span>'
-            + '</div>'
+            + '</div></div>'
             + '</td>';
         return trDom;
     }

+ 10 - 1
zjugis-business/src/main/resources/templates/FlowContractInvoice/js/apply.js

@@ -25,6 +25,7 @@
         initContractInvoiceList();
         bindCalcInvoiceAmount();
         bindReturnMoney();
+        initReturnReg();
         z.workflow.saveBtn.addListener("onSaveClick", submit);
     }
 
@@ -33,6 +34,13 @@
         initInvoiceCompany();
     }
 
+    function initReturnReg(){
+        let register = z.ui.comm.getUrlParam("registerReturn");
+        if(register === '1'){
+            $("[name=addData]").show();
+        }
+    }
+
     function bindGenerateSerial(){
         $("#generateSerial").on("click",function(){
             var genFlag = true;
@@ -679,12 +687,13 @@
             + '</div>'
             + '</td>'
             + '<td>'
+            + '<div style="display: flex;white-space: nowrap">'
             + '<div id="editBtn_' + (index) + '" class="table-btn editBtn_' + (index) + '" data-index="' + (index) + '">'
             + '<span>保存</span>'
             + '</div>'
             + '<div id="delBtn_' + (index) + '" class="table-btn delBtn_' + (index) + '" data-index="' + (index) + '">'
             + '<span>删除</span>'
-            + '</div>'
+            + '</div></div>'
             + '</td>';
         return trDom;
     }

+ 26 - 3
zjugis-business/src/main/resources/templates/FlowProject/js/apply.js

@@ -226,6 +226,7 @@
       z.ui.confirm("compid").init({
         content: "确定删除吗?",
         onConfirm: function () {
+          updateList();
           var element = document.getElementById("project_milestone_" +  i);
           element.remove();
           buildSeq();
@@ -267,6 +268,25 @@
       seqElement.innerHTML = i + 1;
     }
   }
+  function updateList(){
+    lists = [];
+    var postData = z.ui.form.getFormFields("[name=flow-form]", {validatorRequired: false});
+    var milestoneList = new Array()
+    for (let key of Object.keys(postData)) {
+      let mealName = postData[key];
+      if (key.startsWith("ProjectMilestone")) {
+        var dataObj = {
+          name: mealName.name,
+          process: "100%",
+          planFinishTime: mealName.planFinishTime,
+          id: mealName.id,
+          projectId: projectId,
+          sortnum: lists.length - 1
+        }
+        lists.push(dataObj);
+      }
+    }
+  }
 
   function updateView() {
     let tbodyQjsq = document.querySelector('.tbodyQjsq')
@@ -305,12 +325,13 @@
           + '</td>'
           + '<td>';
           if(isFirst !== '0' && viewState !== 'v') {
-            html += '<div id="editBtn_' + (i) + '" class="table-btn editBtn_' + (i) + '" data-index="' + (i) + '">'
+            html += "<div style='display: flex;white-space: nowrap'>"
+            + '<div id="editBtn_' + (i) + '" class="table-btn editBtn_' + (i) + '" data-index="' + (i) + '">'
             + '<span>编辑</span>'
             + '</div>'
             + '<div id="delBtn_' + (i) + '" class="table-btn delBtn_' + (i) + '" data-index="' + (i) + '">'
             + '<span>删除</span>'
-            + '</div>'
+            + '</div></div>'
           }
           html += '</td></tr>';
     }
@@ -322,6 +343,7 @@
           z.ui.confirm("compid").init({
             content: "确定删除吗?",
             onConfirm: function () {
+              updateList();
               var element = document.getElementById("project_milestone_" + i);
               element.remove();
               buildSeq();
@@ -399,12 +421,13 @@
         + '</div>'
         + '</td>'
         + '<td>'
+        + '<div style="display: flex;white-space: nowrap">'
         + '<div id="editBtn_' + (index) + '" class="table-btn editBtn_' + (index) + '" data-index="' + (index) + '">'
         + '<span>保存</span>'
         + '</div>'
         + '<div id="delBtn_' + (index) + '" class="table-btn delBtn_' + (index) + '" data-index="' + (index) + '">'
         + '<span>删除</span>'
-        + '</div>'
+        + '</div></div>'
         + '</td>';
     return trDom;
   }