|
|
@@ -0,0 +1,37 @@
|
|
|
+package service;
|
|
|
+
|
|
|
+import common.ServiceController;
|
|
|
+import common.YosException;
|
|
|
+import common.data.Rows;
|
|
|
+import common.data.SQLFactory;
|
|
|
+
|
|
|
+public class DataCheckAndRepair extends ServiceController {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void serviceRun() throws YosException {
|
|
|
+ checkFreezAmount();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 冻结金额矫正
|
|
|
+ */
|
|
|
+ public void checkFreezAmount() {
|
|
|
+ try {
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select t1.sa_accountbalanceid,t1.freezamount,sum(ifnull(t2.amount,0)) as amount from sa_accountbalance t1\n" +
|
|
|
+ "left join sa_accountbalance_freez t2 on t1.sa_accountbalanceid=t2.sa_accountbalanceid\n" +
|
|
|
+ "group by t1.sa_accountbalanceid,t1.freezamount having \n" +
|
|
|
+ "t1.freezamount!=sum(ifnull(t2.amount,0))");
|
|
|
+ if (rows.isNotEmpty()) {
|
|
|
+ logger.info("监测到有{}个账户冻结金额存在差异,差异内容{}", rows.size(), rows.toJsonArray());
|
|
|
+ new SQLFactory(this, "冻结金额统计修复").runSqlUpdate(dbConnect);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("冻结金额统计修复错误!", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ServiceParam paramSet() {
|
|
|
+ return new ServiceParam("数据错误自动修复任务(冻结金额)", 30, RunType.minute);
|
|
|
+ }
|
|
|
+}
|