diff --git a/data-center-business-controller/src/main/java/com/techsor/datacenter/business/configurator/CrosXssFilter.java b/data-center-business-controller/src/main/java/com/techsor/datacenter/business/configurator/CrosXssFilter.java index 4f79732..a99348f 100644 --- a/data-center-business-controller/src/main/java/com/techsor/datacenter/business/configurator/CrosXssFilter.java +++ b/data-center-business-controller/src/main/java/com/techsor/datacenter/business/configurator/CrosXssFilter.java @@ -53,7 +53,7 @@ public class CrosXssFilter implements Filter { String requestUri = httpRequest.getRequestURI(); // 当 URL 不包含 /common/ 时,校验 Referer // if (!requestUri.contains("/common/") && !requestUri.contains("swagger")) { - if (!requestUri.contains("/swagger")) { + if (!requestUri.contains("/swagger") && !requestUri.contains("/api-docs")) { String referer = httpRequest.getHeader("Referer"); if (StringUtils.isNotBlank(referer)){ if(!"*".equals(accessControlAllowOrigin)){ diff --git a/data-center-business-controller/src/main/java/com/techsor/datacenter/business/controller/DashboardNotificationController.java b/data-center-business-controller/src/main/java/com/techsor/datacenter/business/controller/DashboardNotificationController.java new file mode 100644 index 0000000..5c881cf --- /dev/null +++ b/data-center-business-controller/src/main/java/com/techsor/datacenter/business/controller/DashboardNotificationController.java @@ -0,0 +1,95 @@ +package com.techsor.datacenter.business.controller; + +import com.techsor.datacenter.business.common.exception.BusinessException; +import com.techsor.datacenter.business.common.response.PageInfo; +import com.techsor.datacenter.business.common.response.PageResponse; +import com.techsor.datacenter.business.common.response.ResponseCode; +import com.techsor.datacenter.business.common.response.SimpleDataResponse; +import com.techsor.datacenter.business.configurator.interceptor.AccessRequired; +import com.techsor.datacenter.business.dto.dashboardnotification.DashboardNotificationSearchParams; +import com.techsor.datacenter.business.dto.dashboardnotification.DeleteDashboardNotificationParams; +import com.techsor.datacenter.business.dto.dashboardnotification.OptDashboardNotificationParams; +import com.techsor.datacenter.business.service.DashboardNotificationService; +import com.techsor.datacenter.business.vo.dashboardnotification.DashboardNotificationPageVO; +import io.swagger.v3.oas.annotations.Hidden; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RestController +@AccessRequired +@RequestMapping("/dashboardNotification") +@Tag(name = "dashboard通知管理", description = "Data Provider manage API") +@SuppressWarnings("unchecked") +public class DashboardNotificationController { + + private static Logger logger = LoggerFactory.getLogger(DashboardNotificationController.class); + + @Autowired + private DashboardNotificationService dashboardNotificationService; + + @Operation(summary = "Add dashboard notification") + @RequestMapping(value = "/add", method = RequestMethod.POST) + public SimpleDataResponse add( + @RequestBody OptDashboardNotificationParams optDashboardNotificationParams, + @RequestHeader String LoginName, + @RequestHeader String AccessToken, + @RequestHeader Long UserId, + @RequestHeader(required = false) Long CompanyId, + @RequestHeader Integer LanguageType) { + return dashboardNotificationService.add(optDashboardNotificationParams, UserId, CompanyId, LanguageType); + } + + @Operation(summary = "Edit dashboard notification") + @RequestMapping(value = "/edit", method = RequestMethod.POST) + public SimpleDataResponse edit( + @RequestBody OptDashboardNotificationParams optDashboardNotificationParams, + @RequestHeader String LoginName, + @RequestHeader String AccessToken, + @RequestHeader Long UserId, + @RequestHeader(required = false) Long CompanyId, + @RequestHeader Integer LanguageType) { + return dashboardNotificationService.edit(optDashboardNotificationParams, UserId, CompanyId, LanguageType); + } + + @Operation(summary = "Delete dashboard notification") + @RequestMapping(value = "/batchDelete", method = RequestMethod.POST) + public SimpleDataResponse batchDelete( + @RequestBody DeleteDashboardNotificationParams deleteParams, + @RequestHeader String LoginName, + @RequestHeader String AccessToken, + @RequestHeader Long UserId, + @RequestHeader(required = false) Long CompanyId, + @RequestHeader Integer LanguageType) { + return dashboardNotificationService.batchDelete(deleteParams, UserId, CompanyId, LanguageType); + } + + @Operation(summary = "Get dashboard notification list") + @RequestMapping(value = "/getListPage", method = RequestMethod.GET) + public PageResponse> getListPage( + @RequestHeader String LoginName, + @RequestHeader String AccessToken, + @RequestHeader Long UserId, + @RequestHeader(required = false) Long CompanyId, + @RequestHeader Integer LanguageType, + @RequestHeader Integer UTCOffset, + DashboardNotificationSearchParams searchParams) throws BusinessException { + + searchParams.setUserId(UserId); + PageResponse> response = new PageResponse<>(); + try { + response.setData(dashboardNotificationService.getListPage(searchParams, CompanyId, UserId, LanguageType, UTCOffset)); + response.setCode(ResponseCode.SUCCESS); + response.setMsg("success"); + } catch (Exception e) { + logger.error("Error querying list", e); + response.setCode(ResponseCode.SERVER_ERROR); + response.setMsg("service error"); + } + return response; + } + +} diff --git a/data-center-business-controller/src/main/resources/db/migration/V64__getewayclients_update.sql b/data-center-business-controller/src/main/resources/db/migration/V64__getewayclients_update.sql new file mode 100644 index 0000000..c758be2 --- /dev/null +++ b/data-center-business-controller/src/main/resources/db/migration/V64__getewayclients_update.sql @@ -0,0 +1,3 @@ +ALTER TABLE `gateway_clients` +ADD COLUMN `project_id` BIGINT NULL DEFAULT 0 AFTER `alert_switch`, +ADD COLUMN `building_id` BIGINT NULL DEFAULT 0 AFTER `project_id`; \ No newline at end of file diff --git a/data-center-business-controller/src/main/resources/db/migration/V65__device_update.sql b/data-center-business-controller/src/main/resources/db/migration/V65__device_update.sql new file mode 100644 index 0000000..6ed449d --- /dev/null +++ b/data-center-business-controller/src/main/resources/db/migration/V65__device_update.sql @@ -0,0 +1,2 @@ +ALTER TABLE `device_info` +ADD COLUMN `gateway_client_id` INT NULL DEFAULT NULL AFTER `asset_id`; diff --git a/data-center-business-controller/src/main/resources/db/migration/V66__decimal_places_notice.sql b/data-center-business-controller/src/main/resources/db/migration/V66__decimal_places_notice.sql new file mode 100644 index 0000000..962548a --- /dev/null +++ b/data-center-business-controller/src/main/resources/db/migration/V66__decimal_places_notice.sql @@ -0,0 +1,17 @@ +ALTER TABLE device_info ADD ( + `dashboard_decimal_places` int DEFAULT 2 COMMENT 'dashboard显示小数位数' +); + +CREATE TABLE `dashboard_notification` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `company_id` bigint DEFAULT NULL COMMENT '公司ID', + `demand_time` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '要求时间', + `category` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '分类', + `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '通知内容', + `flag` int NULL DEFAULT 0, + `created_at` bigint NULL DEFAULT NULL COMMENT '创建时间', + `created_by` bigint NULL DEFAULT NULL COMMENT '创建人', + `updated_at` bigint NULL DEFAULT NULL COMMENT '更新时间', + `updated_by` bigint NULL DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB COMMENT = '通知表'; \ No newline at end of file diff --git a/data-center-business-controller/src/main/resources/db/migration/V67__dashboard_device_group_class.sql b/data-center-business-controller/src/main/resources/db/migration/V67__dashboard_device_group_class.sql new file mode 100644 index 0000000..0df8416 --- /dev/null +++ b/data-center-business-controller/src/main/resources/db/migration/V67__dashboard_device_group_class.sql @@ -0,0 +1,7 @@ + +DELETE FROM dashboard_device_group; +ALTER TABLE dashboard_device_group AUTO_INCREMENT = 1; + +DELETE FROM dashboard_device_group_relation; + +ALTER TABLE dashboard_device_group ADD `class_id` int DEFAULT NULL COMMENT '2-积算、3-计测、4-状态' after building_id; \ No newline at end of file diff --git a/data-center-business-dao/src/main/java/com/techsor/datacenter/business/dao/auto/DashboardNotificationMapper.java b/data-center-business-dao/src/main/java/com/techsor/datacenter/business/dao/auto/DashboardNotificationMapper.java new file mode 100644 index 0000000..b7843c5 --- /dev/null +++ b/data-center-business-dao/src/main/java/com/techsor/datacenter/business/dao/auto/DashboardNotificationMapper.java @@ -0,0 +1,120 @@ +package com.techsor.datacenter.business.dao.auto; + +import com.techsor.datacenter.business.model.DashboardNotification; +import com.techsor.datacenter.business.model.DashboardNotificationExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface DashboardNotificationMapper { + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table dashboard_notification + * + * @mbg.generated + */ + long countByExample(DashboardNotificationExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table dashboard_notification + * + * @mbg.generated + */ + int deleteByExample(DashboardNotificationExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table dashboard_notification + * + * @mbg.generated + */ + int deleteByPrimaryKey(Long id); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table dashboard_notification + * + * @mbg.generated + */ + int insert(DashboardNotification record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table dashboard_notification + * + * @mbg.generated + */ + int insertSelective(DashboardNotification record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table dashboard_notification + * + * @mbg.generated + */ + List selectByExampleWithBLOBs(DashboardNotificationExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table dashboard_notification + * + * @mbg.generated + */ + List selectByExample(DashboardNotificationExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table dashboard_notification + * + * @mbg.generated + */ + DashboardNotification selectByPrimaryKey(Long id); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table dashboard_notification + * + * @mbg.generated + */ + int updateByExampleSelective(@Param("record") DashboardNotification record, @Param("example") DashboardNotificationExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table dashboard_notification + * + * @mbg.generated + */ + int updateByExampleWithBLOBs(@Param("record") DashboardNotification record, @Param("example") DashboardNotificationExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table dashboard_notification + * + * @mbg.generated + */ + int updateByExample(@Param("record") DashboardNotification record, @Param("example") DashboardNotificationExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table dashboard_notification + * + * @mbg.generated + */ + int updateByPrimaryKeySelective(DashboardNotification record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table dashboard_notification + * + * @mbg.generated + */ + int updateByPrimaryKeyWithBLOBs(DashboardNotification record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table dashboard_notification + * + * @mbg.generated + */ + int updateByPrimaryKey(DashboardNotification record); +} \ No newline at end of file diff --git a/data-center-business-dao/src/main/java/com/techsor/datacenter/business/dao/ex/DashboardNotificationMapperExt.java b/data-center-business-dao/src/main/java/com/techsor/datacenter/business/dao/ex/DashboardNotificationMapperExt.java new file mode 100644 index 0000000..d43ba99 --- /dev/null +++ b/data-center-business-dao/src/main/java/com/techsor/datacenter/business/dao/ex/DashboardNotificationMapperExt.java @@ -0,0 +1,15 @@ +package com.techsor.datacenter.business.dao.ex; + +import com.techsor.datacenter.business.dao.auto.DashboardNotificationMapper; +import com.techsor.datacenter.business.dto.dashboardnotification.DashboardNotificationSearchParams; +import com.techsor.datacenter.business.dto.dashboardnotification.OptDashboardNotificationParams; +import com.techsor.datacenter.business.vo.dashboardnotification.DashboardNotificationPageVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface DashboardNotificationMapperExt extends DashboardNotificationMapper{ + + List getListPage(DashboardNotificationSearchParams pageSearchParam); +} diff --git a/data-center-business-dao/src/main/resources/mappers/auto/DashboardNotificationMapper.xml b/data-center-business-dao/src/main/resources/mappers/auto/DashboardNotificationMapper.xml new file mode 100644 index 0000000..9321060 --- /dev/null +++ b/data-center-business-dao/src/main/resources/mappers/auto/DashboardNotificationMapper.xml @@ -0,0 +1,423 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + id, company_id, demand_time, category, flag, created_at, created_by, updated_at, + updated_by + + + + content + + + + + + + delete from dashboard_notification + where id = #{id,jdbcType=BIGINT} + + + + delete from dashboard_notification + + + + + + + + SELECT LAST_INSERT_ID() + + insert into dashboard_notification (company_id, demand_time, category, + flag, created_at, created_by, + updated_at, updated_by, content + ) + values (#{companyId,jdbcType=BIGINT}, #{demandTime,jdbcType=VARCHAR}, #{category,jdbcType=VARCHAR}, + #{flag,jdbcType=INTEGER}, #{createdAt,jdbcType=BIGINT}, #{createdBy,jdbcType=BIGINT}, + #{updatedAt,jdbcType=BIGINT}, #{updatedBy,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR} + ) + + + + + SELECT LAST_INSERT_ID() + + insert into dashboard_notification + + + company_id, + + + demand_time, + + + category, + + + flag, + + + created_at, + + + created_by, + + + updated_at, + + + updated_by, + + + content, + + + + + #{companyId,jdbcType=BIGINT}, + + + #{demandTime,jdbcType=VARCHAR}, + + + #{category,jdbcType=VARCHAR}, + + + #{flag,jdbcType=INTEGER}, + + + #{createdAt,jdbcType=BIGINT}, + + + #{createdBy,jdbcType=BIGINT}, + + + #{updatedAt,jdbcType=BIGINT}, + + + #{updatedBy,jdbcType=BIGINT}, + + + #{content,jdbcType=LONGVARCHAR}, + + + + + + + update dashboard_notification + + + id = #{record.id,jdbcType=BIGINT}, + + + company_id = #{record.companyId,jdbcType=BIGINT}, + + + demand_time = #{record.demandTime,jdbcType=VARCHAR}, + + + category = #{record.category,jdbcType=VARCHAR}, + + + flag = #{record.flag,jdbcType=INTEGER}, + + + created_at = #{record.createdAt,jdbcType=BIGINT}, + + + created_by = #{record.createdBy,jdbcType=BIGINT}, + + + updated_at = #{record.updatedAt,jdbcType=BIGINT}, + + + updated_by = #{record.updatedBy,jdbcType=BIGINT}, + + + content = #{record.content,jdbcType=LONGVARCHAR}, + + + + + + + + + update dashboard_notification + set id = #{record.id,jdbcType=BIGINT}, + company_id = #{record.companyId,jdbcType=BIGINT}, + demand_time = #{record.demandTime,jdbcType=VARCHAR}, + category = #{record.category,jdbcType=VARCHAR}, + flag = #{record.flag,jdbcType=INTEGER}, + created_at = #{record.createdAt,jdbcType=BIGINT}, + created_by = #{record.createdBy,jdbcType=BIGINT}, + updated_at = #{record.updatedAt,jdbcType=BIGINT}, + updated_by = #{record.updatedBy,jdbcType=BIGINT}, + content = #{record.content,jdbcType=LONGVARCHAR} + + + + + + + update dashboard_notification + set id = #{record.id,jdbcType=BIGINT}, + company_id = #{record.companyId,jdbcType=BIGINT}, + demand_time = #{record.demandTime,jdbcType=VARCHAR}, + category = #{record.category,jdbcType=VARCHAR}, + flag = #{record.flag,jdbcType=INTEGER}, + created_at = #{record.createdAt,jdbcType=BIGINT}, + created_by = #{record.createdBy,jdbcType=BIGINT}, + updated_at = #{record.updatedAt,jdbcType=BIGINT}, + updated_by = #{record.updatedBy,jdbcType=BIGINT} + + + + + + + update dashboard_notification + + + company_id = #{companyId,jdbcType=BIGINT}, + + + demand_time = #{demandTime,jdbcType=VARCHAR}, + + + category = #{category,jdbcType=VARCHAR}, + + + flag = #{flag,jdbcType=INTEGER}, + + + created_at = #{createdAt,jdbcType=BIGINT}, + + + created_by = #{createdBy,jdbcType=BIGINT}, + + + updated_at = #{updatedAt,jdbcType=BIGINT}, + + + updated_by = #{updatedBy,jdbcType=BIGINT}, + + + content = #{content,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + + update dashboard_notification + set company_id = #{companyId,jdbcType=BIGINT}, + demand_time = #{demandTime,jdbcType=VARCHAR}, + category = #{category,jdbcType=VARCHAR}, + flag = #{flag,jdbcType=INTEGER}, + created_at = #{createdAt,jdbcType=BIGINT}, + created_by = #{createdBy,jdbcType=BIGINT}, + updated_at = #{updatedAt,jdbcType=BIGINT}, + updated_by = #{updatedBy,jdbcType=BIGINT}, + content = #{content,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=BIGINT} + + + + update dashboard_notification + set company_id = #{companyId,jdbcType=BIGINT}, + demand_time = #{demandTime,jdbcType=VARCHAR}, + category = #{category,jdbcType=VARCHAR}, + flag = #{flag,jdbcType=INTEGER}, + created_at = #{createdAt,jdbcType=BIGINT}, + created_by = #{createdBy,jdbcType=BIGINT}, + updated_at = #{updatedAt,jdbcType=BIGINT}, + updated_by = #{updatedBy,jdbcType=BIGINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/data-center-business-dao/src/main/resources/mappers/auto/DeviceGroupMapper.xml b/data-center-business-dao/src/main/resources/mappers/auto/DeviceGroupMapper.xml index 3c9e15d..3ce8f0b 100644 --- a/data-center-business-dao/src/main/resources/mappers/auto/DeviceGroupMapper.xml +++ b/data-center-business-dao/src/main/resources/mappers/auto/DeviceGroupMapper.xml @@ -9,6 +9,7 @@ + @@ -86,7 +87,7 @@ WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> - id, company_id, building_id, `name`, remark, flag, created_by, created_at + id, company_id, building_id, class_id, `name`, remark, flag, created_by, created_at