From f921144059a426430ff74871500c2fb3dd8a8526 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Fri, 22 Mar 2024 11:14:47 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E7=8F=AD=E7=BB=84=E7=AE=A1=E8=B7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/background/dto/ParamDto.java | 6 ++ .../controller/TeamManageController.java | 29 ++++++ .../background/mapper/TeamManageMapper.java | 58 +++++++++++ .../background/service/TeamService.java | 45 +++++++++ .../service/impl/TeamServiceImpl.java | 95 ++++++++++++++++++- .../resources/mapper/TeamManageMapper.xml | 38 ++++++++ 6 files changed, 266 insertions(+), 5 deletions(-) diff --git a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java index 10e54e1..bf4748b 100644 --- a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java +++ b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java @@ -38,4 +38,10 @@ public class ParamDto { @ApiModelProperty(value = "结束时间") private String endTime; + + @ApiModelProperty(value = "绑定班组人员") + private String bandingUsers; + + @ApiModelProperty(value = "未绑定班组人员") + private String unBandingUsers; } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/TeamManageController.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/TeamManageController.java index d666c84..875d9fe 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/TeamManageController.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/TeamManageController.java @@ -7,6 +7,7 @@ import com.securitycontrol.common.core.web.page.TableDataInfo; import com.securitycontrol.common.log.annotation.Log; import com.securitycontrol.common.log.enums.OperationType; import com.securitycontrol.entity.background.dto.ParamDto; +import com.securitycontrol.entity.background.vo.HumanManageVo; import com.securitycontrol.entity.background.vo.TeamManageVo; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; @@ -62,4 +63,32 @@ public class TeamManageController extends BaseController { return service.delTeam(dto); } + @ApiOperation(value = "获取班组人员列表") + @GetMapping("getTeamUserLists") + @Log(title = "人员管理", menu = "人员管理->班组管理", grade = OperationType.QUERY_BUSINESS, details = "查询班组人员", type = "业务日志") + public TableDataInfo getTeamUserLists(ParamDto dto) { + startPage(); + List list = service.getTeamUserLists(dto); + return getDataTable(list); + } + + @ApiOperation(value = "移出班组人员") + @PostMapping("removeTeamUser") + @Log(title = "人员管理", menu = "人员管理->班组管理", grade = OperationType.UPDATE_BUSINESS, details = "移出班组人员", type = "业务日志") + public AjaxResult removeTeamUser(@RequestBody ParamDto dto) { + return service.removeTeamUser(dto); + } + + @ApiOperation(value = "获取班组组员和未加入班组人员") + @GetMapping("getTeamUserAndNoBandingUser") + public AjaxResult getTeamUserAndNoBandingUser(ParamDto dto) { + return service.getTeamUserAndNoBandingUser(dto); + } + + @ApiOperation(value = "添加班组人员") + @PostMapping("addTeamUser") + @Log(title = "人员管理", menu = "人员管理->班组管理", grade = OperationType.ADD_BUSINESS, details = "添加班组人员", type = "业务日志") + public AjaxResult addTeamUser(@RequestBody ParamDto dto) { + return service.addTeamUser(dto); + } } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/TeamManageMapper.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/TeamManageMapper.java index a11929c..adcb809 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/TeamManageMapper.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/TeamManageMapper.java @@ -1,8 +1,10 @@ package com.securitycontrol.background.mapper; import com.securitycontrol.entity.background.dto.ParamDto; +import com.securitycontrol.entity.background.vo.HumanManageVo; import com.securitycontrol.entity.background.vo.TeamManageVo; import org.apache.ibatis.annotations.MapKey; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @@ -89,6 +91,7 @@ public interface TeamManageMapper { /** * 班组是否存在班组人员 + * * @param dto * @return int * @description @@ -96,4 +99,59 @@ public interface TeamManageMapper { * @date 2024/3/21 10:48 */ int isPeopleByTeam(ParamDto dto); + + /** + * 班组人员数量 + * + * @param teamId + * @return int + * @description + * @author cwchen + * @date 2024/3/22 9:59 + */ + int getTeamUserNum(String teamId); + + /** + * 获取班组人员列表 + * + * @param dto + * @return List + * @description + * @author cwchen + * @date 2024/3/22 10:04 + */ + List getTeamUserLists(ParamDto dto); + + /** + * 移出班组人员 + * + * @param dto + * @description + * @author cwchen + * @date 2024/3/22 10:13 + */ + void removeTeamUser(ParamDto dto); + + /** + * 获取班组组员和未加入班组人员 + * + * @param dto + * @return List> + * @description + * @author cwchen + * @date 2024/3/22 10:35 + */ + @MapKey("id") + List> getTeamUserAndNoBandingUser(ParamDto dto); + + /** + * 添加班组人员 + * @param userId + * @param teamId + * @param type + * @description + * @author cwchen + * @date 2024/3/22 10:52 + */ + void addTeamUser(@Param("userId") String userId, @Param("teamId") String teamId, @Param("type") int type); } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/TeamService.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/TeamService.java index e6040a0..99668c4 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/TeamService.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/TeamService.java @@ -2,6 +2,7 @@ package com.securitycontrol.background.service; import com.securitycontrol.common.core.web.domain.AjaxResult; import com.securitycontrol.entity.background.dto.ParamDto; +import com.securitycontrol.entity.background.vo.HumanManageVo; import com.securitycontrol.entity.background.vo.TeamManageVo; import java.util.List; @@ -24,6 +25,7 @@ public interface TeamService { /** * 删除班组 + * * @param vo * @return AjaxResult * @description @@ -53,4 +55,47 @@ public interface TeamService { * @date 2024/3/21 10:40 */ AjaxResult getTeamDetailById(ParamDto dto); + + /** + * 获取班组人员列表 + * + * @param dto + * @return List + * @description + * @author cwchen + * @date 2024/3/22 10:02 + */ + List getTeamUserLists(ParamDto dto); + + /** + * 移出班组人员 + * + * @param dto + * @return AjaxResult + * @description + * @author cwchen + * @date 2024/3/22 10:10 + */ + AjaxResult removeTeamUser(ParamDto dto); + + /** + * 获取班组组员和未加入班组人员 + * + * @param dto + * @return AjaxResult + * @description + * @author cwchen + * @date 2024/3/22 10:31 + */ + AjaxResult getTeamUserAndNoBandingUser(ParamDto dto); + + /** + * 添加班组人员 + * @param dto + * @return AjaxResult + * @description + * @author cwchen + * @date 2024/3/22 10:44 + */ + AjaxResult addTeamUser(ParamDto dto); } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java index b89e072..ae24c26 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java @@ -7,15 +7,21 @@ import com.securitycontrol.common.core.utils.aes.AesCbcUtils; import com.securitycontrol.common.core.web.domain.AjaxResult; import com.securitycontrol.common.security.utils.ValidatorsUtils; import com.securitycontrol.entity.background.dto.ParamDto; +import com.securitycontrol.entity.background.vo.HumanManageVo; import com.securitycontrol.entity.background.vo.TeamManageVo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; import javax.annotation.Resource; import java.util.*; +/** + * 班组-业务逻辑层 + * @author 10488 + */ @Service(value = "TeamService") @Slf4j public class TeamServiceImpl implements TeamService { @@ -30,6 +36,10 @@ public class TeamServiceImpl implements TeamService { public List getTeamLists(ParamDto dto) { List list = new ArrayList<>(); list = mapper.getTeamLists(dto); + for (TeamManageVo vo : list) { + int num = mapper.getTeamUserNum(vo.getTeamId()); + vo.setTeamNum(String.valueOf(num)); + } return list; } @@ -59,6 +69,8 @@ public class TeamServiceImpl implements TeamService { mapper.addOrUpdateTeam(vo); } catch (Exception e) { log.error("新增/修改班组", e); + //手动回滚异常 + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return AjaxResult.error(); } return AjaxResult.success(); @@ -108,11 +120,84 @@ public class TeamServiceImpl implements TeamService { @Override @Transactional(rollbackFor = Exception.class) public AjaxResult delTeam(ParamDto dto) { - int result = mapper.isPeopleByTeam(dto); - if(result > 0){ - return AjaxResult.error("班组存在人员"); + try { + int result = mapper.isPeopleByTeam(dto); + if(result > 0){ + return AjaxResult.error("班组存在人员"); + } + mapper.delTeam(dto); + return AjaxResult.success(); + } catch (Exception e) { + log.error("删除班组",e); + //手动回滚异常 + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return AjaxResult.error(); + } + } + + @Override + public List getTeamUserLists(ParamDto dto) { + List list = new ArrayList<>(); + list = mapper.getTeamUserLists(dto); + return list; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult removeTeamUser(ParamDto dto) { + try { + mapper.removeTeamUser(dto); + return AjaxResult.success(); + } catch (Exception e) { + log.error("移出班组人员"); + //手动回滚异常 + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return AjaxResult.error(); + } + } + + @Override + public AjaxResult getTeamUserAndNoBandingUser(ParamDto dto) { + Map map = new HashMap<>(16); + List> teamUsers = new ArrayList<>(); + List> noBandingUsers = new ArrayList<>(); + List> list = mapper.getTeamUserAndNoBandingUser(dto); + if(CollectionUtils.isNotEmpty(list)){ + for (Map stringMap : list) { + if(Objects.equals(stringMap.get("type"),"1")){ + teamUsers.add(stringMap); + }else if(Objects.equals(stringMap.get("type"),"2")){ + noBandingUsers.add(stringMap); + } + } + } + map.put("teamUsers",teamUsers); + map.put("noBandingUsers",noBandingUsers); + return AjaxResult.success(map); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult addTeamUser(ParamDto dto) { + try { + if(StringUtils.isNotEmpty(dto.getBandingUsers())){ + String[] bandingUserArr = dto.getBandingUsers().split(","); + for (String bandingUser : bandingUserArr) { + mapper.addTeamUser(bandingUser,dto.getId(),1); + } + } + if(StringUtils.isNotEmpty(dto.getUnBandingUsers())){ + String[] unBandingUserArr = dto.getUnBandingUsers().split(","); + for (String unBandingUser : unBandingUserArr) { + mapper.addTeamUser(unBandingUser,null,2); + } + } + return AjaxResult.success(); + } catch (Exception e) { + log.error("添加班组人员"); + //手动回滚异常 + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return AjaxResult.error(); } - mapper.delTeam(dto); - return AjaxResult.success(); } } diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/TeamManageMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/TeamManageMapper.xml index ecb2b49..d6ec43b 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/TeamManageMapper.xml +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/TeamManageMapper.xml @@ -38,6 +38,19 @@ WHERE team_id = #{teamId} + + + + UPDATE t_team_people SET team_id = #{teamId} WHERE user_id = #{userId} + + + UPDATE t_team_people SET team_id = NULL WHERE user_id = #{userId} + + + + + UPDATE t_team_people SET team_id = NULL WHERE user_id = #{id} + DELETE FROM tb_work_team WHERE team_id = #{id} @@ -92,4 +105,29 @@ + + + + + + \ No newline at end of file From f16c58f460a6e78399912e52f8de0b5bb3ac9dbd Mon Sep 17 00:00:00 2001 From: haozq <1611483981@qq.com> Date: Fri, 22 Mar 2024 15:16:34 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=8A=A0=E8=A7=A3?= =?UTF-8?q?=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/TokenController.java | 6 +- .../common/core/utils/CommonConstant.java | 52 ++++ .../common/core/utils/aes/AesCbcUtils.java | 43 +++- .../common/core/utils/aes/MonoUtils.java | 38 +++ .../gateway/filter/GatewayContext.java | 43 ++++ .../gateway/filter/RequestCoverFilter.java | 236 ++++++++++++++++++ ...saDecryptResponseGatewayFilterFactory.java | 144 +++++++++++ .../service/impl/TeamServiceImpl.java | 2 +- 8 files changed, 546 insertions(+), 18 deletions(-) create mode 100644 securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/CommonConstant.java create mode 100644 securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/MonoUtils.java create mode 100644 securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/GatewayContext.java create mode 100644 securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RequestCoverFilter.java create mode 100644 securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RsaDecryptResponseGatewayFilterFactory.java diff --git a/securitycontrol-auth/src/main/java/com/securitycontrol/auth/controller/TokenController.java b/securitycontrol-auth/src/main/java/com/securitycontrol/auth/controller/TokenController.java index 546e5ea..8e1ac8e 100644 --- a/securitycontrol-auth/src/main/java/com/securitycontrol/auth/controller/TokenController.java +++ b/securitycontrol-auth/src/main/java/com/securitycontrol/auth/controller/TokenController.java @@ -17,10 +17,7 @@ import io.jsonwebtoken.Claims; import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -56,7 +53,6 @@ public class TokenController { } - /** * 本地推出登录 * @param request diff --git a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/CommonConstant.java b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/CommonConstant.java new file mode 100644 index 0000000..ec0d781 --- /dev/null +++ b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/CommonConstant.java @@ -0,0 +1,52 @@ +package com.securitycontrol.common.core.utils; + +import com.alibaba.fastjson2.JSONObject; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.server.reactive.ServerHttpResponse; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +/** + * @Author: meng + * @Description: 常用变量 + * @Date: 2023/3/30 10:29 + * @Version: 1.0 + */ +@Component +public class CommonConstant { + + //JWT密钥 + public static final String JWT_TOKEN = "jwt-token"; + + //请求头中的token + public static final String X_TOKEN = "X-TOKEN"; + + //请求头中的sign + public static final String X_SIGN = "X-SIGN"; + + public static final String X_APPID = "X-APPID"; + + public static final String CODE = "code"; + + public static final String MESSAGE = "message"; + + public static final String UTF8 = "UTF-8"; + + public static final String RSA_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDFJIl4il6nDBlF/3byWB/KXRqfEXkviz7ZvO7TU7JBfh7sFqfgLtJFDSA33+qTHOtYTCjCrwl6oWWX7Aff39HiFW1IBnhKjYdSK5/8ruQY+Y2xbpBMgslA0m2euOv3XPJUXWh0JGBqPllgzvtbtUA1iBELAHVYBACuQPYP2VcPeQIDAQAB"; + public static final String RSA_PRIVATE_KEY = "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAMUkiXiKXqcMGUX/dvJYH8pdGp8ReS+LPtm87tNTskF+HuwWp+Au0kUNIDff6pMc61hMKMKvCXqhZZfsB9/f0eIVbUgGeEqNh1Irn/yu5Bj5jbFukEyCyUDSbZ646/dc8lRdaHQkYGo+WWDO+1u1QDWIEQsAdVgEAK5A9g/ZVw95AgMBAAECgYABvRrBR2ciTgcDCQfBh2lwXXXYpUzOUIoTXYk1r+1IipY3OtPsND2CgmUgWQc2mPCybKmHXgfVXwsIVfqTzOOK+PEMVGYNflUdXgV3hNffRzl/nfPdpqhb2ALu8ftPwiGq5QN2PqaRgY9kM67Ye/cCjFzm/kLIqsNuXLKiQc1ioQJBAO7g4ZBcG/D0IxtiR4RdXYtr4wQc+cmscSKj5RPNBwn0bh9psOSg2loS/wWUmCnYSncsLGgMzPl+yPkTLwGryH0CQQDTRduiOzu6bFdOw6tI6eOxHB5h0kfcim4VT/Huh5RyP+GC7kLBmknbBO/tQXxSDVaG81Pkr+INHxJmctfKik+tAkEAtBIrl0IIAhRXnp3wYXRsPtxeLkyVc5SdWEqKNen5Y2Sx2tY2dbJXx0zIl3FTXz/fqoRPGUSFA5Kydygh6DWRlQJBAMmOfOHB9tJ8Z7LJ85AFKucdt1KFpW8eVbVZZqq0iAeTMBaULfW7tzgO9sJ3Vh6FgQYP//pNXbA883XvnDUrTKUCQQDgLO7mThmy7iqqo0be4a2ycy9fvORFYzSq1t6mTd+gr73CMCy2bTmyv/Qp4QsuPIKea0iE+HA/la5zlM8eAxOq"; + //公共返回方法 + public static Mono buildResponse(ServerWebExchange exchange, int code, String message) { + ServerHttpResponse response = exchange.getResponse(); + response.setStatusCode(HttpStatus.OK); + response.getHeaders().add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE); + JSONObject jsonObject = new JSONObject(); + jsonObject.put(CODE, code); + jsonObject.put(MESSAGE, message); + DataBuffer bodyDataBuffer = response.bufferFactory().wrap(jsonObject.toJSONString().getBytes()); + return response.writeWith(Mono.just(bodyDataBuffer)); + } +} \ No newline at end of file diff --git a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/AesCbcUtils.java b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/AesCbcUtils.java index d69b45b..93644dc 100644 --- a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/AesCbcUtils.java +++ b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/AesCbcUtils.java @@ -38,7 +38,7 @@ public class AesCbcUtils { /** * AES要求密钥长度为128位或192位或256位,java默认限制AES密钥长度最多128位 */ - public static String sKey = "zhst@bonus@zhst@bonus@1234567890"; + public static String sKey = "zhgd@bonus@zhgd@bonus@1234567890"; /** * 编码格式导出 @@ -58,26 +58,44 @@ public class AesCbcUtils { * @throws Exception * @return 加密后的密文 */ - public static String encrypt(String source, String key) throws Exception { - byte[] sourceBytes = source.getBytes(ENCODING); - byte[] keyBytes = key.getBytes(ENCODING); - Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM, "BC"); - IvParameterSpec iv = new IvParameterSpec(IV_PARAMETER.getBytes(ENCODING)); - cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(keyBytes, KEY_ALGORITHM), iv); - byte[] decrypted = cipher.doFinal(sourceBytes); - return Base64.encodeBase64String(decrypted); + public static String encrypt(String source ) { + try{ + String key=sKey; + byte[] sourceBytes = source.getBytes(ENCODING); + byte[] keyBytes = key.getBytes(ENCODING); + Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM, "BC"); + IvParameterSpec iv = new IvParameterSpec(IV_PARAMETER.getBytes(ENCODING)); + cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(keyBytes, KEY_ALGORITHM), iv); + byte[] decrypted = cipher.doFinal(sourceBytes); + return Base64.encodeBase64String(decrypted); + }catch (Exception e){ + log.error(e.toString(),e); + } + return null; + } + + public static void main(String[] args) { + String json="username=guest&password=admin@123"; + + // String json="{\"username\":\"guest\",\"password\":\"admin@123\"}"; + String data=encrypt(json); + System.err.println(data); } /** * AES解密 *(CBC模式) - * @param encryptStr 加密后的密文 + * @param data 加密后的密文 * @param * @throws Exception * @return 源字符串 */ - public static String decrypt(String encryptStr) { + public static String decrypt(String data) { try{ + String encryptStr=""; + if(StringHelper.isNotEmpty(data)){ + encryptStr=data.replace(" ","+"); + } String key=sKey; byte[] sourceBytes = Base64.decodeBase64(encryptStr); byte[] keyBytes = key.getBytes(ENCODING); @@ -87,9 +105,10 @@ public class AesCbcUtils { byte[] decoded = cipher.doFinal(sourceBytes); return new String(decoded, ENCODING); }catch (Exception e){ + log.info("------------------->请求加密参数不正确"); log.error(e.toString(),e); - return null; } + return null; } } diff --git a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/MonoUtils.java b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/MonoUtils.java new file mode 100644 index 0000000..26929ac --- /dev/null +++ b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/MonoUtils.java @@ -0,0 +1,38 @@ +package com.securitycontrol.common.core.utils.aes; + +import com.alibaba.fastjson2.JSONObject; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.http.HttpStatus; +import org.springframework.http.server.reactive.ServerHttpResponse; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.nio.charset.StandardCharsets; + +/** + * @author 黑子 + */ +public final class MonoUtils { + + private MonoUtils() { + + } + public static Mono invalidUrl(ServerWebExchange exchange){ + JSONObject json = new JSONObject(); + json.put("code", 400); + json.put("msg", "无效的请求"); + return buildReturnMono(json, exchange); + } + + + public static Mono buildReturnMono(JSONObject json, ServerWebExchange exchange) { + ServerHttpResponse response = exchange.getResponse(); + byte[] bits = json.toJSONString().getBytes(StandardCharsets.UTF_8); + DataBuffer buffer = response.bufferFactory().wrap(bits); + response.setStatusCode(HttpStatus.UNAUTHORIZED); + //指定编码,否则在浏览器中会中文乱码 + response.getHeaders().add("Content-Type", "text/plain;charset=UTF-8"); + return response.writeWith(Mono.just(buffer)); + } + +} diff --git a/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/GatewayContext.java b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/GatewayContext.java new file mode 100644 index 0000000..5ba76b3 --- /dev/null +++ b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/GatewayContext.java @@ -0,0 +1,43 @@ +package com.securitycontrol.gateway.filter; + +import lombok.Data; +import org.springframework.http.HttpHeaders; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; + +/** + * @Author: meng + * @Description: 网关上下文 + * @Version: 1.0 + */ +@Data +public class GatewayContext { + + public static final String CACHE_GATEWAY_CONTEXT = "cacheGatewayContext"; + + /** + * cache headers + */ + private HttpHeaders headers; + + /** + * cache json body + */ + private String cacheBody; + + /** + * cache formdata + */ + private MultiValueMap formData = new LinkedMultiValueMap<>(); + + /** + * ipAddress + */ + private String ipAddress; + + /** + * path + */ + private String path; + +} \ No newline at end of file diff --git a/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RequestCoverFilter.java b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RequestCoverFilter.java new file mode 100644 index 0000000..5512f6a --- /dev/null +++ b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RequestCoverFilter.java @@ -0,0 +1,236 @@ +package com.securitycontrol.gateway.filter; + +import io.netty.buffer.ByteBufAllocator; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.core.Ordered; +import org.springframework.core.io.ByteArrayResource; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.io.buffer.DataBufferUtils; +import org.springframework.core.io.buffer.NettyDataBufferFactory; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.codec.HttpMessageReader; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.http.server.reactive.ServerHttpRequestDecorator; +import org.springframework.http.server.reactive.ServerHttpResponse; +import org.springframework.stereotype.Component; +import org.springframework.util.MultiValueMap; +import org.springframework.web.reactive.function.server.HandlerStrategies; +import org.springframework.web.reactive.function.server.ServerRequest; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Map; + +/** + * @Author: https://blog.csdn.net/zx156955/article/details/115004910 + * @Description: 请求内容存储 处理请求内容 内容放在gatewayContext中 + * @Date: 2023/3/30 10:11 + * @Version: 1.0 + */ +@Component +@Slf4j +public class RequestCoverFilter implements GlobalFilter, Ordered { + + /** + * default HttpMessageReader + */ + private static final List> messageReaders = HandlerStrategies.withDefaults().messageReaders(); + + /** + * ReadFormData + * + * @param exchange + * @param chain + * @return + */ + private Mono readFormData(ServerWebExchange exchange, GatewayFilterChain chain, + GatewayContext gatewayContext) { + final ServerHttpRequest request = exchange.getRequest(); + HttpHeaders headers = request.getHeaders(); + + return exchange.getFormData().doOnNext(multiValueMap -> { + gatewayContext.setFormData(multiValueMap); + log.debug("[GatewayContext]Read FormData:{}", multiValueMap); + }).then(Mono.defer(() -> { + Charset charset = headers.getContentType().getCharset(); + charset = charset == null ? StandardCharsets.UTF_8 : charset; + String charsetName = charset.name(); + MultiValueMap formData = gatewayContext.getFormData(); + /** + * formData is empty just return + */ + if (null == formData || formData.isEmpty()) { + return chain.filter(exchange); + } + StringBuilder formDataBodyBuilder = new StringBuilder(); + String entryKey; + List entryValue; + try { + /** + * repackage form data + */ + for (Map.Entry> entry : formData.entrySet()) { + entryKey = entry.getKey(); + entryValue = entry.getValue(); + if (entryValue.size() > 1) { + for (String value : entryValue) { + formDataBodyBuilder.append(entryKey).append("=") + .append(URLEncoder.encode(value, charsetName)).append("&"); + } + } else { + formDataBodyBuilder.append(entryKey).append("=") + .append(URLEncoder.encode(entryValue.get(0), charsetName)).append("&"); + } + } + } catch (UnsupportedEncodingException e) { + // ignore URLEncode Exception + } + /** + * substring with the last char '&' + */ + String formDataBodyString = ""; + if (formDataBodyBuilder.length() > 0) { + formDataBodyString = formDataBodyBuilder.substring(0, formDataBodyBuilder.length() - 1); + } + /** + * get data bytes + */ + byte[] bodyBytes = formDataBodyString.getBytes(charset); + int contentLength = bodyBytes.length; + ServerHttpRequestDecorator decorator = new ServerHttpRequestDecorator(request) { + /** + * change content-length + * + * @return + */ + @Override + public HttpHeaders getHeaders() { + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.putAll(super.getHeaders()); + if (contentLength > 0) { + httpHeaders.setContentLength(contentLength); + } else { + httpHeaders.set(HttpHeaders.TRANSFER_ENCODING, "chunked"); + } + return httpHeaders; + } + + /** + * read bytes to Flux + * + * @return + */ + @Override + public Flux getBody() { + return DataBufferUtils.read(new ByteArrayResource(bodyBytes), + new NettyDataBufferFactory(ByteBufAllocator.DEFAULT), contentLength); + } + }; + ServerWebExchange mutateExchange = exchange.mutate().request(decorator).build(); + log.info("[GatewayContext]Rewrite Form Data :{}", formDataBodyString); + + return chain.filter(mutateExchange); + })); + } + + /** + * ReadJsonBody + * + * @param exchange + * @param chain + * @return + */ + private Mono readBody(ServerWebExchange exchange, GatewayFilterChain chain, GatewayContext gatewayContext) { + /** + * join the body + */ + return DataBufferUtils.join(exchange.getRequest().getBody()).flatMap(dataBuffer -> { + /* + * read the body Flux, and release the buffer + * see PR https://github.com/spring-cloud/spring-cloud-gateway/pull/1095 + */ + byte[] bytes = new byte[dataBuffer.readableByteCount()]; + dataBuffer.read(bytes); + DataBufferUtils.release(dataBuffer); + Flux cachedFlux = Flux.defer(() -> { + DataBuffer buffer = exchange.getResponse().bufferFactory().wrap(bytes); + DataBufferUtils.retain(buffer); + return Mono.just(buffer); + }); + /** + * repackage ServerHttpRequest + */ + ServerHttpRequest mutatedRequest = new ServerHttpRequestDecorator(exchange.getRequest()) { + @Override + public Flux getBody() { + return cachedFlux; + } + }; + /** + * mutate exchage with new ServerHttpRequest + */ + ServerWebExchange mutatedExchange = exchange.mutate().request(mutatedRequest).build(); + /** + * read body string with default messageReaders + */ + return ServerRequest.create(mutatedExchange, messageReaders).bodyToMono(String.class) + .doOnNext(objectValue -> { + gatewayContext.setCacheBody(objectValue); + log.debug("[GatewayContext]Read JsonBody:{}", objectValue); + }).then(chain.filter(mutatedExchange)); + }); + } + + @Override + public int getOrder() { + return HIGHEST_PRECEDENCE; + } + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + /** + * save request path and serviceId into gateway context + */ + ServerHttpRequest request = exchange.getRequest(); + ServerHttpResponse response = exchange.getResponse(); + + GatewayContext gatewayContext = new GatewayContext(); + String path = request.getPath().pathWithinApplication().value(); + gatewayContext.setPath(path); + gatewayContext.getFormData().addAll(request.getQueryParams()); + gatewayContext.setIpAddress(String.valueOf(request.getRemoteAddress())); + HttpHeaders headers = request.getHeaders(); + gatewayContext.setHeaders(headers); + log.debug("HttpMethod:{},Url:{}", request.getMethod(), request.getURI().getRawPath()); + + /// 注意,因为webflux的响应式编程 不能再采取原先的编码方式 即应该先将gatewayContext放入exchange中,否则其他地方可能取不到 + /** + * save gateway context into exchange + */ + exchange.getAttributes().put(GatewayContext.CACHE_GATEWAY_CONTEXT, gatewayContext); + + // 处理参数 + MediaType contentType = headers.getContentType(); + long contentLength = headers.getContentLength(); + if (contentLength > 0) { + if (MediaType.APPLICATION_JSON.equals(contentType) || MediaType.APPLICATION_JSON_UTF8.equals(contentType)) { + return readBody(exchange, chain, gatewayContext); + } + if (MediaType.APPLICATION_FORM_URLENCODED.equals(contentType)) { + return readFormData(exchange, chain, gatewayContext); + } + } + + log.debug("[GatewayContext]ContentType:{},Gateway context is set with {}", contentType, gatewayContext); + return chain.filter(exchange); + } +} \ No newline at end of file diff --git a/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RsaDecryptResponseGatewayFilterFactory.java b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RsaDecryptResponseGatewayFilterFactory.java new file mode 100644 index 0000000..06770ed --- /dev/null +++ b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RsaDecryptResponseGatewayFilterFactory.java @@ -0,0 +1,144 @@ +package com.securitycontrol.gateway.filter; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.CryptoException; +import com.securitycontrol.common.core.utils.CommonConstant; +import com.securitycontrol.common.core.utils.StringUtils; +import com.securitycontrol.common.core.utils.aes.AesCbcUtils; +import com.securitycontrol.common.core.utils.aes.MonoUtils; +import com.securitycontrol.common.core.utils.aes.StringHelper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cloud.gateway.filter.GatewayFilter; +import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.io.buffer.DataBufferFactory; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.http.server.reactive.ServerHttpRequestDecorator; +import org.springframework.stereotype.Component; +import org.springframework.util.MultiValueMap; +import org.springframework.web.server.ServerWebExchange; +import org.springframework.web.util.UriComponentsBuilder; +import reactor.core.publisher.Flux; + +import java.lang.reflect.Field; +import java.net.URI; +import java.security.interfaces.RSAPrivateKey; + +/** + * @Author: meng + * @Description: RSA实现对请求参数解密 + * @Date: 2023/4/6 15:20 + * @Version: 1.0 + */ +@Slf4j +@Component +class RsaDecryptResponseGatewayFilterFactory extends AbstractGatewayFilterFactory { + + @Override + public GatewayFilter apply(Object config) { + return (exchange, chain) -> { + ServerHttpRequest serverHttpRequest = exchange.getRequest(); + HttpHeaders header = serverHttpRequest.getHeaders(); + String decrypt = serverHttpRequest.getHeaders().getFirst("decrypt"); + //get请求 默认 + if(HttpMethod.GET.matches(serverHttpRequest.getMethodValue())){//如果是get + if(exchange.getRequest().getQueryParams().isEmpty()){//如果参数是空的 + return chain.filter(exchange); + }else{ + try{ + updateRequestParam(exchange); + }catch (Exception e){ + log.error(e.toString(),e); + return CommonConstant.buildResponse(exchange, HttpStatus.BAD_REQUEST.value(), "请求参数异常"); + } + } + } + if (!HttpMethod.POST.matches(serverHttpRequest.getMethodValue())) {//非 post请求 + return chain.filter(exchange); + } + byte[] decrypBytes; + GatewayContext gatewayContext = exchange.getAttribute(GatewayContext.CACHE_GATEWAY_CONTEXT); + if(StrUtil.isBlank(gatewayContext.getCacheBody())){ + if(!exchange.getRequest().getQueryParams().isEmpty()){ + try{ + updateRequestParam(exchange); + }catch (Exception e){ + log.error(e.toString(),e); + return CommonConstant.buildResponse(exchange, HttpStatus.BAD_REQUEST.value(), "请求参数异常"); + } + } + //未强制加密 + return chain.filter(exchange); + + // return CommonConstant.buildResponse(exchange, HttpStatus.BAD_REQUEST.value(), "请求参数不能为空"); + + } + try { + // 获取request body + String requestBody = gatewayContext.getCacheBody(); + String decryptMsg= AesCbcUtils.decrypt(requestBody); + gatewayContext.setCacheBody(decryptMsg); + decrypBytes = decryptMsg.getBytes(); + } catch (Exception e) { + log.error("数据 解密失败:{}", e); + return CommonConstant.buildResponse(exchange, HttpStatus.BAD_REQUEST.value(), "数据解密失败"); + } + // 根据解密后的参数重新构建请求 + DataBufferFactory dataBufferFactory = exchange.getResponse().bufferFactory(); + Flux bodyFlux = Flux.just(dataBufferFactory.wrap(decrypBytes)); + ServerHttpRequest newRequest = serverHttpRequest.mutate().uri(serverHttpRequest.getURI()).build(); + newRequest = new ServerHttpRequestDecorator(newRequest) { + @Override + public Flux getBody() { + return bodyFlux; + } + }; + // 构建新的请求头 + HttpHeaders headers = new HttpHeaders(); + headers.putAll(exchange.getRequest().getHeaders()); + // 由于修改了传递参数,需要重新设置CONTENT_LENGTH,长度是字节长度,不是字符串长度 + int length = decrypBytes.length; + headers.remove(HttpHeaders.CONTENT_LENGTH); + headers.setContentLength(length); + newRequest = new ServerHttpRequestDecorator(newRequest) { + @Override + public HttpHeaders getHeaders() { + return headers; + } + }; + // 把解密后的数据重置到exchange自定义属性中,在之后的日志GlobalLogFilter从此处获取请求参数打印日志 + exchange.getAttributes().put(GatewayContext.CACHE_GATEWAY_CONTEXT, gatewayContext); + return chain.filter(exchange.mutate().request(newRequest).build()); + }; + } + + + /** + * 修改前端传的参数 + */ + private void updateRequestParam(ServerWebExchange exchange) throws NoSuchFieldException, IllegalAccessException { + ServerHttpRequest request = exchange.getRequest(); + URI uri = request.getURI(); + //请求参数 + String query = uri.getQuery(); + //判断是否有加密的参数 这里的约定是 param + if (StringUtils.isNotBlank(query) && query.contains("params")) { + String[] split = query.split("="); + String paramValue = split[1]; + //解密请求参数 + String param =AesCbcUtils.decrypt(paramValue); + //使用反射强行拿出 URI 的 query + Field targetQuery = uri.getClass().getDeclaredField("query"); + //授权 + targetQuery.setAccessible(true); + //重新设置参数 + targetQuery.set(uri, param); + } + } + + + +} \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java index b89e072..d619d07 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java @@ -55,7 +55,7 @@ public class TeamServiceImpl implements TeamService { } else { vo.setType(2); } - vo.setIdNumber(AesCbcUtils.encrypt(vo.getIdNumber(),AesCbcUtils.sKey)); + vo.setIdNumber(AesCbcUtils.encrypt(vo.getIdNumber())); mapper.addOrUpdateTeam(vo); } catch (Exception e) { log.error("新增/修改班组", e); From d90cf639dfa5035d0e5132bff4273273b30c09b7 Mon Sep 17 00:00:00 2001 From: haozq <1611483981@qq.com> Date: Fri, 22 Mar 2024 15:51:26 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=8A=A0=E8=A7=A3?= =?UTF-8?q?=E5=AF=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- securitycontrol-auth/src/main/resources/bootstrap.yml | 4 ++++ .../common/core/utils/aes/AesCbcUtils.java | 4 ++-- .../filter/RsaDecryptResponseGatewayFilterFactory.java | 10 ++++++++-- .../src/main/resources/bootstrap.yml | 6 ++++-- .../background/service/impl/HumanServiceImpl.java | 4 ++-- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/securitycontrol-auth/src/main/resources/bootstrap.yml b/securitycontrol-auth/src/main/resources/bootstrap.yml index 2de2c49..541084a 100644 --- a/securitycontrol-auth/src/main/resources/bootstrap.yml +++ b/securitycontrol-auth/src/main/resources/bootstrap.yml @@ -19,10 +19,14 @@ spring: server-addr: 127.0.0.1:8848 # server-addr: 27.196.164.56:8848 namespace: jjzhgd + username: nacos + password: Jjsp@nacos2023 config: # server-addr: 27.196.164.56:8848 server-addr: 127.0.0.1:8848 namespace: jjzhgd + username: nacos + password: Jjsp@nacos2023 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/AesCbcUtils.java b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/AesCbcUtils.java index 93644dc..dc77acb 100644 --- a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/AesCbcUtils.java +++ b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/AesCbcUtils.java @@ -75,9 +75,9 @@ public class AesCbcUtils { } public static void main(String[] args) { - String json="username=guest&password=admin@123"; + // String json="username=guest&password=admin@123"; - // String json="{\"username\":\"guest\",\"password\":\"admin@123\"}"; + String json="{\"username\":\"guest\",\"password\":\"admin@123\"}"; String data=encrypt(json); System.err.println(data); } diff --git a/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RsaDecryptResponseGatewayFilterFactory.java b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RsaDecryptResponseGatewayFilterFactory.java index 06770ed..de9f518 100644 --- a/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RsaDecryptResponseGatewayFilterFactory.java +++ b/securitycontrol-gateway/src/main/java/com/securitycontrol/gateway/filter/RsaDecryptResponseGatewayFilterFactory.java @@ -8,6 +8,7 @@ import com.securitycontrol.common.core.utils.aes.AesCbcUtils; import com.securitycontrol.common.core.utils.aes.MonoUtils; import com.securitycontrol.common.core.utils.aes.StringHelper; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.gateway.filter.GatewayFilter; import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; import org.springframework.core.io.buffer.DataBuffer; @@ -37,12 +38,17 @@ import java.security.interfaces.RSAPrivateKey; @Component class RsaDecryptResponseGatewayFilterFactory extends AbstractGatewayFilterFactory { + @Value("${system.jm}") + public boolean AQ_JM; + + @Override public GatewayFilter apply(Object config) { return (exchange, chain) -> { ServerHttpRequest serverHttpRequest = exchange.getRequest(); - HttpHeaders header = serverHttpRequest.getHeaders(); - String decrypt = serverHttpRequest.getHeaders().getFirst("decrypt"); + if(!AQ_JM){ + return chain.filter(exchange); + } //get请求 默认 if(HttpMethod.GET.matches(serverHttpRequest.getMethodValue())){//如果是get if(exchange.getRequest().getQueryParams().isEmpty()){//如果参数是空的 diff --git a/securitycontrol-gateway/src/main/resources/bootstrap.yml b/securitycontrol-gateway/src/main/resources/bootstrap.yml index 98cb880..2f6e830 100644 --- a/securitycontrol-gateway/src/main/resources/bootstrap.yml +++ b/securitycontrol-gateway/src/main/resources/bootstrap.yml @@ -17,7 +17,7 @@ spring: nacos: discovery: username: nacos - password: nacos + password: Jjsp@nacos2023 namespace: jjzhgd # 服务注册地址 server-addr: 127.0.0.1:8848 @@ -32,7 +32,7 @@ spring: shared-configs: - vsc-dev.yml username: nacos - password: nacos + password: Jjsp@nacos2023 namespace: jjzhgd # server-addr: 10.138.132.188:18848 management: @@ -48,4 +48,6 @@ management: endpoints: env: enable: false +system: + jm: false diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java index 1c1e9fb..5a624f9 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java @@ -39,7 +39,7 @@ public class HumanServiceImpl implements HumanService { @Resource(name = "HumanManageMapper") private HumanManageMapper mapper; - @Autowired + @Resource private RemoteFileService remoteFileService; @Resource(name = "ValidatorsUtils") @@ -111,7 +111,7 @@ public class HumanServiceImpl implements HumanService { } } } - vo.setIdNumber(AesCbcUtils.encrypt(vo.getIdNumber(),AesCbcUtils.sKey)); + vo.setIdNumber(AesCbcUtils.encrypt(vo.getIdNumber())); // 保存人员数据 mapper.addOrUpdatePersonnel(vo); } catch (Exception e) { From 347d637be3553c1326e1503c8b4a5ab77ec93400 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Fri, 22 Mar 2024 16:27:58 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../background/mapper/HumanManageMapper.java | 15 --------------- .../system/base/mapper/ISelectMapper.java | 1 + 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/HumanManageMapper.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/HumanManageMapper.java index 9c8f421..6718b17 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/HumanManageMapper.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/HumanManageMapper.java @@ -18,21 +18,6 @@ import java.util.Map; @Repository(value = "HumanManageMapper") public interface HumanManageMapper { - - /** - * 新增 - * - * @param vo - * @return - */ - int addHuman(HumanManageVo vo); - - /** - * @param vo - * @return - */ - int updateHuman(HumanManageVo vo); - /** * 获取人员列表 * diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/ISelectMapper.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/ISelectMapper.java index 7c5168f..ee7e166 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/ISelectMapper.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/ISelectMapper.java @@ -111,6 +111,7 @@ public interface ISelectMapper { List getProLists(SelectDto dto); /** + * 区域下拉选 * @param dto * @return List * @description From 7f2c4af11f551d0d715fd6a912c3f189fb80d73e Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Fri, 22 Mar 2024 16:40:22 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/domain/background/FileExportVo.java | 39 ---------- .../api/domain/background/MongoFile.java | 71 ------------------- 2 files changed, 110 deletions(-) delete mode 100644 securitycontrol-api/securitycontrol-api-system/src/main/java/com/securitycontrol/system/api/domain/background/FileExportVo.java delete mode 100644 securitycontrol-api/securitycontrol-api-system/src/main/java/com/securitycontrol/system/api/domain/background/MongoFile.java diff --git a/securitycontrol-api/securitycontrol-api-system/src/main/java/com/securitycontrol/system/api/domain/background/FileExportVo.java b/securitycontrol-api/securitycontrol-api-system/src/main/java/com/securitycontrol/system/api/domain/background/FileExportVo.java deleted file mode 100644 index 05240e3..0000000 --- a/securitycontrol-api/securitycontrol-api-system/src/main/java/com/securitycontrol/system/api/domain/background/FileExportVo.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.securitycontrol.system.api.domain.background; - -import cn.hutool.core.bean.BeanUtil; -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; - -import java.util.Objects; - -/** - * @author lit@epsoft.com.cn - * @version 1.0 - * @Description 统一文件下载vo - * @date Apr 8, 2022 - */ -@Data -public class FileExportVo { - - private String fileId; - - private String fileName; - - private String contentType; - - private String suffix; - - private long fileSize; - - @JsonIgnore - private byte[] data; - - public FileExportVo(MongoFile mongoFile) { - BeanUtil.copyProperties(mongoFile, this); - if (Objects.nonNull(mongoFile.getContent())) { - this.data = mongoFile.getContent().getData(); - } - this.fileId = mongoFile.getId(); - } - -} diff --git a/securitycontrol-api/securitycontrol-api-system/src/main/java/com/securitycontrol/system/api/domain/background/MongoFile.java b/securitycontrol-api/securitycontrol-api-system/src/main/java/com/securitycontrol/system/api/domain/background/MongoFile.java deleted file mode 100644 index 1c5ea69..0000000 --- a/securitycontrol-api/securitycontrol-api-system/src/main/java/com/securitycontrol/system/api/domain/background/MongoFile.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.securitycontrol.system.api.domain.background; - -import lombok.Builder; -import lombok.Data; -import org.bson.types.Binary; -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; - -/** - * @author coisini - * @version 1.0 - * @Description MongoDB文件实体 - * @date Apr 17, 2022 - */ -@Document -@Builder -@Data -public class MongoFile { - - /** - * 主键 - */ - @Id - public String id; - - /** - * 文件名称 - */ - public String fileName; - - /** - * 文件大小 - */ - public long fileSize; - - /** - * 上传时间 - */ - public String uploadDate; - - /** - * MD5值 - */ - public String md5; - - /** - * 文件内容 - */ - private Binary content; - - /** - * 文件类型 - */ - public String contentType; - - /** - * 文件后缀名 - */ - public String suffix; - - /** - * 文件描述 - */ - public String description; - - /** - * 大文件管理GridFS的ID - */ - private String gridFsId; - -} From 8231c0f2f1f99d448fb8dd39f30bc609a27a17aa Mon Sep 17 00:00:00 2001 From: sliang <1589399930@qq.com> Date: Fri, 22 Mar 2024 17:38:40 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E7=BB=84=E5=A1=94=E6=A3=80=E6=B5=8B-?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E8=AE=B0=E5=BD=95=EF=BC=8C=E9=A2=84=E8=AD=A6?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=EF=BC=9B=E6=96=BD=E5=B7=A5=E8=B4=A8=E9=87=8F?= =?UTF-8?q?-=E8=B4=A8=E9=87=8F=E6=A3=80=E6=B5=8B=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=EF=BC=8C=E9=A2=84=E8=AD=A6=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../securitycontrol-background/pom.xml | 30 ++++++++ .../EarlyWarningsRecordController.java | 75 ++++++++++++++++++ .../controller/QualityRecordController.java | 74 ++++++++++++++++++ .../mapper/EarlyWarningsRecordMapper.java | 21 +++++ .../mapper/QualityRecordMapper.java | 23 ++++++ .../service/EarlyWarningsRecordService.java | 20 +++++ .../service/QualityRecordService.java | 19 +++++ .../impl/EarlyWarningsRecordServiceImpl.java | 29 +++++++ .../impl/QualityRecordServiceImpl.java | 31 ++++++++ .../vo/EarlyWarningsRecordVo.java | 31 ++++++++ .../vo/QualityRecordVo.java | 46 +++++++++++ .../EarlyWarningRecordController.java | 76 +++++++++++++++++++ .../controller/TowerRecordController.java | 74 ++++++++++++++++++ .../mapper/EarlyWarningRecordMapper.java | 24 ++++++ .../mapper/TowerRecordMapper.java | 23 ++++++ .../service/EarlyWarningRecordService.java | 18 +++++ .../service/TowerRecordService.java | 18 +++++ .../impl/EarlyWarningRecordServiceImpl.java | 31 ++++++++ .../service/impl/TowerRecordServiceImpl.java | 46 +++++++++++ .../vo/EarlyWarningRecordVo.java | 30 ++++++++ .../towerDetection/vo/TowerRecordVo.java | 45 +++++++++++ .../EarlyWarningsRecordMapper.xml | 21 +++++ .../QualityRecordMapper.xml | 23 ++++++ .../EarlyWarningRecordMapper.xml | 21 +++++ .../towerDetection/TowerRecordMapper.xml | 23 ++++++ 25 files changed, 872 insertions(+) create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/controller/EarlyWarningsRecordController.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/controller/QualityRecordController.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/mapper/EarlyWarningsRecordMapper.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/mapper/QualityRecordMapper.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/EarlyWarningsRecordService.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/QualityRecordService.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/impl/EarlyWarningsRecordServiceImpl.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/impl/QualityRecordServiceImpl.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/vo/EarlyWarningsRecordVo.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/vo/QualityRecordVo.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/controller/EarlyWarningRecordController.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/controller/TowerRecordController.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/mapper/EarlyWarningRecordMapper.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/mapper/TowerRecordMapper.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/EarlyWarningRecordService.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/TowerRecordService.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/impl/EarlyWarningRecordServiceImpl.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/impl/TowerRecordServiceImpl.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/vo/EarlyWarningRecordVo.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/vo/TowerRecordVo.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/resources/mapper/constructionQuality/EarlyWarningsRecordMapper.xml create mode 100644 securitycontrol-model/securitycontrol-background/src/main/resources/mapper/constructionQuality/QualityRecordMapper.xml create mode 100644 securitycontrol-model/securitycontrol-background/src/main/resources/mapper/towerDetection/EarlyWarningRecordMapper.xml create mode 100644 securitycontrol-model/securitycontrol-background/src/main/resources/mapper/towerDetection/TowerRecordMapper.xml diff --git a/securitycontrol-model/securitycontrol-background/pom.xml b/securitycontrol-model/securitycontrol-background/pom.xml index 2952cbc..6a42f11 100644 --- a/securitycontrol-model/securitycontrol-background/pom.xml +++ b/securitycontrol-model/securitycontrol-background/pom.xml @@ -131,6 +131,36 @@ 2.3.30 + + cn.afterturn + easypoi-base + 4.2.0 + compile + + + cn.afterturn + easypoi-base + 4.2.0 + compile + + + com.securitycontrol + securitycontrol-system + 3.6.1 + compile + + + + com.github.docker-java + docker-java + 3.2.12 + + + com.google.guava + guava + + + ${project.artifactId} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/controller/EarlyWarningsRecordController.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/controller/EarlyWarningsRecordController.java new file mode 100644 index 0000000..53b332f --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/controller/EarlyWarningsRecordController.java @@ -0,0 +1,75 @@ +package com.securitycontrol.background.constructionQuality.controller; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; + +import com.securitycontrol.background.constructionQuality.service.EarlyWarningsRecordService; +import com.securitycontrol.background.constructionQuality.vo.EarlyWarningsRecordVo; +import com.securitycontrol.common.core.web.controller.BaseController; +import com.securitycontrol.common.core.web.page.TableDataInfo; +import com.securitycontrol.common.log.annotation.Log; +import com.securitycontrol.common.log.enums.OperationType; +import cn.afterturn.easypoi.excel.entity.ExportParams; + +import com.securitycontrol.system.export.util.ExcelStyleUtil; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.BeanUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; + +/** + * 施工质量 - 预警记录 + * @author lsun + */ +@RestController +@RequestMapping("/constructionQuality/earlyWarningRecord/") +@Slf4j +public class EarlyWarningsRecordController extends BaseController { + + @Resource(name = "EarlyWarningsRecordService") + private EarlyWarningsRecordService service; + + @ApiOperation(value = "获取信息列表") + @GetMapping("getEarlyWarningRecordLists") + @Log(title = "施工质量", menu = "施工质量->预警记录", grade = OperationType.QUERY_BUSINESS, details = "查询列表", type = "业务日志") + public TableDataInfo getEarlyWarningRecordLists(EarlyWarningsRecordVo dto) { + startPage(); + List list = service.getEarlyWarningRecordLists(dto); + return getDataTable(list); + } + + @GetMapping("exportProData") + @Log(title = "施工质量", menu = "施工质量->预警记录", grade = OperationType.EXPORT_BUSINESS, details = "导出列表", type = "业务日志") + public void exportData(HttpServletRequest request, HttpServletResponse response, EarlyWarningsRecordVo dto) { + try { + List proExportVoList = new ArrayList<>(); + List proLists = service.getEarlyWarningRecordLists(dto); + for (int i = 0; i < proLists.size(); i++) { + proLists.get(i).setProId((i + 1) + ""); + EarlyWarningsRecordVo exportVo = new EarlyWarningsRecordVo(); + BeanUtils.copyProperties(proLists.get(i), exportVo); + proExportVoList.add(exportVo); + } + ExportParams exportParams = new ExportParams("预警记录", "预警记录", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, EarlyWarningsRecordVo.class, proExportVoList); + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("预警记录" + ".xlsx", "UTF-8")); + ServletOutputStream outputStream = response.getOutputStream(); + workbook.write(outputStream); + outputStream.close(); + workbook.close(); + } catch (Exception e) { + log.error("导出预警记录", e); + } + } +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/controller/QualityRecordController.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/controller/QualityRecordController.java new file mode 100644 index 0000000..f18ec13 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/controller/QualityRecordController.java @@ -0,0 +1,74 @@ +package com.securitycontrol.background.constructionQuality.controller; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import com.securitycontrol.background.constructionQuality.service.QualityRecordService; +import com.securitycontrol.background.constructionQuality.vo.QualityRecordVo; +import com.securitycontrol.common.core.web.controller.BaseController; +import com.securitycontrol.common.core.web.page.TableDataInfo; +import com.securitycontrol.common.log.annotation.Log; +import com.securitycontrol.common.log.enums.OperationType; +import cn.afterturn.easypoi.excel.entity.ExportParams; + +import com.securitycontrol.system.export.util.ExcelStyleUtil; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.BeanUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; + +/** + * 施工质量 - 质量检测记录 + * @author lsun + */ +@RestController +@RequestMapping("/constructionQuality/qualityRecord/") +@Slf4j +public class QualityRecordController extends BaseController { + + @Resource(name = "QualityRecordService") + private QualityRecordService service; + + @ApiOperation(value = "获取信息列表") + @GetMapping("getQualityRecordLists") + @Log(title = "施工质量", menu = "施工质量->质量检测记录", grade = OperationType.QUERY_BUSINESS, details = "查询列表", type = "业务日志") + public TableDataInfo getQualityRecordLists(QualityRecordVo dto) { + startPage(); + List list = service.getQualityRecordLists(dto); + return getDataTable(list); + } + + @GetMapping("exportProData") + @Log(title = "施工质量", menu = "施工质量->质量检测记录", grade = OperationType.EXPORT_BUSINESS, details = "导出列表", type = "业务日志") + public void exportData(HttpServletRequest request, HttpServletResponse response, QualityRecordVo dto) { + try { + List proExportVoList = new ArrayList<>(); + List proLists = service.getQualityRecordLists(dto); + for (int i = 0; i < proLists.size(); i++) { + proLists.get(i).setProId((i + 1) + ""); + QualityRecordVo exportVo = new QualityRecordVo(); + BeanUtils.copyProperties(proLists.get(i), exportVo); + proExportVoList.add(exportVo); + } + ExportParams exportParams = new ExportParams("质量检测记录", "质量检测记录", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, QualityRecordVo.class, proExportVoList); + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("质量检测记录" + ".xlsx", "UTF-8")); + ServletOutputStream outputStream = response.getOutputStream(); + workbook.write(outputStream); + outputStream.close(); + workbook.close(); + } catch (Exception e) { + log.error("导出质量检测记录", e); + } + } +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/mapper/EarlyWarningsRecordMapper.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/mapper/EarlyWarningsRecordMapper.java new file mode 100644 index 0000000..852f44b --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/mapper/EarlyWarningsRecordMapper.java @@ -0,0 +1,21 @@ +package com.securitycontrol.background.constructionQuality.mapper; + +import com.securitycontrol.background.constructionQuality.vo.EarlyWarningsRecordVo; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 施工质量 - 预警记录 + * @author lsun + */ +@Repository(value = "EarlyWarningsRecordMapper") +public interface EarlyWarningsRecordMapper { + + /** + * 获取信息列表 + * @param dto + * @return + */ + List getEarlyWarningsRecordLists(EarlyWarningsRecordVo dto); +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/mapper/QualityRecordMapper.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/mapper/QualityRecordMapper.java new file mode 100644 index 0000000..ef23dba --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/mapper/QualityRecordMapper.java @@ -0,0 +1,23 @@ +package com.securitycontrol.background.constructionQuality.mapper; + +import com.securitycontrol.background.constructionQuality.vo.QualityRecordVo; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 施工质量 - 质量检测记录 + * @author lsun + */ +@Repository(value = "QualityRecordMapper") +public interface QualityRecordMapper { + + /** + * 获取信息列表 + * @param dto + * @return + */ + List getQualityRecordLists(QualityRecordVo dto); + + +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/EarlyWarningsRecordService.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/EarlyWarningsRecordService.java new file mode 100644 index 0000000..6c39c87 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/EarlyWarningsRecordService.java @@ -0,0 +1,20 @@ +package com.securitycontrol.background.constructionQuality.service; + + +import com.securitycontrol.background.constructionQuality.vo.EarlyWarningsRecordVo; + +import java.util.List; + +/** + * 施工质量 - 预警记录 + * @author lsun + */ +public interface EarlyWarningsRecordService { + + /** + * 获取信息列表 + * @param dto + * @return + */ + List getEarlyWarningRecordLists(EarlyWarningsRecordVo dto); +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/QualityRecordService.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/QualityRecordService.java new file mode 100644 index 0000000..b9e2e6f --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/QualityRecordService.java @@ -0,0 +1,19 @@ +package com.securitycontrol.background.constructionQuality.service; + +import com.securitycontrol.background.constructionQuality.vo.QualityRecordVo; + +import java.util.List; + +/** + * 施工质量 - 质量检测记录 + * @author lsun + */ +public interface QualityRecordService { + + /** + * 获取信息列表 + * @param dto + * @return + */ + List getQualityRecordLists(QualityRecordVo dto); +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/impl/EarlyWarningsRecordServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/impl/EarlyWarningsRecordServiceImpl.java new file mode 100644 index 0000000..c92264a --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/impl/EarlyWarningsRecordServiceImpl.java @@ -0,0 +1,29 @@ +package com.securitycontrol.background.constructionQuality.service.impl; + +import com.securitycontrol.background.constructionQuality.mapper.EarlyWarningsRecordMapper; +import com.securitycontrol.background.constructionQuality.service.EarlyWarningsRecordService; +import com.securitycontrol.background.constructionQuality.vo.EarlyWarningsRecordVo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.*; + +/** + * 施工质量 - 预警记录 + * @author lsun + */ +@Service(value = "EarlyWarningsRecordService") +@Slf4j +public class EarlyWarningsRecordServiceImpl implements EarlyWarningsRecordService { + + @Resource(name = "EarlyWarningsRecordMapper") + private EarlyWarningsRecordMapper mapper; + + @Override + public List getEarlyWarningRecordLists(EarlyWarningsRecordVo dto) { + List list = new ArrayList<>(); + list = mapper.getEarlyWarningsRecordLists(dto); + return list; + } + +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/impl/QualityRecordServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/impl/QualityRecordServiceImpl.java new file mode 100644 index 0000000..3ee1bf5 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/service/impl/QualityRecordServiceImpl.java @@ -0,0 +1,31 @@ +package com.securitycontrol.background.constructionQuality.service.impl; + + +import com.securitycontrol.background.constructionQuality.mapper.QualityRecordMapper; +import com.securitycontrol.background.constructionQuality.service.QualityRecordService; +import com.securitycontrol.background.constructionQuality.vo.QualityRecordVo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.*; + +/** + * 施工质量 - 质量检测记录 + * @author lsun + */ +@Service(value = "QualityRecordService") +@Slf4j +public class QualityRecordServiceImpl implements QualityRecordService { + + @Resource(name = "QualityRecordMapper") + private QualityRecordMapper mapper; + + @Override + public List getQualityRecordLists(QualityRecordVo dto) { + List list = new ArrayList<>(); + list = mapper.getQualityRecordLists(dto); + return list; + } + +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/vo/EarlyWarningsRecordVo.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/vo/EarlyWarningsRecordVo.java new file mode 100644 index 0000000..7aa1b86 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/vo/EarlyWarningsRecordVo.java @@ -0,0 +1,31 @@ +package com.securitycontrol.background.constructionQuality.vo; +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * + * @author lsun + */ +@Data +public class EarlyWarningsRecordVo { + + @Excel(name = "序号", width = 10.0, orderNum = "0") + private String proId; + + @ApiModelProperty(value = "告警内容") + @Excel(name = "告警内容", width = 10.0, orderNum = "1") + private String warnContent; + + @ApiModelProperty(value = "告警时间") + @Excel(name = "告警时间", width = 10.0, orderNum = "2") + private String warnTime; + + @ApiModelProperty(value = "告警类型") + private String warnType; + + @ApiModelProperty(value = "监测时间") + private String createTime; + + private String keyWord; +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/vo/QualityRecordVo.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/vo/QualityRecordVo.java new file mode 100644 index 0000000..d6f34d8 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/constructionQuality/vo/QualityRecordVo.java @@ -0,0 +1,46 @@ +package com.securitycontrol.background.constructionQuality.vo; +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * + * @author lsun + */ +@Data +public class QualityRecordVo { + + @ApiModelProperty(value = "工程ID") + @Excel(name = "序号", width = 10.0, orderNum = "0") + private String proId; + + @ApiModelProperty(value = "设备名称") + @Excel(name = "设备名称", width = 10.0, orderNum = "1") + private String deviceName; + + @ApiModelProperty(value = "区域名称") + @Excel(name = "区域名称", width = 10.0, orderNum = "2") + private String areaName; + + @ApiModelProperty(value = "监测点名称") + @Excel(name = "监测点名称", width = 10.0, orderNum = "3") + private String modeName; + + @ApiModelProperty(value = "检测值") + @Excel(name = "检测值", width = 10.0, orderNum = "4") + private String val; + + @ApiModelProperty(value = "累计变化") + @Excel(name = "累计变化", width = 10.0, orderNum = "5") + private String changeVal; + + @ApiModelProperty(value = "状态") + @Excel(name = "状态", width = 10.0, orderNum = "6") + private String isWarn; + + @ApiModelProperty(value = "监测时间") + @Excel(name = "监测时间", width = 10.0, orderNum = "7") + private String createTime; + + private String keyWord; +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/controller/EarlyWarningRecordController.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/controller/EarlyWarningRecordController.java new file mode 100644 index 0000000..aef3702 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/controller/EarlyWarningRecordController.java @@ -0,0 +1,76 @@ +package com.securitycontrol.background.towerDetection.controller; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import com.securitycontrol.background.towerDetection.service.EarlyWarningRecordService; + + +import com.securitycontrol.background.towerDetection.vo.EarlyWarningRecordVo; +import com.securitycontrol.common.core.web.controller.BaseController; +import com.securitycontrol.common.core.web.page.TableDataInfo; +import com.securitycontrol.common.log.annotation.Log; +import com.securitycontrol.common.log.enums.OperationType; +import cn.afterturn.easypoi.excel.entity.ExportParams; + +import com.securitycontrol.system.export.util.ExcelStyleUtil; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.BeanUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; + +/** + * 组塔检测 - 预警记录 + * @author lsun + */ +@RestController +@RequestMapping("/towerDetection/earlyWarningRecord/") +@Slf4j +public class EarlyWarningRecordController extends BaseController { + + @Resource(name = "EarlyWarningRecordService") + private EarlyWarningRecordService service; + + @ApiOperation(value = "获取信息列表") + @GetMapping("getEarlyWarningRecordLists") + @Log(title = "组塔检测", menu = "组塔检测->预警记录", grade = OperationType.QUERY_BUSINESS, details = "查询列表", type = "业务日志") + public TableDataInfo getEarlyWarningRecordLists(EarlyWarningRecordVo dto) { + startPage(); + List list = service.getEarlyWarningRecordLists(dto); + return getDataTable(list); + } + + @GetMapping("exportProData") + @Log(title = "组塔检测", menu = "组塔检测->预警记录", grade = OperationType.EXPORT_BUSINESS, details = "导出列表", type = "业务日志") + public void exportData(HttpServletRequest request, HttpServletResponse response, EarlyWarningRecordVo dto) { + try { + List proExportVoList = new ArrayList<>(); + List proLists = service.getEarlyWarningRecordLists(dto); + for (int i = 0; i < proLists.size(); i++) { + proLists.get(i).setProId((i + 1) + ""); + EarlyWarningRecordVo exportVo = new EarlyWarningRecordVo(); + BeanUtils.copyProperties(proLists.get(i), exportVo); + proExportVoList.add(exportVo); + } + ExportParams exportParams = new ExportParams("预警记录", "预警记录", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, EarlyWarningRecordVo.class, proExportVoList); + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("预警记录" + ".xlsx", "UTF-8")); + ServletOutputStream outputStream = response.getOutputStream(); + workbook.write(outputStream); + outputStream.close(); + workbook.close(); + } catch (Exception e) { + log.error("导出预警记录", e); + } + } +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/controller/TowerRecordController.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/controller/TowerRecordController.java new file mode 100644 index 0000000..e61e9ef --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/controller/TowerRecordController.java @@ -0,0 +1,74 @@ +package com.securitycontrol.background.towerDetection.controller; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import com.securitycontrol.background.towerDetection.service.TowerRecordService; +import com.securitycontrol.background.towerDetection.vo.TowerRecordVo; +import com.securitycontrol.common.core.web.controller.BaseController; +import com.securitycontrol.common.core.web.page.TableDataInfo; +import com.securitycontrol.common.log.annotation.Log; +import com.securitycontrol.common.log.enums.OperationType; +import cn.afterturn.easypoi.excel.entity.ExportParams; + +import com.securitycontrol.system.export.util.ExcelStyleUtil; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.BeanUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; + +/** + * 组塔检测 - 检测记录 + * @author lsun + */ +@RestController +@RequestMapping("/towerDetection/towerRecord/") +@Slf4j +public class TowerRecordController extends BaseController { + + @Resource(name = "TowerRecordService") + private TowerRecordService service; + + @ApiOperation(value = "获取信息列表") + @GetMapping("getTowerRecordLists") + @Log(title = "组塔检测", menu = "组塔检测->检测记录", grade = OperationType.QUERY_BUSINESS, details = "查询列表", type = "业务日志") + public TableDataInfo getTowerRecordLists(TowerRecordVo dto) { + startPage(); + List list = service.getTowerRecordLists(dto); + return getDataTable(list); + } + + @GetMapping("exportProData") + @Log(title = "组塔检测", menu = "组塔检测->检测记录", grade = OperationType.EXPORT_BUSINESS, details = "导出列表", type = "业务日志") + public void exportData(HttpServletRequest request, HttpServletResponse response, TowerRecordVo dto) { + try { + List proExportVoList = new ArrayList<>(); + List proLists = service.getTowerRecordLists(dto); + for (int i = 0; i < proLists.size(); i++) { + proLists.get(i).setProId((i + 1) + ""); + TowerRecordVo exportVo = new TowerRecordVo(); + BeanUtils.copyProperties(proLists.get(i), exportVo); + proExportVoList.add(exportVo); + } + ExportParams exportParams = new ExportParams("检测记录", "检测记录", ExcelType.XSSF); + exportParams.setStyle(ExcelStyleUtil.class); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TowerRecordVo.class, proExportVoList); + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("检测记录" + ".xlsx", "UTF-8")); + ServletOutputStream outputStream = response.getOutputStream(); + workbook.write(outputStream); + outputStream.close(); + workbook.close(); + } catch (Exception e) { + log.error("导出检测记录", e); + } + } +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/mapper/EarlyWarningRecordMapper.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/mapper/EarlyWarningRecordMapper.java new file mode 100644 index 0000000..a9f8c4a --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/mapper/EarlyWarningRecordMapper.java @@ -0,0 +1,24 @@ +package com.securitycontrol.background.towerDetection.mapper; + +import com.securitycontrol.background.towerDetection.vo.EarlyWarningRecordVo; +import com.securitycontrol.background.towerDetection.vo.TowerRecordVo; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 组塔检测 - 预警记录 + * @author lsun + */ +@Repository(value = "EarlyWarningRecordMapper") +public interface EarlyWarningRecordMapper { + + /** + * 获取信息列表 + * @param dto + * @return + */ + List getEarlyWarningRecordLists(EarlyWarningRecordVo dto); + + +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/mapper/TowerRecordMapper.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/mapper/TowerRecordMapper.java new file mode 100644 index 0000000..3147b9c --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/mapper/TowerRecordMapper.java @@ -0,0 +1,23 @@ +package com.securitycontrol.background.towerDetection.mapper; + +import com.securitycontrol.background.towerDetection.vo.TowerRecordVo; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 组塔检测 - 检测记录 + * @author lsun + */ +@Repository(value = "TowerRecordMapper") +public interface TowerRecordMapper { + + /** + * 获取信息列表 + * @param dto + * @return + */ + List getTowerRecordLists(TowerRecordVo dto); + + +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/EarlyWarningRecordService.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/EarlyWarningRecordService.java new file mode 100644 index 0000000..a4a1a81 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/EarlyWarningRecordService.java @@ -0,0 +1,18 @@ +package com.securitycontrol.background.towerDetection.service; + +import com.securitycontrol.background.towerDetection.vo.EarlyWarningRecordVo; +import java.util.List; + +/** + * 组塔检测 - 预警记录 + * @author lsun + */ +public interface EarlyWarningRecordService { + + /** + * 获取信息列表 + * @param dto + * @return + */ + List getEarlyWarningRecordLists(EarlyWarningRecordVo dto); +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/TowerRecordService.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/TowerRecordService.java new file mode 100644 index 0000000..1dd8c33 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/TowerRecordService.java @@ -0,0 +1,18 @@ +package com.securitycontrol.background.towerDetection.service; + +import com.securitycontrol.background.towerDetection.vo.TowerRecordVo; +import java.util.List; + +/** + * 组塔检测 - 检测记录 + * @author lsun + */ +public interface TowerRecordService { + + /** + * 获取信息列表 + * @param dto + * @return + */ + List getTowerRecordLists(TowerRecordVo dto); +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/impl/EarlyWarningRecordServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/impl/EarlyWarningRecordServiceImpl.java new file mode 100644 index 0000000..31d9333 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/impl/EarlyWarningRecordServiceImpl.java @@ -0,0 +1,31 @@ +package com.securitycontrol.background.towerDetection.service.impl; + + +import com.securitycontrol.background.towerDetection.mapper.EarlyWarningRecordMapper; +import com.securitycontrol.background.towerDetection.service.EarlyWarningRecordService; +import com.securitycontrol.background.towerDetection.vo.EarlyWarningRecordVo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.*; + +/** + * 组塔检测 - 预警记录 + * @author lsun + */ +@Service(value = "EarlyWarningRecordService") +@Slf4j +public class EarlyWarningRecordServiceImpl implements EarlyWarningRecordService { + + @Resource(name = "EarlyWarningRecordMapper") + private EarlyWarningRecordMapper mapper; + + @Override + public List getEarlyWarningRecordLists(EarlyWarningRecordVo dto) { + List list = new ArrayList<>(); + list = mapper.getEarlyWarningRecordLists(dto); + return list; + } + +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/impl/TowerRecordServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/impl/TowerRecordServiceImpl.java new file mode 100644 index 0000000..e9fbdc8 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/service/impl/TowerRecordServiceImpl.java @@ -0,0 +1,46 @@ +package com.securitycontrol.background.towerDetection.service.impl; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.securitycontrol.background.towerDetection.mapper.TowerRecordMapper; +import com.securitycontrol.background.towerDetection.service.TowerRecordService; +import com.securitycontrol.background.towerDetection.vo.TowerRecordVo; +import com.securitycontrol.common.core.constant.Constant; +import com.securitycontrol.common.core.utils.ImportExcelUtils; +import com.securitycontrol.common.core.utils.StringUtils; +import com.securitycontrol.common.core.utils.aes.DateTimeHelper; +import com.securitycontrol.common.core.web.domain.AjaxResult; +import com.securitycontrol.common.security.utils.ValidatorsUtils; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.*; + +/** + * 组塔检测 - 检测记录 + * @author lsun + */ +@Service(value = "TowerRecordService") +@Slf4j +public class TowerRecordServiceImpl implements TowerRecordService { + + @Resource(name = "TowerRecordMapper") + private TowerRecordMapper mapper; + + @Override + public List getTowerRecordLists(TowerRecordVo dto) { + List list = new ArrayList<>(); + list = mapper.getTowerRecordLists(dto); + return list; + } + +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/vo/EarlyWarningRecordVo.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/vo/EarlyWarningRecordVo.java new file mode 100644 index 0000000..cf6a47a --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/vo/EarlyWarningRecordVo.java @@ -0,0 +1,30 @@ +package com.securitycontrol.background.towerDetection.vo; +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * + */ +@Data +public class EarlyWarningRecordVo { + + @Excel(name = "序号", width = 10.0, orderNum = "0") + private String proId; + + @ApiModelProperty(value = "告警内容") + @Excel(name = "告警内容", width = 10.0, orderNum = "1") + private String warnContent; + + @ApiModelProperty(value = "告警时间") + @Excel(name = "告警时间", width = 10.0, orderNum = "2") + private String warnTime; + + @ApiModelProperty(value = "告警类型") + private String warnType; + + @ApiModelProperty(value = "监测时间") + private String createTime; + + private String keyWord; +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/vo/TowerRecordVo.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/vo/TowerRecordVo.java new file mode 100644 index 0000000..9a815ce --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/towerDetection/vo/TowerRecordVo.java @@ -0,0 +1,45 @@ +package com.securitycontrol.background.towerDetection.vo; +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * + */ +@Data +public class TowerRecordVo { + + @ApiModelProperty(value = "工程ID") + @Excel(name = "序号", width = 10.0, orderNum = "0") + private String proId; + + @ApiModelProperty(value = "设备名称") + @Excel(name = "设备名称", width = 10.0, orderNum = "1") + private String deviceName; + + @ApiModelProperty(value = "区域名称") + @Excel(name = "区域名称", width = 10.0, orderNum = "2") + private String areaName; + + @ApiModelProperty(value = "监测点名称") + @Excel(name = "监测点名称", width = 10.0, orderNum = "3") + private String modeName; + + @ApiModelProperty(value = "检测值") + @Excel(name = "检测值", width = 10.0, orderNum = "4") + private String val; + + @ApiModelProperty(value = "累计变化") + @Excel(name = "累计变化", width = 10.0, orderNum = "5") + private String changeVal; + + @ApiModelProperty(value = "状态") + @Excel(name = "状态", width = 10.0, orderNum = "6") + private String isWarn; + + @ApiModelProperty(value = "监测时间") + @Excel(name = "监测时间", width = 10.0, orderNum = "7") + private String createTime; + + private String keyWord; +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/constructionQuality/EarlyWarningsRecordMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/constructionQuality/EarlyWarningsRecordMapper.xml new file mode 100644 index 0000000..9f058d1 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/constructionQuality/EarlyWarningsRecordMapper.xml @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/constructionQuality/QualityRecordMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/constructionQuality/QualityRecordMapper.xml new file mode 100644 index 0000000..b9a13fb --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/constructionQuality/QualityRecordMapper.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/towerDetection/EarlyWarningRecordMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/towerDetection/EarlyWarningRecordMapper.xml new file mode 100644 index 0000000..52534ce --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/towerDetection/EarlyWarningRecordMapper.xml @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/towerDetection/TowerRecordMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/towerDetection/TowerRecordMapper.xml new file mode 100644 index 0000000..10c1251 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/towerDetection/TowerRecordMapper.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file From a7ac882e3084e2be61b5f854e7dd7e33abc044da Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Fri, 22 Mar 2024 18:13:22 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E4=BA=BA=E8=BD=A6=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DeviceOfBdServiceImpl.java | 24 ++++- .../service/impl/HumanServiceImpl.java | 89 +++++++++++-------- .../service/impl/TeamServiceImpl.java | 36 +++++--- 3 files changed, 96 insertions(+), 53 deletions(-) diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/DeviceOfBdServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/DeviceOfBdServiceImpl.java index ce81677..2a57e0a 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/DeviceOfBdServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/DeviceOfBdServiceImpl.java @@ -43,7 +43,11 @@ public class DeviceOfBdServiceImpl implements IDeviceOfBdService { @Override public List getDeviceBdList(DeviceBdDto dto) { List list = new ArrayList<>(); - list = mapper.getDeviceBdList(dto); + try { + list = mapper.getDeviceBdList(dto); + } catch (Exception e) { + log.error("获取边带列表",e); + } return list; } @@ -81,7 +85,11 @@ public class DeviceOfBdServiceImpl implements IDeviceOfBdService { @Override public AjaxResult getDeviceBdById(DeviceBdDto dto) { DeviceBdVo vo = new DeviceBdVo(); - vo = mapper.getDeviceBdById(dto); + try { + vo = mapper.getDeviceBdById(dto); + } catch (Exception e) { + log.error("边带设备详情",e); + } return AjaxResult.success(vo); } @@ -109,7 +117,11 @@ public class DeviceOfBdServiceImpl implements IDeviceOfBdService { @Override public List getDeviceBdChildList(DeviceBdDto dto) { List list = new ArrayList<>(); - list = mapper.getDeviceBdChildList(dto); + try { + list = mapper.getDeviceBdChildList(dto); + } catch (Exception e) { + log.error("获取边带子设备列表",e); + } return list; } @@ -146,7 +158,11 @@ public class DeviceOfBdServiceImpl implements IDeviceOfBdService { @Override public AjaxResult getDeviceBdChildById(DeviceBdDto dto) { DeviceBdChildVo vo = new DeviceBdChildVo(); - vo = mapper.getDeviceBdChildById(dto); + try { + vo = mapper.getDeviceBdChildById(dto); + } catch (Exception e) { + log.error("边带子设备详情",e); + } return AjaxResult.success(vo); } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java index 5a624f9..5058e31 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java @@ -20,7 +20,6 @@ import com.securitycontrol.system.api.RemoteFileService; import com.securitycontrol.system.api.domain.SysFile; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; @@ -48,7 +47,11 @@ public class HumanServiceImpl implements HumanService { @Override public List getHumanLists(ParamDto dto) { List list = new ArrayList<>(); - list = mapper.getHumanLists(dto); + try { + list = mapper.getHumanLists(dto); + } catch (Exception e) { + log.error("获取人员列表",e); + } return list; } @@ -156,28 +159,32 @@ public class HumanServiceImpl implements HumanService { @Override public AjaxResult getPersonnelById(ParamDto dto) { HumanManageVo vo = new HumanManageVo(); - vo = mapper.getPersonnelById(dto); - String decryptIdNumber = AesCbcUtils.decrypt(vo.getIdNumber()); - if(decryptIdNumber != null){ - vo.setIdNumber(decryptIdNumber); - } - List resourceFileVos = mapper.getFiles(vo.getUserId()); - if (CollectionUtils.isNotEmpty(resourceFileVos)) { - List list = new ArrayList<>(); - for (ResourceFileVo fileVo : resourceFileVos) { - String base64 = null; - Result result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER); - if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) { - String jsonString = JSON.toJSONString(result.getData()); - JSONObject item = JSON.parseObject(jsonString); - base64 = item.getString("url"); - } - HumanManageVo.FileData fileData = new HumanManageVo.FileData(); - fileData.setFileId(fileVo.getFileId()); - fileData.setBase64Url(base64); - list.add(fileData); + try { + vo = mapper.getPersonnelById(dto); + String decryptIdNumber = AesCbcUtils.decrypt(vo.getIdNumber()); + if(decryptIdNumber != null){ + vo.setIdNumber(decryptIdNumber); } - vo.setFileData(list); + List resourceFileVos = mapper.getFiles(vo.getUserId()); + if (CollectionUtils.isNotEmpty(resourceFileVos)) { + List list = new ArrayList<>(); + for (ResourceFileVo fileVo : resourceFileVos) { + String base64 = null; + Result result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER); + if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) { + String jsonString = JSON.toJSONString(result.getData()); + JSONObject item = JSON.parseObject(jsonString); + base64 = item.getString("url"); + } + HumanManageVo.FileData fileData = new HumanManageVo.FileData(); + fileData.setFileId(fileVo.getFileId()); + fileData.setBase64Url(base64); + list.add(fileData); + } + vo.setFileData(list); + } + } catch (Exception e) { + log.error("人员详情",e); } return AjaxResult.success(vo); } @@ -212,21 +219,25 @@ public class HumanServiceImpl implements HumanService { @Override public AjaxResult viewPersonnelFile(ParamDto dto) { List list = new ArrayList<>(); - List resourceFileVos = mapper.getFiles(dto.getId()); - if (CollectionUtils.isNotEmpty(resourceFileVos)) { - for (ResourceFileVo fileVo : resourceFileVos) { - String base64 = null; - Result result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER); - if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) { - String jsonString = JSON.toJSONString(result.getData()); - JSONObject item = JSON.parseObject(jsonString); - base64 = item.getString("url"); + try { + List resourceFileVos = mapper.getFiles(dto.getId()); + if (CollectionUtils.isNotEmpty(resourceFileVos)) { + for (ResourceFileVo fileVo : resourceFileVos) { + String base64 = null; + Result result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER); + if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) { + String jsonString = JSON.toJSONString(result.getData()); + JSONObject item = JSON.parseObject(jsonString); + base64 = item.getString("url"); + } + HumanManageVo.FileData fileData = new HumanManageVo.FileData(); + fileData.setFileId(fileVo.getFileId()); + fileData.setBase64Url(base64); + list.add(fileData); } - HumanManageVo.FileData fileData = new HumanManageVo.FileData(); - fileData.setFileId(fileVo.getFileId()); - fileData.setBase64Url(base64); - list.add(fileData); } + } catch (Exception e) { + log.error("人员照片预览",e); } return AjaxResult.success(list); } @@ -234,7 +245,11 @@ public class HumanServiceImpl implements HumanService { @Override public List getPersonnelAccessLists(ParamDto dto) { List list = new ArrayList<>(); - list = mapper.getPersonnelAccessLists(dto); + try { + list = mapper.getPersonnelAccessLists(dto); + } catch (Exception e) { + log.error("获取人员出入记录",e); + } return list; } } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java index 1ff99d8..d077a80 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java @@ -35,10 +35,14 @@ public class TeamServiceImpl implements TeamService { @Override public List getTeamLists(ParamDto dto) { List list = new ArrayList<>(); - list = mapper.getTeamLists(dto); - for (TeamManageVo vo : list) { - int num = mapper.getTeamUserNum(vo.getTeamId()); - vo.setTeamNum(String.valueOf(num)); + try { + list = mapper.getTeamLists(dto); + for (TeamManageVo vo : list) { + int num = mapper.getTeamUserNum(vo.getTeamId()); + vo.setTeamNum(String.valueOf(num)); + } + } catch (Exception e) { + log.error("获取班组列表",e); } return list; } @@ -138,7 +142,11 @@ public class TeamServiceImpl implements TeamService { @Override public List getTeamUserLists(ParamDto dto) { List list = new ArrayList<>(); - list = mapper.getTeamUserLists(dto); + try { + list = mapper.getTeamUserLists(dto); + } catch (Exception e) { + log.error("获取班组人员列表",e); + } return list; } @@ -161,15 +169,19 @@ public class TeamServiceImpl implements TeamService { Map map = new HashMap<>(16); List> teamUsers = new ArrayList<>(); List> noBandingUsers = new ArrayList<>(); - List> list = mapper.getTeamUserAndNoBandingUser(dto); - if(CollectionUtils.isNotEmpty(list)){ - for (Map stringMap : list) { - if(Objects.equals(stringMap.get("type"),"1")){ - teamUsers.add(stringMap); - }else if(Objects.equals(stringMap.get("type"),"2")){ - noBandingUsers.add(stringMap); + try { + List> list = mapper.getTeamUserAndNoBandingUser(dto); + if(CollectionUtils.isNotEmpty(list)){ + for (Map stringMap : list) { + if(Objects.equals(stringMap.get("type"),"1")){ + teamUsers.add(stringMap); + }else if(Objects.equals(stringMap.get("type"),"2")){ + noBandingUsers.add(stringMap); + } } } + } catch (Exception e) { + log.error("获取班组组员和未加入班组人员",e); } map.put("teamUsers",teamUsers); map.put("noBandingUsers",noBandingUsers); From c6a424fe542d8e23b69e45b3ad423fb3bbf13969 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Fri, 22 Mar 2024 18:28:30 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/service/impl/ProServiceImpl.java | 100 +++++++++++------- .../base/service/impl/RoleServiceImpl.java | 18 +++- .../base/service/impl/SelectServiceImpl.java | 42 ++++++-- .../service/impl/TeamQuEvalServiceImpl.java | 12 ++- .../base/service/impl/UserServiceImpl.java | 21 +++- 5 files changed, 138 insertions(+), 55 deletions(-) diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProServiceImpl.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProServiceImpl.java index f1320b7..f2e4d23 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProServiceImpl.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProServiceImpl.java @@ -66,12 +66,16 @@ public class ProServiceImpl implements IProService { @Override public List getProLists(ProDto dto) { List list = new ArrayList<>(); - list = mapper.getProLists(dto); - list.forEach(item -> { - List fileNums = mapper.getProFiles(item.getProId()); - item.setProImgFileNum(fileNums.get(0)); - item.setProFileNum(fileNums.get(1)); - }); + try { + list = mapper.getProLists(dto); + list.forEach(item -> { + List fileNums = mapper.getProFiles(item.getProId()); + item.setProImgFileNum(fileNums.get(0)); + item.setProFileNum(fileNums.get(1)); + }); + } catch (Exception e) { + log.error("获取工程列表",e); + } return list; } @@ -156,25 +160,29 @@ public class ProServiceImpl implements IProService { @Override public AjaxResult getProById(ProDto dto) { ProVo vo = new ProVo(); - vo = mapper.getProById(dto); - List resourceFileVos = mapper.getFiles(vo.getProId()); - if (CollectionUtils.isNotEmpty(resourceFileVos)) { - List list = new ArrayList<>(); - for (ResourceFileVo fileVo : resourceFileVos) { - String base64 = null; - Result result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER); - if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) { - String jsonString = JSON.toJSONString(result.getData()); - JSONObject item = JSON.parseObject(jsonString); - base64 = item.getString("url"); + try { + vo = mapper.getProById(dto); + List resourceFileVos = mapper.getFiles(vo.getProId()); + if (CollectionUtils.isNotEmpty(resourceFileVos)) { + List list = new ArrayList<>(); + for (ResourceFileVo fileVo : resourceFileVos) { + String base64 = null; + Result result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER); + if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) { + String jsonString = JSON.toJSONString(result.getData()); + 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); + vo.setFileData(list); } - vo.setFileData(list); + } catch (Exception e) { + log.error("工程详情",e); } return AjaxResult.success(vo); } @@ -225,24 +233,28 @@ public class ProServiceImpl implements IProService { @Override public AjaxResult viewProFile(ProDto dto) { List list = new ArrayList<>(); - List resourceFileVos = mapper.getFiles(dto.getProId()); - if (CollectionUtils.isNotEmpty(resourceFileVos)) { - for (ResourceFileVo fileVo : resourceFileVos) { - if (Objects.equals(dto.getFileType(), fileVo.getSourceType())) { - String base64 = null; - Result result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER); - if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) { - String jsonString = JSON.toJSONString(result.getData()); - JSONObject item = JSON.parseObject(jsonString); - base64 = item.getString("url"); + try { + List resourceFileVos = mapper.getFiles(dto.getProId()); + if (CollectionUtils.isNotEmpty(resourceFileVos)) { + for (ResourceFileVo fileVo : resourceFileVos) { + if (Objects.equals(dto.getFileType(), fileVo.getSourceType())) { + String base64 = null; + Result result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER); + if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) { + String jsonString = JSON.toJSONString(result.getData()); + 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); } @@ -511,7 +523,11 @@ public class ProServiceImpl implements IProService { @Override public List getGxPlanLists(GxPlanDto dto) { List list = new ArrayList<>(); - list = mapper.getGxPlanLists(dto); + try { + list = mapper.getGxPlanLists(dto); + } catch (Exception e) { + log.error("获取工序列表",e); + } return list; } @@ -603,7 +619,11 @@ public class ProServiceImpl implements IProService { @Override public AjaxResult getGxPlanById(GxPlanDto dto) { GxPlanVo vo = new GxPlanVo(); - vo = mapper.getGxPlanById(dto); + try { + vo = mapper.getGxPlanById(dto); + } catch (Exception e) { + log.error("工序计划详情",e); + } return AjaxResult.success(vo); } diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/RoleServiceImpl.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/RoleServiceImpl.java index a2e60f4..8534171 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/RoleServiceImpl.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/RoleServiceImpl.java @@ -31,7 +31,11 @@ public class RoleServiceImpl implements IRoleService { @Override public List getRoleLists(RoleDto dto) { List list = new ArrayList<>(); - list = mapper.getRoleLists(dto); + try { + list = mapper.getRoleLists(dto); + } catch (Exception e) { + log.error("获取角色列表",e); + } return list; } @@ -67,7 +71,11 @@ public class RoleServiceImpl implements IRoleService { @Override public AjaxResult getRoleById(RoleDto dto) { RoleVo vo = new RoleVo(); - vo = mapper.getRoleById(dto); + try { + vo = mapper.getRoleById(dto); + } catch (Exception e) { + log.error("角色详情",e); + } return AjaxResult.success(vo); } @@ -96,7 +104,11 @@ public class RoleServiceImpl implements IRoleService { @Override public AjaxResult getAuthMenu(RoleDto dto) { List list = new ArrayList<>(); - list = mapper.getAuthMenu(dto); + try { + list = mapper.getAuthMenu(dto); + } catch (Exception e) { + log.error("获取角色授权的菜单",e); + } return AjaxResult.success(list); } } diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/SelectServiceImpl.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/SelectServiceImpl.java index 559cb10..d53519e 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/SelectServiceImpl.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/SelectServiceImpl.java @@ -49,7 +49,11 @@ public class SelectServiceImpl implements ISelectService { @Override public AjaxResult getRoleLists() { List list = new ArrayList<>(); - list = mapper.getRoleLists(); + try { + list = mapper.getRoleLists(); + } catch (Exception e) { + log.error("角色下拉选",e); + } return AjaxResult.success(list); } @@ -100,42 +104,66 @@ public class SelectServiceImpl implements ISelectService { @Override public AjaxResult getBuildLists() { List list = new ArrayList<>(); - list = mapper.getBuildLists(); + try { + list = mapper.getBuildLists(); + } catch (Exception e) { + log.error("建管单位下拉选",e); + } return AjaxResult.success(list); } @Override public AjaxResult getDictLists(SelectDto dto) { List list = new ArrayList<>(); - list = mapper.getDictLists(dto); + try { + list = mapper.getDictLists(dto); + } catch (Exception e) { + log.error("字典表下拉选",e); + } return AjaxResult.success(list); } @Override public AjaxResult getTowerLists(SelectDto dto) { List list = new ArrayList<>(); - list = mapper.getTowerLists(dto); + try { + list = mapper.getTowerLists(dto); + } catch (Exception e) { + log.error("杆塔下拉选",e); + } return AjaxResult.success(list); } @Override public AjaxResult getTeamLists(SelectDto dto) { List list = new ArrayList<>(); - list = mapper.getTeamLists(dto); + try { + list = mapper.getTeamLists(dto); + } catch (Exception e) { + log.error("班组下拉选",e); + } return AjaxResult.success(list); } @Override public AjaxResult getProLists(SelectDto dto) { List list = new ArrayList<>(); - list = mapper.getProLists(dto); + try { + list = mapper.getProLists(dto); + } catch (Exception e) { + log.error("工程下拉选",e); + } return AjaxResult.success(list); } @Override public AjaxResult getAreaLists(SelectDto dto) { List list = new ArrayList<>(); - list = mapper.getAreaLists(dto); + try { + list = mapper.getAreaLists(dto); + } catch (Exception e) { + log.error("区域下拉选"); + } return AjaxResult.success(list); } } diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/TeamQuEvalServiceImpl.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/TeamQuEvalServiceImpl.java index a1d2a01..a446557 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/TeamQuEvalServiceImpl.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/TeamQuEvalServiceImpl.java @@ -34,7 +34,11 @@ public class TeamQuEvalServiceImpl implements ITeamQuEvalService { @Override public List getTeamQuEvalLists(TeamQuEvalDto dto) { List list = new ArrayList<>(); - list = mapper.getTeamQuEvalLists(dto); + try { + list = mapper.getTeamQuEvalLists(dto); + } catch (Exception e) { + log.error("获取班组质量评价列表",e); + } return list; } @@ -64,7 +68,11 @@ public class TeamQuEvalServiceImpl implements ITeamQuEvalService { @Override public AjaxResult getTeamEvalById(TeamQuEvalDto dto) { TeamQuEvalVo vo = new TeamQuEvalVo(); - vo = mapper.getTeamEvalById(dto); + try { + vo = mapper.getTeamEvalById(dto); + } catch (Exception e) { + log.error("班组质量评价详情",e); + } return AjaxResult.success(vo); } diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/UserServiceImpl.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/UserServiceImpl.java index 0b56f68..87c5456 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/UserServiceImpl.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/UserServiceImpl.java @@ -34,7 +34,11 @@ public class UserServiceImpl implements IUserService { @Override public List getUserLists(UserDto dto) { List list = new ArrayList<>(); - list = mapper.getUserLists(dto); + try { + list = mapper.getUserLists(dto); + } catch (Exception e) { + log.error("获取用户列表",e); + } return list; } @@ -69,14 +73,25 @@ public class UserServiceImpl implements IUserService { @Override @Transactional(rollbackFor = Exception.class) 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(); } @Override public AjaxResult getUserById(UserDto dto) { UserVo vo = new UserVo(); - vo = mapper.getUserById(dto); + try { + vo = mapper.getUserById(dto); + } catch (Exception e) { + log.error("用户详情",e); + } return AjaxResult.success(vo); } From db1354703659bf1d7d16dc769f5ab8dcdc961552 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Fri, 22 Mar 2024 18:31:54 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E5=B7=A5=E5=BA=8F=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ProScheduleServiceImpl.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProScheduleServiceImpl.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProScheduleServiceImpl.java index da11d31..07d6e66 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProScheduleServiceImpl.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProScheduleServiceImpl.java @@ -42,28 +42,44 @@ public class ProScheduleServiceImpl implements IProScheduleService { @Override public List getProScheduleLists(ProScheduleDto dto) { List list = new ArrayList<>(); - list = mapper.getProScheduleLists(dto); + try { + list = mapper.getProScheduleLists(dto); + } catch (Exception e) { + log.error("获取工程进度列表",e); + } return list; } @Override public List getGxPlanLists(GxPlanDto dto) { List list = new ArrayList<>(); - list = mapper.getGxPlanLists(dto); + try { + list = mapper.getGxPlanLists(dto); + } catch (Exception e) { + log.error("获取工序计划列表",e); + } return list; } @Override public AjaxResult getGxPlansIsDela(ProScheduleDto dto) { List list = new ArrayList<>(); - list = mapper.getGxPlansIsDela(dto); + try { + list = mapper.getGxPlansIsDela(dto); + } catch (Exception e) { + log.error("工序计划延期提醒",e); + } return AjaxResult.success(list); } @Override public List getGxPlanProgressLists(ProScheduleDto dto) { List list = new ArrayList<>(); - list = mapper.getGxPlanProgressLists(dto); + try { + list = mapper.getGxPlanProgressLists(dto); + } catch (Exception e) { + log.error("获取工序计划进度列表",e); + } return list; }