From f63b5cfa61f18d246c568e78375ce10cab93a9c7 Mon Sep 17 00:00:00 2001 From: panshuling321 Date: Fri, 11 Feb 2022 15:17:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A7=9F=E6=88=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/v2.1.sql | 2 +- xhpc-modules/pom.xml | 2 + .../xhpc/general/constant/AliyunTemplate.java | 4 + .../constant/AliyunTemplateKeyWord.java | 5 + .../general/controller/XhpcSmsController.java | 3 + xhpc-modules/xhpc-tenant/.gitignore | 35 +++ xhpc-modules/xhpc-tenant/pom.xml | 136 +++++++++ .../java/com/xhpc/XhpcTenantApplication.java | 28 ++ .../xhpc/tenant/config/AliOSSProperties.java | 24 ++ .../controller/XhpcTenantController.java | 81 +++++ .../xhpc/tenant/domain/XhpcTenantDomain.java | 99 +++++++ .../xhpc/tenant/mapper/XhpcTenantMapper.java | 37 +++ .../tenant/service/XhpcTenantService.java | 23 ++ .../service/impl/XhpcTenantServiceImpl.java | 81 +++++ .../com/xhpc/tenant/task/XhpcTenantTask.java | 62 ++++ .../com/xhpc/tenant/utils/DownloadUtil.java | 18 ++ .../xhpc-tenant/src/main/resources/banner.txt | 9 + .../src/main/resources/bootstrap.yml | 37 +++ .../src/main/resources/logback.xml | 75 +++++ .../resources/mapper/XhpcTenantMapper.xml | 279 ++++++++++++++++++ 20 files changed, 1039 insertions(+), 1 deletion(-) create mode 100644 xhpc-modules/xhpc-tenant/.gitignore create mode 100644 xhpc-modules/xhpc-tenant/pom.xml create mode 100644 xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/XhpcTenantApplication.java create mode 100644 xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/config/AliOSSProperties.java create mode 100644 xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/controller/XhpcTenantController.java create mode 100644 xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/domain/XhpcTenantDomain.java create mode 100644 xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/mapper/XhpcTenantMapper.java create mode 100644 xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/service/XhpcTenantService.java create mode 100644 xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/service/impl/XhpcTenantServiceImpl.java create mode 100644 xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/task/XhpcTenantTask.java create mode 100644 xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/utils/DownloadUtil.java create mode 100644 xhpc-modules/xhpc-tenant/src/main/resources/banner.txt create mode 100644 xhpc-modules/xhpc-tenant/src/main/resources/bootstrap.yml create mode 100644 xhpc-modules/xhpc-tenant/src/main/resources/logback.xml create mode 100644 xhpc-modules/xhpc-tenant/src/main/resources/mapper/XhpcTenantMapper.xml diff --git a/sql/v2.1.sql b/sql/v2.1.sql index d1f23fca..11d87929 100644 --- a/sql/v2.1.sql +++ b/sql/v2.1.sql @@ -116,7 +116,7 @@ CREATE TABLE `xhpc_tenant` `create_time` DATETIME NULL DEFAULT NULL COMMENT '创建时间', `update_user` BIGINT(64) NULL DEFAULT NULL COMMENT '修改人', `update_time` DATETIME NULL DEFAULT NULL COMMENT '修改时间', - `status` INT(2) NULL DEFAULT NULL COMMENT '状态', + `status` INT(2) NULL DEFAULT NULL COMMENT '状态(0-未启用,1-正常,2-停用)', `is_deleted` INT(2) NULL DEFAULT '0' COMMENT '是否已删除', PRIMARY KEY (`tenant_id`) USING BTREE ) COMMENT ='租户表' diff --git a/xhpc-modules/pom.xml b/xhpc-modules/pom.xml index 3bfb89a7..7e989be8 100644 --- a/xhpc-modules/pom.xml +++ b/xhpc-modules/pom.xml @@ -22,6 +22,8 @@ xhpc-message-board xhpc-card xhpc-data-big-screen + xhpc-workorder + xhpc-tenant xhpc-modules diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/constant/AliyunTemplate.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/constant/AliyunTemplate.java index 96ae4c22..f1e0fc61 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/constant/AliyunTemplate.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/constant/AliyunTemplate.java @@ -41,6 +41,10 @@ public class AliyunTemplate { * 工单派发通知 */ public static final String WORK_ORDER_CREATED = "SMS_232163808"; + /** + * 租户15日即将到期通知 + */ + public static final String TENANT_EXPIRING_15D = "SMS_234156819"; /** * 更新计费模型失败 diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/constant/AliyunTemplateKeyWord.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/constant/AliyunTemplateKeyWord.java index 3566a128..dc4b9731 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/constant/AliyunTemplateKeyWord.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/constant/AliyunTemplateKeyWord.java @@ -44,4 +44,9 @@ public class AliyunTemplateKeyWord { * 工单派送 */ public static final String WORK_ORDER_CREATED = "新的工单"; + + /** + * 租户15日即将到期通知 + */ + public static final String TENANT_EXPIRING_15D = "还有15天到期"; } diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java index f9963edd..9a5d5581 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java @@ -97,6 +97,9 @@ public class XhpcSmsController extends BaseController { } else if(content.contains(AliyunTemplateKeyWord.WORK_ORDER_CREATED)){ signatureName = AliyunTemplate.SIGNATURE_NAME; templateId = AliyunTemplate.WORK_ORDER_CREATED; + } else if (content.contains(AliyunTemplateKeyWord.TENANT_EXPIRING_15D)){ + signatureName = AliyunTemplate.SIGNATURE_NAME; + templateId = AliyunTemplate.TENANT_EXPIRING_15D; } xhpcSmsService.sendNotice(phone, signatureName, templateId, paramMap); diff --git a/xhpc-modules/xhpc-tenant/.gitignore b/xhpc-modules/xhpc-tenant/.gitignore new file mode 100644 index 00000000..54283dd4 --- /dev/null +++ b/xhpc-modules/xhpc-tenant/.gitignore @@ -0,0 +1,35 @@ +HELP.md +target/ +.mvn/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea/ +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/xhpc-modules/xhpc-tenant/pom.xml b/xhpc-modules/xhpc-tenant/pom.xml new file mode 100644 index 00000000..6a7617f0 --- /dev/null +++ b/xhpc-modules/xhpc-tenant/pom.xml @@ -0,0 +1,136 @@ + + + + com.ruoyi + xhpc-modules + 3.0.0 + + 4.0.0 + + xhpc-tenant + + + 租户服务 + + + 8 + 8 + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + + + org.mybatis + mybatis + 3.5.6 + + + com.github.pagehelper + pagehelper-spring-boot-starter + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-sentinel + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-web + + + + + mysql + mysql-connector-java + + + + + com.ruoyi + ruoyi-common-datasource + + + + + com.ruoyi + ruoyi-common-core + + + + com.ruoyi + xhpc-common + 3.0.0 + compile + + + + org.apache.ant + ant + 1.10.12 + + + com.aliyun.oss + aliyun-sdk-oss + 3.10.2 + compile + + + com.ruoyi + ruoyi-common-log + + + + + + ${project.artifactId} + + + src/main/resources + + + src/main/java + + **/*.xml + + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.4.0 + + + + repackage + + + + + + + + diff --git a/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/XhpcTenantApplication.java b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/XhpcTenantApplication.java new file mode 100644 index 00000000..e229ba7c --- /dev/null +++ b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/XhpcTenantApplication.java @@ -0,0 +1,28 @@ +package com.xhpc; + +import com.xhpc.common.security.annotation.EnableCustomConfig; +import com.xhpc.common.security.annotation.EnableRyFeignClients; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.properties.ConfigurationPropertiesScan; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.scheduling.annotation.EnableScheduling; + + +@EnableConfigurationProperties +@ConfigurationPropertiesScan(basePackages = {"com.xhpc.tenant.config"}) +@EnableCustomConfig +@EnableRyFeignClients +@EnableFeignClients +@SpringBootApplication +@EnableScheduling +@MapperScan("com.xhpc.tenant.mapper") +public class XhpcTenantApplication { + + public static void main(String[] args) { + + SpringApplication.run(XhpcTenantApplication.class, args); + } +} diff --git a/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/config/AliOSSProperties.java b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/config/AliOSSProperties.java new file mode 100644 index 00000000..32533144 --- /dev/null +++ b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/config/AliOSSProperties.java @@ -0,0 +1,24 @@ +package com.xhpc.tenant.config; + + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + + +/** + * 支付宝支付配置类 + */ +@Data +@ConfigurationProperties(prefix = "oss") +public class AliOSSProperties { + + private boolean enabled; + private String name; + private boolean tenantMode; + private String endpoint; + private String accessKey; + private String secretKey; + private String bucketName; + private String region; + private String domain; +} diff --git a/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/controller/XhpcTenantController.java b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/controller/XhpcTenantController.java new file mode 100644 index 00000000..7a04e4ae --- /dev/null +++ b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/controller/XhpcTenantController.java @@ -0,0 +1,81 @@ +package com.xhpc.tenant.controller; + + +import com.xhpc.common.core.domain.R; +import com.xhpc.common.core.web.controller.BaseController; +import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; +import com.xhpc.tenant.domain.XhpcTenantDomain; +import com.xhpc.tenant.service.XhpcTenantService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + +@RestController +@RequestMapping("/tenant") +public class XhpcTenantController extends BaseController { + + @Resource + XhpcTenantService tenantService; + + + @GetMapping("/getPage") + public TableDataInfo getPage(String tenantId, + String tenantName, + String contactName){ + + startPage(); + Map params = new HashMap<>(); + params.put("tenantId", tenantId); + params.put("tenantName", tenantName); + params.put("contactName", contactName); + return getDataTable(tenantService.getList(params)); + } + // 到期前15填短信通知联系人 + // 1点定时更新状态 + //停用状态不能登陆PC,小程序正常 + + @GetMapping("/detail") + public R getDetail(@RequestParam("tenantId")String tenantId){ + return R.ok(tenantService.getInfoByPk(tenantId)); + } + + + @Log(title = "租户管理-新增租户", businessType = BusinessType.INSERT) + @PostMapping("/detail") + public R insertNewTenant(@RequestBody XhpcTenantDomain domain){ + return R.ok(tenantService.insertTenant(domain)); + } + + + @Log(title = "租户管理-更新租户信息", businessType = BusinessType.UPDATE) + @PutMapping("/detail") + public R updateTenant(@RequestBody XhpcTenantDomain domain){ + return R.ok(tenantService.updateTenantInfo(domain)); + } + + + @Log(title = "租户管理-更新租户授权配置信息", businessType = BusinessType.UPDATE) + @PutMapping("/config") + public R updateTenantConfig(@RequestBody XhpcTenantDomain domain){ + return R.ok(tenantService.updateTenantConfig(domain)); + } + + + @Log(title = "租户管理-更新租户状态", businessType = BusinessType.UPDATE) + @PutMapping("/status") + public R updateTenantStatus(@RequestBody XhpcTenantDomain domain){ + return R.ok(tenantService.updateTenantConfig(domain)); + } + + + @Log(title = "租户管理-删除租户", businessType = BusinessType.DELETE) + @DeleteMapping("/detail") + public R deleteTenantByPk(@RequestParam("tenantId")String tenantId){ + return R.ok(tenantService.deleteByPk(tenantId)); + } + +} diff --git a/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/domain/XhpcTenantDomain.java b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/domain/XhpcTenantDomain.java new file mode 100644 index 00000000..bc01c89a --- /dev/null +++ b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/domain/XhpcTenantDomain.java @@ -0,0 +1,99 @@ +package com.xhpc.tenant.domain; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 租户对象 + * @author + */ +@Data +public class XhpcTenantDomain implements Serializable { + /** + * 租户ID + */ + private String tenantId; + + /** + * 租户名称 + */ + private String tenantName; + + /** + * 域名地址 + */ + private String domain; + + /** + * 系统背景 + */ + private String backgroundUrl; + + /** + * 联系人 + */ + private String linkman; + + /** + * 联系电话 + */ + private String contactNumber; + + /** + * 联系地址 + */ + private String address; + + /** + * 场站限额 + */ + private Integer stationQuote; + + /** + * 每站桩限额 + */ + private Integer stationPileQuote; + + /** + * 过期时间 + */ + private Date expireTime; + + /** + * 创建人 + */ + private Long createUser; + + /** + * 创建部门 + */ + private Long createDept; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 修改人 + */ + private Long updateUser; + + /** + * 修改时间 + */ + private Date updateTime; + + /** + * 状态 + */ + private Integer status; + + /** + * 是否已删除 + */ + private Integer isDeleted; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/mapper/XhpcTenantMapper.java b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/mapper/XhpcTenantMapper.java new file mode 100644 index 00000000..420e5143 --- /dev/null +++ b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/mapper/XhpcTenantMapper.java @@ -0,0 +1,37 @@ +package com.xhpc.tenant.mapper; + +import com.xhpc.tenant.domain.XhpcTenantDomain; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + + +public interface XhpcTenantMapper { + + List getList(@Param("params") Map params); + + int deleteByPrimaryKey(String tenantId); + + int deleteLogicByPrimaryKey(String tenantId); + + int insert(XhpcTenantDomain record); + + int insertSelective(XhpcTenantDomain record); + + XhpcTenantDomain selectByPrimaryKey(String tenantId); + + int updateByPrimaryKeySelective(XhpcTenantDomain record); + + int updateByPrimaryKey(XhpcTenantDomain record); + + int updateInfoByPrimaryKey(XhpcTenantDomain record); + + int updateStatusByPrimaryKey(XhpcTenantDomain record); + + int updateTenantConfigByPrimaryKey(XhpcTenantDomain record); + + List selectExpiredList(); + + List selectExpiringList(String expireTime); +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/service/XhpcTenantService.java b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/service/XhpcTenantService.java new file mode 100644 index 00000000..8357ff7f --- /dev/null +++ b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/service/XhpcTenantService.java @@ -0,0 +1,23 @@ +package com.xhpc.tenant.service; + +import com.xhpc.tenant.domain.XhpcTenantDomain; + +import java.util.List; +import java.util.Map; + +public interface XhpcTenantService { + + List getList(Map params); + + XhpcTenantDomain getInfoByPk(String tenantId); + + boolean insertTenant(XhpcTenantDomain domain); + + boolean updateTenantInfo(XhpcTenantDomain domain); + + boolean updateTenantStatus(XhpcTenantDomain domain); + + boolean updateTenantConfig(XhpcTenantDomain domain); + + boolean deleteByPk(String tenantId); +} diff --git a/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/service/impl/XhpcTenantServiceImpl.java b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/service/impl/XhpcTenantServiceImpl.java new file mode 100644 index 00000000..8d62ea52 --- /dev/null +++ b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/service/impl/XhpcTenantServiceImpl.java @@ -0,0 +1,81 @@ +package com.xhpc.tenant.service.impl; + +import com.xhpc.common.core.exception.CustomException; +import com.xhpc.common.core.utils.StringUtils; +import com.xhpc.tenant.domain.XhpcTenantDomain; +import com.xhpc.tenant.mapper.XhpcTenantMapper; +import com.xhpc.tenant.service.XhpcTenantService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + + +@Service +public class XhpcTenantServiceImpl implements XhpcTenantService { + + + @Resource + XhpcTenantMapper tenantMapper; + + + @Override + public List getList(Map params){ + return tenantMapper.getList(params); + } + + + @Override + public XhpcTenantDomain getInfoByPk(String tenantId){ + return tenantMapper.selectByPrimaryKey(tenantId); + } + + + @Override + public boolean insertTenant(XhpcTenantDomain domain){ + if(StringUtils.isEmpty(domain.getTenantName()) + || StringUtils.isEmpty(domain.getLinkman()) + || StringUtils.isEmpty(domain.getContactNumber())){ + throw new CustomException("必填字段为空"); + } + + XhpcTenantDomain tenantDomain = tenantMapper.selectByPrimaryKey(domain.getTenantId()); + if(tenantDomain != null){ + throw new CustomException("租户ID已存在"); + } + + return tenantMapper.insertSelective(domain) > 0; + } + + + @Override + public boolean updateTenantInfo(XhpcTenantDomain domain){ + return tenantMapper.updateInfoByPrimaryKey(domain) > 0; + } + + + @Override + public boolean updateTenantStatus(XhpcTenantDomain domain){ + return tenantMapper.updateStatusByPrimaryKey(domain) > 0; + } + + + @Override + public boolean updateTenantConfig(XhpcTenantDomain domain){ + return tenantMapper.updateTenantConfigByPrimaryKey(domain) > 0; + } + + + @Override + public boolean deleteByPk(String tenantId){ + XhpcTenantDomain tenantDomain = tenantMapper.selectByPrimaryKey(tenantId); + if(tenantDomain == null){ + throw new CustomException("该租户不存在"); + } + // todo 检查租户是否存在异常订单、用户余额等 + // todo 暂不实现业务流程,待讨论后再实现 + + return false; + } +} diff --git a/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/task/XhpcTenantTask.java b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/task/XhpcTenantTask.java new file mode 100644 index 00000000..8fb70c98 --- /dev/null +++ b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/task/XhpcTenantTask.java @@ -0,0 +1,62 @@ +package com.xhpc.tenant.task; + +import cn.hutool.core.date.DateUtil; +import com.xhpc.common.api.SmsService; +import com.xhpc.common.core.domain.R; +import com.xhpc.common.core.utils.StringUtils; +import com.xhpc.tenant.domain.XhpcTenantDomain; +import com.xhpc.tenant.mapper.XhpcTenantMapper; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +@Component +public class XhpcTenantTask { + + @Resource + XhpcTenantMapper tenantMapper; + + @Resource + SmsService smsService; + + /** + * 每天一点自动清理过期租户 + */ + @Scheduled(cron = "0 0 1 * * ? ") + private void ExpiredTenantStatusTask(){ + + List expireDomainList = tenantMapper.selectExpiredList(); + for(XhpcTenantDomain domain: expireDomainList){ + domain.setStatus(2); + tenantMapper.updateStatusByPrimaryKey(domain); + } + } + + + /** + * 每天一点自动清理过期租户 + */ + @Scheduled(cron = "0 0 14 * * ? ") + private void ExpiringTenantSmsTask(){ + + String expireTime = DateUtil.formatDateTime(com.xhpc.common.util.DateUtil.addDay(new Date(), -15)); + List expireDomainList = tenantMapper.selectExpiringList(expireTime); + for(XhpcTenantDomain domain: expireDomainList){ + // todo 发短信提醒 + if (StringUtils.isEmpty(domain.getContactNumber())){ + continue; + } + + HashMap paramMap = new HashMap<>(); + paramMap.put("phone", domain.getContactNumber()); + paramMap.put("tenantName", domain.getTenantName()); + paramMap.put("content", "【小华充电】尊敬的租户,您申请的租户(租户名称: " + domain.getTenantName() + ")还有15天到期,请联系业务人员进行续费。"); + smsService.sendNotice(paramMap); + } + } + +} diff --git a/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/utils/DownloadUtil.java b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/utils/DownloadUtil.java new file mode 100644 index 00000000..46f255b8 --- /dev/null +++ b/xhpc-modules/xhpc-tenant/src/main/java/com/xhpc/tenant/utils/DownloadUtil.java @@ -0,0 +1,18 @@ +package com.xhpc.tenant.utils; + +import cn.hutool.http.HttpUtil; +import com.xhpc.common.core.utils.StringUtils; + +import java.io.File; + +public class DownloadUtil { + + public static File downloadFile(String fileUrl) throws Exception { + + if (StringUtils.isEmpty(fileUrl)) { + throw new Exception("文件地址为空"); + } + String suffix = fileUrl.substring(fileUrl.lastIndexOf(".")); + return HttpUtil.downloadFileFromUrl(fileUrl, File.createTempFile("temp_", suffix)); + } +} diff --git a/xhpc-modules/xhpc-tenant/src/main/resources/banner.txt b/xhpc-modules/xhpc-tenant/src/main/resources/banner.txt new file mode 100644 index 00000000..be49df70 --- /dev/null +++ b/xhpc-modules/xhpc-tenant/src/main/resources/banner.txt @@ -0,0 +1,9 @@ +Spring Boot Version: ${spring-boot.version} +Spring Application Name: ${spring.application.name} + + ,--. +,--. ,--. | ,---. ,---. ,---. + \ `' / | .-. | | .-. | | .--' + / /. \ | | | | | '-' ' \ `--. +'--' '--' `--' `--' | |-' `---' + `--' diff --git a/xhpc-modules/xhpc-tenant/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-tenant/src/main/resources/bootstrap.yml new file mode 100644 index 00000000..9774cb5c --- /dev/null +++ b/xhpc-modules/xhpc-tenant/src/main/resources/bootstrap.yml @@ -0,0 +1,37 @@ + +# Tomcat +server: + port: 8911 + +# Spring +spring: + application: + # 应用名称 + name: xhpc-tenant + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 127.0.0.1:8848 + config: + # 配置中心地址 + server-addr: 127.0.0.1:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} +logging: + level: + root: info + com.xhpc.workorder.mapper: debug + + file: + path: "d:\\logs" + + pattern: + console: '%d{yyyy/MM/dd-HH:mm:ss} [%thread] %-5level %logger- %msg%n' + file: '%d{yyyy/MM/dd-HH:mm:ss} [%thread] %-5level %logger- %msg%n' diff --git a/xhpc-modules/xhpc-tenant/src/main/resources/logback.xml b/xhpc-modules/xhpc-tenant/src/main/resources/logback.xml new file mode 100644 index 00000000..4cb51d10 --- /dev/null +++ b/xhpc-modules/xhpc-tenant/src/main/resources/logback.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + diff --git a/xhpc-modules/xhpc-tenant/src/main/resources/mapper/XhpcTenantMapper.xml b/xhpc-modules/xhpc-tenant/src/main/resources/mapper/XhpcTenantMapper.xml new file mode 100644 index 00000000..de7f7fd9 --- /dev/null +++ b/xhpc-modules/xhpc-tenant/src/main/resources/mapper/XhpcTenantMapper.xml @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + tenant_id, tenant_name, `domain`, background_url, linkman, contact_number, address, + station_quote, station_pile_quote, expire_time, create_user, create_dept, create_time, + update_user, update_time, `status`, is_deleted + + + + + + + delete from xhpc_tenant + where tenant_id = #{tenantId,jdbcType=VARCHAR} + + + + update xhpc_tenant set is_deleted = 2 + where tenant_id = #{tenantId,jdbcType=VARCHAR} + + + + insert into xhpc_tenant (tenant_name, `domain`, background_url, + linkman, contact_number, address, + station_quote, station_pile_quote, expire_time, + create_user, create_dept, create_time, + update_user, update_time, `status`, + is_deleted) + values (#{tenantName,jdbcType=VARCHAR}, #{domain,jdbcType=VARCHAR}, #{backgroundUrl,jdbcType=VARCHAR}, + #{linkman,jdbcType=VARCHAR}, #{contactNumber,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, + #{stationQuote,jdbcType=INTEGER}, #{stationPileQuote,jdbcType=INTEGER}, #{expireTime,jdbcType=TIMESTAMP}, + #{createUser,jdbcType=BIGINT}, #{createDept,jdbcType=BIGINT}, sysdate(), + #{updateUser,jdbcType=BIGINT}, sysdate(), #{status,jdbcType=INTEGER}, + 0) + + + insert into xhpc_tenant + + + tenant_name, + + + `domain`, + + + background_url, + + + linkman, + + + contact_number, + + + address, + + + station_quote, + + + station_pile_quote, + + + expire_time, + + + create_user, + + + create_dept, + + create_time, + + update_user, + + update_time, + + `status`, + + is_deleted + + + + #{tenantName,jdbcType=VARCHAR}, + + + #{domain,jdbcType=VARCHAR}, + + + #{backgroundUrl,jdbcType=VARCHAR}, + + + #{linkman,jdbcType=VARCHAR}, + + + #{contactNumber,jdbcType=VARCHAR}, + + + #{address,jdbcType=VARCHAR}, + + + #{stationQuote,jdbcType=INTEGER}, + + + #{stationPileQuote,jdbcType=INTEGER}, + + + #{expireTime,jdbcType=TIMESTAMP}, + + + #{createUser,jdbcType=BIGINT}, + + + #{createDept,jdbcType=BIGINT}, + + sysdate(), + + #{updateUser,jdbcType=BIGINT}, + + sysdate(), + + #{status,jdbcType=INTEGER}, + + 0 + + + + update xhpc_tenant + + + tenant_name = #{tenantName,jdbcType=VARCHAR}, + + + `domain` = #{domain,jdbcType=VARCHAR}, + + + background_url = #{backgroundUrl,jdbcType=VARCHAR}, + + + linkman = #{linkman,jdbcType=VARCHAR}, + + + contact_number = #{contactNumber,jdbcType=VARCHAR}, + + + address = #{address,jdbcType=VARCHAR}, + + + station_quote = #{stationQuote,jdbcType=INTEGER}, + + + station_pile_quote = #{stationPileQuote,jdbcType=INTEGER}, + + + expire_time = #{expireTime,jdbcType=TIMESTAMP}, + + + update_user = #{updateUser,jdbcType=BIGINT}, + + update_time = sysdate(), + + `status` = #{status,jdbcType=INTEGER}, + + + is_deleted = #{isDeleted,jdbcType=INTEGER}, + + + where tenant_id = #{tenantId,jdbcType=VARCHAR} + + + update xhpc_tenant + set tenant_name = #{tenantName,jdbcType=VARCHAR}, + `domain` = #{domain,jdbcType=VARCHAR}, + background_url = #{backgroundUrl,jdbcType=VARCHAR}, + linkman = #{linkman,jdbcType=VARCHAR}, + contact_number = #{contactNumber,jdbcType=VARCHAR}, + address = #{address,jdbcType=VARCHAR}, + station_quote = #{stationQuote,jdbcType=INTEGER}, + station_pile_quote = #{stationPileQuote,jdbcType=INTEGER}, + expire_time = #{expireTime,jdbcType=TIMESTAMP}, + update_user = #{updateUser,jdbcType=BIGINT}, + update_time = sysdate(), + `status` = #{status,jdbcType=INTEGER}, + is_deleted = #{isDeleted,jdbcType=INTEGER} + where tenant_id = #{tenantId,jdbcType=VARCHAR} + + + + + update xhpc_tenant + set tenant_name = #{tenantName,jdbcType=VARCHAR}, + `domain` = #{domain,jdbcType=VARCHAR}, + background_url = #{backgroundUrl,jdbcType=VARCHAR}, + linkman = #{linkman,jdbcType=VARCHAR}, + contact_number = #{contactNumber,jdbcType=VARCHAR}, + address = #{address,jdbcType=VARCHAR}, + update_user = #{updateUser,jdbcType=BIGINT}, + update_time = sysdate() + where tenant_id = #{tenantId,jdbcType=VARCHAR} + + + + + update xhpc_tenant + set update_user = #{updateUser,jdbcType=BIGINT}, + update_time = sysdate(), + `status` = #{status,jdbcType=INTEGER} + where tenant_id = #{tenantId,jdbcType=VARCHAR} + + + + + update xhpc_tenant + set station_quote = #{stationQuote,jdbcType=INTEGER}, + station_pile_quote = #{stationPileQuote,jdbcType=INTEGER}, + expire_time = #{expireTime,jdbcType=TIMESTAMP}, + update_user = #{updateUser,jdbcType=BIGINT}, + update_time = sysdate(), + where tenant_id = #{tenantId,jdbcType=VARCHAR} + + + + + + + + + \ No newline at end of file