|
@@ -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方法 ---> 成本二级 八项成本柱状图 + 总成本折线图 (折柱混合图)
|