水资源调度
parent
a16a90ddc1
commit
fac56264f7
|
|
@ -3,6 +3,7 @@ package com.gunshi.project.hsz.controller;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gunshi.core.result.R;
|
import com.gunshi.core.result.R;
|
||||||
|
import com.gunshi.core.session.entity.SessionUser;
|
||||||
import com.gunshi.project.hsz.entity.so.WaterDispatchPageSo;
|
import com.gunshi.project.hsz.entity.so.WaterDispatchPageSo;
|
||||||
import com.gunshi.project.hsz.entity.so.XlPlanPageSo;
|
import com.gunshi.project.hsz.entity.so.XlPlanPageSo;
|
||||||
import com.gunshi.project.hsz.entity.vo.WdCountVo;
|
import com.gunshi.project.hsz.entity.vo.WdCountVo;
|
||||||
|
|
@ -16,6 +17,7 @@ import com.gunshi.project.hsz.validate.markers.Update;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
@ -61,10 +63,15 @@ public class WaterDispatchController extends AbstractCommonFileController {
|
||||||
|
|
||||||
@Operation(summary = "反馈")
|
@Operation(summary = "反馈")
|
||||||
@PostMapping("/feedback")
|
@PostMapping("/feedback")
|
||||||
public R<WaterDispatch> feedback(@RequestBody WaterDispatch dto) {
|
public R<WaterDispatch> feedback(@RequestBody WaterDispatch dto, HttpServletRequest request) {
|
||||||
|
SessionUser sessionUser = checkLogin(request);
|
||||||
|
if(sessionUser != null){
|
||||||
|
dto.setResPerson(sessionUser.getUserId().toString());
|
||||||
|
dto.setResPersonName(sessionUser.getUserName());
|
||||||
|
}
|
||||||
boolean flag = waterDispatchService.feedBack(dto);
|
boolean flag = waterDispatchService.feedBack(dto);
|
||||||
if(flag){
|
if(flag){
|
||||||
fileService.saveFile(dto.getFiles(),getGroupId(),dto.getId().toString());
|
fileService.saveFile(dto.getResFiles(),getResGroupId(),dto.getId().toString());
|
||||||
}
|
}
|
||||||
return R.ok(dto);
|
return R.ok(dto);
|
||||||
}
|
}
|
||||||
|
|
@ -89,6 +96,7 @@ public class WaterDispatchController extends AbstractCommonFileController {
|
||||||
boolean flag = waterDispatchService.removeById(id);
|
boolean flag = waterDispatchService.removeById(id);
|
||||||
if(flag){
|
if(flag){
|
||||||
fileService.deleteFile(getGroupId(),byId.getId().toString());
|
fileService.deleteFile(getGroupId(),byId.getId().toString());
|
||||||
|
fileService.deleteFile(getResGroupId(),byId.getId().toString());
|
||||||
}
|
}
|
||||||
return R.ok(true);
|
return R.ok(true);
|
||||||
}
|
}
|
||||||
|
|
@ -98,9 +106,10 @@ public class WaterDispatchController extends AbstractCommonFileController {
|
||||||
public R<Page<WaterDispatch>> page(@RequestBody WaterDispatchPageSo pageSo) {
|
public R<Page<WaterDispatch>> page(@RequestBody WaterDispatchPageSo pageSo) {
|
||||||
Page<WaterDispatch> res = waterDispatchService.pageQuery(pageSo);
|
Page<WaterDispatch> res = waterDispatchService.pageQuery(pageSo);
|
||||||
if(!CollectionUtils.isEmpty(res.getRecords())){
|
if(!CollectionUtils.isEmpty(res.getRecords())){
|
||||||
res.getRecords().forEach(o -> o.setFiles(
|
res.getRecords().stream().forEach(o ->{
|
||||||
fileService.getFiles(getGroupId(),o.getId().toString())
|
o.setFiles(fileService.getFiles(getGroupId(),o.getId().toString()));
|
||||||
));
|
o.setResFiles(fileService.getFiles2(getResGroupId(),o.getId().toString()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return R.ok(res);
|
return R.ok(res);
|
||||||
}
|
}
|
||||||
|
|
@ -116,4 +125,8 @@ public class WaterDispatchController extends AbstractCommonFileController {
|
||||||
public String getGroupId() {
|
public String getGroupId() {
|
||||||
return "waterDispatch";
|
return "waterDispatch";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getResGroupId(){
|
||||||
|
return "waterDispatchRes";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,34 @@ public interface FileAssociationsMapper extends BaseMapper<FileAssociations> {
|
||||||
fa.del = '1'
|
fa.del = '1'
|
||||||
AND fa.business_id = #{businessId}
|
AND fa.business_id = #{businessId}
|
||||||
AND fa."table_name" = #{tableName}
|
AND fa."table_name" = #{tableName}
|
||||||
AND fd.group_id = #{tableName}
|
AND fd.group_id = #{tableName}
|
||||||
ORDER BY fa.tm desc
|
ORDER BY fa.tm desc
|
||||||
</script>
|
</script>
|
||||||
""")
|
""")
|
||||||
List<FileAssociations> getFiles(@Param("tableName") String tableName,@Param("businessId") String businessId);
|
List<FileAssociations> getFiles(@Param("tableName") String tableName,@Param("businessId") String businessId);
|
||||||
|
|
||||||
|
@Select("""
|
||||||
|
<script>
|
||||||
|
SELECT
|
||||||
|
fa.*,
|
||||||
|
fd.file_name,
|
||||||
|
fd.file_size,
|
||||||
|
fd.file_path
|
||||||
|
FROM
|
||||||
|
file_associations fa
|
||||||
|
LEFT JOIN file_descriptor fd ON fa.file_id = fd.file_id
|
||||||
|
WHERE
|
||||||
|
fa.del = '1'
|
||||||
|
AND fa.business_id = #{businessId}
|
||||||
|
AND fa."table_name" = #{tableName}
|
||||||
|
ORDER BY fa.tm desc
|
||||||
|
</script>
|
||||||
|
""")
|
||||||
|
List<FileAssociations> getFiles2(@Param("tableName") String tableName,@Param("businessId") String businessId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Select("""
|
@Select("""
|
||||||
<script>
|
<script>
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -97,4 +120,7 @@ public interface FileAssociationsMapper extends BaseMapper<FileAssociations> {
|
||||||
</script>
|
</script>
|
||||||
""")
|
""")
|
||||||
List<FileAssociations> getFilesByIds(@Param("ids") List<String> ids);
|
List<FileAssociations> getFilesByIds(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -32,7 +32,7 @@ public class WaterDispatch {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField("is_distribute")
|
||||||
@Schema(description = "是否下发 0 是 1 否")
|
@Schema(description = "是否下发 0 是 1 否")
|
||||||
private Integer isDistribute;
|
private Integer isDistribute;
|
||||||
|
|
||||||
|
|
@ -109,6 +109,19 @@ public class WaterDispatch {
|
||||||
@Schema(description = "执行结果反馈")
|
@Schema(description = "执行结果反馈")
|
||||||
private String resFb;
|
private String resFb;
|
||||||
|
|
||||||
|
@TableField("res_person")
|
||||||
|
@Schema(description = "反馈人员id")
|
||||||
|
private String resPerson;
|
||||||
|
|
||||||
|
@TableField("res_person_name")
|
||||||
|
@Schema(description = "反馈人员名称")
|
||||||
|
private String resPersonName;
|
||||||
|
|
||||||
|
@TableField("res_tm")
|
||||||
|
@Schema(description = "反馈时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date resTm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否完成 0是 1否
|
* 是否完成 0是 1否
|
||||||
*/
|
*/
|
||||||
|
|
@ -122,4 +135,9 @@ public class WaterDispatch {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@Schema(description = "文件列表")
|
@Schema(description = "文件列表")
|
||||||
private List<FileAssociations> files;
|
private List<FileAssociations> files;
|
||||||
|
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Schema(description = "反馈文件列表")
|
||||||
|
private List<FileAssociations> resFiles;
|
||||||
}
|
}
|
||||||
|
|
@ -210,6 +210,11 @@ public class FileAssociationsService extends ServiceImpl<FileAssociationsMapper,
|
||||||
return this.baseMapper.getFiles(tName,bId);
|
return this.baseMapper.getFiles(tName,bId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<FileAssociations> getFiles2(String tName, String bId) {
|
||||||
|
return this.baseMapper.getFiles2(tName,bId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Cacheable(value = THIS_REDIS_KEY, key = "#p0 +':'+ #p1 +':'+ #p2", unless = "false")
|
@Cacheable(value = THIS_REDIS_KEY, key = "#p0 +':'+ #p1 +':'+ #p2", unless = "false")
|
||||||
public List<FileAssociations> getFiles(String tName, String bId,String num) {
|
public List<FileAssociations> getFiles(String tName, String bId,String num) {
|
||||||
return this.baseMapper.getFiles1(tName,bId,num);
|
return this.baseMapper.getFiles1(tName,bId,num);
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,13 @@ public class WaterDispatchService extends ServiceImpl<WaterDispatchMapper, Water
|
||||||
dto.setExePersonName(sysUser.getNickName());
|
dto.setExePersonName(sysUser.getNickName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(dto.getIsDistribute() == 0){//如果选择下发
|
if(dto.getIsDistribute() != null && dto.getIsDistribute() == 0){//如果选择下发
|
||||||
dto.setExeStatus(2);//状态改为下发中
|
dto.setExeStatus(2);//状态改为下发中
|
||||||
}else{
|
}else{
|
||||||
dto.setExeStatus(1);//否则为待下发
|
dto.setExeStatus(1);//否则为待下发
|
||||||
|
dto.setIsDistribute(1);
|
||||||
}
|
}
|
||||||
|
dto.setFillTime(new Date());
|
||||||
save(dto);
|
save(dto);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -58,7 +60,8 @@ public class WaterDispatchService extends ServiceImpl<WaterDispatchMapper, Water
|
||||||
if(dto.getIsCompelete() == 0){
|
if(dto.getIsCompelete() == 0){
|
||||||
dto.setExeStatus(0);
|
dto.setExeStatus(0);
|
||||||
}
|
}
|
||||||
dto.setFillTime(new Date());
|
dto.setResTm(new Date());
|
||||||
|
dto.setFillTime(byId.getFillTime());
|
||||||
updateById(dto);
|
updateById(dto);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -74,6 +77,12 @@ public class WaterDispatchService extends ServiceImpl<WaterDispatchMapper, Water
|
||||||
dto.setExePersonName(sysUser.getNickName());
|
dto.setExePersonName(sysUser.getNickName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(dto.getIsDistribute() != null && dto.getIsDistribute() == 0){//如果选择下发
|
||||||
|
dto.setExeStatus(2);//状态改为下发中
|
||||||
|
}else{
|
||||||
|
dto.setExeStatus(1);//否则为待下发
|
||||||
|
dto.setIsDistribute(1);
|
||||||
|
}
|
||||||
updateById(dto);
|
updateById(dto);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -39,7 +40,7 @@ public class WaterRTask {
|
||||||
|
|
||||||
|
|
||||||
//每70分钟执行一次
|
//每70分钟执行一次
|
||||||
// @Scheduled(fixedRate = 10 , timeUnit = TimeUnit.SECONDS)
|
//@Scheduled(fixedRate = 70 , timeUnit = TimeUnit.MINUTES)
|
||||||
public void syncDataToReorganize() {
|
public void syncDataToReorganize() {
|
||||||
LambdaQueryWrapper<StWaterRReorganize> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<StWaterRReorganize> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.orderByDesc(StWaterRReorganize::getTm)
|
queryWrapper.orderByDesc(StWaterRReorganize::getTm)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue