package com.chinacreator.videoalliance.order.service; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.chinacreator.common.exception.BusinessException; import com.chinacreator.common.util.Base64; import com.chinacreator.common.util.UsermobUtil; import com.chinacreator.videoalliance.common.bean.AreaInfo; import com.chinacreator.videoalliance.common.bean.CPInfo; import com.chinacreator.videoalliance.common.dao.DictionaryDao; import com.chinacreator.videoalliance.common.dao.ProvinceControlDao; import com.chinacreator.videoalliance.common.util.AreaUtil; import com.chinacreator.videoalliance.common.util.ConfigUtil; import com.chinacreator.videoalliance.order.bean.*; import com.chinacreator.videoalliance.order.dao.*; import com.chinacreator.videoalliance.order.util.JsonUtil; import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang.time.DateFormatUtils; import org.apache.commons.lang.time.DateUtils; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import java.sql.SQLException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @Component public class OrderKsPreService { private static Logger log = Logger.getLogger("orderError"); @Autowired private SmCancelDao smCancelDao; @Autowired private OrderDao orderDao; @Autowired private BlackWhiteDao blackWhiteDao; @Autowired private SPDao spDao; @Autowired private DictionaryDao dictionaryDao; @Autowired private ProvinceControlDao provinceControlDao; @Autowired private VacOrderService vacOrderService; @Autowired private OrderLogDao orderLogDao; @Autowired private OrderSysDao sysDao; @Autowired private EcbService ecbService; @Autowired private EcbDiscntDao ecbDiscntDao; @Autowired private UnifiedAuthService unifiedAuthService; @Autowired private DingxiangOrderService dingxiangOrderService; @Autowired CapOrderService capOrderService; @Autowired CapKbxkQryDao capKbxkQryDao; @Autowired private ShareOrderService shareOrderService; @Autowired private OrderKsPreDao orderKsDao; private void checkUserid(OrderInfo orderInfo) throws Exception { String userid = orderInfo.getUserid(); if ((StringUtils.isEmpty(userid)) || ("null".equals(userid))) throw new BusinessException("7002", "手机号码无效", new String[0]); if (!UsermobUtil.isValid(userid)) { userid = ConfigUtil.decrypt(userid, orderInfo.getCpid()); userid = ConfigUtil.getUserid(userid, orderInfo.getCpid()); } if (!UsermobUtil.isValid(userid)) { throw new BusinessException("7002", "手机号码无效", new String[0]); } orderInfo.setUserid(userid); } public void checkCpInfo(OrderInfo orderInfo) throws Exception { CPInfo cpInfo = ConfigUtil.getCPInfo(orderInfo.getCpid(), null); if ((cpInfo.getStatus() != 0) && (cpInfo.getStatus() != 4)) { throw new BusinessException("9002", "该业务暂未开放,敬请期待。", new String[0]); } } private void checkSpInfo(OrderInfo orderInfo) throws Exception { SPInfo spInfo = getSPInfo(orderInfo); if (spInfo.getCanorder() == 1 && StringUtils.isEmpty(orderInfo.getOrderchannel())) { throw new BusinessException("9012", "该产品不支持订购操作", new String[0]); } if (orderInfo.getOrdertype() == 1) { if (spInfo.getType() != 0 && spInfo.getType() != 3) { throw new BusinessException("5305", "产品标识符无效", new String[0]); } if (spInfo.getType() == 0) { if (StringUtils.isEmpty(orderInfo.getVideoid())) { throw new BusinessException("8002", "{0}参数无效", new String[]{"videoid"}); } if (StringUtils.isEmpty(orderInfo.getVideoname())) throw new BusinessException("8002", "{0}参数无效", new String[]{"videoname"}); try { String videoname = new String(Base64.decodeBase64(orderInfo.getVideoname()), "UTF-8"); orderInfo.setVideoname(videoname); } catch (Exception e) { throw new BusinessException("8002", "{0}参数无效", new String[]{"videoname"}); } orderInfo.setEndtime(this.sysDao.getLastDay()); } else { orderInfo.setOrdertype(3); } } else if (orderInfo.getOrdertype() == 0) { if (spInfo.getType() == 0) { throw new BusinessException("5305", "产品标识符无效", new String[0]); } } else if (orderInfo.getOrdertype() == 2) { if (spInfo.getType() != 0) { throw new BusinessException("5305", "产品标识符无效", new String[0]); } orderInfo.setCachesucceed(0); } else { throw new BusinessException("8002", "{0}参数无效", new String[]{"ordertype"}); } orderInfo.setSpid(spInfo.getSpid()); } public void checkOrder(OrderInfo orderInfo) throws Exception { checkUserid(orderInfo); checkCpInfo(orderInfo); checkSpInfo(orderInfo); String userid = orderInfo.getUserid(); String cpid = orderInfo.getCpid(); String spid = orderInfo.getSpid(); String province = orderInfo.getProvince(); if (this.blackWhiteDao.isBlackUser(userid, orderInfo.getCpid())) { throw new BusinessException("9002", "用户为黑名单用户", new String[0]); } AreaInfo areaInfo = getAreaInfo(userid); orderInfo.setProvince(areaInfo.getProvince()); orderInfo.setArea(areaInfo.getArea()); CPInfo cpInfo = ConfigUtil.getCPInfo(orderInfo.getCpid(), areaInfo.getProvince()); if (cpInfo == null) { throw new BusinessException("7005", "CP标识无效", new String[0]); } String allowOrder = this.dictionaryDao.getValue("allowOrder"); if (("1".equals(allowOrder)) || (areaInfo.getStatus() == 1)) { throw new BusinessException("9002", "该业务暂未开放,敬请期待。", new String[0]); } if ((areaInfo.getProvince() != null) && (this.provinceControlDao.isNotOpen(areaInfo.getProvince()))) throw new BusinessException("9003", "您号码的归属地{0}暂未开放该业务,敬请期待。", new String[]{areaInfo.getProvince()}); if (this.orderDao.isOpen(orderInfo.getSpid(), orderInfo.getCpid(), orderInfo.getProvince())) { // status 为2 表示省份尚未开通 // throw new BusinessException("9003", "省份尚未开通此业务,敬请期待!"); if (!this.blackWhiteDao.isWhiteUserBySpid(userid, orderInfo.getCpid(), orderInfo.getSpid())) {//判断用户是否白名单,是则流程继续 throw new BusinessException("9003", "省份尚未开通此业务,敬请期待!"); } } } private AreaInfo getAreaInfo(String userid) throws Exception { AreaInfo areaInfo = AreaUtil.getAreaInfoByUserid(userid); if (areaInfo == null) { areaInfo = new AreaInfo(); } return areaInfo; } private SPInfo getSPInfo(OrderInfo orderInfo) throws Exception { SPInfo spInfo = null; if (StringUtils.isEmpty(orderInfo.getSpid())) spInfo = this.spDao.findDefaultByCP(orderInfo.getCpid()); else { spInfo = this.spDao.findById(orderInfo.getSpid()); } if (spInfo == null) { throw new BusinessException("5305", "产品标识符无效", new String[0]); } orderInfo.setSpid(spInfo.getSpid()); orderInfo.setMutex(spInfo.getMutex()); orderInfo.setRelationSp(spInfo.getRelationSp()); orderInfo.setPaytype(spInfo.getPaytype()); orderInfo.setErrorhandle(spInfo.getErrorhandle()); return spInfo; } public void order(OrderInfo orderInfo) throws Exception { order(orderInfo, null); } public boolean findKsPrs(OrderInfo orderInfo) throws SQLException { return orderKsDao.findKsPrs(orderInfo.getCpid(), orderInfo.getSpid(), orderInfo.getUserid()); } public void order(OrderInfo orderInfo, EcbProductInfo ecbProductInfo) throws Exception { String errorcode = "0"; String errorinfo = ""; String result = "0"; String BRAND_CODE = ""; String REMOVE_TAG = ""; String ACT_TAG = ""; String RSP_CODE = ""; String CUST_STATUS = ""; String valiVal = ""; String level = ""; boolean logflag = false; try { if (orderInfo.getOrdertype() != 2 && orderInfo.getOrdertype() != 3) { List listOrderInfo = orderDao.findByUser(orderInfo.getUserid()); if (listOrderInfo != null && listOrderInfo.size() > 0) { if (!StringUtils.isEmpty(orderInfo.getMutex())) { String[] mutexSpids = orderInfo.getMutex().trim().split(","); for (String mutexSpid : mutexSpids) { for (OrderInfo oldOrderInfo : listOrderInfo) { if (oldOrderInfo.getSpid().equals(orderInfo.getSpid()) && oldOrderInfo.getStatus() == 0) { throw new BusinessException("9010", "您已订购,请不要重复订购!", new String[0]); } if (oldOrderInfo.getSpid().equals(mutexSpid)) { throw new BusinessException("9011", "您已订购同类产品!", new String[0]); } } } } else { if (listOrderInfo != null && listOrderInfo.size() != 0) { for (OrderInfo oldOrderInfo : listOrderInfo) { if (oldOrderInfo.getSpid().equals(orderInfo.getSpid()) && oldOrderInfo.getStatus() == 0) { if (orderInfo.getCpid().equals("changshi") && ecbProductInfo != null && ecbProductInfo.getDiscntOrderState().equals("3") && orderInfo.getOrderchannel().equals("H5_ko")) { if (ecbDiscntDao.queryByUserid(orderInfo.getUserid(), ecbProductInfo.getDiscntValue(), 0) != null) { throw new BusinessException("9010", "用户续订,重复续订", new String[0]); } else { ecbService.order(orderInfo.getUserid(), orderInfo.getCpid(), orderInfo.getSpid(), ecbProductInfo); ecbDiscntDao.order(ecbProductInfo, orderInfo); this.orderDao.order(orderInfo); throw new BusinessException("9999", "用户续订", new String[0]); } } else if (orderInfo.getCpid().equals("changshi") && orderInfo.getSpid().equals("1040") && !orderInfo.getOrderchannel().equals("H5_ko")) { ecbService.order(orderInfo.getUserid(), orderInfo.getCpid(), orderInfo.getSpid(), ecbProductInfo); ecbDiscntDao.order(ecbProductInfo, orderInfo); this.orderDao.order(orderInfo); } else { throw new BusinessException("9010", "您已订购,请不要重复订购!", new String[0]); } } } } } } } else if (orderInfo.getOrdertype() == 3) { OrderInfo oldOrderInfo = orderDao.findByUser(orderInfo.getUserid(), orderInfo.getCpid(), orderInfo.getSpid()); if (oldOrderInfo != null && !StringUtils.isEmpty(oldOrderInfo.getEndtime())) { orderInfo.setEndtime(this.sysDao.getEndtimeForMonth(1, oldOrderInfo.getEndtime())); orderInfo.setOrdertime(oldOrderInfo.getOrdertime()); } else { orderInfo.setEndtime(this.sysDao.getEndtimeForMonth(1, DateFormatUtils.format(new Date(), "yyyyMMdd") + "235959")); } } if (!this.blackWhiteDao.isWhiteUser(orderInfo.getUserid(), orderInfo.getCpid())) { if (orderInfo.getPaytype() == 1) { result = ecbService.order(orderInfo.getUserid(), orderInfo.getCpid(), orderInfo.getSpid(), ecbProductInfo); if (ecbProductInfo != null) { ecbDiscntDao.order(ecbProductInfo, orderInfo); } } else if (orderInfo.getPaytype() == 2) { } else if (orderInfo.getPaytype() == 3) { ecbService.query(orderInfo.getUserid(), orderInfo.getCpid(), orderInfo.getSpid(), orderInfo.getProvince()); dingxiangOrderService.order(orderInfo.getUserid(), orderInfo.getCpid(), orderInfo.getSpid()); } else if (orderInfo.getPaytype() == 4) { /** * 增加能力共享平台订购入口 * zzb 2020-02-21 */ String currentTime = this.sysDao.getCurrentTime(); if (orderInfo.getOrdertime() == null) { orderInfo.setOrdertime(currentTime); } orderInfo.setChannel("SHARE"); orderKsDao.updateKsPre("3", "0", "取消预退订成功", orderInfo); log.info(orderInfo.getUserid() + "取消预退订成功"); errorinfo = "取消预退订成功"; /* shareOrderService.order(orderInfo.getUserid(), orderInfo.getCpid(), orderInfo.getSpid());*/ } else { String brand = ecbService.query(orderInfo.getUserid(), orderInfo.getCpid(), orderInfo.getSpid(), orderInfo.getProvince()); String accesstype = "1"; //sp/cp的二次认证方式: 1:H5认证 2:SDK认证 3:短信认证 4:页面认证 if (!StringUtils.isEmpty(orderInfo.getSeqnumber())) { accesstype = "3"; } //调cap综合用户查询接口和卡部信控接口 String capqrydata = null; try { capqrydata = capOrderService.capQuery(orderInfo.getUserid()); } catch (Exception e) { e.printStackTrace(); } if (capqrydata != null) { JSONObject capqryJson = JSON.parseObject(capqrydata); BRAND_CODE = capqryJson.getString("BRAND_CODE"); REMOVE_TAG = capqryJson.getString("REMOVE_TAG"); ACT_TAG = capqryJson.getString("ACT_TAG"); RSP_CODE = capqryJson.getString("RSP_CODE"); CUST_STATUS = capqryJson.getString("CUST_STATUS"); } String xkqrydata = null; try { xkqrydata = capOrderService.kbxkQuery(orderInfo.getUserid()); } catch (Exception e) { e.printStackTrace(); } if (xkqrydata != null) { JSONObject capqryJson = JSON.parseObject(xkqrydata); valiVal = capqryJson.getString("valiVal"); level = capqryJson.getString("level"); } logflag = true; //if("0004".equals(RSP_CODE)){ // throw new BusinessException("cap0004", "错误码cap0004", new String[0]); //} //if (unifiedAuthService.sycnOrder(orderInfo)) {CAP接口已包含统计认证,不用再验证 //订购,选择走CAP接口或是VAC接口 /* boolean hasvac = true; //是否调老vac接口 if (capOrderService.hasCap(orderInfo)) {//产品配置是走CAP orderInfo.setChannel("CAP"); hasvac = false; result = this.capOrderService.order(orderInfo, accesstype); if ("0008".equals(result)) { //不是4G用户,走原vac hasvac = true; } } log.info("userid=>" + orderInfo.getUserid() + ",brand=>" + brand + ",accesstype=>" + accesstype + ",hasvac=>" + hasvac); if (hasvac && unifiedAuthService.sycnOrder(orderInfo)) { //没有走CAP业务配置,或者不是4G用户,只有调vac才走统一认证验证 orderInfo.setChannel("VAC"); result = this.vacOrderService.order(orderInfo.getUserid(), orderInfo.getSpid(), orderInfo.getSeqnumber() == null ? "" : orderInfo.getSeqnumber(), orderInfo.getOrderchannel()); } //}*/ //全部走cap接口 orderInfo.setChannel("CAP"); this.capOrderService.order(orderInfo, accesstype); } } else if (orderInfo.getCpid().equals("changshi") && ecbProductInfo != null) { ecbDiscntDao.order(ecbProductInfo, orderInfo); } String currentTime = this.sysDao.getCurrentTime(); if (orderInfo.getOrdertime() == null) { orderInfo.setOrdertime(currentTime); } if (orderInfo.getEffecttime() == null) { orderInfo.setEffecttime(currentTime); } if (!result.equals("0") && orderInfo.getErrorhandle() == 0) { orderInfo.setOrderstatus(7); orderInfo.setIsexperience(1); orderInfo.setShowstatus("0"); } if (orderInfo.getOrdertype() != 2) { this.orderDao.order(orderInfo); } else { this.orderDao.countOrder(orderInfo); } } catch (Exception e) { log.error("userid:" + orderInfo.getUserid() + "订购出现异常," + e); e.printStackTrace(); errorcode = "8000"; errorinfo = "系统忙"; if ((e instanceof BusinessException)) { errorcode = ((BusinessException) e).getCode(); errorinfo = ((BusinessException) e).getMessage(); if (errorinfo.length() > 200) { errorinfo = errorinfo.substring(0, 200); } if (errorinfo.contains("cap订购失败")) { String errorinfo2 = "cap订购失败"; throw new BusinessException(errorcode, errorinfo2); } } if (!errorcode.equals("9999")) { throw e; } orderKsDao.updateKsPre("0", "8000", "取消预退订失败", orderInfo); } finally { saveLog(orderInfo, errorcode, errorinfo); CapKbxkQryBean capKbxkQryBean = new CapKbxkQryBean(); capKbxkQryBean.setUserid(orderInfo.getUserid()); capKbxkQryBean.setActtag(ACT_TAG); capKbxkQryBean.setBrandcode(BRAND_CODE); capKbxkQryBean.setCuststatus(CUST_STATUS); capKbxkQryBean.setRemovetag(REMOVE_TAG); capKbxkQryBean.setRspcode(RSP_CODE); capKbxkQryBean.setUserlevel(level); capKbxkQryBean.setValival(valiVal); capKbxkQryBean.setCpid(orderInfo.getCpid()); capKbxkQryBean.setSpid(orderInfo.getSpid()); if (logflag) { try { capKbxkQryDao.addCapKbxkQryLog(capKbxkQryBean); } catch (Exception e) { e.printStackTrace(); } } } } public void checkCancelOrder(OrderInfo orderInfo) throws Exception { String userid = orderInfo.getUserid(); checkUserid(orderInfo); AreaInfo areaInfo = getAreaInfo(userid); orderInfo.setProvince(areaInfo.getProvince()); orderInfo.setArea(areaInfo.getArea()); CPInfo cpInfo = ConfigUtil.getCPInfo(orderInfo.getCpid(), null); if (cpInfo == null) { throw new BusinessException("7005", "CP标识无效", new String[0]); } SPInfo spInfo = getSPInfo(orderInfo); if (spInfo.getCancancelorder() == 1 && StringUtils.isEmpty(orderInfo.getCancelchannel())) { throw new BusinessException("9011", "该产品不支持退订操作", new String[0]); } if (this.orderDao.hasTiyanValid(orderInfo.getUserid(), orderInfo.getCpid(), orderInfo.getSpid())) throw new BusinessException("9015", "该产品体验期未结束不支持退订操作", new String[0]); } public void cancelOrder(OrderInfo orderInfo) throws Exception { cancelOrder(orderInfo, null); } public void cancelOrder(OrderInfo orderInfo, EcbProductInfo ecbProductInfo) throws Exception { String errorcode = "0"; String errorinfo = ""; try { List listOrderInfo = orderDao.findByUser(orderInfo.getUserid()); OrderInfo relationOrder = null; if (listOrderInfo == null || listOrderInfo.size() == 0) { throw new BusinessException("9016", "退订失败,无该用户订购关系或者已失效", new String[0]); } boolean isHasOrder = false; boolean isHasOtherOrder = false; for (OrderInfo oldOrderInfo : listOrderInfo) { if (orderInfo.getSpid().equals(oldOrderInfo.getSpid())) { orderInfo.setOrdertime(oldOrderInfo.getOrdertime()); if (!StringUtils.isEmpty(oldOrderInfo.getEndtime())) { orderInfo.setEndtime(oldOrderInfo.getEndtime()); } if (oldOrderInfo.getStatus() != 0) { throw new BusinessException("9017", "退订失败,该用户已退订该产品", new String[0]); } isHasOrder = true; break; } } if (!StringUtils.isEmpty(orderInfo.getRelationSp())) { for (OrderInfo oldOrderInfo : listOrderInfo) { if (oldOrderInfo.getSpid().equals(orderInfo.getRelationSp()) && oldOrderInfo.getStatus() == 0) { relationOrder = orderInfo; relationOrder.setSpid(orderInfo.getRelationSp()); isHasOtherOrder = true; break; } } } if (!isHasOrder && !isHasOtherOrder) { throw new BusinessException("9018", "退订失败,该用户没有订购该产品或者已失效", new String[0]); } if (!this.blackWhiteDao.isWhiteUser(orderInfo.getUserid(), orderInfo.getCpid())) { if (orderInfo.getPaytype() == 1) { if (ecbProductInfo == null || (ecbProductInfo != null && (!ecbProductInfo.getDiscntOrderState().equals("2") || !ecbProductInfo.getDiscntFee().equals("0")))) { errorcode = ecbService.cancelOrder(orderInfo.getUserid(), orderInfo.getCpid(), orderInfo.getSpid(), orderInfo.getOrdertime(), ecbProductInfo); if (ecbProductInfo != null) { ecbDiscntDao.cancel(ecbProductInfo, orderInfo); } } } else if (orderInfo.getPaytype() == 2) { } else if (orderInfo.getPaytype() == 3) { dingxiangOrderService.cancel(orderInfo.getUserid(), orderInfo.getCpid(), orderInfo.getSpid()); } else if (orderInfo.getPaytype() == 4) { /** * 增加能力共享平台订购入口 * zzb 2020-02-21 */ orderInfo.setChannel("SHARE"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar cal = Calendar.getInstance(); cal.set(Calendar.DATE, 1); cal.roll(Calendar.DATE, -1); String oldDay = sdf.format(cal.getTime()); if (sdf.format(new Date()).equals(oldDay)) { //每月最后一天走能力平台 shareOrderService.cancel(orderInfo.getUserid(), orderInfo.getCpid(), orderInfo.getSpid()); } else { //添加到预处理表 Map info = new HashMap(); info.put("userid", orderInfo.getUserid()); info.put("cpid", orderInfo.getCpid()); info.put("spid", orderInfo.getSpid()); info.put("status", "0"); info.put("cancelTime", sdf.format(DateUtils.addDays(cal.getTime(), -1))); orderKsDao.insert(info); errorinfo = "快手预退订成功"; log.info(orderInfo.getUserid() + "预退订成功"); } } else { /* //退订,选择走CAP接口或是VAC接口 boolean hasvac = true; //是否调老vac接口 if (capOrderService.hasCap(orderInfo)) {//产品配置是走CAP orderInfo.setChannel("CAP"); hasvac = false; String result = this.capOrderService.cancel(orderInfo); if ("0008".equals(result)) { //不是4G用户,走原vac hasvac = true; } } if (hasvac) { //没有走CAP业务配置,或者不是4G用户 orderInfo.setChannel("VAC"); this.vacOrderService.cancelOrder(orderInfo.getUserid(), orderInfo.getSpid()); }*/ //全部都走cap接口 orderInfo.setChannel("CAP"); this.capOrderService.cancel(orderInfo); } } if (isHasOrder && isHasOtherOrder) { this.smCancelDao.cancelOrder(relationOrder); } if (!isHasOrder && isHasOtherOrder) { orderInfo.setSpid(orderInfo.getRelationSp()); } String currentTime = this.sysDao.getCurrentTime(); if (orderInfo.getCanceltime() != null) { orderInfo.setEndtime(getEndTime(orderInfo.getCanceltime())); } else { orderInfo.setCanceltime(currentTime); } if (orderInfo.getEffecttime() == null) { orderInfo.setEffecttime(currentTime); } if (orderInfo.getEndtime() == null) { orderInfo.setEndtime(this.sysDao.getEndDayOfCurrentMonth()); } this.orderDao.cancelOrder(orderInfo); } catch (Exception e) { log.error("userid:" + orderInfo.getUserid() + "退购出现异常," + e); errorcode = "8000"; errorinfo = "系统忙"; if ((e instanceof BusinessException)) { errorcode = ((BusinessException) e).getCode(); errorinfo = ((BusinessException) e).getMessage(); if (errorinfo.length() > 200) { errorinfo = errorinfo.substring(0, 200); } if (errorinfo.contains("cap退订失败")) { String errorinfo2 = "cap退订失败"; throw new BusinessException(errorcode, errorinfo2); } } if (!errorcode.equals("9998")) { throw e; } } finally { saveLog(orderInfo, errorcode, errorinfo); } } public String getEndTime(String endTimeStr) throws ParseException { Calendar calendar = Calendar.getInstance(); Date date = DateUtils.parseDate(endTimeStr.substring(0, 8), new String[]{"yyyyMMdd"}); calendar.setTime(date); String day = calendar.getActualMaximum(Calendar.DAY_OF_MONTH) + ""; String year = calendar.get(Calendar.YEAR) + ""; String month = calendar.get(Calendar.MONTH) + 1 < 10 ? "0" + (calendar.get(Calendar.MONTH) + 1) : calendar.get(Calendar.MONTH) + 1 + ""; return year + month + day + "235959"; } public void saveLog(OrderInfo orderInfo, String errorcode, String errorinfo) { OrderLog orderLog = new OrderLog(); orderLog.setApptype(orderInfo.getApptype()); orderLog.setArea(orderInfo.getArea()); if (orderInfo.getOrderchannel() != null) { orderLog.setChannel(orderInfo.getOrderchannel()); } else { orderLog.setChannel(orderInfo.getCancelchannel()); } orderLog.setOrderstatus(orderInfo.getOrderstatus()); orderLog.setStatus(orderInfo.getStatus()); orderLog.setCpid(orderInfo.getCpid()); orderLog.setIsexperience(orderInfo.getIsexperience()); orderLog.setOrdertype(orderInfo.getOrdertype() + ""); orderLog.setProvince(orderInfo.getProvince()); orderLog.setArea(orderInfo.getArea()); orderLog.setSpid(orderInfo.getSpid()); orderLog.setUserid(orderInfo.getUserid()); orderLog.setErrorcode(errorcode); orderLog.setErrorinfo(errorinfo); if (!orderInfo.getTimes().isEmpty()) { orderLog.setTimes((System.currentTimeMillis() - NumberUtils.toLong(orderInfo.getTimes())) + ""); } this.orderLogDao.addOrderLog(orderLog); } public static void main(String args[]) { Map map = new HashMap(); map.put("userid", "18673197465"); map.put("cpid", "tencent"); map.put("spid", "101"); String str = JsonUtil.objectToJson(map); String s = "5gLD5I2BeU+YKA8QQHD68AX13cto20yC0ilPkMG+fmI28Ey/hAWi3A=="; String s2 = "N1GrAYM4evTnTaPLzci9Dg=="; System.out.println(s2.length()); System.out.println(str); } }