Browse Source

经营页面接口

ljy121 1 year ago
parent
commit
a9e61623ce

+ 1 - 1
zjugis-business/src/main/java/com/zjugis/business/bean/dto/ManageSegmentDto.java

@@ -12,7 +12,7 @@ import java.math.BigDecimal;
 @Data
 public class ManageSegmentDto {
 
-    private String segment;
+    private Integer segment;
 
     private BigDecimal returnAmount;
 

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

@@ -330,12 +330,12 @@ public class ContractServiceImpl implements ContractService{
             }
             for (ManageSegmentDto signDto : signDtos) {
                 if(signDto.getSegment().equals(manageDto.getSegment())){
-                    manageDto.setReturnAmount(signDto.getSignAmount());
+                    manageDto.setSignAmount(signDto.getSignAmount());
                 }
             }
             for (ManageSegmentDto newDto : newDtos) {
                 if(newDto.getSegment().equals(manageDto.getSegment())){
-                    manageDto.setReturnAmount(newDto.getNewAmount());
+                    manageDto.setNewAmount(newDto.getNewAmount());
                 }
             }
         }
@@ -358,12 +358,12 @@ public class ContractServiceImpl implements ContractService{
             }
             for (ManageDeptDto signDto : signDtos) {
                 if(signDto.getDeptId().equals(manageDto.getDeptId())){
-                    manageDto.setReturnAmount(signDto.getSignAmount());
+                    manageDto.setSignAmount(signDto.getSignAmount());
                 }
             }
             for (ManageDeptDto newDto : newDtos) {
                 if(newDto.getDeptId().equals(manageDto.getDeptId())){
-                    manageDto.setReturnAmount(newDto.getNewAmount());
+                    manageDto.setNewAmount(newDto.getNewAmount());
                 }
             }
         }
@@ -385,7 +385,7 @@ public class ContractServiceImpl implements ContractService{
             }
             for (ManagePersonDto signDto : signDtos) {
                 if(signDto.getUserId().equals(manageDto.getUserId())){
-                    manageDto.setReturnAmount(signDto.getSignAmount());
+                    manageDto.setSignAmount(signDto.getSignAmount());
                 }
             }
         }

+ 1 - 1
zjugis-business/src/main/resources/mapper/oracle/ContractApplyMapper.xml

@@ -104,7 +104,7 @@
 
     <select id="infoGroupBySegment" resultType="com.zjugis.business.bean.dto.ManageSegmentDto">
         select
-        D.SEGMENT
+        D.SEGMENT,
         COALESCE(SUM((CASE WHEN t.APPLY_TYPE = 1 THEN COALESCE(t.CONTRACT_AMOUNT,0) ELSE 0 END)),0) AS subAmount,
         COALESCE(SUM((CASE WHEN t.APPLY_TYPE = 1 THEN COALESCE(t.PAY_AMOUNT,0) ELSE 0 END)),0) AS subPayed
         FROM CONTRACT_APPLY t

+ 22 - 22
zjugis-business/src/main/resources/mapper/oracle/ContractMapper.xml

@@ -542,7 +542,7 @@
         <where>
             t2.ISVALID = 1 and NVL(t2.BZ,'-1') != '冲红' and D.SEGMENT is not null
             <if test="year != null and year != ''">
-                AND TO_CHAR(t2.RETURN_DATE,'YYYY') = #{params.year,jdbcType=VARCHAR}
+                AND TO_CHAR(t2.RETURN_DATE,'YYYY') = #{year,jdbcType=VARCHAR}
             </if>
         </where>
         GROUP BY D.SEGMENT
@@ -556,7 +556,7 @@
         <where>
             c.ISVALID = 1 AND c.FLOW_STATUS = 90 and D.SEGMENT is not null
             <if test="year != null and year != ''">
-                AND TO_CHAR(c.CONTRACT_OFF,'YYYY') = #{params.year,jdbcType=VARCHAR}
+                AND TO_CHAR(c.CONTRACT_OFF,'YYYY') = #{year,jdbcType=VARCHAR}
             </if>
         </where>
         GROUP BY D.SEGMENT
@@ -570,7 +570,7 @@
         <where>
             c.ISVALID = 1 AND c.FLOW_STATUS = 90 and D.SEGMENT is not null
             <if test="year != null and year != ''">
-                AND TO_CHAR(c.CONTRACT_ON,'YYYY') = #{params.year,jdbcType=VARCHAR}
+                AND TO_CHAR(c.CONTRACT_ON,'YYYY') = #{year,jdbcType=VARCHAR}
             </if>
         </where>
         GROUP BY D.SEGMENT
@@ -602,9 +602,9 @@
         LEFT JOIN PROJECT pr ON pr.ID = t1.PROJECT_ID
         LEFT JOIN ZJUGIS_OA.SYSTEM_DEPT D ON D.ID = pr.ZRBM_ID
         <where>
-            t2.ISVALID = 1 and NVL(t2.BZ,'-1') != '冲红'
+            t2.ISVALID = 1 and NVL(t2.BZ,'-1') != '冲红' and D.ID is not null
             <if test="year != null and year != ''">
-                AND TO_CHAR(t2.RETURN_DATE,'YYYY') = #{params.year,jdbcType=VARCHAR}
+                AND TO_CHAR(t2.RETURN_DATE,'YYYY') = #{year,jdbcType=VARCHAR}
             </if>
         </where>
         GROUP BY D.ID
@@ -617,9 +617,9 @@
         RIGHT JOIN PROJECT pr ON pr.ID = c.PROJECT_ID
         LEFT JOIN ZJUGIS_OA.SYSTEM_DEPT D ON D.ID = pr.ZRBM_ID
         <where>
-            c.ISVALID = 1 AND c.FLOW_STATUS = 90
+            c.ISVALID = 1 AND c.FLOW_STATUS = 90 and D.ID is not null
             <if test="year != null and year != ''">
-                AND TO_CHAR(c.CONTRACT_OFF,'YYYY') = #{params.year,jdbcType=VARCHAR}
+                AND TO_CHAR(c.CONTRACT_OFF,'YYYY') = #{year,jdbcType=VARCHAR}
             </if>
         </where>
         GROUP BY D.ID
@@ -632,16 +632,16 @@
         RIGHT JOIN PROJECT pr ON pr.ID = c.PROJECT_ID
         LEFT JOIN ZJUGIS_OA.SYSTEM_DEPT D ON D.ID = pr.ZRBM_ID
         <where>
-            c.ISVALID = 1 AND c.FLOW_STATUS = 90
+            c.ISVALID = 1 AND c.FLOW_STATUS = 90 and D.ID is not null
             <if test="year != null and year != ''">
-                AND TO_CHAR(c.CONTRACT_ON,'YYYY') = #{params.year,jdbcType=VARCHAR}
+                AND TO_CHAR(c.CONTRACT_ON,'YYYY') = #{year,jdbcType=VARCHAR}
             </if>
         </where>
         GROUP BY D.ID
     </select>
 
     <select id="amountByDept" resultType="com.zjugis.business.bean.dto.ManageDeptDto">
-        SELECT D.ID as deptId, MAX(D.NAME) as deptName
+        SELECT D.ID as deptId, MAX(D.NAME) as deptName,
                COALESCE(SUM(COALESCE(PA.invoiceAmount - PA.returnAmount,0)),0) as receivableAmount,
                COALESCE(SUM(COALESCE(c.CONTRACT_AMOUNT,0)),0) - COALESCE(SUM(COALESCE(PA.invoiceAmount,0)),0) as contractBalance
         FROM CONTRACT c
@@ -654,48 +654,48 @@
         ) PA on PA.CONTRACT_ID = c.ID
         RIGHT JOIN PROJECT pr ON pr.ID = c.PROJECT_ID
         LEFT JOIN ZJUGIS_OA.SYSTEM_DEPT D ON D.ID = pr.ZRBM_ID
-        where c.ISVALID = 1 AND c.FLOW_STATUS = 90
+        where c.ISVALID = 1 AND c.FLOW_STATUS = 90 and D.ID is not null
         GROUP BY D.ID
     </select>
 
     <select id="returnGroupByPerson" resultType="com.zjugis.business.bean.dto.ManagePersonDto">
-        select c.AREA_MANAGER_ID as userId, US.NICKNAME,
+        select t1.AREA_MANAGER_ID as userId, MAX(US.NICKNAME) as nickname,
         COALESCE(SUM(COALESCE(t2.RETURN_AMOUNT,0)),0) as returnAmount
         FROM CONTRACT_RETURN_MONEY t2
         RIGHT JOIN CONTRACT t1 on t2.CONTRACT_ID = t1.ID and t1.ISVALID = 1 and t1.FLOW_STATUS = 90
-        LEFT JOIN ZJUGIS_OA.SYSTEM_USERS US ON US.ID = c.AREA_MANAGER_ID
+        LEFT JOIN ZJUGIS_OA.SYSTEM_USERS US ON US.ID = t1.AREA_MANAGER_ID
         <where>
-            t2.ISVALID = 1 and NVL(t2.BZ,'-1') != '冲红'
+            t2.ISVALID = 1 and NVL(t2.BZ,'-1') != '冲红' and t1.AREA_MANAGER_ID is not null
             <if test="year != null and year != ''">
-                AND TO_CHAR(t2.RETURN_DATE,'YYYY') = #{params.year,jdbcType=VARCHAR}
+                AND TO_CHAR(t2.RETURN_DATE,'YYYY') = #{year,jdbcType=VARCHAR}
             </if>
         </where>
-        GROUP BY c.AREA_MANAGER_ID
+        GROUP BY t1.AREA_MANAGER_ID
     </select>
 
     <select id="signGroupByPerson" resultType="com.zjugis.business.bean.dto.ManagePersonDto">
-        SELECT c.AREA_MANAGER_ID as userId, US.NICKNAME,
+        SELECT c.AREA_MANAGER_ID as userId, MAX(US.NICKNAME) as nickname,
         NVL(SUM(c.CONTRACT_AMOUNT), 0) as signAmount
         FROM CONTRACT c
         LEFT JOIN ZJUGIS_OA.SYSTEM_USERS US ON US.ID = c.AREA_MANAGER_ID
         <where>
-            c.ISVALID = 1 AND c.FLOW_STATUS = 90
+            c.ISVALID = 1 AND c.FLOW_STATUS = 90 and c.AREA_MANAGER_ID is not null
             <if test="year != null and year != ''">
-                AND TO_CHAR(c.CONTRACT_OFF,'YYYY') = #{params.year,jdbcType=VARCHAR}
+                AND TO_CHAR(c.CONTRACT_OFF,'YYYY') = #{year,jdbcType=VARCHAR}
             </if>
         </where>
         GROUP BY c.AREA_MANAGER_ID
     </select>
 
     <select id="newGroupByPerson" resultType="com.zjugis.business.bean.dto.ManagePersonDto">
-        SELECT c.AREA_MANAGER_ID as userId, US.NICKNAME,
+        SELECT c.AREA_MANAGER_ID as userId, MAX(US.NICKNAME) as nickname,
         NVL(SUM(C.CONTRACT_AMOUNT), 0) AS newAmount
         FROM CONTRACT c
         LEFT JOIN ZJUGIS_OA.SYSTEM_USERS US ON US.ID = c.AREA_MANAGER_ID
         <where>
-            c.ISVALID = 1 AND c.FLOW_STATUS = 90
+            c.ISVALID = 1 AND c.FLOW_STATUS = 90 and c.AREA_MANAGER_ID is not null
             <if test="year != null and year != ''">
-                AND TO_CHAR(c.CONTRACT_ON,'YYYY') = #{params.year,jdbcType=VARCHAR}
+                AND TO_CHAR(c.CONTRACT_ON,'YYYY') = #{year,jdbcType=VARCHAR}
             </if>
         </where>
         GROUP BY c.AREA_MANAGER_ID