mirror of
https://github.com/luoye663/e5.git
synced 2024-12-25 11:18:50 +00:00
~
This commit is contained in:
parent
bd48b33078
commit
3f7505c16d
@ -15,4 +15,6 @@ public class OutlookVo {
|
|||||||
private String clientSecret;
|
private String clientSecret;
|
||||||
private Integer cronTimeRandomStart;
|
private Integer cronTimeRandomStart;
|
||||||
private Integer cronTimeRandomEnd;
|
private Integer cronTimeRandomEnd;
|
||||||
|
private Integer step;
|
||||||
|
private Integer status;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import lombok.Data;
|
|||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
public class SaveRandomBo {
|
public class SaveRandomBo {
|
||||||
|
private int outlookId;
|
||||||
private int cronTime;
|
private int cronTime;
|
||||||
private String crondomTime;
|
private String crondomTime;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import io.qyi.e5.outlook.bean.bo.insertOneBO;
|
|||||||
import io.qyi.e5.outlook.entity.Outlook;
|
import io.qyi.e5.outlook.entity.Outlook;
|
||||||
import io.qyi.e5.outlook.service.IOutlookService;
|
import io.qyi.e5.outlook.service.IOutlookService;
|
||||||
import io.qyi.e5.util.ResultUtil;
|
import io.qyi.e5.util.ResultUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
@ -34,6 +35,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/outlook/outlook")
|
@RequestMapping("/outlook/outlook")
|
||||||
|
@Slf4j
|
||||||
public class OutlookController {
|
public class OutlookController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -96,7 +98,7 @@ public class OutlookController {
|
|||||||
return ResultUtil.error(-1, "最大间隔时间为 6 小时");
|
return ResultUtil.error(-1, "最大间隔时间为 6 小时");
|
||||||
}
|
}
|
||||||
UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
|
UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
|
||||||
if (outlookService.saveRandomTime(authentication.getGithub_id(), bo.getCronTime(), cron_time_random_start, cron_time_random_end)) {
|
if (outlookService.saveRandomTime(authentication.getGithub_id(), bo.getCronTime(), bo.getOutlookId(), cron_time_random_start, cron_time_random_end)) {
|
||||||
return ResultUtil.success();
|
return ResultUtil.success();
|
||||||
}
|
}
|
||||||
return ResultUtil.error(ResultEnum.UNKNOWN_ERROR);
|
return ResultUtil.error(ResultEnum.UNKNOWN_ERROR);
|
||||||
@ -126,6 +128,7 @@ public class OutlookController {
|
|||||||
List<OutlookListVo> vo = new ArrayList<>();
|
List<OutlookListVo> vo = new ArrayList<>();
|
||||||
outlooklist.forEach(outlook -> {
|
outlooklist.forEach(outlook -> {
|
||||||
OutlookListVo v = new OutlookListVo();
|
OutlookListVo v = new OutlookListVo();
|
||||||
|
log.info(outlook.toString());
|
||||||
BeanUtils.copyProperties(outlook, v);
|
BeanUtils.copyProperties(outlook, v);
|
||||||
vo.add(v);
|
vo.add(v);
|
||||||
});
|
});
|
||||||
|
@ -65,6 +65,12 @@ public class Outlook implements Serializable {
|
|||||||
|
|
||||||
/*描述*/
|
/*描述*/
|
||||||
private String describes;
|
private String describes;
|
||||||
|
/*步骤*/
|
||||||
|
private Integer step;
|
||||||
|
/**
|
||||||
|
* 随机时间结束
|
||||||
|
* 状态: 1、等待配置 2、暂停 3、运行中 4、封禁 5、已停止(由于调用错误导致的停止)
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务类
|
* 服务类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author 落叶
|
* @author 落叶
|
||||||
@ -15,13 +15,13 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface IOutlookService extends IService<Outlook> {
|
public interface IOutlookService extends IService<Outlook> {
|
||||||
|
|
||||||
boolean getTokenAndSave(String code,String client_id,String client_secret,String redirect_uri,String grant_type) throws Exception;
|
boolean getTokenAndSave(String code, String client_id, String client_secret, String redirect_uri, String grant_type) throws Exception;
|
||||||
|
|
||||||
Outlook insertOne(String name, String describe, int github_id);
|
Outlook insertOne(String name, String describe, int github_id);
|
||||||
|
|
||||||
boolean save(String client_id, String client_secret, int outlook_id, int github_id);
|
boolean save(String client_id, String client_secret, int outlook_id, int github_id);
|
||||||
|
|
||||||
boolean saveRandomTime(int github_id, int cron_time, int cron_time_random_start, int cron_time_random_end);
|
boolean saveRandomTime(int github_id, int cron_time, int outlook_id, int cron_time_random_start, int cron_time_random_end);
|
||||||
|
|
||||||
int getMailList(Outlook outlook) throws Exception;
|
int getMailList(Outlook outlook) throws Exception;
|
||||||
|
|
||||||
|
@ -116,6 +116,8 @@ public class OutlookServiceImpl extends ServiceImpl<OutlookMapper, Outlook> impl
|
|||||||
}
|
}
|
||||||
outlook1.setClientId(client_id);
|
outlook1.setClientId(client_id);
|
||||||
outlook1.setClientSecret(client_secret);
|
outlook1.setClientSecret(client_secret);
|
||||||
|
outlook1.setStep(1)
|
||||||
|
.setStatus(8);;
|
||||||
if (baseMapper.update(outlook1, queryWrapper) != 1) {
|
if (baseMapper.update(outlook1, queryWrapper) != 1) {
|
||||||
throw new APIException("更新记录失败!");
|
throw new APIException("更新记录失败!");
|
||||||
}
|
}
|
||||||
@ -123,14 +125,20 @@ public class OutlookServiceImpl extends ServiceImpl<OutlookMapper, Outlook> impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean saveRandomTime(int github_id, int cron_time, int cron_time_random_start, int cron_time_random_end) {
|
public boolean saveRandomTime(int github_id, int cron_time, int outlook_id ,int cron_time_random_start, int cron_time_random_end) {
|
||||||
if (github_id == 0) {
|
if (github_id == 0 || outlook_id == 0) {
|
||||||
return false;
|
throw new APIException("缺少参数!");
|
||||||
}
|
}
|
||||||
UpdateWrapper<Outlook> Wrapper = new UpdateWrapper<>();
|
UpdateWrapper<Outlook> Wrapper = new UpdateWrapper<>();
|
||||||
Wrapper.eq("github_id", github_id);
|
Wrapper.eq("github_id", github_id);
|
||||||
|
Wrapper.eq("id", outlook_id);
|
||||||
Outlook outlook = new Outlook();
|
Outlook outlook = new Outlook();
|
||||||
outlook.setCronTime(cron_time).setCronTimeRandomStart(cron_time_random_start).setCronTimeRandomEnd(cron_time_random_end);
|
outlook.setCronTime(cron_time)
|
||||||
|
.setCronTimeRandomStart(cron_time_random_start)
|
||||||
|
.setCronTimeRandomEnd(cron_time_random_end)
|
||||||
|
.setStep(2)
|
||||||
|
.setStatus(6);
|
||||||
|
|
||||||
int update = baseMapper.update(outlook, Wrapper);
|
int update = baseMapper.update(outlook, Wrapper);
|
||||||
// 有数据
|
// 有数据
|
||||||
if (update > 0) {
|
if (update > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user