From 6c138d1f4d14f200e9f2ddc6fdfaed7e0778cc15 Mon Sep 17 00:00:00 2001 From: lcj <2331845269@qq.com> Date: Sun, 28 Sep 2025 09:46:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EnterpriseBigScreenController.java | 10 +-- .../service/EnterpriseBigScreenService.java | 2 +- .../impl/EnterpriseBigScreenServiceImpl.java | 8 ++- .../domain/bo/BusPlanDocAssociationBo.java | 13 ++-- .../impl/BusPurchaseDocServiceImpl.java | 12 ++-- .../weathermanager/WeatherConstant.java | 5 ++ .../weathermanager/WeatherManager.java | 14 +++++ .../weathermanager/vo/CitySearchVo.java | 52 ++++++++++++++++ .../MatMaterialReceiveCreateReq.java | 1 - .../MatMaterialsInventoryServiceImpl.java | 1 - .../domain/vo/WgzQuestionSavePdfVo.java | 15 +++-- .../impl/WgzQuestionSavePdfServiceImpl.java | 62 +++++++++---------- 12 files changed, 126 insertions(+), 69 deletions(-) create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/weathermanager/vo/CitySearchVo.java diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/controller/EnterpriseBigScreenController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/controller/EnterpriseBigScreenController.java index 080a90d7..8ff4225b 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/controller/EnterpriseBigScreenController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/controller/EnterpriseBigScreenController.java @@ -4,13 +4,12 @@ import cn.dev33.satoken.annotation.SaCheckPermission; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import org.dromara.bigscreen.domain.dto.WeatherQueryReq; import org.dromara.bigscreen.domain.vo.*; import org.dromara.bigscreen.mapper.ProjectBigScreenMapper; import org.dromara.bigscreen.service.EnterpriseBigScreenService; import org.dromara.common.core.domain.R; -import org.dromara.common.core.utils.DateUtils; -import org.dromara.common.utils.BigDecimalUtil; import org.dromara.manager.weathermanager.vo.WeatherVo; import org.dromara.project.domain.BusAttendance; import org.dromara.project.domain.BusProject; @@ -23,16 +22,11 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.io.File; -import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; -import java.text.DecimalFormat; import java.time.LocalDate; import java.time.temporal.ChronoUnit; import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import java.util.stream.Collectors; /** @@ -218,7 +212,7 @@ public class EnterpriseBigScreenController { // return vo; // }).toList()); ArrayList projectAttendanceCountVos = new ArrayList<>(); - List busProjects = projectService.getBaseMapper().selectList(new LambdaQueryWrapper().eq(BusProject::getPId, 0L).eq(BusProject::getIsDelete,0)); + List busProjects = projectService.getBaseMapper().selectList(new LambdaQueryWrapper().eq(BusProject::getPId, 0L).eq(BusProject::getIsDelete, 0)); List projectIds = new ArrayList<>(); for (BusProject busProject : busProjects) { projectIds.add(busProject.getId()); diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/EnterpriseBigScreenService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/EnterpriseBigScreenService.java index 00162b62..5e7e0d6c 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/EnterpriseBigScreenService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/EnterpriseBigScreenService.java @@ -41,7 +41,7 @@ public interface EnterpriseBigScreenService { List getRiskEarlyWarning(); /** - * 获取3天的天气列表 + * 获取当前登录用户3天的天气列表 * * @param req 查询参数 * @return 天气列表 diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/impl/EnterpriseBigScreenServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/impl/EnterpriseBigScreenServiceImpl.java index ed8f529e..7c384044 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/impl/EnterpriseBigScreenServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/impl/EnterpriseBigScreenServiceImpl.java @@ -11,7 +11,10 @@ import org.dromara.common.utils.BigDecimalUtil; import org.dromara.manager.weathermanager.WeatherConstant; import org.dromara.manager.weathermanager.WeatherManager; import org.dromara.manager.weathermanager.vo.WeatherVo; -import org.dromara.out.domain.*; +import org.dromara.out.domain.BusProcurement; +import org.dromara.out.domain.OutConstructionValueRange; +import org.dromara.out.domain.OutMonthPlanAudit; +import org.dromara.out.domain.OutValueAllocation; import org.dromara.out.service.*; import org.dromara.progress.domain.PgsProgressCategory; import org.dromara.progress.service.IPgsProgressCategoryService; @@ -350,9 +353,8 @@ public class EnterpriseBigScreenServiceImpl implements EnterpriseBigScreenServic } /** - * 获取3天的天气列表 + * 获取当前登录用户3天的天气列表 * - * @param req 查询参数 * @return 天气列表 */ @Override diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/domain/bo/BusPlanDocAssociationBo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/domain/bo/BusPlanDocAssociationBo.java index 9a2f743e..6683d1f0 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/domain/bo/BusPlanDocAssociationBo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/domain/bo/BusPlanDocAssociationBo.java @@ -1,13 +1,13 @@ package org.dromara.cailiaoshebei.domain.bo; -import org.dromara.cailiaoshebei.domain.BusPlanDocAssociation; -import org.dromara.common.mybatis.core.domain.BaseEntity; -import org.dromara.common.core.validate.AddGroup; -import org.dromara.common.core.validate.EditGroup; import io.github.linpeilie.annotations.AutoMapper; +import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; -import jakarta.validation.constraints.*; +import org.dromara.cailiaoshebei.domain.BusPlanDocAssociation; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.mybatis.core.domain.BaseEntity; import java.math.BigDecimal; @@ -25,7 +25,7 @@ public class BusPlanDocAssociationBo extends BaseEntity { /** * 主键ID */ - @NotNull(message = "主键ID不能为空", groups = { EditGroup.class }) + @NotNull(message = "主键ID不能为空", groups = {EditGroup.class}) private Long id; /** @@ -46,5 +46,6 @@ public class BusPlanDocAssociationBo extends BaseEntity { /** * 需求数量 */ + @NotNull(message = "需求数量不能为空", groups = {AddGroup.class, EditGroup.class}) private BigDecimal demandQuantity; } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/service/impl/BusPurchaseDocServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/service/impl/BusPurchaseDocServiceImpl.java index 124e09ac..4eab0c08 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/service/impl/BusPurchaseDocServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/service/impl/BusPurchaseDocServiceImpl.java @@ -59,7 +59,6 @@ import org.springframework.transaction.annotation.Transactional; import java.io.*; import java.math.BigDecimal; -import java.math.RoundingMode; import java.net.FileNameMap; import java.net.URLConnection; import java.net.URLEncoder; @@ -205,7 +204,7 @@ public class BusPurchaseDocServiceImpl extends ServiceImpl associationList){ + public void validNum(List associationList) { for (BusPlanDocAssociationBo association : associationList) { @@ -218,7 +217,8 @@ public class BusPurchaseDocServiceImpl extends ServiceImpl 0){ + + if (total.add(association.getDemandQuantity()).compareTo(byId.getDemandQuantity()) > 0) { throw new ServiceException("材料:" + byId.getName() + "已超出计划单的物料批次需求计划数量"); } } @@ -226,8 +226,6 @@ public class BusPurchaseDocServiceImpl extends ServiceImpl 0){ + if (total.add(association.getDemandQuantity()).compareTo(byId.getDemandQuantity()) > 0) { throw new ServiceException("材料:" + byId.getName() + "已超出计划单的物料批次需求计划数量"); } } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/weathermanager/WeatherConstant.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/weathermanager/WeatherConstant.java index 6cf765f4..8397a860 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/weathermanager/WeatherConstant.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/weathermanager/WeatherConstant.java @@ -15,6 +15,11 @@ public interface WeatherConstant { */ String THREE_DAYS_WEATHER_PATH = "/v7/weather/3d"; + /** + * 城市搜索 + */ + String CITY_SEARCH = "/geo/v2/city/lookup"; + /** * 天气信息 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/weathermanager/WeatherManager.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/weathermanager/WeatherManager.java index e558d091..56c25125 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/weathermanager/WeatherManager.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/weathermanager/WeatherManager.java @@ -11,6 +11,7 @@ import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.dromara.common.core.constant.HttpStatus; import org.dromara.common.core.exception.ServiceException; +import org.dromara.manager.weathermanager.vo.CitySearchVo; import org.dromara.manager.weathermanager.vo.WeatherVo; import org.springframework.stereotype.Component; @@ -138,6 +139,19 @@ public class WeatherManager { return String.format("https://%s%s?location=%s&lang=%s", weatherProperties.getApiHost(), weatherPath, location, lang); } + /** + * 获取城市搜索 Url + * + * @param citySearchPath 城市搜索请求路径 + * @param location 位置 + * @param adm 地区 + * @param lang 语言 + */ + private String getCitySearchUrl(String citySearchPath, String location, String adm, String lang) { + return String.format("https://%s%s?location=%s&adm=%s&lang=%s", + weatherProperties.getApiHost(), citySearchPath, location, adm, lang); + } + /** * 获取小数点后两位的经纬度 * diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/weathermanager/vo/CitySearchVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/weathermanager/vo/CitySearchVo.java new file mode 100644 index 00000000..1b26d1ff --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/weathermanager/vo/CitySearchVo.java @@ -0,0 +1,52 @@ +package org.dromara.manager.weathermanager.vo; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author lilemy + * @date 2025-09-26 19:04 + */ +@Data +public class CitySearchVo implements Serializable { + + @Serial + private static final long serialVersionUID = 5453880592207725328L; + + /** + * 城市名称 + */ + private String name; + + /** + * 城市id + */ + private Long id; + + /** + * 城市经度 + */ + private String lat; + + /** + * 城市纬度 + */ + private String lon; + + /** + * 城市的上级行政区划名称 + */ + private String adm2; + + /** + * 城市所属一级行政区域 + */ + private String adm1; + + /** + * 城市所属国家名称 + */ + private String country; +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveCreateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveCreateReq.java index 04c4f41d..6c471fb5 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveCreateReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveCreateReq.java @@ -46,7 +46,6 @@ public class MatMaterialReceiveCreateReq implements Serializable { /** * 设备材料名称 */ - @NotBlank(message = "设备材料名称不能为空") private String materialName; /** diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialsInventoryServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialsInventoryServiceImpl.java index 56b3711c..1641cbbf 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialsInventoryServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialsInventoryServiceImpl.java @@ -14,7 +14,6 @@ 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.materials.domain.MatMaterials; import org.dromara.materials.domain.MatMaterialsInventory; import org.dromara.materials.domain.MatMaterialsUseRecord; diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/vo/WgzQuestionSavePdfVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/vo/WgzQuestionSavePdfVo.java index ea4b8ef1..17eded38 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/vo/WgzQuestionSavePdfVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/vo/WgzQuestionSavePdfVo.java @@ -1,19 +1,17 @@ package org.dromara.safety.domain.vo; +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.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; import org.dromara.common.translation.annotation.Translation; import org.dromara.common.translation.constant.TransConstant; import org.dromara.safety.domain.WgzQuestionSavePdf; -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; -import com.alibaba.excel.annotation.ExcelProperty; -import org.dromara.common.excel.annotation.ExcelDictFormat; -import org.dromara.common.excel.convert.ExcelDictConvert; -import io.github.linpeilie.annotations.AutoMapper; -import lombok.Data; import java.io.Serial; import java.io.Serializable; -import java.util.Date; - /** @@ -51,6 +49,7 @@ public class WgzQuestionSavePdfVo implements Serializable { /** * 用户名 */ + @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "userId") @ExcelProperty(value = "用户名") private String userName; diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/WgzQuestionSavePdfServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/WgzQuestionSavePdfServiceImpl.java index fa6c9ef7..c8cde6ed 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/WgzQuestionSavePdfServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/WgzQuestionSavePdfServiceImpl.java @@ -2,7 +2,9 @@ package org.dromara.safety.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import jakarta.annotation.Resource; @@ -13,15 +15,12 @@ import org.dromara.safety.domain.bo.WgzQuestionSavePdfBo; import org.dromara.safety.domain.vo.WgzQuestionSavePdfVo; import org.dromara.safety.mapper.WgzQuestionSavePdfMapper; import org.dromara.safety.service.IWgzQuestionSavePdfService; -import org.dromara.system.domain.vo.SysUserVo; import org.dromara.system.service.ISysUserService; import org.springframework.stereotype.Service; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.Collection; /** * 用户试卷存储pdfService业务层处理 @@ -36,7 +35,7 @@ public class WgzQuestionSavePdfServiceImpl extends ServiceImpl queryPageList(WgzQuestionSavePdfBo bo, PageQuery pageQuery) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); - // 根据id获取到用户名 - result.getRecords().forEach(item -> { - SysUserVo sysUserVo = userService.selectUserById(item.getUserId()); - item.setUserName(sysUserVo.getNickName()); - }); return TableDataInfo.build(result); } @@ -92,40 +86,40 @@ public class WgzQuestionSavePdfServiceImpl extends ServiceImpl ids, Boolean isValid) { - if(isValid){ + if (isValid) { //TODO 做一些业务上的校验,判断是否需要校验 } return removeByIds(ids); } - @Override - public WgzQuestionSavePdf queryByUserId(Long userId) { - LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); - lqw.eq(WgzQuestionSavePdf::getUserId, userId); - return baseMapper.selectOne(lqw); - } + @Override + public WgzQuestionSavePdf queryByUserId(Long userId) { + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(WgzQuestionSavePdf::getUserId, userId); + return baseMapper.selectOne(lqw); + } - @Override - public Boolean deleteByUserId(Long userId) { - //1、查询数据 - WgzQuestionSavePdf wgzQuestionSavePdf = queryByUserId(userId); - //2、删除数据 - LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); - lqw.eq(WgzQuestionSavePdf::getUserId, userId); - int delete = baseMapper.delete(lqw); - //3、删除相对路径的pdf文件 - if(delete > 0){ - String path = wgzQuestionSavePdf.getPath(); - StrUtil.removePrefix(path, "upload/"); - StrUtil.removePrefix(path, "upload\\"); - } - return true; - } + @Override + public Boolean deleteByUserId(Long userId) { + //1、查询数据 + WgzQuestionSavePdf wgzQuestionSavePdf = queryByUserId(userId); + //2、删除数据 + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(WgzQuestionSavePdf::getUserId, userId); + int delete = baseMapper.delete(lqw); + //3、删除相对路径的pdf文件 + if (delete > 0) { + String path = wgzQuestionSavePdf.getPath(); + StrUtil.removePrefix(path, "upload/"); + StrUtil.removePrefix(path, "upload\\"); + } + return true; + } }