Procházet zdrojové kódy

首页一层当月成本额明细

sl před 1 rokem
rodič
revize
be770a94cf

+ 11 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/controller/IndexController.java

@@ -121,6 +121,17 @@ public class IndexController {
         return Result.OK(page);
     }
 
+    @ApiOperation(value = "首页一层当月成本额明细", notes = "首页一层当月成本额明细")
+    @GetMapping("getZhiChuDetail")
+    @TargetDataSource
+    public Result<IPage<EightCostsDetail>> getZhiChuDetail(@RequestParam(required = false) List<String> departNameList, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                                                    @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest request){
+        Page<EightCostsDetail> page = new Page<EightCostsDetail>(pageNo, pageSize);
+        List<EightCostsDetail> pageList = indexZcbService.getZhiChuDetailList(page, request, departNameList);
+        page.setRecords(pageList);
+        return Result.OK(page);
+    }
+
     @ApiOperation(value = "计算已收款", notes = "计算已收款")
     @GetMapping("getTotalReceived")
     public Result<IndexTotalVo> getTotalReceived(HttpServletRequest request,List<String> departNameList) {

+ 58 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/entity/vo/EightCostsDetail.java

@@ -0,0 +1,58 @@
+package org.jeecg.modules.Index.entity.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * ClassName: EightCostsDetail
+ * Package: org.jeecg.modules.Index.entity.vo
+ * Description:  首页导出八项成本当月明细时使用
+ *
+ * @Author sl
+ * @Create 2024/3/5 10:59
+ * @Version 1.0
+ */
+@Data
+public class EightCostsDetail {
+
+    /** id */
+    private Integer id;
+
+    /** 任务号 */
+    private String taskno;
+
+    /** 下达部门 */
+    private String xdbm;
+
+    /** 责任部门 */
+    private String zrbm;
+
+    /** 总成本 */
+    private BigDecimal zcb;
+
+    /** 材料费 */
+    private BigDecimal clf;
+    /** 专用费 */
+    private BigDecimal zyf;
+    /** 事务费 */
+    private BigDecimal swf;
+    /** 外协费 */
+    private BigDecimal wxf;
+    /** 燃料动力费 */
+    private BigDecimal rldlf;
+    /** 固定资产折旧费 */
+    private BigDecimal gdzczj;
+    /** 工资及劳务费 */
+    private BigDecimal gzjlwf;
+    /** 管理费 */
+    private BigDecimal glf;
+    /** 筛选费 */
+    private BigDecimal sxf;
+
+    /** 年 */
+    private String year;
+    /** 年月 */
+    private String yearmonth;
+
+}

+ 19 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/mapper/IndexZcbMapper.java

@@ -1,10 +1,13 @@
 package org.jeecg.modules.Index.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.Index.entity.vo.EightCosts;
+import org.jeecg.modules.Index.entity.vo.EightCostsDetail;
 import org.jeecg.modules.dataSourceSwitch.annotation.TargetDataSource;
 import org.jeecg.modules.wzOutboundOrder.entity.WzOutboundOrderB;
+import org.jeecg.modules.xmcbDetail.entity.ComContractInfoExchange;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -39,6 +42,14 @@ public interface IndexZcbMapper {
      */
     public BigDecimal getZcbByDepartAndYearMonth(@Param("dep") List<String> dep, @Param("nowDate") String nowDate);
 
+    /**
+     *   author: sl
+     *   version: 1.0
+     *   des: 总成本明细 根据当前用户的部门和日期 根据部门 年月
+     *   date: 2024/3/5
+     */
+    public List<EightCostsDetail> getZcbDetailByDepartAndYearMonth(Page<EightCostsDetail> page, @Param("dep") List<String> dep, @Param("nowDate") String nowDate);
+
 
     /**
      *   author: dzc
@@ -48,6 +59,14 @@ public interface IndexZcbMapper {
      */
     public BigDecimal getZcbByDate(@Param("nowDate") String nowDate);
 
+    /**
+     *   author: sl
+     *   version: 1.0
+     *   des: 总成本明细 根据当前用户的部门和日期 全部部门
+     *   date: 2024/3/5
+     */
+    public List<EightCostsDetail> getZcbDetailByDate(Page<EightCostsDetail> page, @Param("nowDate") String nowDate);
+
     ///**
     // *   author: dzc
     // *   version: 1.0

+ 24 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/mapper/xml/IndexZcbMapper.xml

@@ -30,6 +30,20 @@
             </foreach>
     </select>
 
+    <!-- 总成本(支出)明细 根据部门 年月-->
+    <select id="getZcbDetailByDepartAndYearMonth" resultType="org.jeecg.modules.Index.entity.vo.EightCostsDetail">
+        SELECT
+        *
+        FROM
+        kzks_project_cost_cb
+        WHERE
+        YEARMONTH = #{nowDate}
+        AND zrbm IN
+        <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
+
     <!-- 统计总成本根据当前用户的部门和日期 全部部门 -->
     <select id="getZcbByDate" resultType="BigDecimal">
         SELECT
@@ -40,6 +54,16 @@
             yearmonth = #{nowDate}
     </select>
 
+    <!-- 总成本明细 根据当前用户的部门和日期 全部部门 -->
+    <select id="getZcbDetailByDate" resultType="org.jeecg.modules.Index.entity.vo.EightCostsDetail">
+        SELECT
+            *
+        FROM
+            kzks_project_cost_cb
+        WHERE
+            yearmonth = #{nowDate}
+    </select>
+
 
     <!-- 根据年查询所有部门的总成本 -->
     <select id="getZcbByYear" resultType="BigDecimal">

+ 15 - 4
module_kzks/src/main/java/org/jeecg/modules/Index/service/IndexZcbService.java

@@ -1,7 +1,9 @@
 package org.jeecg.modules.Index.service;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.jeecg.modules.Index.entity.vo.*;
 import org.jeecg.modules.Index.entity.dto.IndexInfoParamDto;
+import org.jeecg.modules.xmcbDetail.entity.ComContractInfoExchange;
 
 import javax.servlet.http.HttpServletRequest;
 import java.time.LocalDate;
@@ -25,13 +27,22 @@ public interface IndexZcbService {
      */
     public List<IndexTotalVo> getZhiChuTotalList(HttpServletRequest request,List<String> departNameList);
 
-
     /**
-     *   author: dzc
+     *   author: sl
      *   version: 1.0
-     *   des: 获取 八项成本相关信息 的service方法
-     *   date: 2023/9/22
+     *   des:  首页成本一级当月成本明细
+     *   date: 2024/3/5
      */
+    public List<EightCostsDetail> getZhiChuDetailList(Page<EightCostsDetail> page, HttpServletRequest request, List<String> departNameList);
+
+
+
+        /**
+         *   author: dzc
+         *   version: 1.0
+         *   des: 获取 八项成本相关信息 的service方法
+         *   date: 2023/9/22
+         */
     public List<EightCostChartInfoVo> getEightCostsList(IndexInfoParamDto indexInfoParamDto,HttpServletRequest request,List<String> departNameList);
 
     /**

+ 46 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/service/impl/IndexZcbServiceImpl.java

@@ -3,6 +3,7 @@ package org.jeecg.modules.Index.service.impl;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.subject.Subject;
@@ -21,6 +22,7 @@ import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.mapper.SysDepartMapper;
 import org.jeecg.modules.system.mapper.SysUserDepartMapper;
 import org.jeecg.modules.system.mapper.SysUserMapper;
+import org.jeecg.modules.xmcbDetail.entity.ComContractInfoExchange;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -330,6 +332,50 @@ public class IndexZcbServiceImpl implements IndexZcbService {
     }
 
     /**
+     *   author: sl
+     *   version: 1.0
+     *   des:  首页成本一级当月成本明细
+     *   date: 2024/3/5
+     */
+    @Override
+    public List<EightCostsDetail> getZhiChuDetailList(Page<EightCostsDetail> page, HttpServletRequest request, List<String> departNameList) {
+        String userNameByToken = JwtUtil.getUserNameByToken(request);
+        LoginUser sysUser = iSysBaseAPI.getUserByName(userNameByToken);
+        List<EightCostsDetail> eightCostsDetailList = new ArrayList<>();
+        // 获取当前登录的用户名
+        String username = JwtUtil.getUserNameByToken(request);
+        //获取当前用户的角色的集合 (一个用户可能会有多个角色)
+        String role = commonMethod.getRole(username);
+        List<String> deptList = null;
+        if (AuthMark.BOSS.equals(role) && departNameList != null && !departNameList.isEmpty()){
+            role = AuthMark.DEPT_LEADER;
+            deptList = departNameList;
+        }else {
+            SysUser sysUser1 = sysUserMapper.selectUserById(sysUser.getId());
+            String[] deptIds = sysUser1.getDepartIds().split(",");
+            deptList = Arrays.asList(deptIds);
+        }
+        // 根据用户名查询对应的部门
+
+        //处理当前系统日期
+        SimpleDateFormat simpl1 = new SimpleDateFormat("yyyy-MM");
+        String nowMonth = DateUtils.date2Str(DateUtils.getDate(), simpl1);
+
+        if (AuthMark.BOSS.equals(role)){ // 如果当前用户角色是领导,则查询全部部门的总成本
+            eightCostsDetailList = indexZcbMapper.getZcbDetailByDate(page, nowMonth);
+        }
+        if (AuthMark.DEPT_LEADER.equals(role)){  // 如果当前用户角色是部门领导,则查询当前部门的总成本
+            //当月支出 (今年当月的总成本)
+            eightCostsDetailList = indexZcbMapper.getZcbDetailByDepartAndYearMonth(page, deptList, nowMonth);
+        }
+//        if (role == null){  // 如果是空 就给0
+//            projectZhiChu.setYearTotal(BigDecimal.valueOf(0));//当年总收入
+//        }
+
+        return eightCostsDetailList;
+    }
+
+    /**
      *   author: dzc
      *   version: 1.0
      *   des: 获取 八项成本相关信息 的service方法   ---> 成本二级  八项成本柱状图 + 总成本折线图 (折柱混合图)