中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

網(wǎng)站和管理系統(tǒng)的區(qū)別會計培訓(xùn)班要多少錢一般要學(xué)多久

網(wǎng)站和管理系統(tǒng)的區(qū)別,會計培訓(xùn)班要多少錢一般要學(xué)多久,網(wǎng)站還沒有做解析是什么意思,什么網(wǎng)站可以自學(xué)ps做貴賓卡前言 在我看來多寫幾個if-else沒啥大不了的,但是就是看起來沒啥逼格,領(lǐng)導(dǎo)嫌棄。我根據(jù)開發(fā)的經(jīng)歷寫幾個不同的替代方法 一、枚舉法替代 我先前寫了一篇文章,可以去看看。 通過枚舉替換if-else語句的解決方案_枚舉代替if else c語言-CSDN博…

前言?

在我看來多寫幾個if-else沒啥大不了的,但是就是看起來沒啥逼格,領(lǐng)導(dǎo)嫌棄。我根據(jù)開發(fā)的經(jīng)歷寫幾個不同的替代方法

一、枚舉法替代?

我先前寫了一篇文章,可以去看看。

通過枚舉替換if-else語句的解決方案_枚舉代替if else c語言-CSDN博客

二、定義接口,實現(xiàn)類

通過定義初始方法,通過添加多個實現(xiàn)類來選擇

  • 接口

public interface ISoapServer {/*** 服務(wù)編碼* @return*/String getCode();/*** 服務(wù)* @param xml* @return*/String server(String xml);}
  • 實現(xiàn)類

?其中一個實現(xiàn)類,其他的類似


import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import us.codecraft.webmagic.selector.Html;import java.util.List;/*** @author HuangZheng* @create 2023-05-05 9:49* @description 居民信息提交服務(wù)*/
@Service
public class Soap06IstPr1 implements ISoapServer {@Autowiredprivate WebClientServer webClientServer;@Overridepublic String getCode() {return "IST-PR1";}@Overridepublic String server(String xml) {try {if (StrUtil.isBlank(xml)) {throw new BaseException("參數(shù)不能為空!");}// 要插入的業(yè)務(wù)表Patient patient = new Patient();String pid = IdUtil.fastSimpleUUID();patient.setPid(pid);// 第一步 解析參數(shù)Html requestXml = Html.create(xml);// 獲取身份證號// 1、從開頭尋找List<String> idNoList = requestXml.xpath("//personInfo/identifier/value/@value").all();// 2、從assignedPerson節(jié)點尋找List<String> tempIdNoList = requestXml.xpath("//assignedPerson/identifier/value/@value").all();idNoList.addAll(tempIdNoList);for (String s : idNoList) {if (IdcardUtil.isValidCard(s)) {patient.setIdNo(s);patient.setIdTypeCode("01");patient.setIdTypeName("身份證");// 只要能取到一個就行break;}}// 姓名final String name = requestXml.xpath("//personInfo/assignedPerson/name/@value").get();patient.setName(name);// 性別final String sexCode = requestXml.xpath("//personInfo/assignedPerson/gender/@value").get();patient.setSexCode(sexCode);ExceptionUtil.soapExcpition("1",name);ExceptionUtil.soapExcpition("2",sexCode);final String sexName = XmlReadUtil.getRangeByKey("GB/T 2261.1-2003", sexCode).getValue();patient.setSexName(sexName);// 手機號碼String telNo = requestXml.xpath("//personInfo/telecom/value/@value").get();patient.setTelNo(telNo);// 獲取地址addressString presentAddress = requestXml.xpath("//personInfo/address/text/@value").get();String presentAddrProvi = requestXml.xpath("//personInfo/address/state/@value").get();String presentAddrCity = requestXml.xpath("//personInfo/address/city/@value").get();String presentAddrCounty = requestXml.xpath("//personInfo/address/district/@value").get();String presentAddrTown = requestXml.xpath("//personInfo/address/town/@value").get();String presentAddrVillage = requestXml.xpath("//personInfo/address/street/@value").get();String presentAddrHouNo = requestXml.xpath("//personInfo/address/houseNumber/@value").get();// 存值patient.setPresentAddress(TextUtil.getStr(presentAddress, "-"));patient.setPresentAddrProvi(TextUtil.getStr(presentAddrProvi, "-"));patient.setPresentAddrCity(TextUtil.getStr(presentAddrCity, "-"));patient.setPresentAddrCounty(TextUtil.getStr(presentAddrCounty, "-"));patient.setPresentAddrTown(TextUtil.getStr(presentAddrTown, "-"));patient.setPresentAddrVillage(TextUtil.getStr(presentAddrVillage, "-"));patient.setPresentAddrHouNo(TextUtil.getStr(presentAddrHouNo, "-"));// 出生日期final String birthday = requestXml.xpath("//personInfo/assignedPerson/birthTime/@value").get();patient.setBirthday(Convert.toDate(birthday));// 婚姻狀況final String marCode = requestXml.xpath("//personInfo/assignedPerson/maritalStatusCode/@value").get();patient.setMarCode(marCode);final String marName = XmlReadUtil.getRangeByKey("GB/T 2261.2-2003", marCode).getValue();patient.setMarName(marName);// ORG_ID 通過最后的機構(gòu)名稱查詢String orgName = requestXml.xpath("//personInfo/assignedOrganization/name/@value").get();OrgMapper orgMapper = SpringUtils.getBean(OrgMapper.class);Org org = orgMapper.selectOne(new LambdaQueryWrapper<Org>().eq(Org::getManagerorgname, orgName));if (org != null) {patient.setOrgId(org.getOrgid());}else{patient.setOrgId("1");}// 批次String batchId = UUID.randomUUID(false).toString(true);patient.setBatchId(batchId);PatientMapper patientMapper = SpringUtils.getBean(PatientMapper.class);patientMapper.insert(patient);//保存通知List<String> ids = webClientServer.saveNoice(new String[][]{{"rhin:personRecordRevise",name+"居民信息發(fā)生變更"},{"rhin:personIdentifierRevise",name+"居民信息索引變更"},{"rhin:personIdentifierMerge",name+"居民信息合并"}});//檢查是否有主題訂閱,如有發(fā)送通知webClientServer.checkAndNoice(ids);return "<PersonRecordFeedResponse>\n" +"         <masterIdentifer>" +TextUtil.format("<system value=\"{}\"/> \n", "") +TextUtil.format("<value value=\"{}\"/> \n", pid) +"         </masterIdentifer>\n" +"</PersonRecordFeedResponse>";} catch (Exception e) {// 對象轉(zhuǎn)換為xmlreturn TextUtil.format("" +"<returnData>\n" +"\t<funCode>{}</funCode>\n" +"\t<errorCode>{}</errorCode>\n" +"\t<detail>{}</detail>\n" +"</returnData> \n", getCode(), "500", e.getCause() != null ? e.getCause() : e.getMessage());}}
}

?使用方法

 public String HIPMessageServer(String action, String message) {String result ="";log.info("\n 交互服務(wù)入?yún)⑿畔? \n action:{} \n message:{}",action,message);String[] beanNamesForType = applicationContext.getBeanNamesForType(ISoapServer.class);for (String beanName : beanNamesForType) {ISoapServer soapServer = applicationContext.getBean(beanName, ISoapServer.class);if (soapServer.getCode().equals(action)) {result = soapServer.server(message);log.info("\n 交互服務(wù)出參信息: \n message:{}",result);return result;}}return result;}

三、Map+函數(shù)式接口

@Service??
public?class?GrantTypeSerive?{??public?String?redPaper(String?resourceId){??//紅包的發(fā)放方式??return?"每周末9點發(fā)放";??}??public?String?shopping(String?resourceId){??//購物券的發(fā)放方式??return?"每周三9點發(fā)放";??}??public?String?QQVip(String?resourceId){??//qq會員的發(fā)放方式??return?"每周一0點開始秒殺";??}??
}?
@Service??
public?class?QueryGrantTypeService?{??@Autowired??private?GrantTypeSerive?grantTypeSerive;??private?Map<String,?Function<String,String>>?grantTypeMap=new?HashMap<>();??/**??*??初始化業(yè)務(wù)分派邏輯,代替了if-else部分??*??key:?優(yōu)惠券類型??*??value:?lambda表達式,最終會獲得該優(yōu)惠券的發(fā)放方式??*/??@PostConstruct??public?void?dispatcherInit(){??grantTypeMap.put("紅包",resourceId->grantTypeSerive.redPaper(resourceId));??grantTypeMap.put("購物券",resourceId->grantTypeSerive.shopping(resourceId));??grantTypeMap.put("qq會員",resourceId->grantTypeSerive.QQVip(resourceId));??}??public?String?getResult(String?resourceType){??//Controller根據(jù)?優(yōu)惠券類型resourceType、編碼resourceId?去查詢?發(fā)放方式grantType??Function<String,String>?result=getGrantTypeMap.get(resourceType);??if(result!=null){??//傳入resourceId?執(zhí)行這段表達式獲得String型的grantType??return?result.apply(resourceId);??}??return?"查詢不到該優(yōu)惠券的發(fā)放方式";??}??
}

http://www.risenshineclean.com/news/12040.html

相關(guān)文章:

  • 網(wǎng)站專題頁面設(shè)計欣賞騰訊企業(yè)郵箱登錄入口
  • 武漢網(wǎng)站制作公司排名中國進入一級戰(zhàn)備狀態(tài)了嗎
  • oa辦公系統(tǒng)下載安裝seo引擎優(yōu)化專員
  • 泰安工作招聘seo企業(yè)站收錄
  • 網(wǎng)站開發(fā)一個多少錢bt磁力兔子引擎
  • 網(wǎng)站有哪些類型和它的成功案例微商怎么找客源人脈
  • 基層建設(shè)網(wǎng)站是不是停辦了做一個公司網(wǎng)站大概要多少錢
  • 廣州個人網(wǎng)站備案要多久貼吧推廣400一個月
  • vipkid網(wǎng)站開發(fā)團隊守游網(wǎng)絡(luò)推廣平臺登陸
  • 網(wǎng)站有很多304狀態(tài)碼口碑營銷公司
  • 如何做網(wǎng)站賺流量錢市場推廣外包團隊
  • 呼市建設(shè)官方網(wǎng)站四川網(wǎng)絡(luò)推廣seo
  • 上海地區(qū)網(wǎng)站建設(shè)百度指數(shù)預(yù)測
  • 網(wǎng)頁 代碼怎么做網(wǎng)站廣告推廣
  • 專業(yè)做公墓 陵園的網(wǎng)站網(wǎng)站seo去哪個網(wǎng)站找好
  • 商務(wù)網(wǎng)站規(guī)劃與網(wǎng)頁制作微信小程序開發(fā)工具
  • 網(wǎng)站做文獻格式福州百度seo排名
  • 朵朵軟件網(wǎng)站建設(shè)個人網(wǎng)站
  • 電子商務(wù)網(wǎng)站建設(shè)移動電商開發(fā)web網(wǎng)站模板
  • 中國建設(shè)銀行網(wǎng)站無法訪問國通快速建站
  • 徐州網(wǎng)站建設(shè)魔站設(shè)計網(wǎng)站都有哪些
  • 天津微信網(wǎng)站本地推廣最好用的平臺
  • 網(wǎng)站權(quán)重能帶來什么作用百度一下瀏覽器
  • 寧夏做網(wǎng)站建設(shè)公司最新國際新聞10條
  • 國外好的做電視包裝的網(wǎng)站鏈接轉(zhuǎn)二維碼
  • 豬八戒網(wǎng)做網(wǎng)站怎么樣今日新聞快報
  • 哪個網(wǎng)站做外貿(mào)好互聯(lián)網(wǎng)營銷師
  • 長沙自助模板建站百度官方免費下載安裝
  • 交易網(wǎng)站建設(shè)電商營銷策劃方案
  • 泉州公司做網(wǎng)站服裝品牌營銷策劃方案