Merge branch 'master_dev' into master_otnew
commit
8a8a8a9831
|
@ -226,6 +226,10 @@ public enum ErrorCode implements IErrorCode {
|
|||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
public void setCodeId(int codeId) {
|
||||
this.codeId = codeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int code() {
|
||||
return codeId;
|
||||
|
|
|
@ -67,7 +67,7 @@ public class ErrorCodeException extends Exception {
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
return "[CODE: " + this.errorCode.code() + "][" + this.errorCode.message() + "][" +((super.getMessage()==null)?"":super.getMessage())+ "][" +((params!=null&¶ms.size()!=0)?params.toString():"")+"] ";
|
||||
return "[CODE: " + this.errorCode.code() + "][" + this.errorCode.message() + "][" +((super.getMessage()==null)?"":super.getMessage())+ "][" +((params!=null&& !params.isEmpty())?params.toString():"")+"] ";
|
||||
}
|
||||
|
||||
public List<String> getParams() {
|
||||
|
@ -75,6 +75,6 @@ public class ErrorCodeException extends Exception {
|
|||
}
|
||||
|
||||
public String getMessage() {
|
||||
return "" + super.getMessage();
|
||||
return super.getMessage();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
package com.ljsd.jieling.exception;
|
||||
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import util.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description: 逻辑异常包装类
|
||||
* Author: zsx
|
||||
* CreateDate: 2019/10/21 11:44
|
||||
*/
|
||||
public class ErrorTableException extends Exception {
|
||||
private int id;
|
||||
private String msg;
|
||||
private List<String> params;
|
||||
|
||||
public ErrorTableException(int id, String msg) {
|
||||
this.id = id;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public ErrorTableException(int id, String msg, List<String> params) {
|
||||
this.id = id;
|
||||
this.msg = msg;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public ErrorTableException(int id) {
|
||||
String message = SErrorCodeEerverConfig.errorTableMap.get(id);
|
||||
if (StringUtil.isEmpty(message)){
|
||||
this.id = -1;
|
||||
this.msg = "操作失败,并未找到错误码:{"+id+"},请联系管理员";
|
||||
}else {
|
||||
this.id = id;
|
||||
this.msg = message;
|
||||
}
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public void setParams(List<String> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return super.getMessage();
|
||||
}
|
||||
|
||||
public List<String> getParams() {
|
||||
return null == params ? new ArrayList<>() : params;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "[CODE: " + this.getCode() + "][" + this.getMsg() + "][" +((super.getMessage()==null)?"":super.getMessage())+ "][" +((params!=null&& !params.isEmpty())?params.toString():"")+"] ";
|
||||
}
|
||||
}
|
|
@ -15,6 +15,13 @@ public class Baubles extends PropertyItem{
|
|||
public Baubles() {
|
||||
}
|
||||
|
||||
// 克隆
|
||||
public Baubles(Baubles baubles) {
|
||||
super(baubles);
|
||||
this.masterId = baubles.getMasterId();
|
||||
this.blessList = new HashSet<>(baubles.getBlessList());
|
||||
}
|
||||
|
||||
public Baubles(int uid, int equipId) {
|
||||
super(uid, equipId);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,15 @@ public class PropertyItem extends MongoBase {
|
|||
this.equipId = equipId;
|
||||
}
|
||||
|
||||
// 克隆
|
||||
public PropertyItem(PropertyItem item) {
|
||||
this.id = item.getId();
|
||||
this.equipId = item.getEquipId();
|
||||
this.level = item.getLevel();
|
||||
this.buildLevel = item.getBuildLevel();
|
||||
this.heroId = item.getHeroId();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -286,22 +286,23 @@ public class CBean2Proto {
|
|||
HelpTypeEnum type = HelpTypeEnum.getType(hero.getPropertyId());
|
||||
// 英雄镜像
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
Hero clone = hero.clone();
|
||||
// 魂宝灵宝镜像
|
||||
List<PropertyItem> jewels = buildPropertyItemList(equipManager, hero.getJewelInfo());
|
||||
List<PropertyItem> jewels = buildPropertyItemList(equipManager, clone.getJewelInfo());
|
||||
// 法相
|
||||
List<PropertyItem> faxiangs = buildPropertyItemList(equipManager, hero.getFaxiangList());
|
||||
List<PropertyItem> faxiangs = buildPropertyItemList(equipManager, clone.getFaxiangList());
|
||||
// 结果返回,援助类型不在这里写
|
||||
HelpHero helpHero = new HelpHero();
|
||||
helpHero.setUid(user.getId());
|
||||
helpHero.setFunctionType(type);
|
||||
helpHero.setCreatTime(TimeUtils.now());
|
||||
helpHero.setHero(hero);
|
||||
helpHero.setHero(clone);
|
||||
helpHero.setState(0);
|
||||
helpHero.setJewels(jewels);
|
||||
helpHero.setFaxiangs(faxiangs);
|
||||
helpHero.setFourTotalTier(user.getPlayerInfoManager().getFourChallengeTotal());
|
||||
helpHero.setBaubles(equipManager.getBaubles(hero.getBauBlesId()));
|
||||
helpHero.setBaublesList(buildBaublesList(equipManager, hero.getBauBlesId()));
|
||||
helpHero.setBaubles(equipManager.getBaubles(clone.getBauBlesId()));
|
||||
helpHero.setBaublesList(buildBaublesList(equipManager, clone.getBauBlesId()));
|
||||
return helpHero;
|
||||
}
|
||||
|
||||
|
@ -309,17 +310,18 @@ public class CBean2Proto {
|
|||
* 克隆装备信息
|
||||
*/
|
||||
public static List<PropertyItem> buildPropertyItemList(EquipManager equipManager, Set<String> infoList){
|
||||
List<PropertyItem> List = new ArrayList<>();
|
||||
List<PropertyItem> items = new ArrayList<>();
|
||||
if (infoList == null || infoList.isEmpty()){
|
||||
return List;
|
||||
return items;
|
||||
}
|
||||
for (String id: infoList){
|
||||
PropertyItem item = equipManager.getEquip(id);
|
||||
if (item != null){
|
||||
List.add(item);
|
||||
PropertyItem clone = new PropertyItem(item);
|
||||
items.add(clone);
|
||||
}
|
||||
}
|
||||
return List;
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -337,10 +339,10 @@ public class CBean2Proto {
|
|||
if (blessList != null && !blessList.isEmpty()){
|
||||
for (String id: blessList){
|
||||
Baubles item = equipManager.getBaubles(id);
|
||||
if (item == null){
|
||||
continue;
|
||||
if (item != null){
|
||||
Baubles clone = new Baubles(item);
|
||||
list.add(clone);
|
||||
}
|
||||
list.add(item);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
|
|
@ -4,13 +4,16 @@ import manager.STableManager;
|
|||
import manager.Table;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Table(name ="ErrorCodeEerverConfig")
|
||||
public class SErrorCodeEerverConfig implements BaseConfig {
|
||||
private static Map<String ,SErrorCodeEerverConfig> errorCodeMap;
|
||||
private static Map<String ,SErrorCodeEerverConfig> errorCodeMap;
|
||||
public static Map<Integer,SErrorCodeEerverConfig> errorMap;
|
||||
public static Map<Integer, String> errorTableMap = new HashMap<>();
|
||||
|
||||
private int id;
|
||||
|
||||
private String key;
|
||||
|
@ -26,13 +29,15 @@ public class SErrorCodeEerverConfig implements BaseConfig {
|
|||
Map<Integer, SErrorCodeEerverConfig> config = STableManager.getConfig(SErrorCodeEerverConfig.class);
|
||||
Map<String ,SErrorCodeEerverConfig> errorCodeEerverConfigMap = new ConcurrentHashMap<>();
|
||||
Map<Integer,SErrorCodeEerverConfig> tempErrorMap = new ConcurrentHashMap<>();
|
||||
for (Map.Entry<Integer, SErrorCodeEerverConfig> entry :config.entrySet()){
|
||||
SErrorCodeEerverConfig sErrorCodeEerverConfig = entry.getValue();
|
||||
errorCodeEerverConfigMap.put(sErrorCodeEerverConfig.getkey(),sErrorCodeEerverConfig);
|
||||
tempErrorMap.put(sErrorCodeEerverConfig.getid(),sErrorCodeEerverConfig);
|
||||
Map<Integer,String> tableErrorMap = new HashMap<>();
|
||||
for (SErrorCodeEerverConfig errorConfig : config.values()) {
|
||||
errorCodeEerverConfigMap.put(errorConfig.getkey(),errorConfig);
|
||||
tempErrorMap.put(errorConfig.getid(),errorConfig);
|
||||
tableErrorMap.put(errorConfig.getid(), errorConfig.getvalue());
|
||||
}
|
||||
errorCodeMap = errorCodeEerverConfigMap;
|
||||
errorMap = tempErrorMap;
|
||||
errorTableMap = tableErrorMap;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue