|
@@ -11,6 +11,7 @@ import com.citygis.web.dataEncrypt.service.JiaMiService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -52,6 +53,8 @@ public class JiaMiServiceImpl implements JiaMiService {
|
|
|
|
|
|
dateBySql.forEach(map -> {
|
|
|
StringBuilder text = new StringBuilder();
|
|
|
+ map.remove("HAMC_CODE");
|
|
|
+ map.remove("IS_ENCRYPT");
|
|
|
map.forEach((key, value) -> {
|
|
|
if (text.length() > 0) {
|
|
|
text.append(",");
|
|
@@ -71,4 +74,34 @@ public class JiaMiServiceImpl implements JiaMiService {
|
|
|
return AjaxResult.success("hmac运算:" + dateBySql.size() + "条");
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public AjaxResult verifyDataCompleteness(String tableName, String idColumn) {
|
|
|
+ List<String> errorData = new ArrayList<>();
|
|
|
+
|
|
|
+ List<LinkedHashMap<String, Object>> dateBySql = jiaMiMapper.getVerifyData(tableName);
|
|
|
+ dateBySql.forEach(map -> {
|
|
|
+ StringBuilder text = new StringBuilder();
|
|
|
+ String hamcCode = map.get("HAMC_CODE").toString();
|
|
|
+ map.remove("HAMC_CODE");
|
|
|
+ map.remove("IS_ENCRYPT");
|
|
|
+ map.forEach((key, value) -> {
|
|
|
+ if (text.length() > 0) {
|
|
|
+ text.append(",");
|
|
|
+ }
|
|
|
+ text.append(value);
|
|
|
+ });
|
|
|
+ String result = text.toString();
|
|
|
+ // 处理 result,如保存到集合或输出
|
|
|
+ try {
|
|
|
+ String hmacText = dataEncryptService.generateHmac(result);
|
|
|
+ if (!hmacText.equals(hamcCode)) {
|
|
|
+ errorData.add(map.get(idColumn).toString());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return AjaxResult.success("验证运算:" + dateBySql.size() + "条,错误数据:" + errorData.size() + "条,id为--->", errorData);
|
|
|
+ }
|
|
|
+
|
|
|
}
|