From ab52c273f9fcd35388cbecedd49fa477ddb1d558 Mon Sep 17 00:00:00 2001 From: "youHong.ai" <774495953@qq.com> Date: Sat, 18 Mar 2023 04:18:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9getLogger=20lombook=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E8=A6=86=E7=9B=96get=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aiyh/utils/recordset/RecordsetUtil.java | 1 + .../schedule/InvoiceQuerySchedule.java | 101 +++++++++--------- .../prop/prop2map/logPathConfig.properties | 2 +- .../youhong/ai/mymapper/ParseSqlTest.java | 38 +++---- .../AbstractCommandPropertiesFactory.java | 2 +- .../java/youhong/ai/taibao/TestTaiBao.java | 18 ---- 6 files changed, 72 insertions(+), 90 deletions(-) diff --git a/src/main/java/aiyh/utils/recordset/RecordsetUtil.java b/src/main/java/aiyh/utils/recordset/RecordsetUtil.java index 1b78fd5..e810df1 100644 --- a/src/main/java/aiyh/utils/recordset/RecordsetUtil.java +++ b/src/main/java/aiyh/utils/recordset/RecordsetUtil.java @@ -20,6 +20,7 @@ import java.util.List; * @author EBU7-dev1-ayh create 2021/12/19 0019 14:39 */ +@SuppressWarnings("all") public class RecordsetUtil implements InvocationHandler { diff --git a/src/main/java/weaver/bokang/xiao/dz_invoice/schedule/InvoiceQuerySchedule.java b/src/main/java/weaver/bokang/xiao/dz_invoice/schedule/InvoiceQuerySchedule.java index ef32907..c616cbb 100644 --- a/src/main/java/weaver/bokang/xiao/dz_invoice/schedule/InvoiceQuerySchedule.java +++ b/src/main/java/weaver/bokang/xiao/dz_invoice/schedule/InvoiceQuerySchedule.java @@ -4,7 +4,6 @@ import aiyh.utils.Util; import aiyh.utils.annotation.ActionDesc; import aiyh.utils.annotation.PrintParamMark; import aiyh.utils.annotation.RequiredMark; -import aiyh.utils.excention.CustomerException; import aiyh.utils.httpUtil.ResponeVo; import aiyh.utils.httpUtil.util.HttpUtils; import com.alibaba.fastjson.JSON; @@ -30,54 +29,54 @@ import java.util.Objects; @ActionDesc(value = "定时查询发票勾选状态", author = "bokang.xiao") @Data public class InvoiceQuerySchedule extends BaseCronJob { - - @RequiredMark("发票查询接口唯一标识") - @PrintParamMark - private String requestUnique; - - private final DealWithMapping dealWithMapping = new DealWithMapping(); - private final DzInvoiceMapper dzInvoiceMapper = Util.getMapper(DzInvoiceMapper.class); - - private final HttpUtils httpUtils = new HttpUtils(); - - private final Logger logger = Util.getLogger(); - - @Override - public void execute() { - try{ - logger.info(String.format("================== {%s} 定时任务开始执行 ================",this.getClass().getName())); - logger.info(String.format("param: requestUnique ==>[%s]",requestUnique)); - Util.verifyRequiredField(this); - List> invoiceList = dzInvoiceMapper.queryOnChooseInvoices(); - RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(requestUnique); - Map header = new HashMap<>(8); - header.put("Content-Type","application/json"); - if(!invoiceList.isEmpty()){ - for (Map invoice : invoiceList) { - logger.info("invoice query ==>"+ JSON.toJSONString(invoice)); - Map requestParam = dealWithMapping.getRequestParam(invoice,requestMappingConfig); - ResponeVo responeVo = httpUtils.apiPost(requestMappingConfig.getRequestUrl(), requestParam,header); - if(responeVo.getCode() == 200){ - Map result = responeVo.getResponseEntity(Map.class); - String code = Util.null2String(result.get("code")); - if("E0000".equals(code)){ - Map res = (Map) result.get("result"); - List> invoices = (List>) res.get("data"); - if(Objects.nonNull(invoices) && !invoices.isEmpty()){ - for (Map map : invoices) { - String checkStatus = Util.null2String(map.get("checkStatus")); - dzInvoiceMapper.updateInvoiceCheckStatus(Util.getIntValue(checkStatus),"id",invoice.get("id")); - } - } - } - }else { - logger.error(String.format("请求状态码不为200 发票 {%s} 查询失败!无法同步发票状态",invoice.get("invoiceNumber"))); - } - } - } - }catch (Exception e){ - logger.error("同步发生异常 ==>"+Util.getErrString(e)); - } - } - + + @RequiredMark("发票查询接口唯一标识") + @PrintParamMark + private String requestUnique; + + private final DealWithMapping dealWithMapping = new DealWithMapping(); + private final DzInvoiceMapper dzInvoiceMapper = Util.getMapper(DzInvoiceMapper.class); + + private final HttpUtils httpUtils = new HttpUtils(); + + private final Logger logger = Util.getLogger(); + + @Override + public void execute() { + try { + logger.info(String.format("================== {%s} 定时任务开始执行 ================", this.getClass().getName())); + logger.info(String.format("param: requestUnique ==>[%s]", requestUnique)); + Util.verifyRequiredField(this); + List> invoiceList = dzInvoiceMapper.queryOnChooseInvoices(); + RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(requestUnique); + Map header = new HashMap<>(8); + header.put("Content-Type", "application/json"); + if (!invoiceList.isEmpty()) { + for (Map invoice : invoiceList) { + logger.info("invoice query ==>" + JSON.toJSONString(invoice)); + Map requestParam = dealWithMapping.getRequestParam(invoice, requestMappingConfig); + ResponeVo responeVo = httpUtils.apiPost(requestMappingConfig.getRequestUrl(), requestParam, header); + if (responeVo.getCode() == 200) { + Map result = responeVo.getResponseEntity(Map.class); + String code = Util.null2String(result.get("code")); + if ("E0000".equals(code)) { + Map res = (Map) result.get("result"); + List> invoices = (List>) res.get("data"); + if (Objects.nonNull(invoices) && !invoices.isEmpty()) { + for (Map map : invoices) { + String checkStatus = Util.null2String(map.get("checkStatus")); + dzInvoiceMapper.updateInvoiceCheckStatus(Util.getIntValue(checkStatus), "id", invoice.get("id")); + } + } + } + } else { + logger.error(String.format("请求状态码不为200 发票 {%s} 查询失败!无法同步发票状态", invoice.get("invoiceNumber"))); + } + } + } + } catch (Exception e) { + logger.error("同步发生异常 ==>" + Util.getErrString(e)); + } + } + } diff --git a/src/main/resources/WEB-INF/prop/prop2map/logPathConfig.properties b/src/main/resources/WEB-INF/prop/prop2map/logPathConfig.properties index 281dfb1..8179424 100644 --- a/src/main/resources/WEB-INF/prop/prop2map/logPathConfig.properties +++ b/src/main/resources/WEB-INF/prop/prop2map/logPathConfig.properties @@ -1 +1 @@ -cus.logPath=/applog/tongweb/ecology_log/ \ No newline at end of file +cus.logPath= \ No newline at end of file diff --git a/src/test/java/youhong/ai/mymapper/ParseSqlTest.java b/src/test/java/youhong/ai/mymapper/ParseSqlTest.java index 3afc2c0..56f99a2 100644 --- a/src/test/java/youhong/ai/mymapper/ParseSqlTest.java +++ b/src/test/java/youhong/ai/mymapper/ParseSqlTest.java @@ -75,25 +75,25 @@ public class ParseSqlTest extends BaseTest { @Test public void testSqlChoose() { - String sql = "@my-bind:name='likeName':value=''%' + name + '%''{}\n" + - "select * from table @my-where{\n" + - "\t@my-for:collection='list':separator='and'{\n" + - "\t\t${index} = #{item}\t\n" + - "\t}\n" + - "} or @my-choose{\n" + - "\t@my-when:test='selectValue == 1'{\n" + - "\t\tselect_name = #{selectName1}\n" + - "\t}\n" + - "\t@my-when:test='selectValue == 2'{\n" + - "\t\tselect_name = #{selectName2}\n" + - "\t}\n" + - "\t@my-when:test='selectValue == 3'{\n" + - "\t\tselect_name = #{selectName3}\n" + - "\t}\n" + - "\t@my-otherwise{\n" + - "\t\tselect_name like #{likeName}\n" + - "\t}\n" + - "}\n"; + String sql = "@my-bind:name='likeName':value=''%' + name + '%''{}" + + "select * from table @my-where{" + + " @my-for:collection='list':separator='and'{" + + " ${index} = #{item}" + + " }" + + "} or @my-choose{" + + "@my-when:test='selectValue == 1'{" + + " select_name = #{selectName1}" + + " }" + + " @my-when:test='selectValue == 2'{" + + " select_name = #{selectName2}" + + " }" + + " @my-when:test='selectValue == 3'{" + + " select_name = #{selectName3}" + + " }" + + " @my-otherwise{" + + " select_name like #{likeName}" + + " }" + + "}"; Map param = new HashMap<>(); param.put("list", new HashMap() {{ diff --git a/src/test/java/youhong/ai/mymapper/util/AbstractCommandPropertiesFactory.java b/src/test/java/youhong/ai/mymapper/util/AbstractCommandPropertiesFactory.java index e96920c..6220c75 100644 --- a/src/test/java/youhong/ai/mymapper/util/AbstractCommandPropertiesFactory.java +++ b/src/test/java/youhong/ai/mymapper/util/AbstractCommandPropertiesFactory.java @@ -38,7 +38,7 @@ public class AbstractCommandPropertiesFactory { return this.setValue(commandItemList, new MyIfProperties()); } - @MethodRuleNo(name = CommandConsTant.TRIM, desc = "tirm 指令参数解析") + @MethodRuleNo(name = CommandConsTant.TRIM, desc = "trim 指令参数解析") private AbstractCommandProperties getTrimProperties(List commandItemList) { return this.setValue(commandItemList, new MyTrimProperties()); } diff --git a/src/test/java/youhong/ai/taibao/TestTaiBao.java b/src/test/java/youhong/ai/taibao/TestTaiBao.java index 0437d5c..b1a6c56 100644 --- a/src/test/java/youhong/ai/taibao/TestTaiBao.java +++ b/src/test/java/youhong/ai/taibao/TestTaiBao.java @@ -10,18 +10,15 @@ import com.cloudstore.dev.api.util.Util_DataCache; import org.junit.Test; import weaver.conn.RecordSet; import weaver.general.BaseBean; -import weaver.general.GCONST; import weaver.hrm.User; import weaver.workflow.request.todo.OfsSettingObject; import weaver.workflow.request.todo.RequestUtil; import weaver.workflow.webservices.WorkflowBaseInfo; import weaver.workflow.webservices.WorkflowRequestInfo; -import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.Map; /** *

测试

@@ -35,21 +32,6 @@ public class TestTaiBao extends BaseTest { @Test public void test() { - String logPath = GCONST.getLogPath(); - try { - Map map = Util.getProperties2Map("logPathConfig", "cus"); - if (map != null) { - if (map.containsKey("logPath")) { - logPath = "".equals(Util.null2String(map.get("logPath"))) ? logPath : Util.null2String(map.get("logPath")); - } - } - } catch (Exception ignore) { - - } - if (!logPath.endsWith(File.separator)) { - logPath = logPath + File.separator; - } - System.out.println(logPath); FunctionListService functionListService = new FunctionListService(); System.out.println(JSON.toJSONString(functionListService.getFunctionList(new User(90)))); }