Browse Source

合同双语

wanglang 2 weeks ago
parent
commit
dc486b38cd

+ 25 - 17
trade-common/src/main/java/com/trade/common/config/mybatis/plugin/I18nSqlProcessInterceptor.java

@@ -179,22 +179,25 @@ public class I18nSqlProcessInterceptor implements Interceptor {
                                 });
                             }
                         } else if (parameterMap.containsKey("et") && parameterMap.get("et") != null
-                                && BaseI18nEntity.class.isAssignableFrom(parameterMap.get("et").getClass())) {
-                                    // updateById,updateAllColumnsById method
-                                    Object baseEntity = parameterMap.get("et");
-                                    String baseTableName = tableInfo.getTableName();
-                                    Long baseTableId = (Long) ReflectionUtil.getMethodValue(baseEntity, ID_CONSTANT);
-                                    // updateById,updateAllColumnsById传入的entity必须有id,不然无法确定改哪个
-                                    if (baseTableId != null) {
-                                        List<String> i18nFieldNameList = I18nUtil
-                                                .getSpecificAnnotationI18nFieldNameList(baseEntity.getClass());
-                                        Map<String, Map<String, String>> metaDataMap = constructMetaDataMap(baseEntity,
-                                                i18nFieldNameList);
-                                        execInsertOrUpdateList(metaDataMap, baseTableName, connection, baseTableId);
-                                    } else {
-                                        log.info("Can not find the value of id of parameter 'entity'!");
-                                    }
-                                }
+                                && (BaseI18nEntity.class.isAssignableFrom(parameterMap.get("et").getClass())
+                                        || BizBaseI18nEntity.class.isAssignableFrom(parameterClass))) {
+                                            // updateById,updateAllColumnsById method
+                                            Object baseEntity = parameterMap.get("et");
+                                            String baseTableName = tableInfo.getTableName();
+                                            Long baseTableId = (Long) ReflectionUtil.getMethodValue(baseEntity,
+                                                    ID_CONSTANT);
+                                            // updateById,updateAllColumnsById传入的entity必须有id,不然无法确定改哪个
+                                            if (baseTableId != null) {
+                                                List<String> i18nFieldNameList = I18nUtil
+                                                        .getSpecificAnnotationI18nFieldNameList(baseEntity.getClass());
+                                                Map<String, Map<String, String>> metaDataMap = constructMetaDataMap(
+                                                        baseEntity, i18nFieldNameList);
+                                                execInsertOrUpdateList(metaDataMap, baseTableName, connection,
+                                                        baseTableId);
+                                            } else {
+                                                log.info("Can not find the value of id of parameter 'entity'!");
+                                            }
+                                        }
                     } else {
                         log.info("Parameter'class: " + parameterClass.getName()
                                 + ",i18n interceptor is not supported for this api now!");
@@ -444,7 +447,12 @@ public class I18nSqlProcessInterceptor implements Interceptor {
      * @return k:language, v: k1:filed,v1:value
      */
     private Map<String, Map<String, String>> constructMetaDataMap(Object parameter, List<String> i18nFieldNameList) {
-        Map<String, List<Map<String, String>>> metaData = ((BaseI18nEntity) parameter).getI18n();
+        Map<String, List<Map<String, String>>> metaData;
+        if (BizBaseI18nEntity.class.isAssignableFrom(parameter.getClass())) {
+            metaData = ((BizBaseI18nEntity) parameter).getI18n();
+        } else {
+            metaData = ((BaseI18nEntity) parameter).getI18n();
+        }
         List<BaseI18nMetaData> baseI18nMetaDataList = new ArrayList<>();
         Map<String, Map<String, String>> metaDataMap = new HashMap<>();
         if (CollUtil.isEmpty(metaData)) {

+ 2 - 0
trade-service/src/main/java/com/trade/service/trade/purchaseorder/dto/InvoiceCommodityDto.java

@@ -36,4 +36,6 @@ public class InvoiceCommodityDto {
     private BigDecimal priceUnit;
     @ApiModelProperty(name = "declarationName", value = "报关品名")
     private String declarationName;
+    @ApiModelProperty(name = "currency", value = "币种")
+    private String currency = "CNY";
 }

+ 1 - 0
trade-service/src/main/java/com/trade/service/trade/purchaseorder/service/impl/PurchaseOrderInvoiceServiceImpl.java

@@ -136,6 +136,7 @@ public class PurchaseOrderInvoiceServiceImpl extends ServiceImpl<PurchaseOrderIn
                 if (purchaseOrderCommodity != null) {
                     invoiceCommodityDto.setPriceUnit(purchaseOrderCommodity.getPriceUnit());
                     invoiceCommodityDto.setDeclarationName(purchaseOrderCommodity.getDeclarationName());
+                    invoiceCommodityDto.setCurrency(purchaseOrderCommodity.getCurrency());
                 } else {
                     invoiceCommodityDto.setDeclarationName(finalCommodityName);
                 }

+ 1 - 1
trade-service/src/main/java/com/trade/service/trade/purchaseorder/vo/PurchaseOrderInvoiceVo.java

@@ -23,7 +23,7 @@ public class PurchaseOrderInvoiceVo {
     @ApiModelProperty(name = "id", value = "发票id")
     private Long id;
     @ApiModelProperty(name = "currency", value = "币种")
-    private String currency;
+    private String currency = "CNY";
     @ApiModelProperty(name = "amount", value = "发票金额")
     private BigDecimal amount;
     @ApiModelProperty(name = "digitalInvoiceNumber", value = "数电发票号码")