|
|
|
@ -1,26 +1,22 @@ |
|
|
|
|
package com.jianshui.invoiceall.service.impl; |
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
import cn.hutool.core.bean.copier.CopyOptions; |
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import cn.hutool.json.JSONObject; |
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.jianshui.common.constant.Constants; |
|
|
|
|
import com.jianshui.common.constant.WebServiceConstant; |
|
|
|
|
import com.jianshui.common.core.domain.AjaxResult; |
|
|
|
|
import com.jianshui.common.core.domain.entity.Companyservice; |
|
|
|
|
import com.jianshui.common.enums.ErrorCode; |
|
|
|
|
import com.jianshui.common.utils.HutoolUtilsPro; |
|
|
|
|
import com.jianshui.common.utils.StringUtils; |
|
|
|
|
import com.jianshui.common.utils.ValidateUtils; |
|
|
|
|
import com.jianshui.common.utils.http.HttpUtils; |
|
|
|
|
import com.jianshui.common.utils.jcsk.ApiHttp; |
|
|
|
|
import com.jianshui.common.utils.uuid.IdUtils; |
|
|
|
|
import com.jianshui.framework.manager.AsyncManager; |
|
|
|
|
import com.jianshui.invoice.domain.BillDetail; |
|
|
|
@ -28,26 +24,29 @@ import com.jianshui.invoice.domain.BillInfo; |
|
|
|
|
import com.jianshui.invoice.domain.Invoice; |
|
|
|
|
import com.jianshui.invoice.mapper.BillInfoMapper; |
|
|
|
|
import com.jianshui.invoice.mapper.InvoiceMapper; |
|
|
|
|
import com.jianshui.common.constant.WebServiceConstant; |
|
|
|
|
import com.jianshui.system.domain.InvoiceAllApiLog; |
|
|
|
|
import com.jianshui.system.domain.InvoiceAllYhdj; |
|
|
|
|
import com.jianshui.invoice.service.UserRegistedLogService; |
|
|
|
|
import com.jianshui.invoiceall.domain.dto.*; |
|
|
|
|
import com.jianshui.invoiceall.domain.dto.jcsk.*; |
|
|
|
|
import com.jianshui.invoiceall.domain.dto.jcsk.add.*; |
|
|
|
|
import com.jianshui.invoiceall.domain.dto.jcsk.add.InvoiceAllAddDTO; |
|
|
|
|
import com.jianshui.invoiceall.domain.dto.jcsk.add.InvoiceAllAddInfoDTO; |
|
|
|
|
import com.jianshui.invoiceall.domain.dto.jcsk.add.InvoiceAllAddmxListDTO; |
|
|
|
|
import com.jianshui.invoiceall.domain.dto.jcsk.red.AddRedInvoiceDTO; |
|
|
|
|
import com.jianshui.invoiceall.domain.vo.InvoiceAllKschVO; |
|
|
|
|
import com.jianshui.invoiceall.domain.vo.jcsk.AddInvoiceVO; |
|
|
|
|
import com.jianshui.invoiceall.domain.vo.jcsk.AddRedInvoiceVO; |
|
|
|
|
import com.jianshui.invoiceall.domain.vo.jcsk.KschVO; |
|
|
|
|
import com.jianshui.invoiceall.service.IInvoiceAll; |
|
|
|
|
import com.jianshui.system.domain.InvoiceAllApiLog; |
|
|
|
|
import com.jianshui.system.domain.InvoiceAllYhdj; |
|
|
|
|
import com.jianshui.system.mapper.InvoiceAllApiLogMapper; |
|
|
|
|
import com.jianshui.system.mapper.InvoiceAllYhdjMapper; |
|
|
|
|
import com.jianshui.invoiceall.service.IInvoiceAll; |
|
|
|
|
import com.jianshui.common.utils.jcsk.ApiHttp; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -73,6 +72,10 @@ public class InvoiceAllImpl implements IInvoiceAll { |
|
|
|
|
@Autowired |
|
|
|
|
private InvoiceAllYhdjMapper yhdjMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private UserRegistedLogService userRegistedLogServicel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 用户登记 |
|
|
|
@ -132,6 +135,81 @@ public class InvoiceAllImpl implements IInvoiceAll { |
|
|
|
|
return AjaxResult.success(result); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 用户登记 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public AjaxResult registed(Companyservice companyservice, InvoiceAllYhdjDTO invoiceAllYhdjDTO) { |
|
|
|
|
|
|
|
|
|
YhdjDTO yhdjDTO = BeanUtil.copyProperties(invoiceAllYhdjDTO, YhdjDTO.class); |
|
|
|
|
ValidateUtils.validate(yhdjDTO); |
|
|
|
|
if (BeanUtil.isEmpty(invoiceAllYhdjDTO.getJsonData())) { |
|
|
|
|
return AjaxResult.error("传入报文错误,请检查,明细不存在!"); |
|
|
|
|
} |
|
|
|
|
YhdjDetailDTO yhdjDetailDTOList = BeanUtil.copyProperties(invoiceAllYhdjDTO.getJsonData(), YhdjDetailDTO.class); |
|
|
|
|
ValidateUtils.validate(yhdjDetailDTOList); |
|
|
|
|
yhdjDTO.setJsonData(yhdjDetailDTOList); |
|
|
|
|
|
|
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
result = ApiHttp.request(WebServiceConstant.YHDJ, WebServiceConstant.URL, yhdjDTO, companyservice); |
|
|
|
|
|
|
|
|
|
userRegistedLogServicel.saveRequest(JSON.toJSONString(yhdjDTO),result.toString(),Constants.STRING_1); |
|
|
|
|
|
|
|
|
|
String code = result.get("code") != null ? result.get("code").toString() : ""; |
|
|
|
|
String msg = result.get("msg") != null ? result.get("msg").toString() : ""; |
|
|
|
|
String data = result.get("data") != null ? result.get("data").toString() : ""; |
|
|
|
|
|
|
|
|
|
if ("0000".equals(code)) { |
|
|
|
|
return AjaxResult.success(result); |
|
|
|
|
} else { |
|
|
|
|
return AjaxResult.error(msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【用户登记】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
|
return AjaxResult.error(ErrorCode.INCOME_ERROR); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 授权活跃状态查询 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public AjaxResult obtainLoginStatus(Companyservice companyservice, com.alibaba.fastjson.JSONObject requestBody) { |
|
|
|
|
com.alibaba.fastjson.JSONObject result = null; |
|
|
|
|
try { |
|
|
|
|
String responParam = HttpUtils.sendJsonPost(Constants.OBTAINLOGIN_STATUS, requestBody); |
|
|
|
|
|
|
|
|
|
result = JSON.parseObject(responParam); |
|
|
|
|
String code = result.get("code") != null ? result.get("code").toString() : ""; |
|
|
|
|
String msg = result.get("msg") != null ? result.get("msg").toString() : ""; |
|
|
|
|
|
|
|
|
|
userRegistedLogServicel.saveRequest(requestBody.toJSONString(),responParam,Constants.STRING_3); |
|
|
|
|
if ("S000".equals(code)) { |
|
|
|
|
return AjaxResult.success(msg); |
|
|
|
|
} else { |
|
|
|
|
return AjaxResult.error(msg); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【授权活跃】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
|
return AjaxResult.error(ErrorCode.COMMON_ERROR); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 通用查询接口 |
|
|
|
|
* |
|
|
|
@ -1306,6 +1384,7 @@ public class InvoiceAllImpl implements IInvoiceAll { |
|
|
|
|
String msg = result.get("msg") != null ? result.get("msg").toString() : ""; |
|
|
|
|
String data = result.get("data") != null ? result.get("data").toString() : ""; |
|
|
|
|
|
|
|
|
|
userRegistedLogServicel.saveRequest(requestBody.toJSONString(),result.toString(),Constants.STRING_2); |
|
|
|
|
if ("0000".equals(code) && StrUtil.isNotEmpty(data)) { |
|
|
|
|
JSONObject json = JSONUtil.parseObj(data); |
|
|
|
|
String requestId = json.getOrDefault("requestId", "").toString(); |
|
|
|
|