Bladeren bron

代码优化

wangliang 1 jaar geleden
bovenliggende
commit
dcdc54b896

+ 1 - 0
sop-business/src/main/java/com/qmth/sop/business/activiti/service/impl/ActivitiServiceImpl.java

@@ -208,6 +208,7 @@ public class ActivitiServiceImpl implements ActivitiService {
      * @param flowApproveParam
      * @return
      */
+    @Override
     @Transactional
     public Map<String, Object> taskApproveCommon(FlowApproveParam flowApproveParam) throws InterruptedException {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();

+ 7 - 3
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysCustomServiceImpl.java

@@ -61,7 +61,9 @@ public class SysCustomServiceImpl extends ServiceImpl<SysCustomMapper, SysCustom
     public IPage<SysCustomResult> query(Page<Map> iPage, ProductTypeEnum type, Long managerId, String name, Long levelId) {
         IPage<SysCustomResult> sysCustomResultIPage = this.baseMapper.query(iPage, Objects.nonNull(type) ? type.name() : null, Objects.nonNull(managerId) ? managerId : null, name, Objects.nonNull(levelId) ? levelId : null);
         sysCustomResultIPage.getRecords().forEach(e -> {
-            if(e.getLevelId()!=null)e.setRoleList(sysLevelRoleService.getList(e.getLevelId()));
+            if(e.getLevelId()!=null) {
+                e.setRoleList(sysLevelRoleService.getList(e.getLevelId()));
+            }
             e.setAddrList(sysCustomAddrService.list(new QueryWrapper<SysCustomAddr>().lambda().eq(SysCustomAddr::getCustomId,e.getId())));
         });
         return  sysCustomResultIPage;
@@ -88,8 +90,9 @@ public class SysCustomServiceImpl extends ServiceImpl<SysCustomMapper, SysCustom
                 e.setCustomId(sysCustom.getId());
                 sysCustomAddrService.saveOrUpdate(e);
             });
-            if(Objects.isNull(sysCustom.getLevelId()))
+            if(Objects.isNull(sysCustom.getLevelId())) {
                 return saveOrUpdate(sysCustom,new LambdaUpdateWrapper<SysCustom>().set(SysCustom::getLevelId,null).eq(SysCustom::getId,sysCustom.getId()));
+            }
             return saveOrUpdate(sysCustom);
         } catch (Exception e) {
             if (e instanceof DuplicateKeyException) {
@@ -111,8 +114,9 @@ public class SysCustomServiceImpl extends ServiceImpl<SysCustomMapper, SysCustom
     @Transactional
     public void delete(Long id) {
         List<TBCrm> list = tbCrmService.list(new LambdaQueryWrapper<TBCrm>().eq(TBCrm::getCustomId, id));
-        if(!list.isEmpty())
+        if(!list.isEmpty()) {
             throw ExceptionResultEnum.ERROR.exception("该客户下已有业务,不能删除");
+        }
         this.removeById(id);
     }
 

+ 4 - 2
sop-business/src/main/java/com/qmth/sop/business/templete/service/impl/TaskLogicServiceImpl.java

@@ -314,10 +314,12 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 dto.setStatus(e.getStatus() ? "已阅" : "未阅");
                 dto.setSupplier(e.getSupplier());
                 //时间戳转化为日期字符串
-                if (Objects.nonNull(e.getReceiveTime()))
+                if (Objects.nonNull(e.getReceiveTime())) {
                     dto.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(e.getReceiveTime()));
-                if (Objects.nonNull(e.getType()))
+                }
+                if (Objects.nonNull(e.getType())) {
                     dto.setType(e.getType().getTitle());
+                }
                 return dto;
             }).collect(Collectors.toList());
 

+ 28 - 22
sop-common/src/main/java/com/qmth/sop/common/util/ByteUtil.java

@@ -35,24 +35,27 @@ public class ByteUtil {
 	public static String toHexAscii(byte[] bytes) {
 		int len = bytes.length;
 		StringWriter sw = new StringWriter(len * 2);
-		for (int i = 0; i < len; ++i)
-			addHexAscii(bytes[i], sw);
+		for (int i = 0; i < len; ++i) {
+            addHexAscii(bytes[i], sw);
+        }
 		return sw.toString();
 	}
 
 	public static String toLowercaseHexAscii(byte[] bytes) {
 		int len = bytes.length;
 		StringWriter sw = new StringWriter(len * 2);
-		for (int i = 0; i < len; ++i)
-			addLowercaseHexAscii(bytes[i], sw);
+		for (int i = 0; i < len; ++i) {
+            addLowercaseHexAscii(bytes[i], sw);
+        }
 		return sw.toString();
 	}
 
 	public static byte[] fromHexAscii(String s) throws NumberFormatException {
 		try {
 			int len = s.length();
-			if ((len % 2) != 0)
-				throw new NumberFormatException("Hex ascii must be exactly two digits per byte.");
+			if ((len % 2) != 0) {
+                throw new NumberFormatException("Hex ascii must be exactly two digits per byte.");
+            }
 
 			int out_len = len / 2;
 			byte[] out = new byte[out_len];
@@ -85,31 +88,34 @@ public class ByteUtil {
 	}
 
 	private static int fromHexDigit(int c) throws NumberFormatException {
-		if (c >= 0x30 && c < 0x3A)
-			return c - 0x30;
-		else if (c >= 0x41 && c < 0x47)
-			return c - 0x37;
-		else if (c >= 0x61 && c < 0x67)
-			return c - 0x57;
-		else
-			throw new NumberFormatException('\'' + c + "' is not a valid hexadecimal digit.");
+		if (c >= 0x30 && c < 0x3A) {
+            return c - 0x30;
+        } else if (c >= 0x41 && c < 0x47) {
+            return c - 0x37;
+        } else if (c >= 0x61 && c < 0x67) {
+            return c - 0x57;
+        } else {
+            throw new NumberFormatException('\'' + c + "' is not a valid hexadecimal digit.");
+        }
 	}
 
 	private static char toHexDigit(int h) {
 		char out;
-		if (h <= 9)
-			out = (char) (h + 0x30);
-		else
-			out = (char) (h + 0x37);
+		if (h <= 9) {
+            out = (char) (h + 0x30);
+        } else {
+            out = (char) (h + 0x37);
+        }
 		return out;
 	}
 
 	private static char toLowercaseHexDigit(int h) {
 		char out;
-		if (h <= 9)
-			out = (char) (h + 0x30);
-		else
-			out = (char) (h + 0x57);
+		if (h <= 9) {
+            out = (char) (h + 0x30);
+        } else {
+            out = (char) (h + 0x57);
+        }
 		return out;
 	}
 

+ 2 - 1
sop-common/src/main/java/com/qmth/sop/common/util/FileUtil.java

@@ -28,11 +28,12 @@ public class FileUtil {
         } catch (IOException e) {
             throw new RuntimeException(e);
         } finally {
-            if (is != null)
+            if (is != null) {
                 try {
                     is.close();
                 } catch (IOException e) {
                 }
+            }
         }
         return new String(base64Byte);
     }