基础管理

This commit is contained in:
cwchen 2024-03-22 18:28:30 +08:00
parent ad4d37ffe6
commit c6a424fe54
5 changed files with 138 additions and 55 deletions

View File

@ -66,12 +66,16 @@ public class ProServiceImpl implements IProService {
@Override @Override
public List<ProVo> getProLists(ProDto dto) { public List<ProVo> getProLists(ProDto dto) {
List<ProVo> list = new ArrayList<>(); List<ProVo> list = new ArrayList<>();
list = mapper.getProLists(dto); try {
list.forEach(item -> { list = mapper.getProLists(dto);
List<Integer> fileNums = mapper.getProFiles(item.getProId()); list.forEach(item -> {
item.setProImgFileNum(fileNums.get(0)); List<Integer> fileNums = mapper.getProFiles(item.getProId());
item.setProFileNum(fileNums.get(1)); item.setProImgFileNum(fileNums.get(0));
}); item.setProFileNum(fileNums.get(1));
});
} catch (Exception e) {
log.error("获取工程列表",e);
}
return list; return list;
} }
@ -156,25 +160,29 @@ public class ProServiceImpl implements IProService {
@Override @Override
public AjaxResult getProById(ProDto dto) { public AjaxResult getProById(ProDto dto) {
ProVo vo = new ProVo(); ProVo vo = new ProVo();
vo = mapper.getProById(dto); try {
List<ResourceFileVo> resourceFileVos = mapper.getFiles(vo.getProId()); vo = mapper.getProById(dto);
if (CollectionUtils.isNotEmpty(resourceFileVos)) { List<ResourceFileVo> resourceFileVos = mapper.getFiles(vo.getProId());
List<ProVo.FileData> list = new ArrayList<>(); if (CollectionUtils.isNotEmpty(resourceFileVos)) {
for (ResourceFileVo fileVo : resourceFileVos) { List<ProVo.FileData> list = new ArrayList<>();
String base64 = null; for (ResourceFileVo fileVo : resourceFileVos) {
Result<SysFile> result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER); String base64 = null;
if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) { Result<SysFile> result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER);
String jsonString = JSON.toJSONString(result.getData()); if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
JSONObject item = JSON.parseObject(jsonString); String jsonString = JSON.toJSONString(result.getData());
base64 = item.getString("url"); JSONObject item = JSON.parseObject(jsonString);
base64 = item.getString("url");
}
ProVo.FileData fileData = new ProVo.FileData();
fileData.setFileId(fileVo.getFileId());
fileData.setBase64Url(base64);
fileData.setFileSourceType(fileVo.getSourceType());
list.add(fileData);
} }
ProVo.FileData fileData = new ProVo.FileData(); vo.setFileData(list);
fileData.setFileId(fileVo.getFileId());
fileData.setBase64Url(base64);
fileData.setFileSourceType(fileVo.getSourceType());
list.add(fileData);
} }
vo.setFileData(list); } catch (Exception e) {
log.error("工程详情",e);
} }
return AjaxResult.success(vo); return AjaxResult.success(vo);
} }
@ -225,24 +233,28 @@ public class ProServiceImpl implements IProService {
@Override @Override
public AjaxResult viewProFile(ProDto dto) { public AjaxResult viewProFile(ProDto dto) {
List<ProVo.FileData> list = new ArrayList<>(); List<ProVo.FileData> list = new ArrayList<>();
List<ResourceFileVo> resourceFileVos = mapper.getFiles(dto.getProId()); try {
if (CollectionUtils.isNotEmpty(resourceFileVos)) { List<ResourceFileVo> resourceFileVos = mapper.getFiles(dto.getProId());
for (ResourceFileVo fileVo : resourceFileVos) { if (CollectionUtils.isNotEmpty(resourceFileVos)) {
if (Objects.equals(dto.getFileType(), fileVo.getSourceType())) { for (ResourceFileVo fileVo : resourceFileVos) {
String base64 = null; if (Objects.equals(dto.getFileType(), fileVo.getSourceType())) {
Result<SysFile> result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER); String base64 = null;
if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) { Result<SysFile> result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER);
String jsonString = JSON.toJSONString(result.getData()); if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
JSONObject item = JSON.parseObject(jsonString); String jsonString = JSON.toJSONString(result.getData());
base64 = item.getString("url"); JSONObject item = JSON.parseObject(jsonString);
base64 = item.getString("url");
}
ProVo.FileData fileData = new ProVo.FileData();
fileData.setFileId(fileVo.getFileId());
fileData.setBase64Url(base64);
fileData.setFileSourceType(fileVo.getSourceType());
list.add(fileData);
} }
ProVo.FileData fileData = new ProVo.FileData();
fileData.setFileId(fileVo.getFileId());
fileData.setBase64Url(base64);
fileData.setFileSourceType(fileVo.getSourceType());
list.add(fileData);
} }
} }
} catch (Exception e) {
log.error("工程图片/平面图预览",e);
} }
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@ -511,7 +523,11 @@ public class ProServiceImpl implements IProService {
@Override @Override
public List<GxPlanVo> getGxPlanLists(GxPlanDto dto) { public List<GxPlanVo> getGxPlanLists(GxPlanDto dto) {
List<GxPlanVo> list = new ArrayList<>(); List<GxPlanVo> list = new ArrayList<>();
list = mapper.getGxPlanLists(dto); try {
list = mapper.getGxPlanLists(dto);
} catch (Exception e) {
log.error("获取工序列表",e);
}
return list; return list;
} }
@ -603,7 +619,11 @@ public class ProServiceImpl implements IProService {
@Override @Override
public AjaxResult getGxPlanById(GxPlanDto dto) { public AjaxResult getGxPlanById(GxPlanDto dto) {
GxPlanVo vo = new GxPlanVo(); GxPlanVo vo = new GxPlanVo();
vo = mapper.getGxPlanById(dto); try {
vo = mapper.getGxPlanById(dto);
} catch (Exception e) {
log.error("工序计划详情",e);
}
return AjaxResult.success(vo); return AjaxResult.success(vo);
} }

View File

@ -31,7 +31,11 @@ public class RoleServiceImpl implements IRoleService {
@Override @Override
public List<RoleVo> getRoleLists(RoleDto dto) { public List<RoleVo> getRoleLists(RoleDto dto) {
List<RoleVo> list = new ArrayList<>(); List<RoleVo> list = new ArrayList<>();
list = mapper.getRoleLists(dto); try {
list = mapper.getRoleLists(dto);
} catch (Exception e) {
log.error("获取角色列表",e);
}
return list; return list;
} }
@ -67,7 +71,11 @@ public class RoleServiceImpl implements IRoleService {
@Override @Override
public AjaxResult getRoleById(RoleDto dto) { public AjaxResult getRoleById(RoleDto dto) {
RoleVo vo = new RoleVo(); RoleVo vo = new RoleVo();
vo = mapper.getRoleById(dto); try {
vo = mapper.getRoleById(dto);
} catch (Exception e) {
log.error("角色详情",e);
}
return AjaxResult.success(vo); return AjaxResult.success(vo);
} }
@ -96,7 +104,11 @@ public class RoleServiceImpl implements IRoleService {
@Override @Override
public AjaxResult getAuthMenu(RoleDto dto) { public AjaxResult getAuthMenu(RoleDto dto) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
list = mapper.getAuthMenu(dto); try {
list = mapper.getAuthMenu(dto);
} catch (Exception e) {
log.error("获取角色授权的菜单",e);
}
return AjaxResult.success(list); return AjaxResult.success(list);
} }
} }

View File

@ -49,7 +49,11 @@ public class SelectServiceImpl implements ISelectService {
@Override @Override
public AjaxResult getRoleLists() { public AjaxResult getRoleLists() {
List<SelectVo> list = new ArrayList<>(); List<SelectVo> list = new ArrayList<>();
list = mapper.getRoleLists(); try {
list = mapper.getRoleLists();
} catch (Exception e) {
log.error("角色下拉选",e);
}
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@ -100,42 +104,66 @@ public class SelectServiceImpl implements ISelectService {
@Override @Override
public AjaxResult getBuildLists() { public AjaxResult getBuildLists() {
List<SelectVo> list = new ArrayList<>(); List<SelectVo> list = new ArrayList<>();
list = mapper.getBuildLists(); try {
list = mapper.getBuildLists();
} catch (Exception e) {
log.error("建管单位下拉选",e);
}
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@Override @Override
public AjaxResult getDictLists(SelectDto dto) { public AjaxResult getDictLists(SelectDto dto) {
List<SelectVo> list = new ArrayList<>(); List<SelectVo> list = new ArrayList<>();
list = mapper.getDictLists(dto); try {
list = mapper.getDictLists(dto);
} catch (Exception e) {
log.error("字典表下拉选",e);
}
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@Override @Override
public AjaxResult getTowerLists(SelectDto dto) { public AjaxResult getTowerLists(SelectDto dto) {
List<SelectVo> list = new ArrayList<>(); List<SelectVo> list = new ArrayList<>();
list = mapper.getTowerLists(dto); try {
list = mapper.getTowerLists(dto);
} catch (Exception e) {
log.error("杆塔下拉选",e);
}
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@Override @Override
public AjaxResult getTeamLists(SelectDto dto) { public AjaxResult getTeamLists(SelectDto dto) {
List<SelectVo> list = new ArrayList<>(); List<SelectVo> list = new ArrayList<>();
list = mapper.getTeamLists(dto); try {
list = mapper.getTeamLists(dto);
} catch (Exception e) {
log.error("班组下拉选",e);
}
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@Override @Override
public AjaxResult getProLists(SelectDto dto) { public AjaxResult getProLists(SelectDto dto) {
List<SelectVo> list = new ArrayList<>(); List<SelectVo> list = new ArrayList<>();
list = mapper.getProLists(dto); try {
list = mapper.getProLists(dto);
} catch (Exception e) {
log.error("工程下拉选",e);
}
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@Override @Override
public AjaxResult getAreaLists(SelectDto dto) { public AjaxResult getAreaLists(SelectDto dto) {
List<SelectVo> list = new ArrayList<>(); List<SelectVo> list = new ArrayList<>();
list = mapper.getAreaLists(dto); try {
list = mapper.getAreaLists(dto);
} catch (Exception e) {
log.error("区域下拉选");
}
return AjaxResult.success(list); return AjaxResult.success(list);
} }
} }

View File

@ -34,7 +34,11 @@ public class TeamQuEvalServiceImpl implements ITeamQuEvalService {
@Override @Override
public List<TeamQuEvalVo> getTeamQuEvalLists(TeamQuEvalDto dto) { public List<TeamQuEvalVo> getTeamQuEvalLists(TeamQuEvalDto dto) {
List<TeamQuEvalVo> list = new ArrayList<>(); List<TeamQuEvalVo> list = new ArrayList<>();
list = mapper.getTeamQuEvalLists(dto); try {
list = mapper.getTeamQuEvalLists(dto);
} catch (Exception e) {
log.error("获取班组质量评价列表",e);
}
return list; return list;
} }
@ -64,7 +68,11 @@ public class TeamQuEvalServiceImpl implements ITeamQuEvalService {
@Override @Override
public AjaxResult getTeamEvalById(TeamQuEvalDto dto) { public AjaxResult getTeamEvalById(TeamQuEvalDto dto) {
TeamQuEvalVo vo = new TeamQuEvalVo(); TeamQuEvalVo vo = new TeamQuEvalVo();
vo = mapper.getTeamEvalById(dto); try {
vo = mapper.getTeamEvalById(dto);
} catch (Exception e) {
log.error("班组质量评价详情",e);
}
return AjaxResult.success(vo); return AjaxResult.success(vo);
} }

View File

@ -34,7 +34,11 @@ public class UserServiceImpl implements IUserService {
@Override @Override
public List<UserVo> getUserLists(UserDto dto) { public List<UserVo> getUserLists(UserDto dto) {
List<UserVo> list = new ArrayList<>(); List<UserVo> list = new ArrayList<>();
list = mapper.getUserLists(dto); try {
list = mapper.getUserLists(dto);
} catch (Exception e) {
log.error("获取用户列表",e);
}
return list; return list;
} }
@ -69,14 +73,25 @@ public class UserServiceImpl implements IUserService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult delUser(UserDto dto) { public AjaxResult delUser(UserDto dto) {
mapper.delUser(dto); try {
mapper.delUser(dto);
} catch (Exception e) {
log.error("删除用户",e);
//手动回滚异常
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error();
}
return AjaxResult.success(); return AjaxResult.success();
} }
@Override @Override
public AjaxResult getUserById(UserDto dto) { public AjaxResult getUserById(UserDto dto) {
UserVo vo = new UserVo(); UserVo vo = new UserVo();
vo = mapper.getUserById(dto); try {
vo = mapper.getUserById(dto);
} catch (Exception e) {
log.error("用户详情",e);
}
return AjaxResult.success(vo); return AjaxResult.success(vo);
} }