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

+ 26 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/contract/controller/FlowContractController.java

@@ -1,9 +1,14 @@
 package com.zjugis.business.flow.contract.controller;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zjugis.business.bean.dto.ProjectDto;
 import com.zjugis.business.bean.entity.Contract;
+import com.zjugis.business.bean.entity.Project;
 import com.zjugis.business.flow.contract.service.FlowContractService;
+import com.zjugis.business.service.ContractMilestoneService;
 import com.zjugis.framework.security.core.util.SecurityFrameworkUtils;
 import com.zjugis.framework.workflow.model.BaseController;
+import com.zjugis.framework.workflow.model.Grid;
 import com.zjugis.framework.workflow.spring.resovler.ParamModel;
 import com.zjugis.framework.workflow.workflow.WorkFlow;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -27,6 +32,9 @@ public class FlowContractController extends BaseController {
     @Autowired
     FlowContractService contractFlowService;
 
+    @Autowired
+    ContractMilestoneService contractMilestoneService;
+
     @WorkFlow(isReceiveMaterial = true, isReceiveOpinion = true)
     @GetMapping("/apply")
     public String apply(String activityTemplateId, String flowInstanceId, String userId) throws Exception {
@@ -56,6 +64,24 @@ public class FlowContractController extends BaseController {
         return resultPage(params);
     }
 
+    @PostMapping("/milestone/page")
+    public String page(@ParamModel ProjectDto project, long page, long rows) {
+        Page<Project> p = projectService.page(new Page<>(page, rows), project);
+        Grid<Project> grid = new Grid(
+                p.getCurrent(),
+                p.getSize(),
+                p.getTotal(),
+                p.getRecords());
+        return ok(grid);
+    }
+
+    @GetMapping("/milestone/list")
+    public String selectMilestoneList(String contractId) {
+        HashMap<Object, Object> params = new HashMap<>();
+        contractMilestoneService.selectByContractId(contractId);
+        return resultPage(params);
+    }
+
 
 
     @PostMapping("/update")

+ 5 - 9
zjugis-business/src/main/java/com/zjugis/business/flow/contract/event/ContractEvent.java

@@ -188,7 +188,7 @@ public class ContractEvent extends BaseController {
         try {
             String flowInstanceId = flowInstance.get("id").toString();
             Contract entity = contractService.selectByInstanceId(flowInstanceId);
-            if(entity != null && entity.getMainType() != null && (entity.getMainType() == 2 || entity.getMainType() == 3)){
+            if(entity != null && entity.getMainType() != null && (entity.getMainType() == 2 || entity.getMainType() == 3 || (entity.getSecondType() != null && entity.getSecondType() == 2))){
                 return "true";
             }
             return "false";
@@ -202,7 +202,7 @@ public class ContractEvent extends BaseController {
         try {
             String flowInstanceId = flowInstance.get("id").toString();
             Contract entity = contractService.selectByInstanceId(flowInstanceId);
-            if(entity != null && entity.getMainType() != null && entity.getMainType() == 1){
+            if(entity != null && (entity.getMainType() == null || (entity.getMainType() != 2 && entity.getMainType() != 3 && (entity.getSecondType() == null || entity.getSecondType() != 2)))){
                 return "true";
             }
             return "false";
@@ -276,13 +276,9 @@ public class ContractEvent extends BaseController {
                 Project project = projectService.selectById(entity.getProjectId());
                 List<Map<String, String>> userMaps = new ArrayList<>();
                 if (StringUtils.isNotBlank(project.getXmjlId())) {
-                    CommonResult<AdminUserRespDTO> userRes = adminUserApi.getUserLeader(project.getXmjlId());
-                    AdminUserRespDTO userLeader = userRes.getCheckedData();
-                    if (userLeader != null) {
-                        HashMap<String, String> leaderMap = new HashMap<>();
-                        leaderMap.put("id", userLeader.getId());
-                        userMaps.add(leaderMap);
-                    }
+                        HashMap<String, String> xmjl = new HashMap<>();
+                        xmjl.put("id", project.getXmjlId());
+                        userMaps.add(xmjl);
                 }
                 if(StringUtils.isNotBlank(project.getZrbmId())){
                     CommonResult<DeptRespDTO> result = deptApi.getDept(project.getZrbmId());

+ 2 - 1
zjugis-business/src/main/java/com/zjugis/business/service/impl/ContractServiceImpl.java

@@ -124,7 +124,8 @@ public class ContractServiceImpl implements ContractService{
     @Override
     public List<Contract> selectByProject(String projectId) {
         QueryWrapper<Contract> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("PROJECT_ID",projectId);
+        queryWrapper.eq("PROJECT_ID",projectId)
+                .eq("FLOW_STATUS",90);
         return contractMapper.selectList(queryWrapper);
     }
 

+ 19 - 0
zjugis-business/src/main/resources/static/flow/js/formCommon.js

@@ -117,3 +117,22 @@ function selectContract(flowInstanceId,callback) {
         }
     });
 }
+
+
+function selectMilestone(contractId,callback) {
+    z.ui.modal("MilestoneModal").init({
+        type: 'get',
+        url: z.ui.comm.getEntranceUrl("/flow/contract/milestone/list"),
+        data: {"contractId": contractId},
+        title: "选择合同里程碑",
+        width:$(window).width()-100,
+        height:$(window).height()-100,
+        onAfterClose:function(res){
+            if(res){
+                if(typeof callback === 'function'){
+                    callback(res);
+                }
+            }
+        }
+    });
+}

+ 78 - 0
zjugis-business/src/main/resources/templates/FlowContract/js/selectMilestoneList.js

@@ -0,0 +1,78 @@
+(function () {
+    z.ui.comp.init($("[name=search]"));
+    bindGrid();
+    bindEvents();
+
+
+    function bindEvents() {
+        $("div[name=searchBtn]").on("click", function () {
+            reloadGrid(true);
+        });
+    }
+
+    function confirm(id) {
+        z.ui.loading(true, true);
+        z.ui.ajax({
+            url: z.ui.comm.getEntranceUrl("/contract"),
+            data: {id:id},
+            type: 'get',
+            success: function (result) {
+                z.ui.loading(false);
+                if(result){
+                    z.ui.modal("milestoneModal").close(result);
+                }
+            }
+        });
+    }
+
+    function reloadGrid(iBackToFirstPage) {
+        z.ui.jqgrid("[name=grid]").setGridParam({
+            reloadfirstpage:iBackToFirstPage,
+            postData: z.ui.form.childStringify(z.ui.form.getFormFields($("[name=search]")))
+        }).trigger("reloadGrid");
+    }
+
+    function bindGrid() {
+        var postdata = z.ui.form.getFormFields($("[name=search]"));
+        z.ui.jqgrid("[name=grid]").init({
+            multiselect: false,
+            shrinkToFit:true,//设置表格自适应
+            url: z.ui.comm.getEntranceUrl('/flow/contract/milestone/page'),
+            postData: z.ui.form.childStringify(postdata),
+            colModel: [
+                {
+                    label: "操作", name: 'action',align:"center", width: 100,frozen: true, fixed: true,
+                    buttons:
+                        [
+                            {
+                                label: "<i class =\"fa fa-pencil\"> </i>  选择",
+                                className: "btn btn-info",
+                                onClick: function (rowObject, rowindex) {
+                                    confirm(rowObject.id);
+                                }
+                            }
+                        ]
+                },
+                {name: "id", hidden: true, key: true},
+                {label: '合同名称', name: "name", width: 200},
+                {label: '合同编号', name: "contractNumber",align:"center", width: 150},
+                {label: '合同金额', name: "contractAmount",align:"center", width: 150},
+                {label: '合同余额', name: "contractBalance",align:"center", width: 150},
+                {label: '已开票金额', name: "invoicedAmount",align:"center", width: 150}
+            ],
+            loadComplete: function (xhr) {
+                $(".jqgfirstrow").find("td:first").css("width", "50");
+                $("th[id$=_rn]").each(function () {
+                    $(this).css("width", "50");
+                });
+                $("td[aria-describedby$=_rn]").each(function () {
+                    $(this).css("width", "50");
+                });
+            },
+            ondblClickRow: function (rowid, iRow, iCol, e) {
+                var rowData = z.ui.jqgrid("[name=grid]").getRowData(rowid);
+            }
+        });
+    }
+
+}());

+ 11 - 0
zjugis-business/src/main/resources/templates/FlowContract/selectMilestoneList.ftl

@@ -0,0 +1,11 @@
+
+
+    <div class="z-form-bar" name="search">
+    </div>
+    <div class="z-form-wrap">
+        <div name="grid"></div>
+    </div>
+<script type="text/javascript">
+</script>
+<script type="text/javascript" src="/FlowContract/js/selectMilestoneList.js"></script>
+

+ 17 - 0
zjugis-business/src/main/resources/templates/FlowContractInvoice/js/apply.js

@@ -8,6 +8,7 @@
 
     function bindEvents() {
         initData();
+        bindSelectMilestone()
         z.workflow.saveBtn.addListener("onSaveClick", submit);
     }
 
@@ -15,6 +16,22 @@
 
     }
 
+    function bindSelectMilestone(){
+        $("#selectMilestone").click(function () {
+            var contractId = $("[name='contractInvoice$contractId']").val();
+            selectMilestone(contractId, setMilestone);
+        })
+    }
+
+    function setMilestone(res) {
+        if (res.data) {
+            $("[name='createReqVO$projectId']").val(res.data.id);
+            z.ui.input("[name='createReqVO$projectName']").setValue(res.data.xmmc);
+            z.ui.input("[name='createReqVO$xmbh']").setValue(res.data.xmbh);
+            z.ui.input("[name='createReqVO$xmzrbm']").setValue(res.data.zrbm);
+        }
+    }
+
 
     function submit(all, istransfer) {
         var postData = z.ui.form.getFormFields("[name=flow-form]", {validatorRequired: istransfer});