diff --git a/jianshui-admin/src/main/java/com/jianshui/JianshuiApplication.java b/jianshui-admin/src/main/java/com/jianshui/JianshuiApplication.java index c77f509..85cd15c 100644 --- a/jianshui-admin/src/main/java/com/jianshui/JianshuiApplication.java +++ b/jianshui-admin/src/main/java/com/jianshui/JianshuiApplication.java @@ -3,12 +3,14 @@ package com.jianshui; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.scheduling.annotation.EnableAsync; /** * 启动程序 * * @author 简税平台 */ +@EnableAsync @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) public class JianshuiApplication { public static void main(String[] args) { diff --git a/jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoiceall/v1/InvoiceAllController.java b/jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoiceall/v1/InvoiceAllController.java index 11db688..7279cd6 100644 --- a/jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoiceall/v1/InvoiceAllController.java +++ b/jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoiceall/v1/InvoiceAllController.java @@ -146,6 +146,38 @@ public class InvoiceAllController { return incomeResponseService.response(result, companyservice, ""); } + @ApiOperation("用户登记接口-不更新信息") + @ApiImplicitParams({ + @ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true), + @ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)}) + @PostMapping({"/api/invoice_all/v1/registed/{identity}", "/api/invoice_all/v1/registed"}) + public Object registed(HttpServletRequest request, String identity) throws Exception { + if (StringUtils.isEmpty(identity)) { + return AjaxResult.error(ErrorCode.EMPTY_IDENTITY); + } + + Companyservice companyservice = iCompanyserviceService.selectCompanyserviceByIdentity(identity); + if (companyservice == null) { + return AjaxResult.error(ErrorCode.COMPANY_NOT_FOUND); + } + + // 获得入口报文适配器 + IInvoiceAllRequestService incomeRequestService = new AisinoIncomeRequestAdapterImpl(); + JSONObject requestBody = incomeRequestService.decrypt(request, companyservice); + + // 指定请求实例 + IInvoiceAll invoiceAllService = iInvoceiAllServiceFactory.getService("elephant_invoiceall"); + + InvoiceAllYhdjDTO invoiceAllYhdjDTO = requestBody.toJavaObject(InvoiceAllYhdjDTO.class); + AjaxResult result = invoiceAllService.registed(companyservice, invoiceAllYhdjDTO); + + //返回报文处理器 + IInvoiceAllResponseService incomeResponseService = new AisinoIncomeResponseAdapterImpl(); + + return incomeResponseService.response(result, companyservice, ""); + } + + @ApiOperation("通用查询接口") @ApiImplicitParams({ @@ -405,28 +437,18 @@ public class InvoiceAllController { } // 获得入口报文适配器 - String requestAdapterKey = serviceManageService.getRequestAdapterKey(SERVICE_KEY, companyservice.getCompanyid()); - IInvoiceAllRequestService incomeRequestService = invoiceAllRequestFactory.getService(requestAdapterKey); + IInvoiceAllRequestService incomeRequestService = new AisinoIncomeRequestAdapterImpl(); JSONObject requestBody = incomeRequestService.decrypt(request, companyservice); - // 获得请求实例,并且进行扣费 - String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid()); - IInvoiceAll invoiceAllService = iInvoceiAllServiceFactory.getService(serviceKey); - + // 指定请求实例 + IInvoiceAll invoiceAllService = iInvoceiAllServiceFactory.getService("elephant_invoiceall"); AjaxResult result = invoiceAllService.loginVerificated(companyservice, requestBody); - //返回处理 增加调用次数 - if (result.isSuccess()) { - serviceManageService.companyConsume(SERVICE_KEY, companyservice.getCompanyid()); - } - //返回报文处理器 - String responseAdapterKey = serviceManageService.getResponseAdapterKey(SERVICE_KEY, companyservice.getCompanyid()); - IInvoiceAllResponseService incomeResponseService = invoiceAllResponseFactory.getService(responseAdapterKey); + IInvoiceAllResponseService incomeResponseService = new AisinoIncomeResponseAdapterImpl(); return incomeResponseService.response(result, companyservice, ""); - } @ApiOperation("发票查询") @ApiImplicitParams({ @@ -831,33 +853,34 @@ public class InvoiceAllController { return incomeResponseService.response(result, companyservice, ""); } + @ApiOperation("授权活跃状态查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true), + @ApiImplicitParam(name = "order", value = "请求体",dataType = "java.lang.Void", required = true)}) + @PostMapping({"/api/invoice_all/v1/obtainLoginStatus/{identity}", "/api/invoice_all/v1/obtainLoginStatus","/invoice_all/obtainLoginStatus"}) + public Object obtainLoginStatus(HttpServletRequest request, String identity) throws Exception { + if (StringUtils.isEmpty(identity)) { + return AjaxResult.error(ErrorCode.EMPTY_IDENTITY); + } + Companyservice companyservice = iCompanyserviceService.selectCompanyserviceByIdentity(identity); + if (companyservice == null) { + return AjaxResult.error(ErrorCode.COMPANY_NOT_FOUND); + } + // 获得入口报文适配器 + IInvoiceAllRequestService incomeRequestService = new AisinoIncomeRequestAdapterImpl(); + JSONObject requestBody = incomeRequestService.decrypt(request, companyservice); + // 指定请求实例 + IInvoiceAll invoiceAllService = iInvoceiAllServiceFactory.getService("elephant_invoiceall"); + AjaxResult result = invoiceAllService.obtainLoginStatus(companyservice, requestBody); + //返回报文处理器 + IInvoiceAllResponseService incomeResponseService = new AisinoIncomeResponseAdapterImpl(); - - - - - - - - - - - - - - - - - - - - - - + return incomeResponseService.response(result, companyservice, ""); + } } diff --git a/jianshui-common/src/main/java/com/jianshui/common/constant/Constants.java b/jianshui-common/src/main/java/com/jianshui/common/constant/Constants.java index ee9046a..b38f521 100644 --- a/jianshui-common/src/main/java/com/jianshui/common/constant/Constants.java +++ b/jianshui-common/src/main/java/com/jianshui/common/constant/Constants.java @@ -171,6 +171,7 @@ public class Constants { public static final String STRING_0 = "0"; public static final String STRING_1 = "1"; public static final String STRING_2 = "2"; + public static final String STRING_3 = "3"; public static final String PDF = "pdf"; public static final String PDF_UPCASE = "PDF"; public static final String OFD = "ofd"; @@ -192,5 +193,7 @@ public class Constants { public static final String QD_LOGIN = "http://zzsq.jcsk100.com/login/getLogin2"; public static final String SUBMIT_SMS = "http://zzsq.jcsk100.com/login/submitSms"; + public static final String OBTAINLOGIN_STATUS = "http://zzsq.jcsk100.com/login/obtainLoginStatus"; + } \ No newline at end of file diff --git a/jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/IInvoiceAll.java b/jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/IInvoiceAll.java index e710303..c5a398d 100644 --- a/jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/IInvoiceAll.java +++ b/jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/IInvoiceAll.java @@ -156,4 +156,14 @@ public interface IInvoiceAll { AjaxResult qrcodeResult(Companyservice companyservice, JSONObject requestBody); AjaxResult loginVerificated(Companyservice companyservice, JSONObject requestBody); + + /** + * 授权活跃状态查询 + * + * @return + */ + AjaxResult obtainLoginStatus(Companyservice companyservice, JSONObject requestBody); + + + AjaxResult registed(Companyservice companyservice, InvoiceAllYhdjDTO invoiceAllYhdjDTO); } diff --git a/jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/impl/InvoiceAllImpl.java b/jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/impl/InvoiceAllImpl.java index c736d22..11f68dd 100644 --- a/jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/impl/InvoiceAllImpl.java +++ b/jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/impl/InvoiceAllImpl.java @@ -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(); diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/mapper/UserRegistedLogMapper.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/mapper/UserRegistedLogMapper.java new file mode 100644 index 0000000..a6a3609 --- /dev/null +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/mapper/UserRegistedLogMapper.java @@ -0,0 +1,7 @@ +package com.jianshui.invoice.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.jianshui.invoice.domain.UserRegistedLogEntity; + +public interface UserRegistedLogMapper extends BaseMapper { +} diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/UserRegistedLogService.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/UserRegistedLogService.java new file mode 100644 index 0000000..d523925 --- /dev/null +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/UserRegistedLogService.java @@ -0,0 +1,15 @@ +package com.jianshui.invoice.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.jianshui.invoice.domain.UserRegistedLogEntity; + +public interface UserRegistedLogService extends IService { + /** + * 保存请求参数 + * @param requestParam + * @param responseParam + * @param requestType + * @return + */ + public void saveRequest(String requestParam,String responseParam,String requestType); +} diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/UserRegistedLogServiceImpl.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/UserRegistedLogServiceImpl.java new file mode 100644 index 0000000..d3b901d --- /dev/null +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/UserRegistedLogServiceImpl.java @@ -0,0 +1,34 @@ +package com.jianshui.invoice.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jianshui.invoice.domain.UserRegistedLogEntity; +import com.jianshui.invoice.mapper.UserRegistedLogMapper; +import com.jianshui.invoice.service.UserRegistedLogService; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import java.util.Date; +import java.util.UUID; + +@Service +public class UserRegistedLogServiceImpl extends ServiceImpl implements UserRegistedLogService { + + /** + * 保存请求参数 + * @param requestParam + * @param responseParam + * @param requestType + * @return + */ + + @Async + public void saveRequest(String requestParam,String responseParam,String requestType){ + + UserRegistedLogEntity userRegistedLog = new UserRegistedLogEntity(); + userRegistedLog.setBatchId(UUID.randomUUID().toString().replace("-","")); + userRegistedLog.setCreateTime(new Date()); + userRegistedLog.setRequestType(requestType); + userRegistedLog.setRequestData(requestParam); + userRegistedLog.setResponseData(responseParam); + this.save(userRegistedLog); + } +} diff --git a/jianshui-ui/src/api/digital/registered.js b/jianshui-ui/src/api/digital/registered.js index fdeb6a3..0462003 100644 --- a/jianshui-ui/src/api/digital/registered.js +++ b/jianshui-ui/src/api/digital/registered.js @@ -20,7 +20,7 @@ export function getInvoiceallyhdj(id) { //用户登记 export function registeredMethod(registeredParams,identity) { return request({ - url: '/api/invoice_all/v1/registration?identity=' + identity+"&order="+registeredParams, + url: '/api/invoice_all/v1/registed?identity=' + identity+"&order="+registeredParams, method: 'post', }) } @@ -67,6 +67,13 @@ export function encrypt(data) { }) } +export function obtainLoginStatus(data,identity) { + return request({ + url: '/invoice_all/obtainLoginStatus?identity=' + identity+"&order="+data, + method: 'post' + }) +} + export function getCompanyservice(companyid) { return request({ url: '/system/companyservice/' + companyid, diff --git a/jianshui-ui/src/views/digital/registered/index.vue b/jianshui-ui/src/views/digital/registered/index.vue index 3150a3c..f2f90df 100644 --- a/jianshui-ui/src/views/digital/registered/index.vue +++ b/jianshui-ui/src/views/digital/registered/index.vue @@ -141,6 +141,17 @@ v-hasPermi="['invoiceall:invoiceallyhdj:routerFreedom']" >自主授权 + + 授权活跃状态查询 + @@ -178,7 +189,6 @@ icon="el-icon-s-promotion" @click="registered(scope.row)" v-hasPermi="['invoiceall:invoiceallyhdj:edit']" - v-if="isShowRegistered(scope.row)" >登记 登录校验 @@ -211,7 +220,7 @@ - + @@ -221,7 +230,7 @@ - + @@ -272,9 +281,9 @@ import { registeredMethod, getCompanyservice, qrcodeMethod, - encrypt + encrypt, + obtainLoginStatus } from "@/api/digital/registered"; -import router from "@/router"; export default { name: "Invoiceallyhdj", @@ -285,6 +294,7 @@ export default { loading: true, // 选中数组 ids: [], + chooses: [], should : false, // 非单个禁用 single: true, @@ -354,6 +364,26 @@ export default { { required: true, message: "属性不能为空", trigger: "blur" } ] }, + + checkRegested:{ + identity: "企业ID", + bsryxm : "办税人员姓名", + dqbm : "地区编码", + dlsf : "登录身份", + dlsfmm : "办税人员登录密码", + dlmm : "登录密码", + dlzh : "登录账号", + nsrmc : "纳税人名称", + nsrsbh : "纳税人识别号", + bsrysfzjhm : "办税人员身份证件号码", + bsrysjhm : "办税人员手机号码" + }, + checkLogin:{ + identity: "企业ID", + dqbm : "地区编码", + nsrsbh : "纳税人识别号", + bsrysfzjhm : "办税人员身份证件号码", + }, //登记参数 registeredParams: { appkey: "935248bf224f6c8431cdc1969f029519", @@ -397,7 +427,43 @@ export default { }, methods: { routerFreedom() { - this.$router.push("/auth") + const url = this.$router.resolve({ path: "/auth" }).href; + window.open(url, '_blank'); + }, + /** 等级活跃状态查询 */ + obtainLoginStatus(){ + + if (this.chooses.length==1){ + getCompanyservice(this.chooses[0].identity).then(resp=>{ + //请求成功 + if(resp.code==200 && resp.data != null && resp.data != ""){ + + const requestBody = { + key: resp.data.secret, + order: JSON.stringify({ + nsrsbh: this.chooses[0].nsrsbh + }), + } + encrypt(requestBody).then(res => { + if (res.code == 200 && res.data != null && res.data != "") { + obtainLoginStatus(res.data,this.chooses[0].identity).then(response => { + if (response.code == 200){ + this.$message.success(response.msg) + } + }); + }else if (res.data == null || res.data == ""){ + this.$message.error('报文加密失败') + } + }) + }else if(resp.data == null || resp.data == "") { + this.$message.error('请检查企业ID配置') + } + + }) + }else{ + this.$message.error('请选择一条数据') + } + }, /** 查询金四-用户登记列表 */ getList() { @@ -451,6 +517,9 @@ export default { // 多选框选中数据 handleSelectionChange(selection) { this.ids = selection.map(item => item.id) + this.chooses = selection.map(item => { + return {identity:item.identity,nsrsbh:item.nsrsbh} + }) this.single = selection.length!==1 this.multiple = !selection.length }, @@ -472,73 +541,97 @@ export default { }, //登记方法 registered(row) { - this.reset(); - this.$modal.confirm('请确认:登记identity为'+row.identity+',登记方式为'+row.dlfs+',登记身份为'+row.dlsf+'?').then(() => { + let msg = this.checkParams(row,this.checkRegested) + if (!msg){ + this.reset(); + this.$modal.confirm('请确认:登记identity为'+row.identity+',登记方式为'+row.dlfs+',登记身份为'+row.dlsf+'?').then(() => { + getCompanyservice(row.identity).then(resp=>{ + //请求成功 + if(resp.code==200 && resp.data){ + this.convertRegistedParam(row,true) + const requestBody = { + key: resp.data.secret, + order: JSON.stringify(this.registeredParams), + } + encrypt(requestBody).then(res => { + if (res.code == 200 && res.data) { + registeredMethod(res.data,row.identity).then(response => { + if (response.code == 200){ + this.$message.success('请求登记成功') + } + }); + }else if (!res.data){ + this.$message.error('报文加密失败') + } + }) + }else if(!resp.data) { + this.$message.error('请检查企业ID配置') + } + + }) + }) + }else{ + this.$message.error(msg) + } + + }, + /** 登陆验证 */ + loginVerificated(row){ + + let msg = this.checkParams(row,this.checkLogin); + + if (!msg){ + this.reset(); getCompanyservice(row.identity).then(resp=>{ //请求成功 - if(resp.code==200 && resp.data != null && resp.data != ""){ - this.convertRegistedParam(row,true) + if(resp.code==200 && resp.data){ + this.convertRegistedParam(row,false) const requestBody = { key: resp.data.secret, - order: JSON.stringify(this.registeredParams), + order: JSON.stringify(this.loginVerificatedParams), } encrypt(requestBody).then(res => { - if (res.code == 200 && res.data != null && res.data != "") { - registeredMethod(res.data,row.identity).then(response => { - if (response.code == 200){ - this.$message.success('请求登记成功') + if (res.code == 200 && res.data) { + qrcodeMethod(res.data,row.identity).then(response => { + if (response.code == 200 && response.data){ + + if (response.data.requestId){ + this.$message.success('登记成功') + }else { + this.$message.error('登记失败') + } + }else { + if(response.msg){ + this.$message.error(response.msg) + }else { + this.$message.error(response.message) + } } }); - }else if (res.data == null || res.data == ""){ + }else if (!res.data){ this.$message.error('报文加密失败') } }) - }else if(resp.data == null || resp.data == "") { + }else if (!resp.data){ this.$message.error('请检查企业ID配置') } }) - }) - + }else { + this.$message.error(msg) + } }, - /** 登陆验证 */ - loginVerificated(row){ - this.reset(); - getCompanyservice(row.identity).then(resp=>{ - //请求成功 - if(resp.code==200 && resp.data != null && resp.data != ""){ - this.convertRegistedParam(row,false) - const requestBody = { - key: resp.data.secret, - order: JSON.stringify(this.loginVerificatedParams), - } - encrypt(requestBody).then(res => { - if (res.code == 200 && res.data != null && res.data != "") { - qrcodeMethod(res.data,row.identity).then(response => { - if (response.code == 200 && response.data != null && response.data != ""){ - - if (response.data.requestId != null && response.data.requestId != ""){ - this.$message.success('登记成功') - }else { - this.$message.error('登记失败') - } - }else { - if(response.msg){ - this.$message.error(response.msg) - }else { - this.$message.error(response.message) - } - } - }); - }else if (res.data == null || res.data == ""){ - this.$message.error('报文加密失败') - } - }) - }else if (resp.data == null || resp.data == ""){ - this.$message.error('请检查企业ID配置') + checkParams(row,check){ + let msg = ''; + Object.keys(check).forEach(key=>{ + if (row[key]==null || row[key]==''){ + msg = msg+check[key]+'、' } - }) + if (msg){ + msg = msg.slice(0,msg.length-1)+ '不能为空' + } + return msg; }, convertRegistedParam(row,flag){ if (flag){ @@ -597,36 +690,6 @@ export default { this.download('invoiceall/invoiceallyhdj/export', { ...this.queryParams }, `invoiceallyhdj_${new Date().getTime()}.xlsx`) - }, - isShowRegistered(row){ - return row.dqbm != null - && row.dqbm != '' - && row.dlfs != null - && row.dlfs != '' - && row.dlsfmm != null - && row.dlsfmm != '' - && row.dlmm != null - && row.dlmm != '' - && row.dlzh != null - && row.dlzh != '' - && row.nsrmc != null - && row.nsrmc != '' - && row.nsrsbh != null - && row.nsrsbh != '' - && row.bsrysfzjhm != null - && row.bsrysfzjhm != '' - && row.identity != null - && row.identity != '' - }, - isShowLoginVerificated(row){ - return row.dqbm != null - && row.dqbm != '' - && row.nsrsbh != null - && row.nsrsbh != '' - && row.bsrysfzjhm != null - && row.bsrysfzjhm != '' - && row.identity != null - && row.identity != '' } } };