|
|
|
@ -1,51 +1,54 @@ |
|
|
|
|
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.SecurityUtils; |
|
|
|
|
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; |
|
|
|
|
import com.jianshui.invoice.domain.BillInfo; |
|
|
|
|
import com.jianshui.invoice.domain.Invoice; |
|
|
|
|
import com.jianshui.invoice.domain.UserRegistedLogEntity; |
|
|
|
|
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.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -71,6 +74,9 @@ public class InvoiceAllImpl implements IInvoiceAll { |
|
|
|
|
@Autowired |
|
|
|
|
private InvoiceAllYhdjMapper yhdjMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private UserRegistedLogService userRegistedLogServicel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 用户登记 |
|
|
|
@ -131,6 +137,47 @@ public class InvoiceAllImpl implements IInvoiceAll { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 用户登记 |
|
|
|
|
* |
|
|
|
|
* @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); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 授权活跃状态查询 |
|
|
|
@ -147,6 +194,7 @@ public class InvoiceAllImpl implements IInvoiceAll { |
|
|
|
|
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 { |
|
|
|
@ -1334,6 +1382,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(); |
|
|
|
@ -1354,4 +1403,16 @@ public class InvoiceAllImpl implements IInvoiceAll { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean saveRequest(String requestParam,String responseParam,String requestType){ |
|
|
|
|
|
|
|
|
|
UserRegistedLogEntity userRegistedLog = new UserRegistedLogEntity(); |
|
|
|
|
userRegistedLog.setBatchId(UUID.randomUUID().toString().replace("-","")); |
|
|
|
|
userRegistedLog.setLoginAccount(SecurityUtils.getUsername()); |
|
|
|
|
userRegistedLog.setCreateTime(new Date()); |
|
|
|
|
userRegistedLog.setRequestType(requestType); |
|
|
|
|
userRegistedLog.setRequestData(requestParam); |
|
|
|
|
userRegistedLog.setResponseData(responseParam); |
|
|
|
|
return userRegistedLogServicel.save(userRegistedLog); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|