|
@@ -12,9 +12,11 @@ import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Random;
|
|
|
|
|
|
/**
|
|
|
* @author zhao
|
|
@@ -52,6 +54,7 @@ public class ProxyDemandServiceImpl implements ProxyDemandService {
|
|
|
if(!o.toString().equals(proxyVerifyDTO.getImgCode())){
|
|
|
throw new BusinessException("验证码错误");
|
|
|
}
|
|
|
+ String result = getTime();
|
|
|
ProxyDemand proxyDemand = new ProxyDemand();
|
|
|
proxyDemand.setCreatTime(new Date());
|
|
|
proxyDemand.setUnitName(proxyVerifyDTO.getUnitName());
|
|
@@ -65,11 +68,25 @@ public class ProxyDemandServiceImpl implements ProxyDemandService {
|
|
|
proxyDemand.setProxyName(proxyVerifyDTO.getProxyName());
|
|
|
proxyDemand.setProxyPhone(proxyVerifyDTO.getProxyPhone());
|
|
|
proxyDemand.setProxyMatters(proxyVerifyDTO.getProxyMatters());
|
|
|
+ proxyDemand.setReserveKey(result);
|
|
|
//proxyDemand.setHandleTotal(handleTotal+1);
|
|
|
proxyDemandDao.insert(proxyDemand);
|
|
|
- return BaseResult.ok();
|
|
|
+ return BaseResult.okData(result);
|
|
|
}
|
|
|
|
|
|
+ private static String getTime() {
|
|
|
+ // 创建SimpleDateFormat实例来格式化日期为月和日
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("MMdd");
|
|
|
+ // 获取当前日期(月和日)
|
|
|
+ String formattedDate = dateFormat.format(new Date());
|
|
|
+ // 创建一个Random实例,并生成一个两位的随机数 (00 到 99)
|
|
|
+ Random random = new Random();
|
|
|
+ int randomNumber = random.nextInt(100); // 生成从 0 到 99 的数字
|
|
|
+ String formattedRandomNumber = String.format("%02d", randomNumber); // 确保是两位数
|
|
|
+ // 组合日期和随机数
|
|
|
+ String result = formattedDate + formattedRandomNumber;
|
|
|
+ return result;
|
|
|
+ }
|
|
|
@Override
|
|
|
public void update(ProxyDemand proxyDemand) {
|
|
|
proxyDemandDao.update(proxyDemand);
|