添加h5表单信息,添加防止重复提交代码

master
bynt 2 years ago
parent dd6df84346
commit 2cb96e3f5a

@ -0,0 +1,17 @@
package me.zhengjie.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Enzo
* @
* @date : 2022/6/6
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface NoRepeatSubmit {
}

@ -0,0 +1,59 @@
package me.zhengjie.aspect;
import javax.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.annotation.NoRepeatSubmit;
import me.zhengjie.exception.BadRequestException;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.concurrent.TimeUnit;
/**
* @author Enzo
* @desc aop
* @date 2018-08-26
*/
@Slf4j
@Aspect
@Component
public class NoRepeatSubmitAspect {
private final RedisTemplate<Object, Object> redisTemplate;
public NoRepeatSubmitAspect(RedisTemplate<Object, Object> redisTemplate) {
this.redisTemplate = redisTemplate;
}
@Around("@annotation(nrs)")
public Object around(ProceedingJoinPoint pjp, NoRepeatSubmit nrs) {
ValueOperations<Object, Object> opsForValue = redisTemplate.opsForValue();
try {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
String sessionId = RequestContextHolder.getRequestAttributes().getSessionId();
HttpServletRequest request = attributes.getRequest();
String key = sessionId + "-" + request.getServletPath();
// 如果缓存中有这个url视为重复提交
if (opsForValue.get(key) == null) {
Object o = pjp.proceed();
opsForValue.set(key, 0, 2, TimeUnit.SECONDS);
return o;
} else {
log.error("重复提交");
throw new BadRequestException("重复提交!");
}
} catch (BadRequestException e) {
throw new BadRequestException(e.getMessage());
} catch (Throwable e) {
log.error("验证重复提交时出现未知异常!");
throw new BadRequestException("验证重复提交时出现未知异常!");
}
}
}

@ -0,0 +1,23 @@
package me.zhengjie.config;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.Cache;
import java.util.concurrent.TimeUnit;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @
* @author
* @date 2018-08-26
*/
@Configuration
public class UrlCache {
@Bean
public Cache<String, Integer> getCache() {
return CacheBuilder.newBuilder().expireAfterWrite(2L, TimeUnit.SECONDS).build();
}
}

@ -0,0 +1,112 @@
package me.zhengjie.utils;
import org.apache.commons.lang3.StringUtils;
import java.util.regex.Pattern;
/**
* @author Enzo
* @date : 2022/4/18
*/
public class MobileUtil {
/**
* 133,149,153,173,177,180,181,189,199,1349,1410,1700,1701,1702
**/
private static final String CHINA_TELECOM_PATTERN = "(?:^(?:\\+86)?1(?:33|49|53|7[37]|8[019]|99)\\d{8}$)|(?:^(?:\\+86)?1349\\d{7}$)|(?:^(?:\\+86)?1410\\d{7}$)|(?:^(?:\\+86)?170[0-2]\\d{7}$)";
/**
* 130,131,132,145,146,155,156,166,171,175,176,185,186,1704,1707,1708,1709
**/
private static final String CHINA_UNICOM_PATTERN = "(?:^(?:\\+86)?1(?:3[0-2]|4[56]|5[56]|66|7[156]|8[56])\\d{8}$)|(?:^(?:\\+86)?170[47-9]\\d{7}$)";
/**
*
* 134,135,136,137,138,139,147,148,150,151,152,157,158,159,178,182,183,184,187,188,198,1440,1703,1705,1706
**/
private static final String CHINA_MOBILE_PATTERN = "(?:^(?:\\+86)?1(?:3[4-9]|4[78]|5[0-27-9]|78|8[2-478]|98)\\d{8}$)|(?:^(?:\\+86)?1440\\d{7}$)|(?:^(?:\\+86)?170[356]\\d{7}$)";
/**
*
*
* @param phone
*
* @return
*/
public static boolean checkPhone(String phone) {
if (StringUtils.isNotBlank(phone)) {
if (checkChinaMobile(phone) || checkChinaUnicom(phone) || checkChinaTelecom(phone)) {
return true;
}
}
return false;
}
/**
*
*
* @param phone
*
* @return
*/
public static boolean checkChinaMobile(String phone) {
if (StringUtils.isNotBlank(phone)) {
Pattern regexp = Pattern.compile(CHINA_MOBILE_PATTERN);
if (regexp.matcher(phone).matches()) {
return true;
}
}
return false;
}
/**
*
*
* @param phone
*
* @return
*/
public static boolean checkChinaUnicom(String phone) {
if (StringUtils.isNotBlank(phone)) {
Pattern regexp = Pattern.compile(CHINA_UNICOM_PATTERN);
if (regexp.matcher(phone).matches()) {
return true;
}
}
return false;
}
/**
*
*
* @param phone
*
* @return
*/
public static boolean checkChinaTelecom(String phone) {
if (StringUtils.isNotBlank(phone)) {
Pattern regexp = Pattern.compile(CHINA_TELECOM_PATTERN);
if (regexp.matcher(phone).matches()) {
return true;
}
}
return false;
}
/**
*
*
* @param phone
*
* @return java.lang.String
*/
public static String hideMiddleMobile(String phone) {
if (StringUtils.isNotBlank(phone)) {
phone = phone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
}
return phone;
}
}

@ -9,8 +9,8 @@ import org.springframework.stereotype.Component;
@Generated( @Generated(
value = "org.mapstruct.ap.MappingProcessor", value = "org.mapstruct.ap.MappingProcessor",
date = "2021-08-09T13:53:23+0800", date = "2022-06-06T14:36:08+0800",
comments = "version: 1.3.1.Final, compiler: javac, environment: Java 1.8.0_261 (Oracle Corporation)" comments = "version: 1.3.1.Final, compiler: javac, environment: Java 1.8.0_251 (Oracle Corporation)"
) )
@Component @Component
public class LogErrorMapperImpl implements LogErrorMapper { public class LogErrorMapperImpl implements LogErrorMapper {

@ -9,8 +9,8 @@ import org.springframework.stereotype.Component;
@Generated( @Generated(
value = "org.mapstruct.ap.MappingProcessor", value = "org.mapstruct.ap.MappingProcessor",
date = "2021-08-09T13:53:23+0800", date = "2022-06-06T14:36:08+0800",
comments = "version: 1.3.1.Final, compiler: javac, environment: Java 1.8.0_261 (Oracle Corporation)" comments = "version: 1.3.1.Final, compiler: javac, environment: Java 1.8.0_251 (Oracle Corporation)"
) )
@Component @Component
public class LogSmallMapperImpl implements LogSmallMapper { public class LogSmallMapperImpl implements LogSmallMapper {

@ -1,18 +0,0 @@
package me.zhengjie.modules.dmp.rest;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Enzo
* @date : 2022/3/1
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "数据解析与图表展示")
@RequestMapping("/api/dmp")
public class DMPController {
}

@ -9,6 +9,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -52,7 +53,8 @@ public class GoldPriceController {
&& ObjectUtil.isNull(requestDTO.getEndDate())) { && ObjectUtil.isNull(requestDTO.getEndDate())) {
DateTime date = DateUtil.date(); DateTime date = DateUtil.date();
requestDTO.setStartDate(DateUtil.beginOfDay requestDTO.setStartDate(DateUtil.beginOfDay
(DateUtil.offsetDay(date, -DefaultConstant.SEVEN_NUMBER))); (DateUtil.offsetMonth(DateUtil.beginOfDay(date),
-DefaultConstant.ONE_NUMBER)));
requestDTO.setEndDate(DateUtil.beginOfDay(date)); requestDTO.setEndDate(DateUtil.beginOfDay(date));
} }
if (requestDTO.getStartDate().after(requestDTO.getEndDate())) { if (requestDTO.getStartDate().after(requestDTO.getEndDate())) {
@ -68,15 +70,16 @@ public class GoldPriceController {
long betweenDays = DateUtil.between(requestDTO.getStartDate(), requestDTO.getEndDate(), DateUnit.DAY); long betweenDays = DateUtil.between(requestDTO.getStartDate(), requestDTO.getEndDate(), DateUnit.DAY);
DateTime dateTime = DateUtil.beginOfDay(DateUtil.date()); DateTime dateTime = DateUtil.beginOfDay(DateUtil.date());
for (String code : requestDTO.getGoldCodeList()) { for (String code : requestDTO.getGoldCodeList()) {
Date endDate = requestDTO.getEndDate();
Date startDate = requestDTO.getStartDate();
String goldCode = GoldCodeEnums.findCode(code); String goldCode = GoldCodeEnums.findCode(code);
// 发送请求 // 发送请求
JSONObject jsonObject = ResponseUtil.goldRequest JSONObject jsonObject = ResponseUtil.goldRequest
(betweenDays, goldCode, requestDTO.getStartDate(), requestDTO.getEndDate()); (betweenDays, goldCode, requestDTO.getStartDate(), requestDTO.getEndDate());
// 解析数据 // 解析数据
List<AnalyzingGoldResponseDTO> dtoArrayList = getAnalyzingGoldResponse(jsonObject); List<AnalyzingGoldResponseDTO> dtoArrayList = getAnalyzingGoldResponse(jsonObject);
List<AnalyzingGoldResponseDTO> todayGoldList = Lists.newArrayList(dtoArrayList); Map<Date, AnalyzingGoldResponseDTO> dtoMap = Maps.newHashMap
Iterator<AnalyzingGoldResponseDTO> iterator = todayGoldList.iterator(); (Maps.uniqueIndex(dtoArrayList, AnalyzingGoldResponseDTO::getTime));
TodayGoldResponseDTO todayGoldResponseDTO;
// 查看周几 // 查看周几
int dayOfWeek = DateUtil.thisDayOfWeek(); int dayOfWeek = DateUtil.thisDayOfWeek();
if (dayOfWeek == DefaultConstant.SEVEN_NUMBER || dayOfWeek == DefaultConstant.ONE_NUMBER) { if (dayOfWeek == DefaultConstant.SEVEN_NUMBER || dayOfWeek == DefaultConstant.ONE_NUMBER) {
@ -84,19 +87,28 @@ public class GoldPriceController {
(dateTime, -(dayOfWeek == DefaultConstant.SEVEN_NUMBER (dateTime, -(dayOfWeek == DefaultConstant.SEVEN_NUMBER
? DefaultConstant.ONE_NUMBER : DefaultConstant.TWO_NUMBER)); ? DefaultConstant.ONE_NUMBER : DefaultConstant.TWO_NUMBER));
} }
while (iterator.hasNext()) { while (startDate.before(endDate) || startDate.equals(endDate)) {
AnalyzingGoldResponseDTO next = iterator.next(); if (dtoMap.containsKey(startDate)) {
long betweenDay = DateUtil.betweenDay(dateTime, next.getTime(), Boolean.TRUE); long betweenDay = DateUtil.betweenDay(dateTime, startDate, Boolean.TRUE);
// 查询当天金价 // 查询当天金价
if (betweenDay == DefaultConstant.ZERO_NUMBER) { if (betweenDay == DefaultConstant.ZERO_NUMBER) {
todayGoldResponseDTO = new TodayGoldResponseDTO(); TodayGoldResponseDTO todayGoldResponseDTO = new TodayGoldResponseDTO();
BeanUtil.copyProperties(next, todayGoldResponseDTO); BeanUtil.copyProperties(dtoMap.get(startDate), todayGoldResponseDTO);
todayGoldResponseDTO.setGoldCode(code); todayGoldResponseDTO.setGoldCode(code);
goldResponseDTOList.add(todayGoldResponseDTO); goldResponseDTOList.add(todayGoldResponseDTO);
break; }
startDate = DateUtil.offsetDay(startDate, DefaultConstant.ONE_NUMBER);
continue;
} }
AnalyzingGoldResponseDTO empty = new AnalyzingGoldResponseDTO();
empty.setTime(startDate);
dtoMap.put(startDate, empty);
startDate = DateUtil.offsetDay(startDate, DefaultConstant.ONE_NUMBER);
} }
historyMap.put(code, dtoArrayList); // list排序
List<AnalyzingGoldResponseDTO> goldListDTOList = Lists.newArrayList(dtoMap.values());
goldListDTOList.sort(Comparator.comparing(AnalyzingGoldResponseDTO::getTime, Date::compareTo));
historyMap.put(code, goldListDTOList);
} }
// map排序 // map排序
Stream<Map.Entry<String, List<AnalyzingGoldResponseDTO>>> st = Stream<Map.Entry<String, List<AnalyzingGoldResponseDTO>>> st =
@ -109,6 +121,8 @@ public class GoldPriceController {
} }
@Log("查询当天金价") @Log("查询当天金价")
@ApiOperation("查询当天金价") @ApiOperation("查询当天金价")
@GetMapping("/dayPrice") @GetMapping("/dayPrice")
@ -135,14 +149,14 @@ public class GoldPriceController {
private List<AnalyzingGoldResponseDTO> getAnalyzingGoldResponse(JSONObject jsonObject) { private List<AnalyzingGoldResponseDTO> getAnalyzingGoldResponse(JSONObject jsonObject) {
// 解析数据 // 解析数据
List<AnalyzingGoldResponseDTO> dtoList = List<AnalyzingGoldResponseDTO> dtoList =
Convert.toList(AnalyzingGoldResponseDTO.class, Convert.toList(AnalyzingGoldResponseDTO.class,
jsonObject.get("data")); jsonObject.get("data"));
// 时间去除 // 时间去除
return dtoList.stream() return dtoList.stream()
.collect(Collectors.collectingAndThen(Collectors.toCollection( .collect(Collectors.collectingAndThen(Collectors.toCollection(
() -> new TreeSet<>(Comparator.comparing(AnalyzingGoldResponseDTO::getTime))), ArrayList::new)); () -> new TreeSet<>(Comparator.comparing(AnalyzingGoldResponseDTO::getTime))), ArrayList::new));
} }
} }

@ -0,0 +1,55 @@
package me.zhengjie.modules.loan.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import me.zhengjie.base.BaseEntity;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author Enzo
* @date : 2022/6/6
*/
@Getter
@Setter
@Entity
@Table(name = "tb_loan_user")
public class LoanUser extends BaseEntity implements Serializable {
private static final long serialVersionUID = 631332413031546831L;
@Id
@Column(name = "id")
@NotNull(groups = {BaseEntity.Update.class})
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "username")
@ApiModelProperty(value = "用户名称")
private String username;
@Column(name = "phone")
@ApiModelProperty(value = "手机号码")
private String phone;
@Column(name = "address")
@ApiModelProperty(value = "地址")
private String address;
@Column(name = "borrowing_type")
@ApiModelProperty(value = "借款类别 1:信用卡 2:网贷 3:信用卡+网贷")
private Integer borrowingType;
@Column(name = "quota_type")
@ApiModelProperty(value = "额度类型 1:5-10万 2:10-20万 3:20-30万 4:30-50万 5:50万以上")
private Integer quotaType;
}

@ -0,0 +1,34 @@
package me.zhengjie.modules.loan.dto;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @author Enzo
* @date : 2022/6/6
*/
@Data
public class LoanUserDTO {
@NotBlank
@ApiModelProperty(value = "用户名称")
private String username;
@NotBlank
@ApiModelProperty(value = "手机号码")
private String phone;
@ApiModelProperty(value = "地址")
private String address;
@NotNull
@ApiModelProperty(value = "借款类别 1:信用卡 2:网贷 3:信用卡+网贷")
private Integer borrowingType;
@NotNull
@ApiModelProperty(value = "额度类型 1:5-10万 2:10-20万 3:20-30万 4:30-50万 5:50万以上")
private Integer quotaType;
}

@ -0,0 +1,32 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.modules.loan.mapstruct;
import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.loan.domain.LoanUser;
import me.zhengjie.modules.loan.dto.LoanUserDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @website https://el-admin.vip
* @author x
* @date 2021-08-05
**/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface LoanUserMapper extends BaseMapper<LoanUserDTO, LoanUser> {
}

@ -0,0 +1,35 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.modules.loan.repository;
import me.zhengjie.modules.loan.domain.LoanUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @website https://el-admin.vip
* @author x
* @date 2021-08-05
**/
public interface LoanUserRepository extends JpaRepository<LoanUser, Long>, JpaSpecificationExecutor<LoanUser> {
/**
*
* @param phone
* @return
*/
LoanUser findByPhone(String phone);
}

@ -0,0 +1,43 @@
package me.zhengjie.modules.loan.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.annotation.NoRepeatSubmit;
import me.zhengjie.common.http.CommonResponse;
import me.zhengjie.common.http.ResponseCode;
import me.zhengjie.modules.loan.dto.LoanUserDTO;
import me.zhengjie.modules.loan.service.LoanUserService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Enzo
* @date : 2022/6/6
*/
@Slf4j
@RestController
@Api("用户额度信息收集")
@RequestMapping("/api/loanUser")
@RequiredArgsConstructor
public class LoanUserController {
private final LoanUserService loanUserService;
@NoRepeatSubmit
@PostMapping("/submit")
@ApiOperation("提交用户信息")
public ResponseEntity<Object> submit(@RequestBody @Validated LoanUserDTO loanUserDTO) {
Boolean flag = loanUserService.userSubmit(loanUserDTO);
return flag != null && flag ?
new ResponseEntity<>(CommonResponse.createBySuccess(ResponseCode.SUCCESS), HttpStatus.OK)
: new ResponseEntity<>(CommonResponse.createByError(ResponseCode.ERROR), HttpStatus.INTERNAL_SERVER_ERROR);
}
}

@ -0,0 +1,16 @@
package me.zhengjie.modules.loan.service;
import me.zhengjie.modules.loan.dto.LoanUserDTO;
/**
* @author Enzo
* @date : 2022/6/6
*/
public interface LoanUserService {
/**
*
* @param loanUserDTO
* @return
*/
Boolean userSubmit(LoanUserDTO loanUserDTO);
}

@ -0,0 +1,41 @@
package me.zhengjie.modules.loan.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import lombok.RequiredArgsConstructor;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.loan.domain.LoanUser;
import me.zhengjie.modules.loan.dto.LoanUserDTO;
import me.zhengjie.modules.loan.repository.LoanUserRepository;
import me.zhengjie.modules.loan.service.LoanUserService;
import me.zhengjie.utils.MobileUtil;
import org.springframework.stereotype.Service;
/**
* @author Enzo
* @date : 2022/6/6
*/
@Service
@RequiredArgsConstructor
public class LoanUserServiceImpl implements LoanUserService {
private final LoanUserRepository loanUserRepository;
@Override
public Boolean userSubmit(LoanUserDTO loanUserDTO) {
if (ObjectUtil.isNotNull(loanUserDTO)) {
if (!MobileUtil.checkPhone(loanUserDTO.getPhone())) {
throw new BadRequestException("号码验证失败!");
}
LoanUser byPhone = loanUserRepository.findByPhone(loanUserDTO.getPhone());
if (byPhone != null) {
throw new BadRequestException("该号码已提交信息!");
}
LoanUser loanUser = new LoanUser();
BeanUtil.copyProperties(loanUserDTO, loanUser);
LoanUser saveLoanUser = loanUserRepository.save(loanUser);
return ObjectUtil.isNotNull(saveLoanUser.getId());
}
return Boolean.FALSE;
}
}

@ -124,6 +124,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// 爬取数据请求 用户小程序过审 By Enzo // 爬取数据请求 用户小程序过审 By Enzo
.antMatchers("/api/consult/**").permitAll() .antMatchers("/api/consult/**").permitAll()
.antMatchers("/api/gold/**").permitAll() .antMatchers("/api/gold/**").permitAll()
.antMatchers("/api/loanUser/**").permitAll()
// 放行OPTIONS请求 // 放行OPTIONS请求
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll() .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
// 自定义匿名访问所有url放行允许匿名和带Token访问细腻化到每个 Request 类型 // 自定义匿名访问所有url放行允许匿名和带Token访问细腻化到每个 Request 类型

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.domain; package me.zhengjie.modules.system.domain.sms.domain;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.domain; package me.zhengjie.modules.system.domain.sms.domain;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.domain; package me.zhengjie.modules.system.domain.sms.domain;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;

@ -13,14 +13,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.domain; package me.zhengjie.modules.system.domain.sms.domain;
import lombok.Data; import lombok.Data;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.io.Serializable; import java.io.Serializable;

@ -1,4 +1,4 @@
package me.zhengjie.modules.sms.dto; package me.zhengjie.modules.system.domain.sms.dto;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;

@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.repository; package me.zhengjie.modules.system.domain.sms.repository;
import me.zhengjie.modules.sms.domain.SmsConfiguration; import me.zhengjie.modules.system.domain.sms.domain.SmsConfiguration;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.repository; package me.zhengjie.modules.system.domain.sms.repository;
import me.zhengjie.modules.sms.domain.TbBlacklist; import me.zhengjie.modules.system.domain.sms.domain.TbBlacklist;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;

@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.repository; package me.zhengjie.modules.system.domain.sms.repository;
import me.zhengjie.modules.sms.domain.TbSendSms; import me.zhengjie.modules.system.domain.sms.domain.TbSendSms;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.transaction.Transactional;
/** /**
* @website https://el-admin.vip * @website https://el-admin.vip
* @author Enzo * @author Enzo

@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.repository; package me.zhengjie.modules.system.domain.sms.repository;
import me.zhengjie.modules.sms.domain.TbTemplate; import me.zhengjie.modules.system.domain.sms.domain.TbTemplate;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;

@ -1,4 +1,4 @@
package me.zhengjie.modules.sms.rest; package me.zhengjie.modules.system.domain.sms.rest;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.rest; package me.zhengjie.modules.system.domain.sms.rest;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -21,11 +21,11 @@ import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log; import me.zhengjie.annotation.Log;
import me.zhengjie.common.http.CommonResponse; import me.zhengjie.common.http.CommonResponse;
import me.zhengjie.common.http.ResponseCode; import me.zhengjie.common.http.ResponseCode;
import me.zhengjie.modules.sms.domain.SmsConfiguration; import me.zhengjie.modules.system.domain.sms.domain.SmsConfiguration;
import me.zhengjie.modules.sms.service.SmsConfigurationService; import me.zhengjie.modules.system.domain.sms.service.SmsConfigurationService;
import me.zhengjie.modules.sms.service.dto.SmsConfigurationDto; import me.zhengjie.modules.system.domain.sms.service.dto.SmsConfigurationDto;
import me.zhengjie.modules.sms.service.dto.SmsConfigurationQueryCriteria; import me.zhengjie.modules.system.domain.sms.service.dto.SmsConfigurationQueryCriteria;
import me.zhengjie.modules.sms.vo.UploadAndSendMessageVo; import me.zhengjie.modules.system.domain.sms.vo.UploadAndSendMessageVo;
import me.zhengjie.utils.SecurityUtils; import me.zhengjie.utils.SecurityUtils;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;

@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.rest; package me.zhengjie.modules.system.domain.sms.rest;
import me.zhengjie.annotation.Log; import me.zhengjie.annotation.Log;
import me.zhengjie.modules.sms.domain.TbBlacklist; import me.zhengjie.modules.system.domain.sms.domain.TbBlacklist;
import me.zhengjie.modules.sms.service.TbBlacklistService; import me.zhengjie.modules.system.domain.sms.service.TbBlacklistService;
import me.zhengjie.modules.sms.service.dto.TbBlacklistQueryCriteria; import me.zhengjie.modules.system.domain.sms.service.dto.TbBlacklistQueryCriteria;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.rest; package me.zhengjie.modules.system.domain.sms.rest;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -23,11 +23,11 @@ import me.zhengjie.annotation.Log;
import me.zhengjie.common.http.ResponseCode; import me.zhengjie.common.http.ResponseCode;
import me.zhengjie.exception.BadRequestException; import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.constant.DefaultConstant; import me.zhengjie.modules.constant.DefaultConstant;
import me.zhengjie.modules.sms.domain.TbSendSms; import me.zhengjie.modules.system.domain.sms.domain.TbSendSms;
import me.zhengjie.modules.sms.service.TbSendSmsService; import me.zhengjie.modules.system.domain.sms.service.TbSendSmsService;
import me.zhengjie.modules.sms.service.dto.TbSendSmsQueryCriteria; import me.zhengjie.modules.system.domain.sms.service.dto.TbSendSmsQueryCriteria;
import me.zhengjie.modules.sms.vo.LinkCallBack; import me.zhengjie.modules.system.domain.sms.vo.LinkCallBack;
import me.zhengjie.modules.sms.vo.SendVo; import me.zhengjie.modules.system.domain.sms.vo.SendVo;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.rest; package me.zhengjie.modules.system.domain.sms.rest;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.zhengjie.annotation.AnonymousAccess; import me.zhengjie.annotation.AnonymousAccess;
@ -21,11 +21,10 @@ import me.zhengjie.annotation.Log;
import me.zhengjie.common.http.CommonResponse; import me.zhengjie.common.http.CommonResponse;
import me.zhengjie.common.http.ResponseCode; import me.zhengjie.common.http.ResponseCode;
import me.zhengjie.modules.sms.domain.TbTemplate; import me.zhengjie.modules.system.domain.sms.domain.TbTemplate;
import me.zhengjie.modules.sms.service.TbTemplateService; import me.zhengjie.modules.system.domain.sms.service.TbTemplateService;
import me.zhengjie.modules.sms.service.dto.TbTemplateQueryCriteria; import me.zhengjie.modules.system.domain.sms.service.dto.TbTemplateQueryCriteria;
import me.zhengjie.modules.sms.vo.SendNewVo; import me.zhengjie.modules.system.domain.sms.vo.SendNewVo;
import me.zhengjie.modules.sms.vo.SendVo;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@ -36,8 +35,6 @@ import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import java.io.IOException; import java.io.IOException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.LocalDate;
import java.util.Date;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
/** /**

@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service; package me.zhengjie.modules.system.domain.sms.service;
import me.zhengjie.modules.sms.domain.SmsConfiguration; import me.zhengjie.modules.system.domain.sms.domain.SmsConfiguration;
import me.zhengjie.modules.sms.service.dto.SmsConfigurationDto; import me.zhengjie.modules.system.domain.sms.service.dto.SmsConfigurationDto;
import me.zhengjie.modules.sms.service.dto.SmsConfigurationQueryCriteria; import me.zhengjie.modules.system.domain.sms.service.dto.SmsConfigurationQueryCriteria;
import me.zhengjie.modules.sms.vo.UploadAndSendMessageVo; import me.zhengjie.modules.system.domain.sms.vo.UploadAndSendMessageVo;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;

@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service; package me.zhengjie.modules.system.domain.sms.service;
import me.zhengjie.modules.sms.domain.TbBlacklist; import me.zhengjie.modules.system.domain.sms.domain.TbBlacklist;
import me.zhengjie.modules.sms.service.dto.TbBlacklistDto; import me.zhengjie.modules.system.domain.sms.service.dto.TbBlacklistDto;
import me.zhengjie.modules.sms.service.dto.TbBlacklistQueryCriteria; import me.zhengjie.modules.system.domain.sms.service.dto.TbBlacklistQueryCriteria;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;

@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service; package me.zhengjie.modules.system.domain.sms.service;
import me.zhengjie.modules.sms.domain.TbSendSms; import me.zhengjie.modules.system.domain.sms.domain.TbSendSms;
import me.zhengjie.modules.sms.service.dto.TbSendSmsDto; import me.zhengjie.modules.system.domain.sms.service.dto.TbSendSmsDto;
import me.zhengjie.modules.sms.service.dto.TbSendSmsQueryCriteria; import me.zhengjie.modules.system.domain.sms.service.dto.TbSendSmsQueryCriteria;
import me.zhengjie.modules.sms.vo.SendVo; import me.zhengjie.modules.system.domain.sms.vo.SendVo;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;

@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service; package me.zhengjie.modules.system.domain.sms.service;
import me.zhengjie.modules.sms.domain.TbTemplate; import me.zhengjie.modules.system.domain.sms.domain.TbTemplate;
import me.zhengjie.modules.sms.service.dto.TbTemplateDto; import me.zhengjie.modules.system.domain.sms.service.dto.TbTemplateDto;
import me.zhengjie.modules.sms.service.dto.TbTemplateQueryCriteria; import me.zhengjie.modules.system.domain.sms.service.dto.TbTemplateQueryCriteria;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.dto; package me.zhengjie.modules.system.domain.sms.service.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.dto; package me.zhengjie.modules.system.domain.sms.service.dto;
import lombok.Data; import lombok.Data;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.dto; package me.zhengjie.modules.system.domain.sms.service.dto;
import lombok.Data; import lombok.Data;
import java.sql.Timestamp; import java.sql.Timestamp;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.dto; package me.zhengjie.modules.system.domain.sms.service.dto;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.dto; package me.zhengjie.modules.system.domain.sms.service.dto;
import lombok.Data; import lombok.Data;
import java.sql.Timestamp; import java.sql.Timestamp;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.dto; package me.zhengjie.modules.system.domain.sms.service.dto;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.dto; package me.zhengjie.modules.system.domain.sms.service.dto;
import lombok.Data; import lombok.Data;
import java.sql.Timestamp; import java.sql.Timestamp;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.dto; package me.zhengjie.modules.system.domain.sms.service.dto;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.impl; package me.zhengjie.modules.system.domain.sms.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Snowflake; import cn.hutool.core.lang.Snowflake;
@ -26,13 +26,13 @@ import me.zhengjie.common.http.ResponseCode;
import me.zhengjie.exception.BadRequestException; import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.constant.DefaultConstant; import me.zhengjie.modules.constant.DefaultConstant;
import me.zhengjie.modules.constant.FileConstant; import me.zhengjie.modules.constant.FileConstant;
import me.zhengjie.modules.sms.domain.SmsConfiguration; import me.zhengjie.modules.system.domain.sms.domain.SmsConfiguration;
import me.zhengjie.modules.sms.repository.SmsConfigurationRepository; import me.zhengjie.modules.system.domain.sms.repository.SmsConfigurationRepository;
import me.zhengjie.modules.sms.service.SmsConfigurationService; import me.zhengjie.modules.system.domain.sms.service.SmsConfigurationService;
import me.zhengjie.modules.sms.service.dto.SmsConfigurationDto; import me.zhengjie.modules.system.domain.sms.service.dto.SmsConfigurationDto;
import me.zhengjie.modules.sms.service.dto.SmsConfigurationQueryCriteria; import me.zhengjie.modules.system.domain.sms.service.dto.SmsConfigurationQueryCriteria;
import me.zhengjie.modules.sms.service.mapstruct.SmsConfigurationMapper; import me.zhengjie.modules.system.domain.sms.service.mapstruct.SmsConfigurationMapper;
import me.zhengjie.modules.sms.vo.UploadAndSendMessageVo; import me.zhengjie.modules.system.domain.sms.vo.UploadAndSendMessageVo;
import me.zhengjie.modules.uploadnew.service.TbUploadFileNewService; import me.zhengjie.modules.uploadnew.service.TbUploadFileNewService;
import me.zhengjie.modules.uploadnew.service.dto.TbUploadFileNewDto; import me.zhengjie.modules.uploadnew.service.dto.TbUploadFileNewDto;
import me.zhengjie.modules.uploadnew.task.SendMessageTask; import me.zhengjie.modules.uploadnew.task.SendMessageTask;

@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.impl; package me.zhengjie.modules.system.domain.sms.service.impl;
import me.zhengjie.modules.sms.domain.TbBlacklist; import me.zhengjie.modules.system.domain.sms.domain.TbBlacklist;
import me.zhengjie.modules.sms.repository.TbBlacklistRepository; import me.zhengjie.modules.system.domain.sms.repository.TbBlacklistRepository;
import me.zhengjie.modules.sms.service.TbBlacklistService; import me.zhengjie.modules.system.domain.sms.service.TbBlacklistService;
import me.zhengjie.modules.sms.service.dto.TbBlacklistDto; import me.zhengjie.modules.system.domain.sms.service.dto.TbBlacklistDto;
import me.zhengjie.modules.sms.service.dto.TbBlacklistQueryCriteria; import me.zhengjie.modules.system.domain.sms.service.dto.TbBlacklistQueryCriteria;
import me.zhengjie.modules.sms.service.mapstruct.TbBlacklistMapper; import me.zhengjie.modules.system.domain.sms.service.mapstruct.TbBlacklistMapper;
import me.zhengjie.utils.ValidationUtil; import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.utils.FileUtil; import me.zhengjie.utils.FileUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.impl; package me.zhengjie.modules.system.domain.sms.service.impl;
import cn.hutool.cache.impl.LRUCache; import cn.hutool.cache.impl.LRUCache;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
@ -31,17 +31,17 @@ import lombok.extern.slf4j.Slf4j;
import me.zhengjie.constant.SmsConstant; import me.zhengjie.constant.SmsConstant;
import me.zhengjie.exception.BadRequestException; import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.constant.DefaultConstant; import me.zhengjie.modules.constant.DefaultConstant;
import me.zhengjie.modules.sms.domain.TbSendSms; import me.zhengjie.modules.system.domain.sms.domain.TbSendSms;
import me.zhengjie.modules.sms.domain.TbTemplate; import me.zhengjie.modules.system.domain.sms.domain.TbTemplate;
import me.zhengjie.modules.sms.dto.ShortLinkUrlDto; import me.zhengjie.modules.system.domain.sms.dto.ShortLinkUrlDto;
import me.zhengjie.modules.sms.repository.TbSendSmsRepository; import me.zhengjie.modules.system.domain.sms.repository.TbSendSmsRepository;
import me.zhengjie.modules.sms.repository.TbTemplateRepository; import me.zhengjie.modules.system.domain.sms.repository.TbTemplateRepository;
import me.zhengjie.modules.sms.service.TbSendSmsService; import me.zhengjie.modules.system.domain.sms.service.TbSendSmsService;
import me.zhengjie.modules.sms.service.dto.TbSendSmsDto; import me.zhengjie.modules.system.domain.sms.service.dto.TbSendSmsDto;
import me.zhengjie.modules.sms.service.dto.TbSendSmsQueryCriteria; import me.zhengjie.modules.system.domain.sms.service.dto.TbSendSmsQueryCriteria;
import me.zhengjie.modules.sms.service.mapstruct.TbSendSmsMapper; import me.zhengjie.modules.system.domain.sms.service.mapstruct.TbSendSmsMapper;
import me.zhengjie.modules.sms.util.SmsUtil; import me.zhengjie.modules.system.domain.sms.util.SmsUtil;
import me.zhengjie.modules.sms.vo.SendVo; import me.zhengjie.modules.system.domain.sms.vo.SendVo;
import me.zhengjie.modules.upload.task.model.SendSmsJsonContent; import me.zhengjie.modules.upload.task.model.SendSmsJsonContent;
import me.zhengjie.utils.FileUtil; import me.zhengjie.utils.FileUtil;
import me.zhengjie.utils.PageUtil; import me.zhengjie.utils.PageUtil;

@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.impl; package me.zhengjie.modules.system.domain.sms.service.impl;
import me.zhengjie.modules.sms.domain.TbTemplate; import me.zhengjie.modules.system.domain.sms.domain.TbTemplate;
import me.zhengjie.modules.sms.repository.TbTemplateRepository; import me.zhengjie.modules.system.domain.sms.repository.TbTemplateRepository;
import me.zhengjie.modules.sms.service.TbTemplateService; import me.zhengjie.modules.system.domain.sms.service.TbTemplateService;
import me.zhengjie.modules.sms.service.dto.TbTemplateDto; import me.zhengjie.modules.system.domain.sms.service.dto.TbTemplateDto;
import me.zhengjie.modules.sms.service.dto.TbTemplateQueryCriteria; import me.zhengjie.modules.system.domain.sms.service.dto.TbTemplateQueryCriteria;
import me.zhengjie.modules.sms.service.mapstruct.TbTemplateMapper; import me.zhengjie.modules.system.domain.sms.service.mapstruct.TbTemplateMapper;
import me.zhengjie.utils.ValidationUtil; import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.utils.FileUtil; import me.zhengjie.utils.FileUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;

@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.mapstruct; package me.zhengjie.modules.system.domain.sms.service.mapstruct;
import me.zhengjie.base.BaseMapper; import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.sms.domain.SmsConfiguration; import me.zhengjie.modules.system.domain.sms.domain.SmsConfiguration;
import me.zhengjie.modules.sms.service.dto.SmsConfigurationDto; import me.zhengjie.modules.system.domain.sms.service.dto.SmsConfigurationDto;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy; import org.mapstruct.ReportingPolicy;

@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.mapstruct; package me.zhengjie.modules.system.domain.sms.service.mapstruct;
import me.zhengjie.base.BaseMapper; import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.sms.domain.TbBlacklist; import me.zhengjie.modules.system.domain.sms.domain.TbBlacklist;
import me.zhengjie.modules.sms.service.dto.TbBlacklistDto; import me.zhengjie.modules.system.domain.sms.service.dto.TbBlacklistDto;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy; import org.mapstruct.ReportingPolicy;

@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.mapstruct; package me.zhengjie.modules.system.domain.sms.service.mapstruct;
import me.zhengjie.base.BaseMapper; import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.sms.domain.TbSendSms; import me.zhengjie.modules.system.domain.sms.domain.TbSendSms;
import me.zhengjie.modules.sms.service.dto.TbSendSmsDto; import me.zhengjie.modules.system.domain.sms.service.dto.TbSendSmsDto;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy; import org.mapstruct.ReportingPolicy;

@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package me.zhengjie.modules.sms.service.mapstruct; package me.zhengjie.modules.system.domain.sms.service.mapstruct;
import me.zhengjie.base.BaseMapper; import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.sms.domain.TbTemplate; import me.zhengjie.modules.system.domain.sms.domain.TbTemplate;
import me.zhengjie.modules.sms.service.dto.TbTemplateDto; import me.zhengjie.modules.system.domain.sms.service.dto.TbTemplateDto;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy; import org.mapstruct.ReportingPolicy;

@ -1,4 +1,4 @@
package me.zhengjie.modules.sms.util; package me.zhengjie.modules.system.domain.sms.util;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;

@ -1,4 +1,4 @@
package me.zhengjie.modules.sms.vo; package me.zhengjie.modules.system.domain.sms.vo;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;

@ -1,4 +1,4 @@
package me.zhengjie.modules.sms.vo; package me.zhengjie.modules.system.domain.sms.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

@ -1,4 +1,4 @@
package me.zhengjie.modules.sms.vo; package me.zhengjie.modules.system.domain.sms.vo;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;

@ -1,4 +1,4 @@
package me.zhengjie.modules.sms.vo; package me.zhengjie.modules.system.domain.sms.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

@ -12,10 +12,12 @@ import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.jcraft.jsch.Session; import com.jcraft.jsch.Session;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.zhengjie.exception.BadRequestException; import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.constant.DefaultConstant;
import me.zhengjie.modules.constant.FileConstant; import me.zhengjie.modules.constant.FileConstant;
import me.zhengjie.modules.upload.task.model.ResponseEncryptJsonContent; import me.zhengjie.modules.upload.task.model.ResponseEncryptJsonContent;
import me.zhengjie.modules.upload.task.model.SendEncryptJsonContent; import me.zhengjie.modules.upload.task.model.SendEncryptJsonContent;
@ -38,11 +40,13 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.nio.file.StandardOpenOption; import java.nio.file.StandardOpenOption;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -115,7 +119,7 @@ public class SaveToFileNewTask {
* @param tbUploadFileNewDto Bean * @param tbUploadFileNewDto Bean
*/ */
private void runTask(TbUploadFileNewDto tbUploadFileNewDto) { private void runTask(TbUploadFileNewDto tbUploadFileNewDto) {
boolean finalTag = false; int finalTag;
// 获取需求的地址 // 获取需求的地址
String tempFilesPath = tbUploadFileNewDto.getLocalSavePath(); String tempFilesPath = tbUploadFileNewDto.getLocalSavePath();
@ -125,16 +129,16 @@ public class SaveToFileNewTask {
// 更新状态为成功,更新解析成功的条数 // 更新状态为成功,更新解析成功的条数
TbUploadFileNew tbUploadFileNew = new TbUploadFileNew(); TbUploadFileNew tbUploadFileNew = new TbUploadFileNew();
if (finalTag) { if (finalTag > DefaultConstant.ZERO_NUMBER) {
BeanUtils.copyProperties(tbUploadFileNewDto, tbUploadFileNew); BeanUtils.copyProperties(tbUploadFileNewDto, tbUploadFileNew);
tbUploadFileNew.setFileTransSuccessCount(tbUploadFileNewDto.getFileCount()); tbUploadFileNew.setFileTransSuccessCount((long) finalTag);
tbUploadFileNew.setUploadTag(SUCCESS_TAG); tbUploadFileNew.setUploadTag(SUCCESS_TAG);
tbUploadFileNewService.update(tbUploadFileNew); tbUploadFileNewService.update(tbUploadFileNew);
} else { } else {
// 失败进行容错 // 失败进行容错
BeanUtils.copyProperties(tbUploadFileNewDto, tbUploadFileNew); BeanUtils.copyProperties(tbUploadFileNewDto, tbUploadFileNew);
tbUploadFileNew.setUploadTag(FAIL_TAG); tbUploadFileNew.setUploadTag(FAIL_TAG);
tbUploadFileNew.setFileTransSuccessCount(tbUploadFileNewDto.getFileCount()); tbUploadFileNew.setFileTransSuccessCount((long) finalTag);
tbUploadFileNewService.update(tbUploadFileNew); tbUploadFileNewService.update(tbUploadFileNew);
} }
} }
@ -145,19 +149,24 @@ public class SaveToFileNewTask {
* @param filePath * @param filePath
*/ */
@SneakyThrows @SneakyThrows
private boolean handleEachFileContent(String filePath, TbUploadFileNewDto tbUploadFileNewDto) { private int handleEachFileContent(String filePath, TbUploadFileNewDto tbUploadFileNewDto) {
List<String> phoneList = Lists.newArrayList();
//根据文件类型进行解析 //根据文件类型进行解析
List<String> listT = tbUploadFileNewDto.getFileFormat().contains(FileConstant.TXT_FILE_SUB_NAME) ? List<String> listT = tbUploadFileNewDto.getFileFormat().contains(FileConstant.TXT_FILE_SUB_NAME) ?
TxtUtils.txtParseListVyUrl(filePath) : TxtUtils.txtParseListVyUrl(filePath) :
ToolExcelUtils.excelParseListByUrl(filePath); ToolExcelUtils.excelParseListByUrl(filePath);
Map<Integer, List<String>> preEncryptNumMap = listT.stream() Map<Integer, List<String>> preEncryptNumMap = listT.stream().filter
(phone -> phone.trim().getBytes(StandardCharsets.UTF_8).length == DefaultConstant.ELEVEN_NUMBER)
.collect(Collectors.groupingBy(String::length)); .collect(Collectors.groupingBy(String::length));
if (CollectionUtil.isNotEmpty(preEncryptNumMap)) { if (CollectionUtil.isNotEmpty(preEncryptNumMap)) {
// 分批调用接口进行加密 // 分批调用接口进行加密
List<String> list = preEncryptNumMap.get(PRE_SEND_NUM_LENGTH); List<String> list = preEncryptNumMap.get(PRE_SEND_NUM_LENGTH);
if (CollectionUtil.isNotEmpty(list)) { phoneList = Lists.newArrayList(Sets.newHashSet(list));
batchSendToEncrypt(filePath, list); if (CollectionUtil.isNotEmpty(phoneList)) {
batchSendToEncrypt(filePath, phoneList);
} }
} }
// modify by q 把剩下不需要加密的内容也写到文件中 // modify by q 把剩下不需要加密的内容也写到文件中
@ -168,7 +177,7 @@ public class SaveToFileNewTask {
// 加入一个全局控制开关 // 加入一个全局控制开关
if (!booleanTag) { if (!booleanTag) {
return Boolean.FALSE; return DefaultConstant.ZERO_NUMBER;
} }
// 把临时存储的文件进行删除 // 把临时存储的文件进行删除
@ -181,9 +190,9 @@ public class SaveToFileNewTask {
boolean sendUpdatePostReqTag = sendUpdatePostReq(filePath + TEMP_FILE_END_STR, tbUploadFileNewDto); boolean sendUpdatePostReqTag = sendUpdatePostReq(filePath + TEMP_FILE_END_STR, tbUploadFileNewDto);
// fixme 这里要修改之前的平台给一个更新接口,然后这边可以用rpc调用,也可以用http,也可以考虑直接消息中间件进行解耦 // fixme 这里要修改之前的平台给一个更新接口,然后这边可以用rpc调用,也可以用http,也可以考虑直接消息中间件进行解耦
if (delFileTag && sendUpdatePostReqTag) { if (delFileTag && sendUpdatePostReqTag) {
return Boolean.TRUE; return phoneList.size();
} }
return Boolean.FALSE; return DefaultConstant.ZERO_NUMBER;
} }
private void batchSendToEncrypt(String filePath, List<String> fileAllLinesList) { private void batchSendToEncrypt(String filePath, List<String> fileAllLinesList) {

@ -8,18 +8,16 @@ import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.zhengjie.constant.SmsConstant; import me.zhengjie.constant.SmsConstant;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.constant.DefaultConstant; import me.zhengjie.modules.constant.DefaultConstant;
import me.zhengjie.modules.constant.FileConstant; import me.zhengjie.modules.constant.FileConstant;
import me.zhengjie.modules.sms.domain.TbSendSms; import me.zhengjie.modules.system.domain.sms.domain.TbSendSms;
import me.zhengjie.modules.sms.dto.ShortLinkUrlDto; import me.zhengjie.modules.system.domain.sms.dto.ShortLinkUrlDto;
import me.zhengjie.modules.sms.service.TbSendSmsService; import me.zhengjie.modules.system.domain.sms.service.TbSendSmsService;
import me.zhengjie.modules.sms.service.dto.SmsConfigurationDto; import me.zhengjie.modules.system.domain.sms.service.dto.SmsConfigurationDto;
import me.zhengjie.modules.sms.util.SmsUtil; import me.zhengjie.modules.system.domain.sms.util.SmsUtil;
import me.zhengjie.modules.uploadnew.domain.TbUploadFileNew; import me.zhengjie.modules.uploadnew.domain.TbUploadFileNew;
import me.zhengjie.modules.uploadnew.service.TbUploadFileNewService; import me.zhengjie.modules.uploadnew.service.TbUploadFileNewService;
import me.zhengjie.modules.uploadnew.service.dto.TbUploadFileNewDto; import me.zhengjie.modules.uploadnew.service.dto.TbUploadFileNewDto;
import me.zhengjie.modules.uploadnew.util.ExcelUtils;
import me.zhengjie.modules.uploadnew.util.ToolExcelUtils; import me.zhengjie.modules.uploadnew.util.ToolExcelUtils;
import me.zhengjie.modules.uploadnew.util.TxtUtils; import me.zhengjie.modules.uploadnew.util.TxtUtils;
import me.zhengjie.utils.ConvertUtil; import me.zhengjie.utils.ConvertUtil;
@ -31,7 +29,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.Instant; import java.time.Instant;

@ -59,7 +59,7 @@ public class ExcelUtils {
* @return * @return
* @throws IOException * @throws IOException
*/ */
public List<String> excelParseListByUrl(String url) throws IOException { public static List<String> excelParseListByUrl(String url) throws IOException {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
InputStream inputStream = new FileInputStream(url) ; InputStream inputStream = new FileInputStream(url) ;
Workbook workbook = new XSSFWorkbook(inputStream); Workbook workbook = new XSSFWorkbook(inputStream);

@ -1,12 +1,19 @@
package me.zhengjie.modules.uploadnew.util; package me.zhengjie.modules.uploadnew.util;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.zhengjie.modules.constant.DefaultConstant;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
@Slf4j @Slf4j
public class TxtUtils { public class TxtUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(TxtUtils.class); private static final Logger LOGGER = LoggerFactory.getLogger(TxtUtils.class);
@ -43,6 +50,7 @@ public class TxtUtils {
/** /**
* txt * txt
* @param url * @param url
* update
* @return * @return
* @throws IOException * @throws IOException
*/ */
@ -53,7 +61,7 @@ public class TxtUtils {
try { try {
String count; String count;
while((count = d.readLine()) != null){ while((count = d.readLine()) != null){
String u = count.toUpperCase(); String u = StrUtil.cleanBlank(count.toUpperCase());
list.add(u); list.add(u);
} }

@ -46,9 +46,9 @@ spring:
redis: redis:
#数据库索引 #数据库索引
database: 0 database: 0
host: 127.0.0.1 host: 8.130.96.163
port: 6379 port: 6379
password: '012099' password:
#连接超时时间 #连接超时时间
timeout: 5000 timeout: 5000
@ -137,8 +137,8 @@ sys:
debug: true debug: true
redisson: redisson:
address: redis://127.0.0.1:6379 address: redis://8.130.96.163:6379
password: '012099' password:
rdsFileRecord: rdsFileRecord:
link: link:
downloadUrl: http://116.60.197.152:8000/api/tempFileRecord/downloadFile downloadUrl: http://116.60.197.152:8000/api/tempFileRecord/downloadFile

@ -6,7 +6,7 @@ spring:
freemarker: freemarker:
check-template-location: false check-template-location: false
profiles: profiles:
active: prod active: dev
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
data: data:

Loading…
Cancel
Save