Merge remote-tracking branch 'origin/dev' into dev
| | |
| | | //扫脸成功 |
| | | index = 1; |
| | | } |
| | | goalDom.editQrCodeStatus(index); |
| | | goalDom.editQrCodeStatus(index,json); |
| | | } |
| | | } |
| | | |
| | |
| | | Dom.qrCodeRefreshFun=function () { |
| | | var json={}; |
| | | json.taxNo=Dom.data.taxNo; |
| | | json.doccode=Dom.data.doccode; |
| | | json.funclinkFormid=Dom.data.funclinkFormid; |
| | | $.ajax({ |
| | | url: '/baiwang/refreshQrcode.do', |
| | | type: 'POST', |
| | |
| | | } |
| | | }) |
| | | } |
| | | Dom.editQrCodeStatus=function (index) { |
| | | Dom.editQrCodeStatus=function (index,obj) { |
| | | Dom.qrCodeStatus.removeClass('show-this'); |
| | | Dom.qrCodeStatus.eq(index).addClass('show-this'); |
| | | if(index==1) { |
| | | setTimeout(function () { |
| | | var layerIndex=0; |
| | | $.ajax({ |
| | | url: '/baiwang/einvoice.do?formid='+Dom.data.funclinkFormid+'¶m='+Dom.data.doccode, |
| | | type: 'GET', |
| | | beforeSend: function (XMLHttpRequest) { |
| | | layerIndex= layer.msg('电子发票生成中....', { |
| | | icon: 16, |
| | | shade: 0.6 |
| | | }); |
| | | }, |
| | | success: function (res) { |
| | | if(res.state==-1) { |
| | | alert(res.msg); |
| | | } |
| | | $(top.layeerFace).css("display", "none"); |
| | | }, 1000); |
| | | layer.closeAll(layerIndex); |
| | | if(parent.location) parent.location.reload(); |
| | | }, |
| | | error: function (err) { |
| | | alert( err); |
| | | $(top.layeerFace).css("display", "none"); |
| | | layer.closeAll(layerIndex); |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | // 修改二维码图片 |
| | |
| | | final DataSourceEntity dataSourceMap = MultiDataSource.getDataSourceMap(dbId); |
| | | //--------------------------------- |
| | | |
| | | if(dataSourceMap.isLoginOnceForOneUserCode()) { |
| | | |
| | | //开启了账号只能在相同类型设备上登录一个,禁止多方登录 |
| | | if (isApp) { |
| | | //---验证当前设备是否为上一次登录设备 |
| | |
| | | if(equipmentEntry!=null&&equipmentEntry.getUserId()!=null) { |
| | | //log.info(JSON.toJSONString("equipmentEntry:"+equipmentEntry)); |
| | | //2----不相同,则需要SMS进行验证登录 |
| | | session.invalidate();//删除当前会话 |
| | | //session.invalidate();//删除当前会话 |
| | | String error=null; |
| | | if(org.apache.commons.lang3.StringUtils.isNotBlank(equipmentEntry.getUniqueIdentifier())) { |
| | | error = String.format("您已在另一台设备%s登录,登录时间:%s,如果需要在本机登录,则需要验证您的身份。", equipmentEntry.getEquipmentName(), equipmentEntry.getLastLogonDate()); |
| | | }else { |
| | | //为空表示是新用户第一次登录或清空了之前登录过的设备 |
| | | error="为了保证系统使用安全,需要验证您的身份"; |
| | | } |
| | | //开启了才需要提示 |
| | | if(dataSourceMap.isLoginOnceForOneUserCode()) { |
| | | error = String.format("您已在另一台设备%s登录,登录时间:%s,如果需要在本机登录,需要验证您的身份。", equipmentEntry.getEquipmentName(), equipmentEntry.getLastLogonDate()); |
| | | printJson(response, callBackMessage.sendErrorMessage(error,-1005)); |
| | | return null; |
| | | } |
| | | }else{ |
| | | this.singleAccount(isApp ? "2" : "1", dbId, userAccount, request); |
| | | //是否开启限制,也需要弹出验证,为空表示是新用户第一次登录或清空了之前登录过的设备 |
| | | error="为了保证系统使用安全,需要验证您的身份"; |
| | | printJson(response, callBackMessage.sendErrorMessage(error,-1005)); |
| | | return null; |
| | | } |
| | | } |
| | | }else { |
| | | if(dataSourceMap.isLoginOnceForOneUserCode()) { |
| | | this.singleAccount(isApp ? "2" : "1", dbId, userAccount, request); |
| | | } |
| | | } |
| | | }else { |
| | | if(dataSourceMap.isLoginOnceForOneUserCode()) { |
| | | //限制多设备登录 |
| | | this.singleAccount(isApp ? "2" : "1", dbId, userAccount, request); |
| | | } |
| | |
| | | }catch (IllegalStateException e) { |
| | | e.printStackTrace(); |
| | | if (e.getMessage()!=null&&e.getMessage().contains("Session already invalidated")) { |
| | | sb.append("会话已过期,请关闭浏览器再重新登录系统\\n"); |
| | | sb.append("会话已过期,请重新登录系统"); |
| | | print2(response, sb.toString(), redirect, isApp); |
| | | System.out.println(this.getClass() + " sessionid:" + session.getId()); |
| | | return null;// 会话已过期返回 |
| | |
| | | this.printJson(response, callBackMessage.sendErrorMessage("验证码不能为空", -1)); |
| | | return ""; |
| | | } |
| | | if (org.apache.commons.lang3.StringUtils.isBlank(tel)) { |
| | | this.printJson(response, callBackMessage.sendErrorMessage("手机号不能为空", -1)); |
| | | return ""; |
| | | } |
| | | if(org.apache.commons.lang3.StringUtils.isNotBlank(request.getHeader("x-app-loginCode"))) { |
| | | String token=request.getHeader("x-app-loginCode"); |
| | | if (org.apache.commons.lang3.StringUtils.isBlank(token)) { |
| | | this.printJson(response, callBackMessage.sendErrorMessage("token不能为空", -1)); |
| | | return ""; |
| | | } |
| | | try { |
| | | String value = AESUtils.decrypt(EncodeUtil.replaceUrlChar(token));//解密 |
| | | Gson gson = new Gson(); |
| | | TokenInfo tokenInfo = gson.fromJson(value, new com.google.gson.reflect.TypeToken<TokenInfo>() { |
| | | }.getType()); |
| | | if (!tel.equals(tokenInfo.getUsercode())) { |
| | | this.printJson(response, callBackMessage.sendErrorMessage("注册手机号与传过来的手机号不相符", -1)); |
| | | return ""; |
| | | } |
| | | } catch (Exception e) { |
| | | printJson(response, callBackMessage.sendErrorMessage(e.getMessage(), -1)); |
| | | return ""; |
| | | } |
| | | } |
| | | String verifyCode = (String) redisTemplate.opsForValue().get(VerificationCodes.getCodeKey(tel)); |
| | | if (verifyCode==null) { |
| | | printJson(response, callBackMessage.sendErrorMessage("验证码已失效,请重新获取验证码。",-1)); |
| | |
| | | import com.yc.open.baiwang.schedule.BaiwangThread; |
| | | import com.yc.open.baiwang.schedule.QueryThread; |
| | | import com.yc.open.baiwang.service.BaiwangIfc; |
| | | import com.yc.open.baiwang.service.QueryEntiy; |
| | | import com.yc.open.baiwang.utils.TokenUtils; |
| | | import com.yc.open.controller.BaseController; |
| | | import com.yc.open.jinwu.entity.T110565Entity; |
| | | import com.yc.open.mutual.schedule.GateEntity; |
| | | import com.yc.sdk.WebSocketMessage.action.WebSocketMessageServer; |
| | | import com.yc.sdk.WebSocketMessage.entity.MessageInfo; |
| | | import com.yc.sdk.WebSocketMessage.entity.MessageType; |
| | | import com.yc.sdk.weixincp.util.UploadFiles; |
| | | import com.yc.service.build.type.T_22_Ifc; |
| | | import com.yc.service.upload.AttachmentIfc; |
| | |
| | | import java.io.InputStream; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import static java.util.stream.Collectors.joining; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * 百望云相关功能 |
| | |
| | | try { |
| | | IBWClient client = new BWRestClient(TokenUtils.url, TokenUtils.appKey, TokenUtils.appSecret); // 初始化一个客户端 |
| | | String token = TokenUtils.getToken(); |
| | | request.setAttribute("doccode", entry.getDoccode()); |
| | | request.setAttribute("funclinkFormid",entry.getFunclinkFormid()); |
| | | confrimFace(client, entry.getTaxNo(), token, request, response, callBackMessage); |
| | | callBackMessage.sendSuccessMessage("刷新成功"); |
| | | return callBackMessage.toJSONObject(); |
| | |
| | | OutputRedinvoiceAddRequest einvoiceInfo = null; |
| | | IBWClient client = null; |
| | | String token = null; |
| | | String funclinkFormid = null; |
| | | GateEntity entity = new GateEntity(); |
| | | try { |
| | | Map<String, String> map = null; |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request); |
| | |
| | | callBackMessage.sendErrorMessage("单号不能为空"); |
| | | return callBackMessage.toJSONObject(); |
| | | } |
| | | funclinkFormid=request.getParameter("formid");//功能链接功能号,返回给前端在刷脸成功后自动再次执行使用 |
| | | |
| | | GateEntity entity = new GateEntity(); |
| | | entity.setFormid(150504); |
| | | entity.setDbid(dataSourceEntity.getDbId() + ""); |
| | | entity.setDocCode(docCode); |
| | |
| | | } else if ("70045".equals(ex.getSubCode())) { |
| | | //刷脸验证,生成二维码图片给税局APP扫码 |
| | | errorCode = -1008; |
| | | request.setAttribute("doccode", entity.getDocCode()); |
| | | request.setAttribute("funclinkFormid",funclinkFormid); |
| | | confrimFace(client, einvoiceInfo.getTaxNo(), token, request, response, callBackMessage); |
| | | } else if ("70035".equals(ex.getSubCode())) { |
| | | //红字录入单操作异常,该发票存在进行中的红字确认单! |
| | |
| | | OutputInvoiceIssueRequest einvoiceInfo = null; |
| | | IBWClient client = null; |
| | | String token = null; |
| | | String funclinkFormid = null; |
| | | GateEntity entity = new GateEntity(); |
| | | try { |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request); |
| | | Map<String, String> map = null; |
| | |
| | | callBackMessage.sendErrorMessage("单号不能为空"); |
| | | return callBackMessage.toJSONObject(); |
| | | } |
| | | |
| | | GateEntity entity = new GateEntity(); |
| | | funclinkFormid=request.getParameter("formid");//功能链接功能号,返回给前端在刷脸成功后自动再次执行使用 |
| | | entity.setFormid(150504); |
| | | entity.setDbid(dataSourceEntity.getDbId() + ""); |
| | | entity.setDocCode(docCode); |
| | | entity.setUserCode(request.getSession().getAttribute(SessionKey.USERCODE) + ""); |
| | | entity.setUserName(request.getSession().getAttribute(SessionKey.USER_NAME) + ""); |
| | | einvoiceInfo = this.baiwangIfc.getEinvoiceInfo(entity); |
| | | //---------测试代码 |
| | | /* int errorCode = -1008; |
| | | client = new BWRestClient(TokenUtils.url, TokenUtils.appKey, TokenUtils.appSecret); // 初始化一个客户端 |
| | | token = TokenUtils.getToken(); |
| | | request.setAttribute("doccode", entity.getDocCode()); |
| | | request.setAttribute("funclinkFormid",funclinkFormid); |
| | | confrimFace(client, einvoiceInfo.getTaxNo(), token, request, response, callBackMessage); |
| | | callBackMessage.sendErrorMessage("errorMsg", errorCode); |
| | | return callBackMessage.toJSONObject();*/ |
| | | //----- |
| | | if (einvoiceInfo != null) { |
| | | client = new BWRestClient(TokenUtils.url, TokenUtils.appKey, TokenUtils.appSecret); // 初始化一个客户端 |
| | | token = TokenUtils.getToken(); |
| | | OutputInvoiceIssueResponse issue = client.outputInvoice().issue(einvoiceInfo, token); |
| | | log.info("msg:" + JSON.toJSONString(issue)); |
| | | //1--记录日志 |
| | | baiwangIfc.sendLog(entity, issue); |
| | | if (!issue.isSuccess()) { |
| | | //失败 |
| | | callBackMessage.sendErrorMessage(issue.getErrorResponse().getSubMessage()); |
| | | return callBackMessage.toJSONObject(); |
| | | } |
| | | |
| | | //-------成功 |
| | | //1--记录日志 |
| | | com.yc.open.jinwu.entity.T110565Entity t110565Entity = new T110565Entity(entity.getFormid(), entity.getDocCode(), null, "接收电子发票", JSON.toJSONString(issue)); |
| | | this.sendLogBy110565(t110565Entity); |
| | | //3---更新状态 |
| | | //2---更新状态 |
| | | baiwangIfc.updateStatus(entity, issue); |
| | | threadPoolExecutor.execute(new QueryThread(client, token,issue.getResponse().getSuccess().get(0).getInvoiceNo(), einvoiceInfo.getTaxNo(),entity, request.getSession(),this,baiwangIfc)); |
| | | callBackMessage.setData("成功"); |
| | | callBackMessage.setMemo("生成成功!正在下载电子发票,稍候请手动刷新界面显示发票附件").sendSuccessMessageByDefault(); |
| | | callBackMessage.setMemo("生成成功!正在下载电子发票,稍候手动刷新界面显示发票附件").sendSuccessMessageByDefault(); |
| | | return callBackMessage.toJSONObject(); |
| | | } else { |
| | | callBackMessage.sendErrorMessage(String.format("%s没有所需要的推送数据", entity.getDocCode())); |
| | |
| | | Map map = new HashMap(); |
| | | map.put("url", TokenUtils.LOGIN_URL); |
| | | errorCode = -1007; |
| | | errorMsg = "【" + ex.getSubMessage() + "】点击【确定】按钮在弹出的百望云平台重新登录,成功后关闭弹出窗口再次执行生成电子发票操作"; |
| | | errorMsg = "【" + ex.getSubMessage() + "】点击【确定】按钮在弹出的百望云平台重新登录,成功后关闭弹窗然后再次执行生成电子发票操作"; |
| | | callBackMessage.setInfo(map); |
| | | } else if ("70045".equals(ex.getSubCode())) { |
| | | //刷脸验证,生成二维码图片给税局APP扫码 |
| | | errorCode = -1008; |
| | | request.setAttribute("doccode", entity.getDocCode()); |
| | | request.setAttribute("funclinkFormid",funclinkFormid); |
| | | confrimFace(client, einvoiceInfo.getTaxNo(), token, request, response, callBackMessage); |
| | | } |
| | | callBackMessage.sendErrorMessage(errorMsg, errorCode); |
| | |
| | | SpObserver.setDBtoInstance(); |
| | | } |
| | | } |
| | | @RequestMapping(value = "/baiwang/download.do") |
| | | private @ResponseBody Object downLoadEinvoiceFile(HttpServletRequest request, HttpServletResponse response) { |
| | | CallBackMessage callBackMessage = new CallBackMessage(); |
| | | try { |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request); |
| | | SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//切换数据源 |
| | | Map<String, String> map = null; |
| | | try { |
| | | map = t22ifc.getParamMap(request); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | callBackMessage.sendErrorMessage(this.getErrorMsg(e)); |
| | | return callBackMessage.toJSONObject(); |
| | | } |
| | | String docCode = null;//单号 |
| | | |
| | | if (map != null) { |
| | | docCode = map.get("doccode"); |
| | | } |
| | | if (docCode == null) { |
| | | callBackMessage.sendErrorMessage("单号不能为空"); |
| | | return callBackMessage.toJSONObject(); |
| | | } |
| | | GateEntity entity=new GateEntity(); |
| | | entity.setDocCode(docCode); |
| | | QueryEntiy einvoiceInfo = this.baiwangIfc.getEinvoiceInfo(docCode); |
| | | if(einvoiceInfo!=null) { |
| | | BWRestClient client = new BWRestClient(TokenUtils.url, TokenUtils.appKey, TokenUtils.appSecret); // 初始化一个客户端 |
| | | String token = TokenUtils.getToken(); |
| | | OutputFormatQueryQdInvoiceRequest query = new OutputFormatQueryQdInvoiceRequest(); |
| | | OutputFormatQueryQdInvoiceData data = new OutputFormatQueryQdInvoiceData(); |
| | | data.setInvoiceNo(einvoiceInfo.getInvoiceNo()); |
| | | query.setData(data); |
| | | query.setTaxNo(einvoiceInfo.getTaxNo()); |
| | | OutputFormatQueryQdInvoiceResponse outputFormatQueryQdInvoiceResponse = client.outputFormat().queryQdInvoice(query, |
| | | token); |
| | | log.info("msg:" + JSON.toJSONString(outputFormatQueryQdInvoiceResponse)); |
| | | if (!outputFormatQueryQdInvoiceResponse.isSuccess()) { |
| | | //失败 |
| | | throw new ApplicationException(outputFormatQueryQdInvoiceResponse.getErrorResponse().getSubMessage()); |
| | | |
| | | } |
| | | String fielid = "InvoiceFile";//附件字段 |
| | | String unid = this.saveAttachment(outputFormatQueryQdInvoiceResponse, entity, fielid); |
| | | //--更新状态 |
| | | baiwangIfc.updateByAttachment(entity, unid, fielid); |
| | | } |
| | | callBackMessage.setData("成功"); |
| | | callBackMessage.setMemo("下载成功").sendSuccessMessageByDefault(); |
| | | return callBackMessage.toJSONObject(); |
| | | }catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | callBackMessage.sendErrorMessage(ex.getMessage()); |
| | | return callBackMessage.toJSONObject(); |
| | | }finally { |
| | | SpObserver.setDBtoInstance(); |
| | | } |
| | | } |
| | | private void confrimFace(IBWClient client, String taxNo, String token, HttpServletRequest request, HttpServletResponse response, CallBackMessage callBackMessage) { |
| | | try { |
| | | OutputBasicinfoGetAuthQrCodeRequest qrCodeRequest = new OutputBasicinfoGetAuthQrCodeRequest(); |
| | |
| | | map.put("qrCode", qrCodeResponse.getResponse().get(0).getQrCode()); |
| | | map.put("authId", qrCodeResponse.getResponse().get(0).getAuthId()); |
| | | map.put("taxNo", taxNo); |
| | | map.put("doccode", request.getAttribute("doccode"));//传多一个单号,实现扫码成功自动执行生成电子发票操作 |
| | | map.put("funclinkFormid", request.getAttribute("funclinkFormid"));//传多一个功能链接功能号 |
| | | map.put("taxUserName", request.getSession().getAttribute(SessionKey.USER_TELE_PHONE) + "");//要用手机号做扫码认证,不能用账号 |
| | | callBackMessage.setInfo(map); |
| | | }catch (Exception e){ |
| | |
| | | attachmentEntity.setPhysicalPath(null); |
| | | attachmentEntity.setOriginalFileName(entity.getDocCode() + ".pdf"); |
| | | attachmentEntity.setFileType("pdf"); |
| | | attachmentEntity.setAuthorCode("SYSTEM"); |
| | | attachmentEntity.setAuthorName("管理员"); |
| | | attachmentEntity.setFileSize(new Long(orgBinaryimages.length)); |
| | | attachmentEntity.setAuthorCode(entity.getUserCode()); |
| | | attachmentEntity.setAuthorName(entity.getUserName()); |
| | | UploadFiles uploadFiles = new UploadFiles(); |
| | | uploadFiles.setOrgBinaryimages(orgBinaryimages); |
| | | uploadFiles.setSmallBinaryimages(orgBinaryimages); |
| | |
| | | |
| | | @Data |
| | | public class FaceSwipingEntry { |
| | | String taxNo, authId, taxUserName; |
| | | String taxNo, authId, taxUserName,doccode,funclinkFormid; |
| | | } |
| | |
| | | |
| | | import com.baiwang.open.entity.request.OutputInvoiceIssueRequest; |
| | | import com.baiwang.open.entity.request.OutputRedinvoiceAddRequest; |
| | | import com.baiwang.open.entity.request.node.OutputInvoiceIssuePreInvoice; |
| | | import com.baiwang.open.entity.response.OutputInvoiceIssueResponse; |
| | | import com.baiwang.open.entity.response.OutputRedinvoiceAddResponse; |
| | | import com.yc.open.mutual.schedule.GateEntity; |
| | |
| | | void updateStatus(GateEntity entity, OutputInvoiceIssueResponse response); |
| | | void updateRedStatus(GateEntity entity, OutputRedinvoiceAddResponse response); |
| | | void updateByAttachment(GateEntity entity, String uuid, String fieldid); |
| | | |
| | | void sendLog(GateEntity entity, OutputInvoiceIssueResponse issue); |
| | | QueryEntiy getEinvoiceInfo(String doccode); |
| | | } |
| | |
| | | package com.yc.open.baiwang.service; |
| | | |
| | | import com.baiwang.open.entity.ErrorResponse; |
| | | import com.baiwang.open.entity.request.OutputInvoiceIssueRequest; |
| | | import com.baiwang.open.entity.request.OutputRedinvoiceAddRequest; |
| | | import com.baiwang.open.entity.request.node.OutputInvoiceIssueInvoiceDetail; |
| | |
| | | import com.baiwang.open.entity.request.node.OutputRedinvoiceAddObjectType; |
| | | import com.baiwang.open.entity.response.OutputInvoiceIssueResponse; |
| | | import com.baiwang.open.entity.response.OutputRedinvoiceAddResponse; |
| | | import com.baiwang.open.entity.response.node.OutputInvoiceIssueInvoice; |
| | | import com.baiwang.open.entity.response.node.OutputInvoiceIssueInvoiceResult; |
| | | import com.baiwang.open.entity.response.node.OutputRedinvoiceAdd; |
| | | import com.baiwang.open.entity.response.node.*; |
| | | import com.yc.action.grid.GridUtils; |
| | | import com.yc.exception.ApplicationException; |
| | | import com.yc.open.mutual.schedule.GateEntity; |
| | | import com.yc.service.BaseService; |
| | | import org.apache.commons.lang.RandomStringUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.jdbc.core.BeanPropertyRowMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | @Service |
| | | public class BaiwangImpl extends BaseService implements BaiwangIfc { |
| | | /** |
| | | * 下载发票附件使用 |
| | | * @param doccode |
| | | * @return |
| | | */ |
| | | @Override |
| | | public QueryEntiy getEinvoiceInfo(String doccode) { |
| | | String sql = |
| | | " select b.invoiceNo,c.vatCode as taxNo\n" + |
| | | " from t150504H b \n" + |
| | | " join ocompany c on c.companyid=b.companyid\n" + |
| | | " where b.doccode=" + GridUtils.prossSqlParm(doccode); |
| | | return this.jdbcTemplate.queryForObject(sql,new BeanPropertyRowMapper<>(QueryEntiy.class)); |
| | | } |
| | | |
| | | @Override |
| | | public OutputInvoiceIssueRequest getEinvoiceInfo(GateEntity entity) { |
| | | OutputInvoiceIssueRequest request = null; |
| | | String sql = |
| | | " select b.invoiceTypeCode,b.buyerTaxNo,case when isnull(b.paperInvoiceFlag,'')='' then 'N' else b.paperInvoiceFlag end as paperInvoiceFlag,isnull(b.invoiceType,0) as invoiceType,b.entername,\n" + |
| | | " b.buyerTaxNo,b.buyerName,b.buyerBankName,b.buyerBankNumber,b.buyerAddress,b.buyerTelphone,b.HDMemo,\n" + |
| | | " b.buyerTaxNo,b.buyerName,b.buyerBankName,b.buyerBankNumber,b.buyerAddress,b.buyerTelephone,b.HDMemo,b.buyerEmail,b.buyerPhone,\n" + |
| | | " a.DocItem,a.MatName,a.Digit,a.netprice,a.netmoney,a.vatrate,c.vatCode,c.BankCode,c.BankAccount,c.Province,c.City,c.Street,c.Tel1,d.TaxCatalogCode\n" + |
| | | " from t150504H b join t150504D a on a.doccode=b.DocCode" + |
| | | " join ocompany c on c.companyid=b.companyid\n" + |
| | |
| | | request.setTaxNo(GridUtils.prossRowSetDataType_String(map, "vatCode")); |
| | | //发票种类编码,01:全电发票(增值税专用发票) 02:全电发票(普通发票) |
| | | preInvoice.setInvoiceTypeCode(GridUtils.prossRowSetDataType_String(map, "invoiceTypeCode")); |
| | | if(!"01".equals(preInvoice.getInvoiceTypeCode())&&!"02".equals(preInvoice.getInvoiceTypeCode())){ |
| | | throw new ApplicationException("只能开具全电发票(增值税专用发票),全电发票(普通发票)"); |
| | | } |
| | | //全电纸质发票标志(Y是N否) |
| | | preInvoice.setPaperInvoiceFlag(GridUtils.prossRowSetDataType_String(map, "paperInvoiceFlag")); |
| | | //开票类型 0:正数发票(蓝票) 1:负数发票(红票)默认0 |
| | |
| | | //购方地址及电话, 增值税专用发票开具时必填,发票类型代码为 |
| | | //01、02时该字段拆分为地址电话两个字段 |
| | | preInvoice.setBuyerAddress(GridUtils.prossRowSetDataType_String(map, "buyerAddress")); |
| | | preInvoice.setBuyerTelphone(GridUtils.prossRowSetDataType_String(map, "buyerTelphone")); |
| | | preInvoice.setBuyerTelphone(GridUtils.prossRowSetDataType_String(map, "buyerTelephone")); |
| | | //购方开户行及账号, 增值税专用发票开具时必填,发票类型代码为 |
| | | //01、02时该字段拆分为银行名称、账号两个字段 |
| | | preInvoice.setBuyerBankName(GridUtils.prossRowSetDataType_String(map, "buyerBankName")); |
| | |
| | | preInvoice.setDrawer(entity.getUserName()); |
| | | //备注 |
| | | preInvoice.setRemarks(GridUtils.prossRowSetDataType_String(map, "HDMemo")); |
| | | |
| | | //客户邮箱 |
| | | preInvoice.setBuyerEmail(GridUtils.prossRowSetDataType_String(map, "buyerEmail")); |
| | | //客户电话 |
| | | preInvoice.setBuyerPhone(GridUtils.prossRowSetDataType_String(map, "buyerPhone")); |
| | | //销方地址及电话, 增值税专用发票开具时必填,发票类型代码为 |
| | | //01、02时该字段拆分为地址电话两个字段 |
| | | preInvoice.setSellerAddress(GridUtils.prossRowSetDataType_String(map, "Province") |
| | |
| | | public OutputRedinvoiceAddRequest getRedEinvoiceInfo(GateEntity entity) { |
| | | OutputRedinvoiceAddRequest request = null; |
| | | String sql = |
| | | "select b.buyerName,b.buyerBankName,b.buyerBankNumber,b.buyerAddress,b.buyerTelphone,b.HDMemo,b.SumNetMoney,b.sumVatMoney,b.redInvoiceLabel,b.sumVatMoney,b.buyerTaxNo,\n" + |
| | | " a.DocItem,a.MatName,a.Digit,a.netprice,a.netmoney,a.vatmoney,a.vatrate,\n" + |
| | | "select b.buyerName,b.buyerBankName,b.buyerBankNumber,b.buyerAddress,b.buyerTelephone,b.HDMemo,b.SumNetMoney,b.sumVatMoney,b.redInvoiceLabel,b.sumVatMoney,b.buyerTaxNo,\n" + |
| | | " a.DocItem,a.MatName,a.Digit,a.netprice,a.netmoney,a.vatmoney,a.vatrate,a.UOM,\n" + |
| | | " c.vatCode,c.BankCode,c.BankAccount,c.Province,c.City,c.Street,c.Tel1,c.companyName,d.TaxCatalogCode,e.SPBMJC,\n" + |
| | | " g.SumNetMoney as originInvoiceTotalPrice,g.sumVatMoney as originInvoiceTotalTax,g.invoiceTypeCode as originInvoiceType ,case when isnull(g.paperInvoiceFlag,'')='' then 'N' else g.paperInvoiceFlag end as originalPaperInvoiceCode,isnull(g.invoiceType,0) as originInvoiceType,g.invoiceNo as originalInvoiceNo,g.invoiceDate as originInvoiceDate,f.docitem as originalInvoiceDetailNo \n" + |
| | | " from t150504H b join t150504D a on a.doccode=b.DocCode\n" + |
| | |
| | | request.setInvoiceTotalTax(new BigDecimal(GridUtils.prossRowSetDataType_String(map, "sumVatMoney"))); |
| | | //红字发票冲红原因代码 01:开票有误 02:销货退回 03:服务中止 04:销售折让 |
| | | request.setRedInvoiceLabel(GridUtils.prossRowSetDataType_String(map, "redInvoiceLabel")); |
| | | //发票来源:全电平台红冲必须要传递的字段 1:增值税发票管 |
| | | //理系统:表示此发票是通过原税控系统开具的增值税发票 |
| | | //,红冲此类发票时,税控设备需注销后才可以申请全电的红 |
| | | //字确认单; 2:电子发票服务平台:表示此发票是通过电子发 |
| | | //票服务平台开具的全电发票(包括全电纸质发票),红冲此 |
| | | //类发票时需要传递蓝票属性为此 |
| | | //发票来源:全电平台红冲必须要传递的字段 |
| | | // 1:增值税发票管理系统:表示此发票是通过原税控系统开具的增值税发票,红冲此类发票时,税控设备需注销后才可以申请全电的红字确认单; |
| | | // 2:电子发票服务平台:表示此发票是通过电子发票服务平台开具的全电发票(包括全电纸质发票),红冲此类发票时需要传递蓝票属性为此 |
| | | request.setInvoiceSource("2"); |
| | | if(StringUtils.isBlank(request.getOriginalInvoiceNo())){ |
| | | throw new ApplicationException("蓝字发票全电发票号码不能为空"); |
| | |
| | | item.setProjectName(GridUtils.prossRowSetDataType_String(map, "MatName")); |
| | | //商品全称( 简称自定义名称) |
| | | item.setGoodsName("*"+item.getGoodsSimpleName()+"*"+item.getProjectName()); |
| | | item.setGoodsQuantity(GridUtils.prossRowSetDataType_String(map, "Digit")); |
| | | item.setGoodsPrice(GridUtils.prossRowSetDataType_String(map, "netprice")); |
| | | //金额,小数点后2位 |
| | | item.setGoodsTotalPrice(new BigDecimal(GridUtils.prossRowSetDataType_String(map, "netmoney"))); |
| | | //税额 |
| | |
| | | } |
| | | return request; |
| | | } |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void sendLog(GateEntity entity, OutputInvoiceIssueResponse issue) { |
| | | OutputInvoiceIssue response = issue.getResponse(); |
| | | String sql="set nocount on \n" + |
| | | " declare @DocCode varchar(50),@FormID int=150523 ,@now datetime=getdate(),@DocDate datetime,@PeriodID varchar(50),@refCode varchar(50),@refformid int,\n" + |
| | | " @refFormType int=5 ,@CompanyID varchar(50),@CompanyName varchar(150),@CcCode varchar(50),@CcName varchar(150),@CltCode varchar(50),@CltName varchar(150),@invoiceStatus varchar(50),@serialNo varchar(50),@invoiceTotalPrice money,\n" + |
| | | " @invoiceTotalTax money,@invoiceTotalPriceTax money,@invoiceCode varchar(50),@invoiceNo varchar(50),@invoiceCheckCode varchar(50),@invoiceDate varchar(50),@invoiceQrCode varchar(max),@taxControlCode varchar(50),\n" + |
| | | " @invoiceTypeCode varchar(50),@eInvoiceUrl varchar(250),@method varchar(50),@requestId varchar(50),@code varchar(50),@message varchar(2500),@subCode varchar(50),@subMessage varchar(2500),@RowId varchar(50),@goodsLineNo varchar(50),\n" + |
| | | " @invoiceLineNature varchar(50),@goodsCode varchar(50),@goodsName varchar(150),@goodsSpecification varchar(50),@goodsUnit varchar(50),@goodsQuantity money,@goodsPrice money,@goodsTotalPrice money,@goodsTotalTax money,\n" + |
| | | " @goodsTaxRate money,@priceTaxMark money,@vatSpecialManagement varchar(50),@freeTaxMark varchar(150),@preferentialMark varchar(50) \n" + |
| | | " exec sp_newdoccode 150523,'SYSTEM',@DocCode output \n" + |
| | | " select @DocDate = convert(datetime,convert(varchar(10),GETDATE(),120) ) \n" + |
| | | " select @CompanyID=CompanyID,@CompanyName=CompanyName,@CltCode=CltCode,@CltName=CltName,@ccCode=ccCode,@ccName=ccName,@refCode=DocCode,@refformid=FormID from t150504H where doccode="+GridUtils.prossSqlParm(entity.getDocCode()) +"\n"+ |
| | | " select @PeriodId = dbo.GetPeriodID(@FormID,@CompanyID,@now)\n"; |
| | | sql+=" select @invoiceStatus='"+(issue.isSuccess()?"success":"fail") +"',@method="+GridUtils.prossSqlParm(issue.getMethod())+",@requestId="+GridUtils.prossSqlParm(issue.getRequestId()); |
| | | if(issue.isSuccess()) { |
| | | OutputInvoiceIssueInvoiceResult result = response.getSuccess().get(0); |
| | | String formattedDateTime=result.getInvoiceCode(); |
| | | if(StringUtils.isNotBlank(formattedDateTime)) { |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); |
| | | LocalDateTime dateTime = LocalDateTime.parse(result.getInvoiceDate(), formatter); |
| | | formattedDateTime = dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | sql+= " select @invoiceCode="+GridUtils.prossSqlParm(result.getInvoiceCode())+",@invoiceNo="+GridUtils.prossSqlParm(result.getInvoiceNo())+",@invoiceCheckCode="+GridUtils.prossSqlParm(result.getInvoiceCheckCode())+",@invoiceDate="+GridUtils.prossSqlParm(formattedDateTime)+",@invoiceQrCode="+GridUtils.prossSqlParm(result.getInvoiceQrCode())+",@taxControlCode="+GridUtils.prossSqlParm(result.getTaxControlCode())+",@invoiceTypeCode="+GridUtils.prossSqlParm(result.getInvoiceTypeCode())+",@serialNo="+GridUtils.prossSqlParm(result.getSerialNo())+",@eInvoiceUrl="+GridUtils.prossSqlParm(result.getEInvoiceUrl())+",@invoiceTotalPrice="+result.getInvoiceTotalPrice()+",@invoiceTotalTax="+result.getInvoiceTotalTax()+",@invoiceTotalPriceTax="+result.getInvoiceTotalPriceTax()+" \n"+ |
| | | "insert into t150523H(DocCode,FormID,DocDate,PeriodID,refCode,refformid,refFormType,CompanyID,CompanyName,CcCode,CcName,CltCode,CltName,invoiceStatus,invoiceCode,invoiceNo,invoiceCheckCode,invoiceDate,invoiceQrCode,taxControlCode,invoiceTypeCode,serialNo,eInvoiceUrl,method,requestId,invoiceTotalPrice,invoiceTotalTax,invoiceTotalPriceTax,docstatus) values(@DocCode,@FormID,@DocDate,@PeriodID,@refCode,@refformid,@refFormType,@CompanyID,@CompanyName,@CcCode,@CcName,@CltCode,@CltName,@invoiceStatus,@invoiceCode,@invoiceNo,@invoiceCheckCode,@invoiceDate,@invoiceQrCode,@taxControlCode,@invoiceTypeCode,@serialNo,@eInvoiceUrl,@method,@requestId,@invoiceTotalPrice,@invoiceTotalTax,@invoiceTotalPriceTax,100) \n"; |
| | | for(OutputInvoiceIssuePreInvoiceDetailVO detail:result.getInvoiceDetailsList()){ |
| | | //明细行 |
| | | sql+= " exec getXXXX @rowId output \n" + |
| | | " select @goodsLineNo="+detail.getGoodsLineNo()+",@goodsCode="+GridUtils.prossSqlParm(detail.getGoodsCode())+",@goodsName="+GridUtils.prossSqlParm(detail.getGoodsName())+",@goodsUnit="+GridUtils.prossSqlParm(detail.getGoodsUnit())+",@goodsQuantity="+detail.getGoodsQuantity()+",@goodsPrice="+detail.getGoodsPrice()+",@goodsTotalPrice="+detail.getGoodsTotalPrice()+",@goodsTotalTax="+detail.getGoodsTotalTax()+",@goodsTaxRate="+detail.getGoodsTaxRate()+",@priceTaxMark="+GridUtils.prossSqlParm(detail.getPriceTaxMark())+"\n"+ |
| | | " insert into t150523D(DocCode,RowId,goodsLineNo,goodsCode,goodsName,goodsUnit,goodsQuantity,goodsPrice,goodsTotalPrice,goodsTotalTax,goodsTaxRate,priceTaxMark) values(@DocCode,@RowId,@goodsLineNo,@goodsCode,@goodsName,@goodsUnit,@goodsQuantity,@goodsPrice,@goodsTotalPrice,@goodsTotalTax,@goodsTaxRate,@priceTaxMark)"; |
| | | } |
| | | }else { |
| | | ErrorResponse errorResponse = issue.getErrorResponse(); |
| | | OutputInvoiceIssueInvoice fail = response.getFail().get(0); |
| | | sql+=" select @code="+GridUtils.prossSqlParm(errorResponse.getCode())+",@message="+GridUtils.prossSqlParm(errorResponse.getMessage())+",@subCode="+GridUtils.prossSqlParm(errorResponse.getSubCode())+",@subMessage="+GridUtils.prossSqlParm(errorResponse.getSubMessage())+",@serialNo="+GridUtils.prossSqlParm(fail.getSerialNo())+",@invoiceTotalPrice="+fail.getInvoiceTotalPrice()+",@invoiceTotalTax="+fail.getInvoiceTotalTax()+",@invoiceTotalPriceTax="+fail.getInvoiceTotalPriceTax()+" \n"+ |
| | | //表头 |
| | | " insert into t150523H(DocCode,FormID,DocDate,PeriodID,refCode,refformid,refFormType,CompanyID,CompanyName,CcCode,CcName,CltCode,CltName,invoiceStatus,serialNo,invoiceTotalPrice,invoiceTotalTax,invoiceTotalPriceTax,method,requestId,code,message,subCode,subMessage,docstatus) values(@DocCode,@FormID,@DocDate,@PeriodID,@refCode,@refformid,@refFormType,@CompanyID,@CompanyName,@CcCode,@CcName,@CltCode,@CltName,@invoiceStatus,@serialNo,@invoiceTotalPrice,@invoiceTotalTax,@invoiceTotalPriceTax,@method,@requestId,@code,@message,@subCode,@subMessage,100) \n" ; |
| | | for(com.baiwang.open.entity.response.node.OutputInvoiceIssueInvoiceDetail detail:fail.getInvoiceDetailsList()) { |
| | | //明细行 |
| | | sql+= " exec getXXXX @rowId output \n" + |
| | | " select @goodsLineNo="+GridUtils.prossSqlParm(detail.getGoodsLineNo())+",@invoiceLineNature="+GridUtils.prossSqlParm(detail.getInvoiceLineNature())+",@goodsCode="+GridUtils.prossSqlParm(detail.getGoodsCode())+",@goodsName="+GridUtils.prossSqlParm(detail.getGoodsName())+",@goodsSpecification="+GridUtils.prossSqlParm(detail.getGoodsSpecification())+",@goodsUnit="+GridUtils.prossSqlParm(detail.getGoodsUnit())+",@goodsQuantity="+GridUtils.prossSqlParm(detail.getGoodsQuantity())+",@goodsPrice="+detail.getGoodsPrice()+",@goodsTotalPrice="+detail.getGoodsTotalPrice()+",@goodsTotalTax="+detail.getGoodsTotalTax()+",@goodsTaxRate="+detail.getGoodsTaxRate()+",@priceTaxMark="+GridUtils.prossSqlParm(detail.getPriceTaxMark())+",@vatSpecialManagement="+GridUtils.prossSqlParm(detail.getVatSpecialManagement())+",@freeTaxMark="+GridUtils.prossSqlParm(detail.getFreeTaxMark())+",@preferentialMark="+GridUtils.prossSqlParm(detail.getPreferentialMark())+"\n"+ |
| | | " insert into t150523D(DocCode,RowId,goodsLineNo,invoiceLineNature,goodsCode,goodsName,goodsSpecification,goodsUnit,goodsQuantity,goodsPrice,goodsTotalPrice,goodsTotalTax,goodsTaxRate,priceTaxMark,vatSpecialManagement,freeTaxMark,preferentialMark) values(@DocCode,@RowId,@goodsLineNo,@invoiceLineNature,@goodsCode,@goodsName,@goodsSpecification,@goodsUnit,@goodsQuantity,@goodsPrice,@goodsTotalPrice,@goodsTotalTax,@goodsTaxRate,@priceTaxMark,@vatSpecialManagement,@freeTaxMark,@preferentialMark)"; |
| | | } |
| | | } |
| | | //过账 |
| | | /*sql+=" \n declare @PostFormId int, @DocStatusValue int,@PreDocStatus int,@PostDocStatus int,@Memo varchar(100),@LinkDocInfo varchar(100),@EnterCode varchar(50)="+GridUtils.prossSqlParm(entity.getUserCode())+",@EnterName="+GridUtils.prossSqlParm(entity.getUserName())+"\n" + |
| | | "exec p150523Save @doccode\n" + |
| | | " select @PostFormId = FormId,@DocStatusValue = DocStatus from t150523H where docCode=@docCode\n" + |
| | | " select @PreDocStatus = PreDocStatus,@PostDocStatus = a.PostDocStatus from gform a where a.formid = @PostFormId \n" + |
| | | " if isnull(@DocStatusValue,0) = isnull(@PreDocStatus,0)\n" + |
| | | " begin \n" + |
| | | " update a set DocStatus = @PostDocStatus,PostCode=@EnterCode,PostName=@EnterName,PostDate=@now\n" + |
| | | " from t150523H a where a.DocCode = @docCode \n" + |
| | | " exec p150523Post @UserCode = @EnterCode,@UserName = @EnterName, \n" + |
| | | " @DocCode = @docCode,@FormId = @PostFormId,\n" + |
| | | " @DocStatusValue = @DocStatusValue,@ButtonType ='提交', \n" + |
| | | " @Memo=@Memo output ,@LinkDocInfo = @LinkDocInfo output \n" + |
| | | " end\n";*/ |
| | | log.info("150523sql:"+sql); |
| | | this.doBaseExecute(sql); |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public void updateStatus(GateEntity entity, OutputInvoiceIssueResponse response) { |
New file |
| | |
| | | package com.yc.open.baiwang.service; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class QueryEntiy { |
| | | String invoiceNo; |
| | | String taxNo; |
| | | } |
| | |
| | | if(StringUtils.isNotBlank(uniqueIdentifier)) { |
| | | String sql=" set nocount on \n " + |
| | | " declare @userid int, \n" + |
| | | " @tel varchar(20)=" + GridUtils.prossSqlParm(tel) + ",@LastUniqueIdentifier varchar(50)=" + GridUtils.prossSqlParm(uniqueIdentifier) + " \n" + |
| | | "select top 1 @userid=userid from gProfile where (isnull(LastUniqueIdentifier,'')=@LastUniqueIdentifier and Telephone=@tel) \n" + |
| | | " if isnull(@userid,'')=''\n" +//表示当前传的和最近一次的不同或是新用户,则需要弹出验证 |
| | | " begin\n" + |
| | | " select top 1 @userid=userid,@LastUniqueIdentifier=LastUniqueIdentifier from gProfile where Telephone=@tel\n" +//不同上一次的设备登录,需要取出最后一次登录设备信息 |
| | | " if isnull(@LastUniqueIdentifier,'')='' \n" +//表示没有信任设备的情况 |
| | | " begin \n" + |
| | | " select @userId as userId, null as uniqueIdentifier \n"+ |
| | | " end \n" + |
| | | " else\n" +//表示有信任设备但不是上次登录的设备 |
| | | " begin\n"+ |
| | | " select top 1 case when isnull(EquipmentName,'')='' then EquipmentModel else EquipmentName end as EquipmentName ,convert(varchar(20),lastLogonDate,120) as lastLogonDate,uniqueIdentifier,userId\n" + |
| | | " @tel varchar(20)=" + GridUtils.prossSqlParm(tel) + ",@LastUniqueIdentifier varchar(50)=" + GridUtils.prossSqlParm(uniqueIdentifier) + |
| | | " ,@UniqueIdentifier varchar(50),@currUniqueIdentifier varchar(50) \n" + |
| | | " select @userId=userid,@currUniqueIdentifier=lastUniqueIdentifier from gProfile where Telephone=@tel \n" + |
| | | " select top 1 @userId=a.userid,@UniqueIdentifier=a.uniqueIdentifier --首先判断是否存在这个设备\n" + |
| | | " from gProfileEquipment a \n" + |
| | | " where userid=@UserId \n" + |
| | | " and Status = 1 order by lastLogonDate desc\n" + |
| | | " end \n"+ |
| | | " where a.userid=@userid and a.uniqueIdentifier=@lastUniqueIdentifier\n" + |
| | | " and a.Status = 1 order by a.lastLogonDate desc\n" + |
| | | " if isnull(@UniqueIdentifier,'')='' --信任设备列表没有当前设备\n" + |
| | | " begin\n" + |
| | | " select @userId as userId, null as uniqueIdentifier --作为新设备,需要弹出验证\n" + |
| | | " end\n" + |
| | | " else \n" + |
| | | " select null \n "; |
| | | " begin\n" + |
| | | " if isnull(@UniqueIdentifier,'')=isnull(@currUniqueIdentifier,'')--是否为最近登录的设备\n" + |
| | | " begin\n" + |
| | | " select null --返回null表示直接跳过\n" + |
| | | " end\n" + |
| | | " else --否则输出最近登录设备信息\n" + |
| | | " begin\n" + |
| | | " select top 1 case when isnull(EquipmentName,'')='' \n" + |
| | | " then EquipmentModel else EquipmentName end as EquipmentName ,convert(varchar(20),lastLogonDate,120) as lastLogonDate, uniqueIdentifier,@userid as userid\n" + |
| | | " from gProfileEquipment a \n" + |
| | | " where userid=@UserId and uniqueIdentifier=@currUniqueIdentifier and Status = 1 order by lastLogonDate desc\n" + |
| | | " end\n" + |
| | | " end"; |
| | | // log.info("checkSameEquipmentByLastLogin:"+sql); |
| | | return this.jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(EquipmentEntry.class)); |
| | | }else { |
| | |
| | | public void deleteLogonEquipment(EquipmentEntry entry) { |
| | | String sql=" set nocount on\n" + |
| | | " declare @UserId int="+entry.getUserId()+",@UniqueIdentifier varchar(50)=" + GridUtils.prossSqlParm(entry.getUniqueIdentifier()) +"\n"+ |
| | | " delete b from gProfileEquipment b where b.UniqueIdentifier=@UniqueIdentifier and b.userid=@UserId" + |
| | | " if not exists(select top 1 1 from gProfileEquipment a \n" + |
| | | " where a.UserId = @UserId )\n" + |
| | | " begin\n" + |
| | | " update a set a.LastUniqueIdentifier=null from gProfile a where a.UserId = @UserId \n" + |
| | | " end "; |
| | | " delete b from gProfileEquipment b where b.UniqueIdentifier=@UniqueIdentifier and b.userid=@UserId"; |
| | | this.doBaseExecute(sql); |
| | | } |
| | | |
| | | @Override |
| | | public Integer removeLoginUser(RemoveUserEntry entry) { |
| | | String sql="set nocount on\n" + |
| | | " declare @UserCode varchar(50) = '"+entry.getUserCode()+"',@ModifyCode varchar(50) = '"+entry.getUserCode()+"',@ModifyName varchar(80)='"+entry.getUserName()+"' ,@LogonType int = "+entry.getLogonType()+"\n" + |
| | | " declare @UserCode varchar(50) = '"+entry.getUserCode()+"',@ModifyCode varchar(50) = '"+entry.getUserCode()+"',@ModifyName varchar(80)='"+entry.getUserName()+"' ,@LogonType int = "+entry.getLogonType()+",@myCount int=0\n" + |
| | | " if isnull(@LogonType,0) = 0\n" + |
| | | " begin\n" + |
| | | " update a set inActive = 1 , inActiveDate=getdate(),ModifyCode = @ModifyCode,ModifyName = @ModifyName\n" + |
| | | " from _sysUser a \n" + |
| | | " where UserCode = @UserCode \n" + |
| | | " select @@rowcount;"+ |
| | | " select @myCount=@@rowcount;\n"+ |
| | | " end \n" + |
| | | " if isnull(@LogonType,0) = 1\n" + |
| | | " begin\n" + |
| | | " update a set inActive = 1 , inActiveDate=getdate(),ModifyCode = @ModifyCode,ModifyName = @ModifyName\n" + |
| | | " from t110203 a \n" + |
| | | " where CltCode = @UserCode \n" + |
| | | " select @@rowcount;"+ |
| | | " select @myCount=@@rowcount;\n"+ |
| | | " end \n" + |
| | | " if isnull(@LogonType,0) = 3\n" + |
| | | " begin\n" + |
| | | " update a set inActive = 1, inActiveDate=getdate(),ModifyCode = @ModifyCode,ModifyName = @ModifyName\n" + |
| | | " from t110302 a \n" + |
| | | " where CltCode = @UserCode \n" + |
| | | " select @@rowcount;"+ |
| | | " end \n"; |
| | | " select @myCount=@@rowcount;\n"+ |
| | | " end \n" + |
| | | " if @myCount=1\n" + |
| | | " begin \n" + |
| | | " delete from t9668h where UserCode = @UserCode\n" +//方便用户可以重新开通app |
| | | " select @myCount=@@rowcount;\n" + |
| | | " end\n" + |
| | | " select @myCount;" ; |
| | | |
| | | return this.jdbcTemplate.queryForObject(sql,Integer.class); |
| | | } |