This commit is contained in:
lcj
2025-10-20 14:19:43 +08:00
parent f3473fe5d5
commit 80ec8ff86d
12 changed files with 133 additions and 27 deletions

View File

@ -1,6 +1,5 @@
package org.dromara.bigscreen.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
@ -62,7 +61,7 @@ public class MoneyBigScreenController {
/**
* 查询项目位置列表
*/
@SaCheckPermission("money:bigScreen:projectGis")
// @SaCheckPermission("money:bigScreen:projectGis")
@GetMapping("/project/gis")
public R<List<BusProjectGisVo>> getProjectGis() {
return R.ok(moneyBigScreenService.getProjectGis());
@ -545,7 +544,7 @@ public class MoneyBigScreenController {
/**
* 查询项目天气
*/
@SaCheckPermission("project:bigScreen:weather")
// @SaCheckPermission("project:bigScreen:weather")
@GetMapping("/weather/{projectId}")
public R<List<WeatherVo>> getProjectWeather(@NotNull(message = "主键不能为空")
@PathVariable Long projectId) {
@ -555,7 +554,7 @@ public class MoneyBigScreenController {
/**
* 查询项目安全天数
*/
@SaCheckPermission("project:bigScreen:safetyDay")
// @SaCheckPermission("project:bigScreen:safetyDay")
@GetMapping("/safetyDay/{projectId}")
public R<BusProjectSafetyDayVo> getProjectSafetyDay(@NotNull(message = "主键不能为空")
@PathVariable Long projectId) {

View File

@ -1,6 +1,5 @@
package org.dromara.bigscreen.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -296,7 +295,7 @@ public class ProjectBigScreenController extends BaseController {
/**
* 查询GPS设备用户列表
*/
@SaCheckPermission("project:big:screen")
// @SaCheckPermission("project:big:screen")
@GetMapping("/getList")
public R<List<String>> getList(Long projectId) {
return R.ok(projectBigScreenService.getList(projectId));
@ -316,7 +315,7 @@ public class ProjectBigScreenController extends BaseController {
/**
* 查询地图项目分类
*/
@SaCheckPermission("project:big:screen")
// @SaCheckPermission("project:big:screen")
@GetMapping("/getProjectMapList")
public R<Map<String, Map<String, Map<String, String>>>> getProjectMapList() {
return R.ok(projectService.getProjectMapList());
@ -325,7 +324,7 @@ public class ProjectBigScreenController extends BaseController {
/**
* 查询地图项目分类
*/
@SaCheckPermission("project:big:screen")
// @SaCheckPermission("project:big:screen")
@PostMapping("/updatePosition")
public R<Void> updatePosition(@RequestBody ProjectUpdateDto dto) {
return toAjax(projectService.updatePosition(dto));

View File

@ -29,6 +29,11 @@ public class CtrSubcontractProgressSettlement extends BaseEntity {
@TableId(value = "id")
private Long id;
/**
* 所属部门
*/
private Long deptId;
/**
* 单据编码
*/

View File

@ -60,6 +60,11 @@ public class CtrContractProgressSettlementBo extends BaseEntity {
@NotBlank(message = "合同编码不能为空", groups = {AddGroup.class, EditGroup.class})
private String contractCode;
/**
* 类型1付款 2收款
*/
private String type;
/**
* 合同名称
*/

View File

@ -31,12 +31,6 @@ public class CtrContractProgressSettlementCreateReq implements Serializable {
@NotNull(message = "所属部门不能为空")
private Long deptId;
/**
* 单据编码
*/
@NotBlank(message = "单据编码不能为空")
private String documentCode;
/**
* 标题
*/

View File

@ -24,10 +24,9 @@ public class CtrSubcontractProgressSettlementCreateReq implements Serializable {
private static final long serialVersionUID = 770553999547826460L;
/**
* 单据编码
* 所属部门
*/
@NotBlank(message = "单据编码不能为空")
private String documentCode;
private Long deptId;
/**
* 标题

View File

@ -41,6 +41,12 @@ public class CtrContractProgressSettlementVo implements Serializable {
@ExcelProperty(value = "所属部门")
private Long deptId;
/**
* 部门名称
*/
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "deptId")
private String deptName;
/**
* 单据编码
*/
@ -114,6 +120,12 @@ public class CtrContractProgressSettlementVo implements Serializable {
@ExcelProperty(value = "结算单位(客户)")
private Long settlementUnit;
/**
* 结算单位名称
*/
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "settlementUnit")
private String settlementUnitName;
/**
* 本期结算金额
*/

View File

@ -4,6 +4,8 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.ctr.domain.CtrSubcontractProgressSettlement;
import java.io.Serial;
@ -45,6 +47,18 @@ public class CtrSubcontractProgressSettlementVo implements Serializable {
@ExcelProperty(value = "标题")
private String title;
/**
* 所属部门
*/
@ExcelProperty(value = "所属部门")
private Long deptId;
/**
* 部门名称
*/
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "deptId")
private String deptName;
/**
* 单据日期
*/
@ -105,6 +119,12 @@ public class CtrSubcontractProgressSettlementVo implements Serializable {
@ExcelProperty(value = "结算单位")
private Long settlementUnit;
/**
* 结算单位名称
*/
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "settlementUnit")
private String settlementUnitName;
/**
* 合同金额
*/

View File

@ -1,6 +1,7 @@
package org.dromara.ctr.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -8,9 +9,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.ObjectUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.ctr.domain.CtrContractProgressSettlement;
import org.dromara.ctr.domain.CtrContractProgressSettlementItem;
import org.dromara.ctr.domain.bo.CtrContractProgressSettlementBo;
@ -23,14 +26,16 @@ import org.dromara.ctr.domain.vo.CtrContractProgressSettlementVo;
import org.dromara.ctr.mapper.CtrContractProgressSettlementMapper;
import org.dromara.ctr.service.ICtrContractProgressSettlementItemService;
import org.dromara.ctr.service.ICtrContractProgressSettlementService;
import org.dromara.system.domain.vo.SysDeptVo;
import org.dromara.system.service.ISysDeptService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -46,6 +51,8 @@ public class CtrContractProgressSettlementServiceImpl extends ServiceImpl<CtrCon
private final ICtrContractProgressSettlementItemService contractProgressSettlementItemService;
private final ISysDeptService deptService;
/**
* 查询承包合同进度结算
*
@ -101,7 +108,21 @@ public class CtrContractProgressSettlementServiceImpl extends ServiceImpl<CtrCon
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<CtrContractProgressSettlement> lqw = Wrappers.lambdaQuery();
lqw.orderByDesc(CtrContractProgressSettlement::getId);
lqw.eq(bo.getDeptId() != null, CtrContractProgressSettlement::getDeptId, bo.getDeptId());
Long deptId = bo.getDeptId();
String type = bo.getType();
if (ObjectUtils.isNotEmpty(deptId) && StringUtils.isNotBlank(type) && !LoginHelper.isSuperAdmin()) {
SysDeptVo sysDeptVo = deptService.selectDeptById(deptId);
List<Long> list = StringUtils.splitTo(sysDeptVo.getAncestors(), Convert::toLong);
if (list.size() == 2 && Objects.equals(type, "1")) {
lqw.eq(CtrContractProgressSettlement::getDeptId, deptId);
} else if (list.size() == 2 && Objects.equals(type, "2")) {
lqw.eq(CtrContractProgressSettlement::getSettlementUnit, deptId);
} else if (list.size() > 2 && Objects.equals(type, "1")) {
lqw.eq(CtrContractProgressSettlement::getDeptId, list.get(2));
} else if (list.size() > 2 && Objects.equals(type, "2")) {
lqw.eq(CtrContractProgressSettlement::getSettlementUnit, list.get(2));
}
}
lqw.like(StringUtils.isNotBlank(bo.getDocumentCode()), CtrContractProgressSettlement::getDocumentCode, bo.getDocumentCode());
lqw.eq(StringUtils.isNotBlank(bo.getTitle()), CtrContractProgressSettlement::getTitle, bo.getTitle());
lqw.eq(bo.getSettlementDate() != null, CtrContractProgressSettlement::getSettlementDate, bo.getSettlementDate());
@ -134,8 +155,22 @@ public class CtrContractProgressSettlementServiceImpl extends ServiceImpl<CtrCon
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(CtrContractProgressSettlementCreateReq req) {
CtrContractProgressSettlement add = MapstructUtils.convert(req, CtrContractProgressSettlement.class);
// 生成唯一编号
LocalDate today = LocalDate.now();
Long userId = LoginHelper.getUserId();
boolean flag;
synchronized (userId.toString().intern()) {
LocalDateTime startOfDay = today.atStartOfDay();
LocalDateTime endOfDay = today.plusDays(1).atStartOfDay().minusNanos(1);
// 获取当天的最大编号
Long count = this.lambdaQuery()
.between(CtrContractProgressSettlement::getCreateTime, startOfDay, endOfDay)
.count();
String result = String.format("%03d", count + 1); // 3表示长度0表示补0
add.setDocumentCode(today.format(DateTimeFormatter.BASIC_ISO_DATE) + "-" + result);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
flag = baseMapper.insert(add) > 0;
}
if (flag) {
Long id = add.getId();
List<CtrContractProgressSettlementItemCreateReq> inInventory = req.getInInventory();

View File

@ -11,6 +11,7 @@ import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.ctr.domain.CtrSubcontractProgressSettlement;
import org.dromara.ctr.domain.CtrSubcontractProgressSettlementItem;
import org.dromara.ctr.domain.bo.CtrSubcontractProgressSettlementBo;
@ -26,6 +27,9 @@ import org.dromara.ctr.service.ICtrSubcontractProgressSettlementService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -128,8 +132,22 @@ public class CtrSubcontractProgressSettlementServiceImpl extends ServiceImpl<Ctr
@Override
public Boolean insertByBo(CtrSubcontractProgressSettlementCreateReq req) {
CtrSubcontractProgressSettlement add = MapstructUtils.convert(req, CtrSubcontractProgressSettlement.class);
// 生成唯一编号
LocalDate today = LocalDate.now();
Long userId = LoginHelper.getUserId();
boolean flag;
synchronized (userId.toString().intern()) {
LocalDateTime startOfDay = today.atStartOfDay();
LocalDateTime endOfDay = today.plusDays(1).atStartOfDay().minusNanos(1);
// 获取当天的最大编号
Long count = this.lambdaQuery()
.between(CtrSubcontractProgressSettlement::getCreateTime, startOfDay, endOfDay)
.count();
String result = String.format("%03d", count + 1); // 3表示长度0表示补0
add.setDocumentCode(today.format(DateTimeFormatter.BASIC_ISO_DATE) + "-" + result);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
flag = baseMapper.insert(add) > 0;
}
if (flag) {
Long id = add.getId();
List<CtrSubcontractProgressSettlementItemCreateReq> inInventory = req.getInInventory();

View File

@ -780,7 +780,7 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
final Long PID = 0L;
lqw.eq(BusProject::getPId, PID);
}
if (ObjectUtils.isNotEmpty(deptId)) {
if (ObjectUtils.isNotEmpty(deptId) && deptId != 100) {
SysDeptVo sysDeptVo = deptService.selectDeptById(deptId);
List<Long> list = StringUtils.splitTo(sysDeptVo.getAncestors(), Convert::toLong);
List<Long> projectDepts = new ArrayList<>();

View File

@ -9,6 +9,7 @@ import org.dromara.common.core.domain.R;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.web.core.BaseController;
import org.dromara.system.domain.bo.SysDeptBo;
import org.dromara.system.domain.vo.SysDeptVo;
@ -157,4 +158,23 @@ public class SysDeptController extends BaseController {
return R.ok(list);
}
/**
* 获取当前登录用户顶级部门
*/
@GetMapping("/getTopDept")
public R<SysDeptVo> getTopDept() {
// 获取当前用户部门
Long deptId = LoginHelper.getDeptId();
SysDeptVo deptVo = deptService.selectDeptById(deptId);
if (LoginHelper.isSuperAdmin()) {
return R.ok(deptVo);
}
String ancestors = deptVo.getAncestors();
List<Long> ids = StringUtils.splitTo(ancestors, Convert::toLong);
if (ids.size() == 2) {
return R.ok(deptVo);
}
return R.ok(deptService.selectDeptById(ids.get(2)));
}
}