소스 검색

2024 7 16 号

zhuwei 1 년 전
부모
커밋
c94664a9d2

+ 73 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/APIWbsContractNodeVo.java

@@ -0,0 +1,73 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import org.springblade.core.tool.node.INode;
+
+
+import java.util.ArrayList;
+import java.util.List;
+/**
+ * 视图实体类
+ *
+ * @author Chill
+ */
+@Data
+@ApiModel(value = "APIWbsContractNodeVo对象", description = "APIWbsContractNodeVo对象")
+public class APIWbsContractNodeVo implements INode<APIWbsContractNodeVo> {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long pkeyId;
+
+    private Long id;
+
+    private Long parentId;
+
+    private String nodeName;
+
+    private Integer type;
+
+    /**
+     * 子孙节点
+     */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private List<APIWbsContractNodeVo> children;
+
+    /**
+     * 是否有子孙节点
+     */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private Boolean hasChildren;
+
+    @Override
+    public List<APIWbsContractNodeVo> getChildren() {
+        if (this.children == null) {
+            this.children = new ArrayList<>();
+        }
+        return this.children;
+    }
+
+}

+ 62 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/APIController.java

@@ -0,0 +1,62 @@
+package org.springblade.manager.controller;
+
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.secure.BladeUser;
+import org.springblade.core.tool.api.R;
+import org.springblade.manager.service.IWbsTreeContractService;
+import org.springblade.manager.vo.APIWbsContractNodeVo;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/hczc/api")
+@Api(value = "接口信息", tags = "接口信息类")
+public class APIController extends BladeController {
+
+    private final JdbcTemplate jdbcTemplate;
+    private final IWbsTreeContractService iWbsTreeContractService;
+
+    @GetMapping("/getProjectInfo")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "获取项目信息", notes = "传入合同段Id")
+    public R getProjectInfo(BladeUser bladeUser) {
+        List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT distinct a.id,a.project_name as projectName from m_project_info a , m_project_assignment_user b where a.id=b.project_id and b.user_id=" + bladeUser.getUserId() + "");
+        return R.data(maps);
+    }
+
+    @GetMapping("/getContractInfo")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "获取合同段信息", notes = "传入项目Id")
+    public R getContractInfo(String projectId) {
+        List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT distinct c.id,c.contract_name as contractName from m_contract_info c,m_project_info a  where  c.is_deleted=0 and c.p_id='"+projectId+"'");
+        return R.data(maps);
+    }
+
+    /**
+     *  获取合同段tree信息
+     */
+    @GetMapping("/tree")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "获取合同段tree信息", notes = "合同")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "contractId", value = "合同段Id", required = true)
+    })
+    public R<List<APIWbsContractNodeVo>> tree(String contractId) {
+        List<APIWbsContractNodeVo> tree = iWbsTreeContractService.apiTreeNode(contractId);
+        if (tree != null && tree.size() > 0) {
+            return R.data(tree);
+        }
+        return R.fail(200, "未查询到信息");
+    }
+}

+ 2 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.java

@@ -108,4 +108,6 @@ public interface WbsTreeContractMapper extends EasyBaseMapper<WbsTreeContract> {
     void updateIsPId(@Param("map") Map<Long, Long> map);
 
     void tableSort(@Param("map") Map<Long, Integer> map);
+
+    List<APIWbsContractNodeVo> apiTreeNode(@Param("contractId") String contractId);
 }

+ 22 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml

@@ -134,6 +134,16 @@
         <result column="contractIdRelation" property="contractIdRelation"/>
     </resultMap>
 
+    <resultMap id="apiTreeNodeResultMap" type="org.springblade.manager.vo.APIWbsContractNodeVo">
+        <id column="id" property="id"/>
+        <result column="p_key_id" property="pkeyId"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="node_name" property="nodeName"/>
+        <result column="type" property="type"/>
+        <result column="has_children" property="hasChildren"/>
+    </resultMap>
+
+
     <insert id="insertByCondition">
         INSERT INTO m_wbs_tree_contract(p_key_id, id, wbs_id, wbs_type, project_id, contract_id, contract_type,
                                         tenant_id, parent_id, ancestors, node_type, node_name, full_name, sort,
@@ -809,4 +819,16 @@
         select p_key_id,id,wbs_id,project_id from m_wbs_tree_contract
         WHERE project_id = #{projectId} and type = 1 and is_deleted = 0 and is_type_private_pid is null
     </select>
+
+    <select id="apiTreeNode" resultMap="apiTreeNodeResultMap">
+        select distinct p_key_id ,type, CONCAT(SUBSTR(id, 2, LENGTH(id) - 5), SUBSTR(p_key_id, -5, 5)) as id ,CONCAT(SUBSTR(parent_id, 2, LENGTH(parent_id) - 5), SUBSTR(p_key_id, -5, 5)) as parent_id , node_name
+        from m_wbs_tree_contract
+        where
+        is_deleted = 0
+        and status = 1
+        and wbs_type = 1
+        and type=1
+        and contract_id = #{contractId}
+        ORDER BY type,sort
+    </select>
 </mapper>

+ 1 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java

@@ -69,4 +69,5 @@ public interface IWbsTreeContractService extends BaseService<WbsTreeContract> {
 
     List<WbsTreeContractLazyVO> getConcealedWorksNodeTree(String contractId, String parentId);
 
+    List<APIWbsContractNodeVo> apiTreeNode(String contractId);
 }

+ 4 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -1066,6 +1066,10 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         return null;
     }
 
+    @Override
+    public List<APIWbsContractNodeVo> apiTreeNode(String contractId) {
+        return ForestNodeMerger.merge(baseMapper.apiTreeNode(contractId));
+    }
 
 
     /**

+ 13 - 4
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

@@ -2482,6 +2482,7 @@ public class TaskController extends BladeController {
                         data.setPrintDate(me.getFormPrintDate());
                         data.setPeriodNumber(me.getPeriodNumber());
                         data.setProjectId(me.getProjectId());
+                        data.setApproveStatus(2);
                         if (task.getMeterTaskType() == 2) {
                             data.setRepaymentCause("材料预付款");
                             data.setStatementName("材料预付款--" + me.getPeriodName());
@@ -2519,11 +2520,13 @@ public class TaskController extends BladeController {
                         inData2.setPrintDate(me.getFormPrintDate());
                         inData2.setProjectId(me.getProjectId());
                         inData2.setPayMoney(currentMeterMoney);
+                        inData2.setApproveStatus(2);
                         interimPayCertificateService.save(inData2);
                         reportId = inData2.getId() + "";
                     } else {
                         reportId = inData.getId() + "";
-                        interimPayCertificateService.update(new LambdaUpdateWrapper<InterimPayCertificate>().eq(InterimPayCertificate::getId, reportId).set(InterimPayCertificate::getPayMoney, currentMeterMoney));
+
+                        interimPayCertificateService.update(new LambdaUpdateWrapper<InterimPayCertificate>().eq(InterimPayCertificate::getId, reportId).set(InterimPayCertificate::getPayMoney, currentMeterMoney).set(InterimPayCertificate::getApproveStatus,2));
                     }
                 }
                 /**计量公式执行 0中间,1材料,2开工*/
@@ -3334,21 +3337,23 @@ public class TaskController extends BladeController {
             String deleteMapTask1 = null;
             String deleteMapTask2 = null;
             String deleteMapTask3 = null;
-            if (type == 0) { //中间计量
+            if (type == 0) { //0中间计量支付证书
                 String uptPeriod = "update s_contract_meter_period  set approve_status =0 where id ='" + periodId + "'";
 
                 String updta = "UPDATE s_middle_meter_apply set approve_status=0 where contract_period_id='" + periodId + "' ";
 
                 String delete = "UPDATE s_inventory_form_apply c set approve_status=0 where middle_meter_id in(SELECT id from  s_middle_meter_apply a  where a.contract_period_id=" + periodId + ") and contract_period_id='" + periodId + "'";
+                String upData = "UPDATE s_interim_pay_certificate c set approve_status=0,raw_url='',file_url_list='' where contract_period_id='"+periodId+"'";
                 jdbcTemplate.execute(delete);
                 jdbcTemplate.execute(uptPeriod);
                 jdbcTemplate.execute(updta);
+                jdbcTemplate.execute(upData);
 
                 //同时删除映射task表数据
                 deleteMapTask1 = "DELETE from s_middle_meter_apply_task where task_id = "+task.getId();
                 deleteMapTask2 =  "DELETE from s_inventory_form_apply_task where task_id = "+task.getId();
             }
-            if (type == 1) {
+            if (type == 1) { //1材料,2开工
                 String uptPeriod = "update s_meter_period  set approve_status =0 where id ='" + periodId + "'";
                 jdbcTemplate.execute(uptPeriod);
                 String uptMeter = "update s_material_meter_form  set approve_status =0 where meter_period_id ='" + periodId + "'";
@@ -3356,12 +3361,16 @@ public class TaskController extends BladeController {
 
                 //同时删除映射task表数据
                 deleteMapTask1 = "DELETE from s_material_meter_form_task where task_id = "+task.getId();
+                String upData = "UPDATE s_material_start_statement c set approve_status=0,raw_url='',file_url_list='' where meter_period_id='"+periodId+"'";
+                jdbcTemplate.execute(upData);
             }
-            if (type == 2) {
+            if (type == 2) {//2开工
                 String uptPeriod = "update s_meter_period  set approve_status =0 where id ='" + periodId + "'";
                 jdbcTemplate.execute(uptPeriod);
                 String uptMeter = "update s_start_pay_meter_form  set approve_status =0 where meter_period_id ='" + periodId + "'";
                 jdbcTemplate.execute(uptMeter);
+                String upData = "UPDATE s_material_start_statement c set approve_status=0,raw_url='',file_url_list='' where meter_period_id='"+periodId+"'";
+                jdbcTemplate.execute(upData);
             }
             if (type == 3){
                 //变更令没有期数,periodId为变更令ID