|
|
|
@ -41,7 +41,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
/**
|
|
|
|
|
* @website https://el-admin.vip
|
|
|
|
|
* @author x
|
|
|
|
|
* @date 2020-09-08
|
|
|
|
|
* @date 2020-09-09
|
|
|
|
|
**/
|
|
|
|
|
@RestController
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
@ -112,8 +112,9 @@ public class TaskRecordController {
|
|
|
|
|
if (CollectionUtils.isEmpty(idList)){
|
|
|
|
|
return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.EMPTY_ARGUMENT), HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
// 调用发送课包任务,开始发送
|
|
|
|
|
sendRecordTask.doRunTask(idList);
|
|
|
|
|
return new ResponseEntity<>(HttpStatus.OK);
|
|
|
|
|
return new ResponseEntity<>(CommonResponse.createBySuccess(), HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -127,7 +128,7 @@ public class TaskRecordController {
|
|
|
|
|
@ApiOperation("发送课包数目校验")
|
|
|
|
|
@PreAuthorize("@el.check('taskRecord:list')")
|
|
|
|
|
@PostMapping(value = "/checkSendTotal")
|
|
|
|
|
public ResponseEntity<Object> checkSendTotal(@RequestParam(value = "sendTotal", defaultValue = "0") Integer sendTotal,
|
|
|
|
|
public ResponseEntity<Object> checkSendTotal(@RequestParam(value = "sendTotal", defaultValue = "0") Long sendTotal,
|
|
|
|
|
@RequestParam(value = "id")Integer id){
|
|
|
|
|
if (sendTotal == null || id == null){
|
|
|
|
|
return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.EMPTY_ARGUMENT), HttpStatus.OK);
|
|
|
|
@ -137,15 +138,21 @@ public class TaskRecordController {
|
|
|
|
|
if (dto == null){
|
|
|
|
|
return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.NO_RELEVANT_CONTENT_WAS_FOUND), HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
// (本次发送数目 + 最后一次发送数目) < 该任务课包总条数
|
|
|
|
|
// TODO: 2020/9/9 0009 编写相关逻辑代码
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ResponseEntity<>(HttpStatus.OK);
|
|
|
|
|
// 满足要求的公式 (本次发送数目 + 最后一次发送数目) < 该任务课包总条数
|
|
|
|
|
if (!isMatchCheckNum(dto, sendTotal)){
|
|
|
|
|
return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.NO_MATCH_ARGUMENT_SET), HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
return new ResponseEntity<>(CommonResponse.createBySuccess(), HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isMatchCheckNum(TaskRecordDto dto, Long sendTotal){
|
|
|
|
|
Long total = dto.getTotal();
|
|
|
|
|
Long send = dto.getSendTotal();
|
|
|
|
|
if ((sendTotal + send) < total){
|
|
|
|
|
return Boolean.TRUE;
|
|
|
|
|
}
|
|
|
|
|
return Boolean.FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Log("任务课包任务合并")
|
|
|
|
|
@ApiOperation("任务课包任务合并")
|
|
|
|
@ -156,4 +163,4 @@ public class TaskRecordController {
|
|
|
|
|
return new ResponseEntity<>(HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
// ================ 自定义功能实现 end ================
|
|
|
|
|
}
|
|
|
|
|
}
|