浏览代码

Merge branch 'dev'

yangdamao 1 月之前
父节点
当前提交
5075458d0b

+ 9 - 0
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/order/TopOldOrderController.java

@@ -350,4 +350,13 @@ public class TopOldOrderController extends BaseController {
         return AjaxResult.success();
     }
 
+    /**
+     * 订单发票上传
+     */
+    @ApiOperation("订单发票上传")
+    @PostMapping("/invoice/upload")
+    public AjaxResult<Void> invoiceUpload(@RequestBody TopInvoiceUploadBo bo) {
+        return toAjax(iTopOldOrderService.invoiceUpload(bo) ? 1 : 0);
+    }
+
 }

+ 1 - 0
zhongzheng-admin-saas/src/main/resources/application-dev.yml

@@ -135,6 +135,7 @@ oldStudySys:
     salePassword: http://gdxypx.xy.com/WitSystem/BussinessApi/GetSaleInfo
     updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
     createExamPath: http://gdxypx.xy.com/system/BussinessApi/CreateSameClass
+    saveInvoice: http://gdxypx.xy.com/WitSystem/BussinessApi/InvoiceUpdate
 
 officialPush:
     infoPath: http://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan

+ 1 - 0
zhongzheng-admin-saas/src/main/resources/application-prod.yml

@@ -135,6 +135,7 @@ oldStudySys:
     salePassword: http://www.xyyxt.net/WitSystem/BussinessApi/GetSaleInfo
     updateInvoicePath: http://www.xyyxt.net/system/BussinessApi/UpdateInvoiceData
     createExamPath: http://www.xyyxt.net/system/BussinessApi/CreateSameClass
+    saveInvoice: https://www.xyyxt.net/WitSystem/BussinessApi/InvoiceUpdate
 
 officialPush:
     infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan

+ 3 - 2
zhongzheng-admin/src/main/resources/application-dev.yml

@@ -29,13 +29,13 @@ spring:
             webStatFilter:
                 enabled: true
             statViewServlet:
-                enabled: true
+                enabled: false
                 # 设置白名单,不填则允许所有访问
                 allow:
                 url-pattern: /druid/*
                 # 控制台管理用户名和密码
                 login-username: ruoyi
-                login-password: 123456
+                login-password: XYY@2025
             filter:
                 stat:
                     enabled: true
@@ -135,6 +135,7 @@ oldStudySys:
     salePassword: http://gdxypx.xy.com/WitSystem/BussinessApi/GetSaleInfo
     updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
     createExamPath: http://gdxypx.xy.com/system/BussinessApi/CreateSameClass
+    saveInvoice: http://gdxypx.xy.com/WitSystem/BussinessApi/InvoiceUpdate
 
 officialPush:
     infoPath: closehttps://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan

+ 3 - 2
zhongzheng-admin/src/main/resources/application-prod.yml

@@ -29,13 +29,13 @@ spring:
             webStatFilter:
                 enabled: true
             statViewServlet:
-                enabled: true
+                enabled: false
                 # 设置白名单,不填则允许所有访问
                 allow:
                 url-pattern: /druid/*
                 # 控制台管理用户名和密码
                 login-username: ruoyi
-                login-password: 123456
+                login-password: XYY@2025
             filter:
                 stat:
                     enabled: true
@@ -135,6 +135,7 @@ oldStudySys:
     salePassword: http://www.xyyxt.net/WitSystem/BussinessApi/GetSaleInfo
     updateInvoicePath: http://www.xyyxt.net/system/BussinessApi/UpdateInvoiceData
     createExamPath: http://www.xyyxt.net/system/BussinessApi/CreateSameClass
+    saveInvoice: https://www.xyyxt.net/WitSystem/BussinessApi/InvoiceUpdate
 
 officialPush:
     infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan

+ 3 - 1
zhongzheng-admin/src/main/resources/application.yml

@@ -105,8 +105,10 @@ management:
       base-path: /actuator
       exposure:
         # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
-        include: '*'
+        include: health, info  # 只启用健康和info端点
   endpoint:
+    health:
+      show-details: when_authorized  # 敏感信息需要授权
     logfile:
       external-file: ./logs/sys-console.log
 

+ 2 - 1
zhongzheng-api/src/main/resources/application-dev.yml

@@ -137,7 +137,8 @@ oldStudySys:
     classOpenPath: http://gdxypx.xy.com/System/BussinessApi/OpenClass
     salePassword: http://gdxypx.xy.com/WitSystem/BussinessApi/GetSaleInfo
     updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
-    createExamPath: http://gdxypx.xy.com/system/BussinessApi/CreateSameClass0
+    createExamPath: http://gdxypx.xy.com/system/BussinessApi/CreateSameClass
+    saveInvoice: http://gdxypx.xy.com/WitSystem/BussinessApi/InvoiceUpdate
 
 officialPush:
     infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan

+ 3 - 2
zhongzheng-api/src/main/resources/application-prod.yml

@@ -29,13 +29,13 @@ spring:
             webStatFilter:
                 enabled: true
             statViewServlet:
-                enabled: true
+                enabled: false
                 # 设置白名单,不填则允许所有访问
                 allow:
                 url-pattern: /druid/*
                 # 控制台管理用户名和密码
                 login-username: ruoyi
-                login-password: 123456
+                login-password: XYY@2025
             filter:
                 stat:
                     enabled: true
@@ -147,6 +147,7 @@ oldStudySys:
     salePassword: http://www.xyyxt.net/WitSystem/BussinessApi/GetSaleInfo
     updateInvoicePath: http://www.xyyxt.net/system/BussinessApi/UpdateInvoiceData
     createExamPath: http://www.xyyxt.net/system/BussinessApi/CreateSameClass
+    saveInvoice: https://www.xyyxt.net/WitSystem/BussinessApi/InvoiceUpdate
 
 officialPush:
     infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan

+ 3 - 1
zhongzheng-api/src/main/resources/application.yml

@@ -105,8 +105,10 @@ management:
       base-path: /actuator
       exposure:
         # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
-        include: '*'
+        include: health, info  # 只启用健康和info端点
   endpoint:
+    health:
+      show-details: when_authorized  # 敏感信息需要授权
     logfile:
       external-file: ./logs/sys-console.log
 

+ 12 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/exception/GlobalExceptionHandler.java

@@ -9,6 +9,7 @@ import com.zhongzheng.common.exception.DemoModeException;
 import io.jsonwebtoken.ExpiredJwtException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.dao.DataAccessException;
 import org.springframework.security.access.AccessDeniedException;
 import org.springframework.security.authentication.AccountExpiredException;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
@@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
 import org.springframework.web.servlet.NoHandlerFoundException;
 
 import javax.validation.ConstraintViolationException;
+import java.sql.SQLException;
 
 /**
  * 全局异常处理器
@@ -52,6 +54,16 @@ public class GlobalExceptionHandler
         return AjaxResult.error(e.getCode(), e.getMessage());
     }
 
+    /**
+     * sql错误
+     */
+    @ExceptionHandler({SQLException.class, DataAccessException.class})
+    public AjaxResult handleAllSqlExceptions(Exception e)
+    {
+        log.error(e.getMessage(), e);
+        return AjaxResult.error(HttpStatus.HTTP_INTERNAL_ERROR, "非法操作,请稍后再试");
+    }
+
     @ExceptionHandler(NoHandlerFoundException.class)
     public AjaxResult handlerNoFoundException(Exception e)
     {

+ 23 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopInvoiceUploadBo.java

@@ -0,0 +1,23 @@
+package com.zhongzheng.modules.top.goods.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 订单编辑对象 top_order
+ *
+ * @author ruoyi
+ * @date 2023-04-20
+ */
+@Data
+@ApiModel("订单发票上传")
+public class TopInvoiceUploadBo {
+
+    @ApiModelProperty("订单号")
+    private String orderSn;
+
+    @ApiModelProperty("发票图片地址")
+    private String invoiceUrl;
+
+}

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/ITopOldOrderService.java

@@ -216,4 +216,6 @@ public interface ITopOldOrderService extends IService<TopOldOrder> {
 	TopQuestionImportVo importOrderQuestion(List<TopOrderQuestionImportBo> questionImportBos);
 
 	boolean batchSaveOrderQuestion(List<TopOrderRepQuestionBo> bos);
+
+	boolean invoiceUpload(TopInvoiceUploadBo bo);
 }

+ 57 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopOldOrderServiceImpl.java

@@ -322,6 +322,9 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
     @Value("${shared.saleData}")
     private String SHARED_SALE_DATA;
 
+    @Value("${oldStudySys.saveInvoice}")
+    private String OLD_SAVE_INVOICE;
+
 
     @Override
     public TopOldOrderVo queryById(String orderSn) {
@@ -394,16 +397,22 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                 .eq(TopNuoMplatformLog::getStatus, 2));
         if (CollectionUtils.isNotEmpty(fromLogs)){
             BigDecimal invoiceTotal = BigDecimal.ZERO;
+            List<String> invoiceUrls = new ArrayList<>();
             for (TopNuoMplatformLog fromLog : fromLogs) {
                 OrderInvoiceHostBo invoiceBo = JSONObject.parseObject(fromLog.getContent(), OrderInvoiceHostBo.class);
                 if (ObjectUtils.isNotNull(invoiceBo)){
                     BigDecimal price = invoiceBo.getOrder().getInvoiceDetail().getPrice();
                     invoiceTotal = invoiceTotal.add(price);
                 }
-                orderVo.setInvoiceDate(invoiceBo.getOrder().getInvoiceDate());
+                if (ObjectUtils.isNotNull(invoiceBo)){
+                    orderVo.setInvoiceDate(invoiceBo.getOrder().getInvoiceDate());
+                }
+                String url = StringUtils.isNotBlank(fromLog.getOssPdfUrl()) ? fromLog.getOssPdfUrl():fromLog.getPdfUrl();
+                invoiceUrls.add(url);
             }
             orderVo.setInvoiceMoney(invoiceTotal);
             orderVo.setInvoiceStatus(1);
+            orderVo.setInvoiceUrl(invoiceUrls);
         }else {
             orderVo.setInvoiceStatus(0);
         }
@@ -5186,6 +5195,53 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
         return topOldOrderQuestionService.saveBatch(collect);
     }
 
+    @Override
+    public boolean invoiceUpload(TopInvoiceUploadBo bo) {
+        TopOldOrder order = getOne(new LambdaQueryWrapper<TopOldOrder>().eq(TopOldOrder::getOrderSn, bo.getOrderSn()));
+        if (ObjectUtils.isNull(order)){
+            throw new CustomException("订单查询失败,请检查订单号");
+        }
+
+        //新增发票
+        TopNuoMplatformLog entity = new TopNuoMplatformLog();
+        entity.setOrderNo(bo.getOrderSn());
+        entity.setOrderNoList(bo.getOrderSn());
+        entity.setTenantId(order.getTenantId().toString());
+        entity.setStatus(2);
+        entity.setFromPlat(3);
+        entity.setPdfUrl(bo.getInvoiceUrl());
+        entity.setOssPdfUrl(bo.getInvoiceUrl());
+        entity.setUpdateTime(DateUtils.getNowTime());
+        entity.setCreateTime(DateUtils.getNowTime());
+        topNuoMplatformLogService.save(entity);
+
+        //修改订单发票状态
+        update(new LambdaUpdateWrapper<TopOldOrder>()
+                .eq(TopOldOrder::getOrderSn,bo.getOrderSn())
+                .set(TopOldOrder::getInvoiceStatus,1));
+
+        //通知旧系统
+        Map<String, String> params = new HashMap<>();
+        Long nowTime = DateUtils.getNowTime();
+        String sign = ToolsUtils.EncoderByMd5(nowTime.toString() + "pubilc2022");
+        params.put("stamp", nowTime.toString());
+        params.put("sign", sign);
+        params.put("orderSn", order.getOrderSn());
+        params.put("invoiceUrl", bo.getInvoiceUrl());
+        String respone = "";
+        String path = OLD_SAVE_INVOICE;
+        try {
+            respone = HttpUtils.postFormBody(path, params);
+            if (!respone.contains("\"Status\":true")) {
+                throw new CustomException("旧系统新增发票接口请求错误" + respone);
+            }
+        } catch (IOException e) {
+            throw new CustomException("旧系统新增发票接口请求错误" + e.getMessage());
+        }
+
+        return true;
+    }
+
     private String hideIDCard(String idCard) {
         if (idCard == null || idCard.length() != 18) {
             return idCard;

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopOldOrderVo.java

@@ -151,6 +151,9 @@ public class TopOldOrderVo {
 	@ApiModelProperty("佣金")
 	private BigDecimal brokerage;
 
+	@ApiModelProperty("订单发票地址")
+	private List<String> invoiceUrl;
+
 	public String getOrderBusiness() {
 		if (CollectionUtils.isEmpty(this.businessNames)){
 			return "";