123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185 |
- package com.chinacreator.process.job;
- import com.alibaba.fastjson.JSON;
- import com.alibaba.fastjson.JSONObject;
- import com.chinacreator.common.exception.BusinessException;
- import com.chinacreator.common.util.DESUtil;
- import com.chinacreator.common.util.MD5;
- import com.chinacreator.common.util.URLUtil;
- import com.chinacreator.process.bean.AreaInfo;
- import com.chinacreator.process.dao.*;
- import com.chinacreator.process.service.CShandleSmsTempService;
- import com.chinacreator.process.util.DesUtil;
- import com.chinacreator.process.util.HttpInvoke;
- import com.chinacreator.process.util.JsonUtil;
- import com.chinacreator.process.util.SHAUtil;
- import com.chinacreator.process.util.WriteLogUtil;
- import com.chinacreator.video.queue.MessageService;
- import com.chinacreator.video.queue.bean.MessagePipe;
- import org.apache.commons.lang.StringUtils;
- import org.apache.commons.lang.time.DateFormatUtils;
- import org.apache.log4j.Logger;
- import org.quartz.DisallowConcurrentExecution;
- import org.quartz.PersistJobDataAfterExecution;
- import org.springframework.beans.factory.annotation.Autowired;
- import java.net.URLEncoder;
- import java.sql.SQLException;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.*;
- /**
- * 使用短信模板发业务订购退订短信
- * @author xu.zhou
- * @date 20220415
- */
- @PersistJobDataAfterExecution
- @DisallowConcurrentExecution
- public class CShandleSmsTempJob {
- private Logger logger = Logger.getLogger("cssms");
-
- //private Logger log = Logger.getLogger(CShandleSmsConfJob.class);
- @Autowired
- private MqSmsTempConfDao mqSmsConfDao; // = new MqSmsTempConfDao();
- @Autowired
- private DictionaryDao dictionaryDao; // = new DictionaryDao();
- @Autowired
- private CallerAreacodeDao callerAreacodeDao; // = new CallerAreacodeDao();
-
- @Autowired
- private CommonDao commonDao; // = new CommonDao();
- @Autowired
- private MessageService messageService;
-
- @Autowired
- private CShandleSmsTempService cShandleSmsTempService;
-
- private String getMessageParam(String p){
- if(StringUtils.isEmpty(p)){
- return "";
- }else{
- return p;
- }
- }
- /**
- * 为空时返回一个空格,短信接口传空串会报错
- * @param p
- * @return
- */
- private String fullNullStr(String p){
- if(StringUtils.isEmpty(p)){
- return " ";
- }else{
- return p;
- }
- }
-
- private MessagePipe getTestMessagePipe(){
- MessagePipe mp = new MessagePipe();
- mp.addBody("userid", "13107418055");
- mp.addBody("cpid", "youtu");
- mp.addBody("spid", "1167");
- mp.addBody("busiType", "cancel_succ");
- mp.addBody("channel", "boyuan");
- mp.addBody("subchannel", "1234567890");
- mp.addBody("province", "湖南");
- return mp;
- }
-
- public void doProcess() throws Exception {
- WriteLogUtil.writeLong("业务短信CShandleSmsTempJob开始执行", logger, "CShandleSmsTempJob");//("业务短信CShandleSmsTempJob开始执行");
- //配置的发送开关为启用
- if ("0".equals(dictionaryDao.getValue("recivemq"))) {
- //logger.info("获取队列数据开始"+new Date().toLocaleString());
- List<MessagePipe> list = messageService.reciveBatchMessage("cssms", 500);
- //logger.info("获取队列数据结束"+new Date().toLocaleString());
- //List<MessagePipe> list = new ArrayList<MessagePipe>();
- //list.add(getTestMessagePipe());
- if (list != null && list.size() > 0) {
- logger.info("CShandleSmsTempJob短信需要发送的条数:" + list.size());
- HashMap logmap = new HashMap();
- for (MessagePipe messagePipe : list) {
- String resultcode = "";
- String errorinfo = "";
- logmap = new HashMap();
- logmap.put("job", "CShandleSmsTempJob");
- logmap.put("mqbody", messagePipe.getBody());
- String spid = (String) messagePipe.getBody().get("spid");
- String cpid = messagePipe.getBody().get("cpid") + "";
- String userid = (String) messagePipe.getBody().get("userid");
- String times = (String) messagePipe.getBody().get("times");
- String style = (String) messagePipe.getBody().get("style");
- String busiType = getMessageParam((String)messagePipe.getBody().get("busiType")); //业务类型
- String channel = getMessageParam((String)messagePipe.getBody().get("channel")); //渠道
- String subchannel = getMessageParam((String)messagePipe.getBody().get("subchannel"));//子渠道
- String province = getMessageParam((String)messagePipe.getBody().get("province")); //省份
- String param1 = getMessageParam((String)messagePipe.getBody().get("param1"));
- String param2 = getMessageParam((String)messagePipe.getBody().get("param2"));
- String param3 = getMessageParam((String)messagePipe.getBody().get("param3"));
- String staffid = getMessageParam((String)messagePipe.getBody().get("staffid"));//员工工号
- try {
- //对于没传省份的获取省份
- if (StringUtils.isEmpty(province)||"null".equals(province)){
- AreaInfo areaInfo = callerAreacodeDao.findByCallerhead(userid.substring(0, 7));
- province = areaInfo.getProvince();
- logmap.put("province",province);
- }
- //业务类型不能为空
- if(StringUtils.isEmpty(busiType)){
- throw new BusinessException("9007","参数busiType为空");
- }
-
- /**
- //短信表配置
- HashMap mqsmsconf = null;
- List<HashMap> confList = mqSmsConfDao.getConfListBySpid(spid, busiType);
- if(confList == null || confList.size() == 0){
- throw new BusinessException("9001","sp产品短信发送无配置");
- }
- **/
- //logmap.put("confList", confList);
- //配置表的业务类型
- //String confbusitype = "";
- /***
- * 验证配置数据
- * busitype必须相同
- * 获取配置信息排序:
- * 配置字段:CHANNEL, SUBCHANNEL, PROVCINCE, STARTTIME, ENDTIME
- *
- * 1. CHANNEL,SUBCHANNEL,PROVINCE,STARTTIME,ENDTIME有配置
- * 2. CHANNEL,SUBCHANNEL,PROVINCE有配置,但STARTTIME,ENDTIME无配置
- * 3. CHANNEL,PROVINCE,STARTTIME,ENDTIME有配置,SUBCHANNEL无配置
- * 4. CHANNEL,PROVINCE有配置,SUBCHANNEL,STARTTIME,ENDTIME无配置
- * 5. PROVINCE,STARTTIME,ENDTIME有配置,CHANNEL,SUBCHANNEL无配置
- * 6. PROVINCE有配置,CHANNEL,SUBCHANNEL,STARTTIME,ENDTIME无配置
- * 7. CHANNEL,SUBCHANNEL,STARTTIME,ENDTIME有配置,PROVINCE无配置
- * 8. CHANNEL,SUBCHANNEL有配置,,PROVINCE,STARTTIME,ENDTIME无配置
- * 9. CHANNEL,STARTTIME,ENDTIME有配置,PROVINCE,SUBCHANNEL无配置
- * 10. CHANNEL有配置,,PROVINCE,SUBCHANNEL,STARTTIME,ENDTIME无配置
- * 11. STARTTIME,ENDTIME有配置,CHANNEL,SUBCHANNEL,PROVINCE无配置
- * 12. 全都无配置
- */
-
- HashMap<String, String> bodyparams = new HashMap<String, String>();
- bodyparams.put("busiType", busiType); //业务类型
- bodyparams.put("channel", channel); //渠道
- bodyparams.put("subchannel", subchannel);//子渠道
- bodyparams.put("province", province); //省份
- bodyparams.put("param1", param1); //附加参数1
- bodyparams.put("param2", param2); //附加参数2
- bodyparams.put("param3", param3); //附加参数3
- bodyparams.put("userid", userid); //手机号码
- bodyparams.put("spid", spid); //SPID
- //获取配置信息
- //mqsmsconf = cShandleSmsTempService.getMqSmsConfBySort(confList, bodyparams, logmap);
-
- /**
- * 1. CHANNEL,SUBCHANNEL,PROVINCE,STARTTIME,ENDTIME有配置
- */
- /***
- if(mqsmsconf == null){
- for(HashMap tmphm : confList){
- confbusitype = tmphm.get("BUSITYPE").toString();
- //busiType完全相同,且有CHANNEL、SUBCHANNEL、PROVINCE都有配置
- if(confbusitype.equals(busiType)
- && tmphm.get("CHANNEL") != null && tmphm.get("CHANNEL").equals(channel)
- && tmphm.get("SUBCHANNEL") != null && tmphm.get("SUBCHANNEL").equals(subchannel)
- && tmphm.get("PROVINCE") != null && tmphm.get("PROVINCE").equals(province)
- && ( tmphm.get("STARTTIME") != null || tmphm.get("ENDTIME") != null )){
- //验证当前是否在配置的发送时间内
- if(valisendtime(tmphm)){
- mqsmsconf = tmphm;
- //跳出循环
- break;
- }else{
- logmap.put("valitime", "当前时间不在配置范围内");
- }
- }
- }
- }
- ***/
- /**
- * 2. CHANNEL,SUBCHANNEL,PROVINCE有配置,但STARTTIME,ENDTIME无配置
- */
- /***
- if(mqsmsconf == null){
- for(HashMap tmphm : confList){
- confbusitype = tmphm.get("BUSITYPE").toString();
- //busiType完全相同,且有CHANNEL、SUBCHANNEL、PROVINCE都有配置
- if(confbusitype.equals(busiType)
- && tmphm.get("CHANNEL") != null && tmphm.get("CHANNEL").equals(channel)
- && tmphm.get("SUBCHANNEL") != null && tmphm.get("SUBCHANNEL").equals(subchannel)
- && tmphm.get("PROVINCE") != null && tmphm.get("PROVINCE").equals(province)
-
- && tmphm.get("STARTTIME") == null
- && tmphm.get("ENDTIME") == null ){
- //验证当前是否在配置的发送时间内
- if(valisendtime(tmphm)){
- mqsmsconf = tmphm;
- //跳出循环
- break;
- }else{
- logmap.put("valitime", "当前时间不在配置范围内");
- }
- }
- }
- }
- ***/
- /*
- * 3. CHANNEL,PROVINCE,STARTTIME,ENDTIME有配置,SUBCHANNEL无配置
- */
- /***
- if(mqsmsconf == null){
- for(HashMap tmphm : confList){
- confbusitype = tmphm.get("BUSITYPE").toString();
- //busiType完全相同,且有CHANNEL、SUBCHANNEL、PROVINCE都有配置
- if(confbusitype.equals(busiType)
- && tmphm.get("CHANNEL") != null && tmphm.get("CHANNEL").equals(channel)
- && tmphm.get("PROVINCE") != null && tmphm.get("PROVINCE").equals(province)
- && ( tmphm.get("STARTTIME") != null || tmphm.get("ENDTIME") != null )
-
- && tmphm.get("SUBCHANNEL") == null
- ){
- //验证当前是否在配置的发送时间内
- if(valisendtime(tmphm)){
- mqsmsconf = tmphm;
- //跳出循环
- break;
- }else{
- logmap.put("valitime", "当前时间不在配置范围内");
- }
- }
- }
- }
- ***/
- /**
- * 4. CHANNEL,PROVINCE有配置,SUBCHANNEL,STARTTIME,ENDTIME无配置
- */
- /***
- if(mqsmsconf == null){
- for(HashMap tmphm : confList){
- confbusitype = tmphm.get("BUSITYPE").toString();
- //busiType完全相同,且有CHANNEL、SUBCHANNEL、PROVINCE都有配置
- if(confbusitype.equals(busiType)
- && tmphm.get("CHANNEL") != null && tmphm.get("CHANNEL").equals(channel)
- && tmphm.get("PROVINCE") != null && tmphm.get("PROVINCE").equals(province)
-
- && tmphm.get("SUBCHANNEL") == null
- && tmphm.get("STARTTIME") == null
- && tmphm.get("ENDTIME") == null
- ){
- //验证当前是否在配置的发送时间内
- if(valisendtime(tmphm)){
- mqsmsconf = tmphm;
- //跳出循环
- break;
- }else{
- logmap.put("valitime", "当前时间不在配置范围内");
- }
- }
- }
- }
- ***/
- /**
- * 5. PROVINCE,STARTTIME,ENDTIME有配置,CHANNEL,SUBCHANNEL无配置
- */
- /***
- if(mqsmsconf == null){
- for(HashMap tmphm : confList){
- confbusitype = tmphm.get("BUSITYPE").toString();
- //busiType完全相同,且有PROVINCE配置,PROVINCE配置优先
- if(confbusitype.equals(busiType) && tmphm.get("PROVINCE") != null && tmphm.get("PROVINCE").equals(province)
- && ( tmphm.get("STARTTIME") != null || tmphm.get("ENDTIME") != null )
-
- && tmphm.get("CHANNEL") == null
- && tmphm.get("SUBCHANNEL") == null){
- //验证当前是否在配置的发送时间内
- if(valisendtime(tmphm)){
- mqsmsconf = tmphm;
- //跳出循环
- break;
- }else{
- logmap.put("valitime", "当前时间不在配置范围内");
- }
- }
- }
- }
- ***/
- /**
- * 6. PROVINCE有配置,CHANNEL,SUBCHANNEL,STARTTIME,ENDTIME无配置
- */
- /***
- if(mqsmsconf == null){
- for(HashMap tmphm : confList){
- confbusitype = tmphm.get("BUSITYPE").toString();
- //busiType完全相同,且有PROVINCE配置,PROVINCE配置优先
- if(confbusitype.equals(busiType) && tmphm.get("PROVINCE") != null && tmphm.get("PROVINCE").equals(province)
-
- && tmphm.get("CHANNEL") == null
- && tmphm.get("SUBCHANNEL") == null
- && tmphm.get("STARTTIME") == null
- && tmphm.get("ENDTIME") == null ){
- //验证当前是否在配置的发送时间内
- if(valisendtime(tmphm)){
- mqsmsconf = tmphm;
- //跳出循环
- break;
- }else{
- logmap.put("valitime", "当前时间不在配置范围内");
- }
- }
- }
- }
- ***/
- /**
- * 7. CHANNEL,SUBCHANNEL,STARTTIME,ENDTIME有配置,PROVINCE无配置
- */
- /***
- if(mqsmsconf == null){
- for(HashMap tmphm : confList){
- confbusitype = tmphm.get("BUSITYPE").toString();
- //busiType完全相同,且有CHANNEL和SUBCHANNEL配置,SUBCHANNEL配置优先
- if(confbusitype.equals(busiType)
- && tmphm.get("CHANNEL") != null && tmphm.get("CHANNEL").equals(channel)
- && tmphm.get("SUBCHANNEL") != null && tmphm.get("SUBCHANNEL").equals(subchannel)
- && ( tmphm.get("STARTTIME") != null || tmphm.get("ENDTIME") != null )
-
- && tmphm.get("PROVINCE") == null
- ){
- //验证当前是否在配置的发送时间内
- if(valisendtime(tmphm)){
- mqsmsconf = tmphm;
- //跳出循环
- break;
- }else{
- logmap.put("valitime", "当前时间不在配置范围内");
- }
- }
- }
- }
- ***/
- /**
- * 8. CHANNEL,SUBCHANNEL有配置,,PROVINCE,STARTTIME,ENDTIME无配置
- */
- /***
- if(mqsmsconf == null){
- for(HashMap tmphm : confList){
- confbusitype = tmphm.get("BUSITYPE").toString();
- //busiType完全相同,且有CHANNEL和SUBCHANNEL配置,SUBCHANNEL配置优先
- if(confbusitype.equals(busiType)
- && tmphm.get("CHANNEL") != null && tmphm.get("CHANNEL").equals(channel)
- && tmphm.get("SUBCHANNEL") != null && tmphm.get("SUBCHANNEL").equals(subchannel)
-
- && tmphm.get("PROVINCE") == null
- && tmphm.get("STARTTIME") == null
- && tmphm.get("ENDTIME") == null
- ){
- //验证当前是否在配置的发送时间内
- if(valisendtime(tmphm)){
- mqsmsconf = tmphm;
- //跳出循环
- break;
- }else{
- logmap.put("valitime", "当前时间不在配置范围内");
- }
- }
- }
- }
- ***/
- /**
- * 9. CHANNEL,STARTTIME,ENDTIME有配置,PROVINCE,SUBCHANNEL无配置
- */
- /***
- if(mqsmsconf == null){
- for(HashMap tmphm : confList){
- confbusitype = tmphm.get("BUSITYPE").toString();
- //busiType完全相同,且有CHANNEL配置,CHANNEL配置优先
- if(confbusitype.equals(busiType)
- && tmphm.get("CHANNEL") != null && tmphm.get("CHANNEL").equals(channel)
- && ( tmphm.get("STARTTIME") != null || tmphm.get("ENDTIME") != null )
-
- && tmphm.get("PROVINCE") == null
- && tmphm.get("SUBCHANNEL") == null){
- //验证当前是否在配置的发送时间内
- if(valisendtime(tmphm)){
- mqsmsconf = tmphm;
- //跳出循环
- break;
- }else{
- logmap.put("valitime", "当前时间不在配置范围内");
- }
- }
- }
- }
- ***/
- /**
- * 10. CHANNEL有配置,,PROVINCE,SUBCHANNEL,STARTTIME,ENDTIME无配置
- */
- /***
- if(mqsmsconf == null){
- for(HashMap tmphm : confList){
- confbusitype = tmphm.get("BUSITYPE").toString();
- //busiType完全相同,且有CHANNEL配置,CHANNEL配置优先
- if(confbusitype.equals(busiType)
- && tmphm.get("CHANNEL") != null && tmphm.get("CHANNEL").equals(channel)
-
- && tmphm.get("PROVINCE") == null
- && tmphm.get("SUBCHANNEL") == null
- && tmphm.get("STARTTIME") == null
- && tmphm.get("ENDTIME") == null
- ){
- //验证当前是否在配置的发送时间内
- if(valisendtime(tmphm)){
- mqsmsconf = tmphm;
- //跳出循环
- break;
- }else{
- logmap.put("valitime", "当前时间不在配置范围内");
- }
- }
- }
- }
- ***/
- /**
- * 11. STARTTIME,ENDTIME有配置,CHANNEL,SUBCHANNEL,PROVINCE无配置
- */
- /***
- if(mqsmsconf == null){
- for(HashMap tmphm : confList){
- confbusitype = tmphm.get("BUSITYPE").toString();
- //busiType完全相同
- if(confbusitype.equals(busiType)
- && ( tmphm.get("STARTTIME") != null || tmphm.get("ENDTIME") != null )
-
- && tmphm.get("PROVINCE") == null
- && tmphm.get("SUBCHANNEL") == null
- && tmphm.get("CHANNEL") == null
- ){
- //验证当前是否在配置的发送时间内
- if(valisendtime(tmphm)){
- mqsmsconf = tmphm;
- //跳出循环
- break;
- }else{
- logmap.put("valitime", "当前时间不在配置范围内");
- }
- }
- }
- }
- ***/
- /**
- * 12. 全都无配置
- */
- /***
- if(mqsmsconf == null){
- for(HashMap tmphm : confList){
- confbusitype = tmphm.get("BUSITYPE").toString();
- //busiType完全相同
- if(confbusitype.equals(busiType)
- && tmphm.get("PROVINCE") == null
- && tmphm.get("SUBCHANNEL") == null
- && tmphm.get("CHANNEL") == null
- && tmphm.get("STARTTIME") == null
- && tmphm.get("ENDTIME") == null
- ){
- //验证当前是否在配置的发送时间内
- if(valisendtime(tmphm)){
- mqsmsconf = tmphm;
- //跳出循环
- break;
- }else{
- logmap.put("valitime", "当前时间不在配置范围内");
- }
- }
- }
- }
- ***/
- //验证业务类型完全相同的数据,优先级最低,默认先第一条,按时间排序
- /**
- if(mqsmsconf == null){
- for(HashMap tmphm : confList){
- confbusitype = tmphm.get("BUSITYPE").toString();
- //busiType完全相同
- if(confbusitype.equals(busiType)){
- //验证当前是否在配置的发送时间内
- if(valisendtime(tmphm)){
- mqsmsconf = tmphm;
- //跳出循环
- break;
- }else{
- logmap.put("valitime", "当前时间不在配置范围内");
- }
- }
- }
- }
- **/
- /**
- if(mqsmsconf == null || mqsmsconf.size() == 0){
- throw new BusinessException("9003","sp产品无对应业务短信配置");
- }
-
- //移除时间验证失败标记
- logmap.remove("valitime");
-
- //短信模板ID
- String smstempid = (String)mqsmsconf.get("SMSTEMPID");
-
- if(StringUtils.isEmpty(smstempid)){
- throw new BusinessException("9006","无模板ID配置");
- }
-
- logmap.put("mqsmsconf", mqsmsconf);
- **/
- /*****************发送时间验证开始*****************
- //发送时间验证
- String sendstarttime = (String)mqsmsconf.get("STARTTIME");
- String sendendtime = (String)mqsmsconf.get("ENDTIME");
-
- String currtime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
- logmap.put("currtime", currtime);
- //有配置短信发送开始时间,但当前时间小于开始时间
- if(!StringUtils.isEmpty(sendstarttime) && Long.parseLong(currtime) < Long.parseLong(sendstarttime)){
- throw new BusinessException("9004","未到短信发送开始时间");
- }
- //有配置短信发送结束时间,但当前时间大于结束时间
- if(!StringUtils.isEmpty(sendendtime) && Long.parseLong(currtime) > Long.parseLong(sendendtime)){
- throw new BusinessException("9005","已过短信发送结束时间");
- }
- *****************发送时间验证结束*****************/
-
- /***************************模板参数设置开始***************************/
- //获取调短信接口的模板参数
- //HashMap<String, String> invokeparams = cShandleSmsTempService.getInvokeparams(mqsmsconf, bodyparams,logmap);
-
- /****
- //短信参数
- String [] smsparamsArray = mqsmsconf.get("PARAMS").toString().split("\\|");
- //短信参数映射
- String [] smsparamsmappArray = mqsmsconf.get("PARAMSMAPP").toString().split("\\|");
- //获取mq表的参数映射
- String mqparamsmapp = (String)mqsmsconf.get("MQPARAMSMAPP");
- //有个性化配置映射,优先级高于TB_SMSTEMP_CONF的MQPARAMSMAPP配置
- if(!StringUtils.isEmpty(mqparamsmapp)){
- smsparamsmappArray = mqparamsmapp.split("\\|");
- }
- //调接口模板参数
- HashMap<String, String> invokeparams = new HashMap<String, String>();
- String param = "";
- //组建调接口模板参数
- for(int p = 0; p < smsparamsArray.length; p++){
- param = smsparamsArray[p];
- if("param1".equals(param)){ //自定义预留参数1
- if(!param.equals(smsparamsmappArray[p])){
- invokeparams.put(param, smsparamsmappArray[p]);
- }else{
- invokeparams.put(param, fullNullStr(param1));
- }
- }else if("param2".equals(param)){//自定义预留参数2
- if(!param.equals(smsparamsmappArray[p])){
- invokeparams.put(param, smsparamsmappArray[p]);
- }else{
- invokeparams.put(param, fullNullStr(param2));
- }
- }else if("param3".equals(param)){//自定义预留参数3
- if(!param.equals(smsparamsmappArray[p])){
- invokeparams.put(param, smsparamsmappArray[p]);
- }else{
- invokeparams.put(param, fullNullStr(param3));
- }
- }else if("oriuserid".equals(param)){//原始手机号码
- invokeparams.put(param, userid);
- }else if("userid".equals(param)){
- //模糊化
- String fulluserid = userid.substring(0, 3)+"****"+userid.substring(7);
- invokeparams.put(param, fulluserid);
- }else if("mm".equals(param)){
- invokeparams.put(param, DateFormatUtils.format(new Date(), "MM"));
- }else if("dd".equals(param)){
- invokeparams.put(param, DateFormatUtils.format(new Date(), "dd"));
- }else if("spname".equals(param)){
- if(!param.equals(smsparamsmappArray[p])){
- invokeparams.put(param, smsparamsmappArray[p]);
- }else{
- invokeparams.put(param, (String)mqsmsconf.get("SPNAME"));
- }
- }else if("price".equals(param)){
- if(!param.equals(smsparamsmappArray[p])){
- invokeparams.put(param, smsparamsmappArray[p]);
- }else{
- invokeparams.put(param, (String)mqsmsconf.get("PRICE"));
- }
- }else if("cpname".equals(param)){
- if(!param.equals(smsparamsmappArray[p])){
- invokeparams.put(param, smsparamsmappArray[p]);
- }else{
- invokeparams.put(param, fullNullStr((String)mqsmsconf.get("SMSCPNAME")));
- }
- }else if("maxflow".equals(param)){
- if(!param.equals(smsparamsmappArray[p])){
- invokeparams.put(param, smsparamsmappArray[p]);
- }else{
- String maxflow = (String)mqsmsconf.get("MAXFLOW");
- if(!StringUtils.isEmpty(maxflow)){
- try {
- //转为G
- maxflow = (Integer.parseInt(maxflow)/1024)+"";
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- invokeparams.put(param, maxflow);
- }
- }else if(param.indexOf("expdate") != -1){
- if(!param.equals(smsparamsmappArray[p])){
- invokeparams.put(param, smsparamsmappArray[p]);
- }else{
- if(param.split("-").length == 2){
- //计算当天时间加上多少天,含多少天,显示开始时间和结束时间
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
- //当前时间加多少天
- int day = Integer.parseInt(param.split("-")[1]);
- day = day - 1; //当天也包含
- Date currdate = new Date();
- Calendar ca = Calendar.getInstance();
- ca.setTime(currdate);
- ca.add(Calendar.DATE, day);
- Date enddate = ca.getTime();
- invokeparams.put(param, sdf.format(new Date())+"-"+sdf.format(enddate));
- }else{
- invokeparams.put(param, DateFormatUtils.format(new Date(), "yyyyMMdd"));
- }
- }
- }else if("mappid".equals(param)){//映射ID
- if(!param.equals(smsparamsmappArray[p])){
- invokeparams.put(param, smsparamsmappArray[p]);
- }else{
- //调接口获取mappid
- String mappid = getMappidByUserid(userid, logmap);
- //如果为空,赋值为空格
- if(StringUtils.isEmpty(mappid)) {
- mappid = " ";
- }
- invokeparams.put(param, mappid);
- }
- }else{//按配置的信息设置
- invokeparams.put(param, fullNullStr(smsparamsmappArray[p]));
- }
- }
- ****/
- /***************************模板参数设置结束***************************/
- /**
- logmap.put("invokeparams", JsonUtil.objectToJson(invokeparams));
-
- //调接口参数不为空
- if(invokeparams != null && invokeparams.size()>0){
- //调接口发送短信
- logmap.put("smstype", "sms117");
- String sendres = cShandleSmsTempService.sendSMS(userid,smstempid,JsonUtil.objectToJson(invokeparams),"sms117", logmap);
- logmap.put("sendres", sendres);
- //华胜数据查询小时问隔
- String huashengpushhour = dictionaryDao.getValue("huashengpushhour");
- //更新华胜推送表数据
- boolean updhuasheng = mqSmsConfDao.updHuaShengWaitInfo(userid, spid, busiType, huashengpushhour);
- logmap.put("updhuasheng", updhuasheng);
- }
- **/
- //第一条短信
- cShandleSmsTempService.sendFirSms(bodyparams,logmap);
- //第二条短信
- cShandleSmsTempService.sendSecSms(bodyparams,logmap);
- //下发退订成功营销短信
- cShandleSmsTempService.sendCancelYxSms(bodyparams,logmap);
- resultcode = "0";
- errorinfo = "ok";
- } catch (Exception e) {
- if (e instanceof BusinessException) {
- resultcode = ((BusinessException) e).getCode();
- errorinfo = ((BusinessException) e).getMessage();
- //非过期,无配置,走原流程
- /**
- if(logmap.get("valitime") == null && ("9001".equals(resultcode) || "9003".equals(resultcode) || "9006".equals(resultcode))){
- String mqres = inserMqCssms2(messagePipe);
- logmap.put("mqres", mqres);
- }
- **/
- }else{
- e.printStackTrace();
- resultcode = "8000";
- errorinfo = e.getMessage();
- }
- } finally {
- logmap.put("resultcode", resultcode);
- logmap.put("errorinfo", errorinfo);
- //写日志
- logger.info(JsonUtil.objectToJson(logmap));
- }
- }
- }
- }
- }
-
- /**
- * 判断当前时间是否在配置的时间范围内,如果有配置
- * @param mqsmsconf
- * @return true 未限制,false被限制
- */
- /**
- private boolean valisendtime(HashMap mqsmsconf){
- //默认为成功
- boolean res = true;
- //发送时间验证
- String sendstarttime = (String)mqsmsconf.get("STARTTIME");
- String sendendtime = (String)mqsmsconf.get("ENDTIME");
- String currtime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
- //有配置短信发送开始时间,但当前时间小于开始时间
- if(!StringUtils.isEmpty(sendstarttime) && Long.parseLong(currtime) < Long.parseLong(sendstarttime)){
- res = false;
- }
- //有配置短信发送结束时间,但当前时间大于结束时间
- if(!StringUtils.isEmpty(sendendtime) && Long.parseLong(currtime) > Long.parseLong(sendendtime)){
- res = false;
- }
- return res;
- }
- **/
-
- /**
- * 根据短信模板发送短信
- * @param userid
- * @param tempid 模板ID
- * @param params 参数变量
- * @param smstype 短信网关类型, sms117走117网关,smsjh走聚合网关
- * @return
- */
- /**
- private String sendSMS(String userid, String tempid, String params, String smstype) {
- String res = "";
- try {
- //获取发送短信的地址及其他配置
- HashMap confhm = commonDao.getInvokeUrlInfo("common", smstype, "2");
- if(confhm == null || confhm.size() == 0){
- throw new BusinessException("9011","无短信接口配置信息");
- }
- String invokeurl = confhm.get("INVOKEURL").toString();
- JSONObject params1 = JSONObject.parseObject((String)confhm.get("PARAM1"));
- String smsid = params1.getString("SMSID");
- String key = params1.getString("PWD");
- String method = params1.getString("METHOD");
- int timeout = params1.getInteger("TIMEOUT");
- String tls = params1.getString("TLS");
- //String invokeurl = dictionaryDao.getValue("newSmsSendUrl");
- //String smsid = dictionaryDao.getValue("mqsmssmsid");
- //String key = dictionaryDao.getValue("mqsmspwd");
- String contentid = tempid;
- String timestamp = System.currentTimeMillis() / 1000 + "";
- String usermob = DesUtil.encode(userid, key);
- String vars = params;
- String sign = SHAUtil.shaEncode(smsid + usermob + timestamp + vars + contentid + key).toLowerCase();
- //手机号码和参数转码
- usermob = URLEncoder.encode(usermob, "utf-8");
- vars = URLEncoder.encode(vars, "utf-8");
- String url = invokeurl+"?userid=" + usermob + "&smsid=" + smsid + "×tamp=" + timestamp + "&sign=" + sign + "&contentid=" + contentid + "&vars=" + vars;
- //logmap.put("invokeurl", url);
- //res = URLUtil.get(url);
- res = HttpInvoke.sendhttpsReqAll(method, url, null, null, timeout*1000, tls);
- } catch (Exception e) {
- e.printStackTrace();
- res = e.getMessage();
- }
- return res;
- }
- **/
-
- /**
- * 没切换的产品走原流程
- * @param messagePipe
- */
- /****
- public String inserMqCssms2(MessagePipe messagePipe) {
- String res = "fail";
- try {
- MessagePipe mpipe = new MessagePipe();
- mpipe.setHeader("cssms2");
- mpipe.addBody("spid", messagePipe.getBody().get("spid"));
- mpipe.addBody("cpid", messagePipe.getBody().get("cpid"));
- mpipe.addBody("userid", messagePipe.getBody().get("userid"));
- mpipe.addBody("times", messagePipe.getBody().get("times"));
- mpipe.addBody("style", messagePipe.getBody().get("style"));
- mpipe.addBody("busiType", messagePipe.getBody().get("busiType")); //业务类型
- mpipe.addBody("channel", messagePipe.getBody().get("channel")); //渠道
- mpipe.addBody("subchannel", messagePipe.getBody().get("subchannel"));//子渠道
- mpipe.addBody("province", messagePipe.getBody().get("province")); //省份
- mpipe.addBody("param1", messagePipe.getBody().get("param1"));
- mpipe.addBody("param2", messagePipe.getBody().get("param2"));
- mpipe.addBody("param3", messagePipe.getBody().get("param3"));
- mpipe.addBody("staffid", messagePipe.getBody().get("staffid"));//员工工号" +
- mpipe.addBody("origin", "tmpjob");//员工工号" +
-
- this.messageService.sendMessage(mpipe);
- res = "succ";
- } catch (Exception e) {
- e.printStackTrace();
- logger.error("超时异步重试队列推送出现异常," + e.getMessage());
- }
-
- return res;
- }
- ****/
-
- public static void main(String[] args) throws Exception {
- CShandleSmsTempJob job = new CShandleSmsTempJob();
- job.doProcess();
- }
-
- /**
- * 发送退订营销短信
- * @param userid 手机嘎巴
- * @param spid spid
- * @param busitype 业务类型
- * @param mainlogmap 主日志对象
- */
- /***
- private void sendCancelYxSms(HashMap<String, String> bodyparams, HashMap mainlogmap){
- String userid = bodyparams.get("userid");
- String spid = bodyparams.get("spid");
- String busitype = bodyparams.get("busiType");
- if(busitype.indexOf("cancel_succ") == -1){
- return;
- }
- String resultcode = "5000";
- String errorinfo = "";
- String phcpid = ""; //偏好CPID
- String hyspid = ""; //合约产品SPID
- HashMap<String, Object> logmap = new HashMap<String, Object>();
- HashMap<String, String> vargs = null;
- try {
- List<HashMap> dataList = mqSmsConfDao.qryCancelYxConf(busitype);
- if(dataList == null || dataList.size() == 0){
- throw new BusinessException("9002","业务类型【"+busitype+"】无营销配置");
- }
- logmap.put("hasconf", "0");//是否有配置
- logmap.put("userid", userid);
- logmap.put("busitype", busitype);
-
- //调柏源用户偏好接口
- String res = this.invokeCancelyx(userid, logmap);
- //res = "{\"code\":200,\"success\":true,\"data\":\"aiqy\",\"msg\":\"操作成功\"}";
- JSONObject resobj = JSONObject.parseObject(res);
- if(resobj.get("code") != null && resobj.getInteger("code") == 200
- && resobj.getBoolean("success") == true){ //调接口成功
- phcpid = resobj.getString("data");
- }
- //得到了偏好CP
- if(!StringUtils.isEmpty(phcpid)){
- //用户是否已订购偏好CP产品
- List<HashMap> relList = commonDao.qryRealByUserid(userid, phcpid, null,"2");
- //芒果CPID特殊处理,多一次查询
- if(relList == null || relList.size() == 0){
- //是mangtv,则再查一次mangtv16
- if("mangtv".equals(phcpid)){
- relList = commonDao.qryRealByUserid(userid, "mangtv16", null,"2");
- }else if("mangtv16".equals(phcpid)){//是mangtv16,则再查一次mangtv
- relList = commonDao.qryRealByUserid(userid, "mangtv", null,"2");
- }
- }
-
- //判断是否订购了后向产品,如果是,则剔除
- if(relList != null && relList.size()>0){
- Iterator<HashMap> it = relList.iterator();;
- HashMap hm = null;
- HashMap backconf = null;
- while(it.hasNext()){
- hm = it.next();
- //查询是否为后向产品
- backconf = commonDao.qryBackBusiBySpid((String)hm.get("SPID"));
- if(backconf != null && backconf.size() > 0){
- logger.info("后向产品不参与统计=>" + hm.get("SPID"));
- it.remove(); //移除对象
- }
- }
- //再次判断
- if(relList != null && relList.size()>0){
- throw new BusinessException("9013","已有【"+phcpid+"】订购关系");
- }
- }
-
- HashMap cancelyxconf = null;
- for(HashMap tmp : dataList){
- if(phcpid.equals(tmp.get("PHCPID"))){//有偏好CP配置
- cancelyxconf = tmp;
- break;
- }
- }
-
- //有营销配置
- if(cancelyxconf != null){
- logmap.put("cancelyxconf", cancelyxconf);
- hyspid = cancelyxconf.get("HYSPID").toString();
- //获取合约产品的合约期
- HashMap hymap = commonDao.qryHyProduct(hyspid);
- if(hymap == null || hymap.size() == 0){
- throw new BusinessException("9014","合约产品【"+hyspid+"】无有效期配置");
- }
- int month = Integer.parseInt(hymap.get("MONTH").toString());
- //查询是否订购了合约产品
- List<HashMap> relList2 = commonDao.qryRealByUserid(userid, null, hyspid, null);
- //订购了合约主品,已失效
- if(relList2 != null && relList2.size()>0){
- boolean hasRetryOrder = mqSmsConfDao.hasRetryOrder(userid, hyspid, month);
- if(!hasRetryOrder){
- throw new BusinessException("9015","上次订购合约产品的合约期未到期,hyspid【"+hyspid+"】,month【"+month+"】");
- }
- }
- //是否成功发送过营销短信,且已超过合约期的月份
- //boolean hasRetrySendSms = mqSmsConfDao.hasRetrySendSms(userid, hyspid, month);
- //if(!hasRetrySendSms){
- //throw new BusinessException("9016","上次发送营销短信未超过合约期,hyspid【"+hyspid+"】,month【"+month+"】");
- //}
-
- //获取调接口参数
- vargs = matchParam(cancelyxconf, userid);
- logmap.put("营销模板参数", vargs);
- if(vargs == null || vargs.size() == 0){
- throw new BusinessException("9008","退订营销短信无模板参数匹配");
- }
- //模板ID
- String smstempid = (String)cancelyxconf.get("SMSTEMPID");
- logmap.put("营销模板ID", smstempid);
- logmap.put("smstype", "smsjh");
- //调短信发送接口
- String smsres = sendSMS(userid,smstempid,JsonUtil.objectToJson(vargs),"smsjh");
- //smsres = "{\"resultcode\":\"0\",\"errorinfo\":\"\",\"taskid\":\"202208191529181184600\",\"ssmsid\":null}";
- logmap.put("发送营销短信响应报文", smsres);
- JSONObject smsresobj = JSONObject.parseObject(smsres);
- if("0".equals(smsresobj.getString("resultcode"))){
- resultcode = "0";
- errorinfo = "ok";
- }else{
- resultcode = "9099";
- errorinfo = "发送短信失败," + smsres;
- }
- }else{
- throw new BusinessException("9009","偏好CP无模板配置【"+phcpid+"】");
- }
- }else{
- throw new BusinessException("9019","柏源接口无偏好CP返回");
- }
- } catch (Exception e) {
- if (e instanceof BusinessException) {
- resultcode = ((BusinessException)e).getCode();
- errorinfo = ((BusinessException)e).getMessage();
- }else{
- e.printStackTrace();
- resultcode = "8000";
- errorinfo = e.getMessage();
- }
- } finally {
- //有配置则记录数据,输出日志
- if("0".equals(logmap.get("hasconf"))){
- logmap.put("resultcode", resultcode);
- logmap.put("errorinfo", errorinfo);
- try {
- HashMap<String, String> params = new HashMap<String, String>();
- params.put("HYSPID", hyspid);
- params.put("SPNAME", commonDao.qrySpinfoBySpid(spid).get("SPNAME")+"");
- params.put("PHCPID", phcpid);
- params.put("USERID", userid);
- params.put("RESULTCODE", resultcode);
- params.put("ERRORINFO", errorinfo);
- params.put("BUSITYPE", busitype);
- params.put("SPID", spid);
- params.put("VARGS", (vargs == null ? null : vargs.toString()));
- params.put("OUTPARAMS", (String)logmap.get("invokeres"));
- boolean flag = mqSmsConfDao.addCancelyxRec(params);
- logmap.put("addCancelyxRec", flag);
- } catch (Exception e) {
- e.printStackTrace();
- logmap.put("addCancelyxRec", "false "+e.getMessage());
- }
- //输出日志
- //logger.info(logmap);
- mainlogmap.put("cancelyxsms", logmap);
- }
- }
- }
- ***/
-
-
- /**
- * 匹配调模板参数
- * @param mqsmsconf
- * @param userid
- * @return
- */
- /**
- private HashMap<String, String> matchParam(HashMap mqsmsconf, String userid){
- //短信参数
- String [] smsparamsArray = mqsmsconf.get("PARAMS").toString().split("\\|");
- //短信参数映射
- String [] smsparamsmappArray = mqsmsconf.get("PARAMSMAPP").toString().split("\\|");
- //获取mq表的参数映射
- String mqparamsmapp = (String)mqsmsconf.get("MQPARAMSMAPP");
- //有个性化配置映射,优先级高于TB_SMSTEMP_CONF的MQPARAMSMAPP配置
- if(!StringUtils.isEmpty(mqparamsmapp)){
- smsparamsmappArray = mqparamsmapp.split("\\|");
- }
- //调接口模板参数
- HashMap<String, String> invokeparams = new HashMap<String, String>();
- String param = "";
- //组建调接口模板参数
- for(int p = 0; p < smsparamsArray.length; p++){
- param = smsparamsArray[p];
- if("oriuserid".equals(param)){//原始手机号码
- invokeparams.put(param, userid);
- }else if("userid".equals(param)){
- //模糊化
- String fulluserid = userid.substring(0, 3)+"****"+userid.substring(7);
- invokeparams.put(param, fulluserid);
- }else{//按配置的信息设置
- invokeparams.put(param, fullNullStr(smsparamsmappArray[p]));
- }
- }
-
- return invokeparams;
- }
- **/
-
- /**
- * 调柏源用户偏好接口
- * @param userid
- * @return
- * @throws Exception
- */
- /**
- private String invokeCancelyx(String userid, HashMap<String, Object> logmap) throws Exception{
- String res = "";
- try {
- HashMap confhm = commonDao.getInvokeUrlInfo("activeprocess", "foreigngetCpid", "1");
- if(confhm == null || confhm.size() == 0){
- throw new BusinessException("9012","无柏源接口配置信息");
- }
- logmap.put("invokeconf", confhm);
- String url = confhm.get("INVOKEURL").toString();
- JSONObject params1 = JSONObject.parseObject((String)confhm.get("PARAM1"));
- String method = params1.getString("METHOD");
- int timeout = params1.getInteger("TIMEOUT");
- String tls = params1.getString("TLS");
- String contentttype = params1.getString("CONTENTTYPE");
- String channel = params1.getString("CHANNEL");
- //加密KEY
- String despwd = params1.getString("DESPWD");
- Map reqProperty = new HashMap();
- reqProperty.put("Content-type", contentttype);
- JSONObject content = new JSONObject();
- if(StringUtils.isEmpty(despwd)){ //密钥为空,参数不加密
- content.put("phone", userid);
- }else{
- //content.put("phone", EnDecHelper2.encodeByPwd(userid, despwd));
- content.put("phone", DesUtil.encode(userid, despwd));
- }
-
- logmap.put("invokeparams", userid+"=>"+content.toJSONString());
- res = HttpInvoke.sendhttpsReqAll(method, url, content.toJSONString(), reqProperty, timeout*1000, tls);
- logmap.put("invokeres", res);
- } catch (Exception e) {
- if (e instanceof BusinessException) {
- throw e;
- }else{
- e.printStackTrace();
- throw new BusinessException("8000","调柏源用户偏好接口出现异常,"+e.getMessage());
- }
- }
- return res;
- }
- **/
-
- /**
- * 根据手机号码获取映射ID,用于页面自动登录
- * @param userid
- * @return
- */
- /**
- private String getMappidByUserid(String userid, HashMap<String, Object> logmap){
- String mappid = "";
- String resultcode = "5000";
- String errorinfo = "";
- HashMap<String, Object> tmplogmap = new HashMap<String, Object>();
- try {
- HashMap confhm = commonDao.getInvokeUrlInfo("univideo", "usermappqrymappid", "2");
- if(confhm == null || confhm.size() == 0){
- throw new BusinessException("9012","无柏源接口配置信息");
- }
-
- String url = confhm.get("INVOKEURL").toString();
- JSONObject params1 = JSONObject.parseObject((String)confhm.get("PARAM1"));
- String method = params1.getString("METHOD");
- int timeout = params1.getInteger("TIMEOUT");
- String tls = params1.getString("TLS");
- String contentttype = params1.getString("CONTENTTYPE");
- String channel = params1.getString("CHANNEL");
- //加密KEY
- String pwd = params1.getString("PWD");
- Map reqProperty = new HashMap();
- if(!StringUtils.isEmpty(contentttype)){
- reqProperty.put("Content-type", contentttype);
- }
- String account = userid;
- String timestamp = (System.currentTimeMillis())/1000+"";
- account = DesUtil.encode(account, pwd);
- String signature = account+channel+timestamp+pwd;
- signature = MD5.MD5Encode(signature);
- JSONObject params = new JSONObject();
- params.put("account", account);
- params.put("channel", channel);
- params.put("timestamp", timestamp);
- params.put("signature", signature);
- tmplogmap.put("invokeparams", params.toJSONString());
- String res = "";
- if(url.startsWith("https")){
- res = HttpInvoke.sendhttpsReqAll(method, url, params.toJSONString(), reqProperty, timeout*1000, tls);
- }else{
- res = HttpInvoke.sendHttpByPost(method, url, params.toJSONString(), reqProperty, timeout*1000);
- }
-
- tmplogmap.put("invokeres", res);
-
- //{"resultcode":"0","errorinfo":"ok","data":{"userid":"UooUmz1MQgSRsKdMZVpGIQ==","mappid":"9e888164125f44359943d48b566355da"}}
-
- if(!StringUtils.isEmpty(res)){
- JSONObject tmp = JSONObject.parseObject(res);
- resultcode = tmp.getString("resultcode");
- errorinfo = tmp.getString("errorinfo");
- if(tmp.getJSONObject("data") != null){
- mappid = tmp.getJSONObject("data").getString("mappid");
- }
- }
- } catch (Exception e) {
- if (e instanceof BusinessException) {
- resultcode = ((BusinessException)e).getCode();
- errorinfo = ((BusinessException)e).getMessage();
- }else{
- e.printStackTrace();
- resultcode = "8000";
- errorinfo = "获取映射ID出现异常,"+e.getMessage();
- }
- } finally {
- tmplogmap.put("resultcode", resultcode);
- tmplogmap.put("errorinfo", errorinfo);
- logmap.put("getMappidByUserid", tmplogmap);
- }
-
- return mappid;
- }
- **/
- }
|