Merge branch 'master' of http://60.1.1.230/backend/jieling_server
# Conflicts: # tablemanager/src/main/java/config/SRechargeCommodityConfig.javaback_recharge
commit
724a3b0fb4
|
@ -169,35 +169,81 @@ public class MongoUtil {
|
|||
String s1 = gson.toJson(user);//内存
|
||||
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonObject obj = (JsonObject) parser.parse(s1);
|
||||
JsonObject mem = (JsonObject) parser.parse(s1);
|
||||
JsonParser parser1 = new JsonParser();
|
||||
JsonObject obj1 = (JsonObject) parser1.parse(s); //也可以 不好排查
|
||||
if(obj.equals(obj1)){
|
||||
|
||||
JsonObject db = (JsonObject) parser1.parse(s);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
StringBuilder stringBuilder2 = new StringBuilder();
|
||||
if (equill(db, mem, stringBuilder, stringBuilder2)) {
|
||||
LOGGER.info("匹配" + byId.getId());
|
||||
}else {
|
||||
} else {
|
||||
File file1 = new File(SysUtil.getPath("conf/checkout_db" + id + ".txt"));
|
||||
try (PrintWriter printWriter = new PrintWriter(new FileOutputStream(file1));) {
|
||||
printWriter.print(s);
|
||||
printWriter.flush();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
prientFile(file1, stringBuilder, s);
|
||||
File file2 = new File(SysUtil.getPath("conf/checkout_mem" + id + ".txt"));
|
||||
try (PrintWriter printWriter = new PrintWriter(new FileOutputStream(file2));) {
|
||||
printWriter.print(s1);
|
||||
printWriter.flush();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
prientFile(file2, stringBuilder2, s1);
|
||||
|
||||
LOGGER.error("定期检查数据库对象数据一致性 err" + byId.getId());
|
||||
}
|
||||
|
||||
|
||||
}, new LinkedList<>(ids), 300);
|
||||
}
|
||||
|
||||
private static void prientFile(File file, StringBuilder stringBuilder, String s) {
|
||||
|
||||
try (PrintWriter printWriter = new PrintWriter(new FileOutputStream(file));) {
|
||||
printWriter.print(stringBuilder.toString());
|
||||
printWriter.print("\r\n\r\n");
|
||||
printWriter.print(s);
|
||||
printWriter.flush();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean equill(JsonObject o1, JsonObject o2, StringBuilder builder, StringBuilder builder2) {
|
||||
boolean is = true;
|
||||
try {
|
||||
Iterator<Map.Entry<String, JsonElement>> i = o1.entrySet().iterator();
|
||||
|
||||
while (i.hasNext()) {
|
||||
Map.Entry<String, JsonElement> e = i.next();
|
||||
String key = e.getKey();
|
||||
JsonElement value = e.getValue();
|
||||
if (value == null) {
|
||||
if (!(o2.get(key) == null && o2.has(key))) {
|
||||
builder.append("type0000:o1 k-v= [" + key + ":" + value + "]\r\n");
|
||||
builder2.append("type0000:o2 k-v= [" + key + ":" + o2.get(key) + "]\r\n");
|
||||
is = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (value instanceof JsonObject && o2.get(key) instanceof JsonObject) {
|
||||
if (!equill((JsonObject) value, (JsonObject) o2.get(key), builder, builder2)) {
|
||||
// builder.append("type111111:o1 = [" + o1 + "]\r\n");
|
||||
// builder2.append( "type111111:o2 = [" + o2 + "]\r\n");
|
||||
is = false;
|
||||
}
|
||||
} else {
|
||||
if (!value.equals(o2.get(key))) {
|
||||
builder.append("type22222:o1 k-v= [" + key + ":" + value + "]\r\n");
|
||||
builder2.append("type22222:o2 k-v= [" + key + ":" + o2.get(key) + "]\r\n");
|
||||
is = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (ClassCastException unused) {
|
||||
is = false;
|
||||
} catch (NullPointerException unused) {
|
||||
is = false;
|
||||
}
|
||||
|
||||
return is;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
package com.ljsd.jieling.db.mongo;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.gson.*;
|
||||
import com.ljsd.common.mogodb.LjsdMongoTemplate;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.ConfigurableApplicationContextManager;
|
||||
import com.ljsd.jieling.util.InnerMessageUtil;
|
||||
import com.ljsd.jieling.util.SysUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import util.MathUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
|
||||
public class MongoUtiltest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
try {
|
||||
File dbf3 = new File(SysUtil.getPath("conf/checkout_db10043724" + ".txt"));
|
||||
File memf3 = new File(SysUtil.getPath("conf/checkout_mem10043724" + ".txt"));
|
||||
|
||||
byte[] allbytes = Files.readAllBytes(dbf3.toPath());
|
||||
byte[] allbytes2 = Files.readAllBytes(memf3.toPath());
|
||||
String db = new String(allbytes, Charset.defaultCharset());
|
||||
String mem = new String(allbytes2, Charset.defaultCharset());
|
||||
|
||||
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonObject obj = (JsonObject) parser.parse(db);
|
||||
JsonParser parser1 = new JsonParser();
|
||||
JsonObject obj1 = (JsonObject) parser1.parse(mem);
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
StringBuilder stringBuilder2 = new StringBuilder();
|
||||
if (MongoUtil.equill(obj1, obj, stringBuilder,stringBuilder2)) {
|
||||
|
||||
System.out.println("匹配");
|
||||
} else {
|
||||
|
||||
File file3 = new File(SysUtil.getPath("conf/checkout_diffmem__" +dbf3.getName()+ ".txt"));
|
||||
try (PrintWriter printWriter = new PrintWriter(new FileOutputStream(file3));) {
|
||||
printWriter.print(stringBuilder.toString());
|
||||
printWriter.flush();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
File file4 = new File(SysUtil.getPath("conf/checkout_diffdb__" +dbf3.getName()+ ".txt"));
|
||||
try (PrintWriter printWriter = new PrintWriter(new FileOutputStream(file4));) {
|
||||
printWriter.print(stringBuilder2.toString());
|
||||
printWriter.flush();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -29,6 +29,7 @@ public interface GlobalItemType {
|
|||
int DECORATION = 17;//皮肤
|
||||
int RIDE = 18;//坐骑
|
||||
int JEWEL = 19;//宝器
|
||||
int SELECTSecretBox=20; // 自选宝箱(前端要区分)
|
||||
//物品使用类型
|
||||
int NO_USE = 0 ; //不使用
|
||||
int RANDOM_USE = 1; // 随机使用
|
||||
|
|
|
@ -136,6 +136,8 @@ public class CumulationData {
|
|||
public int ten_challenge_time;// 挑战十绝阵num次
|
||||
// public Map<Integer,Integer> finisin_daily_challenge_times;//完成type(0不限、1金币、2武将经验、3武将碎片、4兵魂、5谋略)的日常副本num次
|
||||
public Map<Integer,Integer> expedition_floor_times= new HashMap<>();//猎妖之路通过floor层num次
|
||||
public Map<Integer,Integer> itemUse = new HashMap<>(); //货币道具消耗
|
||||
|
||||
|
||||
public int decompose_times;//献祭武将次数
|
||||
public int death_path_times;// 击杀过关十绝阵num次
|
||||
|
|
|
@ -134,6 +134,7 @@ public class ExpeditionManager extends MongoBase {
|
|||
}
|
||||
|
||||
public WorldTreasureReward getWorldTreasureReward() {
|
||||
updateString("worldTreasureReward", worldTreasureReward);
|
||||
return worldTreasureReward;
|
||||
}
|
||||
|
||||
|
@ -146,6 +147,7 @@ public class ExpeditionManager extends MongoBase {
|
|||
}
|
||||
|
||||
public void setExpeditionLeve(int expeditionLeve) {
|
||||
updateString("expeditionLeve", expeditionLeve);
|
||||
this.expeditionLeve = expeditionLeve;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ public class GuildMyInfo extends MongoBase {
|
|||
curPos = path.remove(0);
|
||||
}
|
||||
setCurPos(curPos);
|
||||
setPath(path);
|
||||
setPreMoveTimestamp(timestamp);
|
||||
return curPos;
|
||||
}
|
||||
|
|
|
@ -847,11 +847,11 @@ public class ExpeditionLogic {
|
|||
continue;
|
||||
}
|
||||
Equip newequip = new Equip(uid, equip.getEquipId());
|
||||
if(isTemp){
|
||||
user.getExpeditionManager().addEquipToTemp(user, newequip);
|
||||
}else {
|
||||
// if(isTemp){
|
||||
// user.getExpeditionManager().addEquipToTemp(user, newequip);
|
||||
// }else {
|
||||
user.getExpeditionManager().addEquip(user, newequip);
|
||||
}
|
||||
// }
|
||||
|
||||
newHero.updateEquipPositionMap(next.getKey(), newequip.getId());
|
||||
}
|
||||
|
|
|
@ -94,9 +94,9 @@ public class ItemLogic {
|
|||
for (int j = 0; j <itemReward.length ; j++) {
|
||||
if (reward.length() == 0){
|
||||
reward = new StringBuilder();
|
||||
reward.append(itemReward[i]);
|
||||
reward.append(itemReward[j]);
|
||||
}else{
|
||||
reward.append("#").append(itemReward[i]);
|
||||
reward.append("#").append(itemReward[j]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -113,6 +113,7 @@ public enum MissionType {
|
|||
CAR_PLAY_TIMES(105),//参与车迟斗法num次
|
||||
CAR_PLAY_LOOT_TIME(106),//于车迟斗法中抢夺其他玩家积分num次
|
||||
RANDOM_All_TIMES(107),//使用募英殿内(即包含魂晶、友情、普通三种方式)任意类型招募武将num次
|
||||
ITEMUSE(108),//消耗代币(道具类型为1特殊类)itemid的数量达到num
|
||||
;
|
||||
|
||||
private int missionType;
|
||||
|
|
|
@ -133,6 +133,8 @@ public class DataManagerDistributor {
|
|||
judges.put(MissionType.CAR_PLAY_TIMES,new CarPlayManager());
|
||||
judges.put(MissionType.CAR_PLAY_LOOT_TIME,new CarPlayLootManager());
|
||||
judges.put(MissionType.RANDOM_All_TIMES,new RandomAllTypeTimes());
|
||||
judges.put(MissionType.ITEMUSE,new ItemUseDataManager());
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package com.ljsd.jieling.logic.mission.data;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Description: 货币类道具使用
|
||||
* Author: zsx
|
||||
* CreateDate: 2020/6/10 7:08
|
||||
*/
|
||||
public class ItemUseDataManager extends AbstractDataManager {
|
||||
@Override
|
||||
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object... parm) {
|
||||
if(parm.length==1&&parm[0] instanceof Map){
|
||||
((Map)parm[0]).forEach((o, o2) -> {
|
||||
int type =(int)o;
|
||||
int count =(int)o2;
|
||||
data.itemUse.merge(type,count,Integer::sum);
|
||||
});
|
||||
}
|
||||
return new CumulationData.Result(missionType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinish(User user, CumulationData data, int[][] cfgValue, Object... parm) {
|
||||
Integer orDefault = data.itemUse.getOrDefault(cfgValue[0][0], 0);
|
||||
return orDefault>=cfgValue[1][0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcess(User user, CumulationData data, int[] missionSubType) {
|
||||
return data.itemUse.getOrDefault(missionSubType[0], 0);
|
||||
}
|
||||
}
|
|
@ -112,6 +112,7 @@ public class MissionEventDistributor {
|
|||
typeList.add(MissionType.USER_CONSUMER_GEM);
|
||||
typeList.add(MissionType.USER_CONSUMER_STAMINA);
|
||||
typeList.add(MissionType.ENDLESS_CONSUME_ACTION);
|
||||
typeList.add(MissionType.ITEMUSE);
|
||||
eventEnumListMap.put(GameEvent.CONSUMER_MATERIAL,typeList);
|
||||
eventProcessor.put(GameEvent.CONSUMER_MATERIAL,new CumulationDataEventProcessor());
|
||||
|
||||
|
|
|
@ -515,6 +515,7 @@ public class ItemUtil {
|
|||
case GlobalItemType.DESIGNATION:
|
||||
case GlobalItemType.DECORATION:
|
||||
case GlobalItemType.RIDE:
|
||||
case GlobalItemType.SELECTSecretBox:
|
||||
itemType = GlobalItemType.ITEM;
|
||||
break;
|
||||
case GlobalItemType.RANDOM_ITME:
|
||||
|
@ -1263,9 +1264,9 @@ public class ItemUtil {
|
|||
for (int j = 0; j <sItem.getRewardGroup().length ; j++) {
|
||||
if (dropIds.length() == 0){
|
||||
dropIds = new StringBuilder();
|
||||
dropIds.append(sItem.getRewardGroup()[i]);
|
||||
dropIds.append(sItem.getRewardGroup()[j]);
|
||||
}else{
|
||||
dropIds.append("#").append(sItem.getRewardGroup()[i]);
|
||||
dropIds.append("#").append(sItem.getRewardGroup()[j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue