generated from root/miduo_server
返利错误,查询道具
parent
e06c0a04e2
commit
d278513f5b
|
|
@ -2,15 +2,19 @@ package com.jmfy.controller;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
import com.jmfy.dao.BanFuctionDao;
|
||||
import com.jmfy.dao.ItemDao;
|
||||
import com.jmfy.dao.ServerInfoDao;
|
||||
import com.jmfy.dao.UserInfoDao;
|
||||
import com.jmfy.model.*;
|
||||
import com.jmfy.model.vo.HeroHotRankVo;
|
||||
import com.jmfy.model.vo.ItemLogVo;
|
||||
import com.jmfy.model.vo.RechargeInfo;
|
||||
import com.jmfy.redisProperties.RedisUserKey;
|
||||
import com.jmfy.thrift.idl.Result;
|
||||
import com.jmfy.utils.*;
|
||||
import config.SItemConfig;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
|
|
@ -22,11 +26,13 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
@Controller
|
||||
|
|
@ -39,32 +45,49 @@ public class GmController {
|
|||
private UserInfoDao userInfoDao;
|
||||
@Resource
|
||||
private BanFuctionDao banFuctionDao;
|
||||
@Resource
|
||||
private ItemDao itemDao;
|
||||
|
||||
private int htmlLikeId = 0;
|
||||
|
||||
@RequestMapping(value = "/sendGm", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody
|
||||
int publishNotice(HttpServletRequest request) throws Exception {
|
||||
int publishNotice(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
|
||||
List<String> serverList = new ArrayList<>();
|
||||
allServerInfo.forEach(v->serverList.add(v.getServer_id()));
|
||||
allServerInfo.forEach(v -> serverList.add(v.getServer_id()));
|
||||
String cmd = request.getParameter("content");
|
||||
// 订单返利
|
||||
if(cmd.equals("recharge")){
|
||||
if (cmd.equals("recharge")) {
|
||||
recharge();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 修改服务器状态 serverstatus#10001#-2
|
||||
if (cmd.contains("serverstatus")){
|
||||
if (cmd.contains("serverstatus")) {
|
||||
String[] split = cmd.split("#");
|
||||
serverInfoDao.updateServerInfo(split[1],split[2]);
|
||||
serverInfoDao.updateServerInfo(split[1], split[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
String serverId = request.getParameter("serverId");
|
||||
if (StringUtil.isEmpty(serverId)){
|
||||
if (StringUtil.isEmpty(serverId)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 删除道具
|
||||
if (cmd.contains("deletemailiteminfo")){
|
||||
TaskKit.scheduleWithFixedOne(() -> {
|
||||
try {
|
||||
createExcelToItem(cmd,serverId,response);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("删除邮件道具查询报错:{}",e.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
},1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
String[] split = serverId.split(",");
|
||||
for (String str : split) {
|
||||
if (!serverList.contains(str)) {
|
||||
|
|
@ -74,12 +97,12 @@ public class GmController {
|
|||
//TODO 分服
|
||||
String rpcString = RedisUtil.getInstence().getObject(RedisUserKey.LOGIC_SERVER_INFO, String.valueOf(str), String.class, -1);
|
||||
System.out.println(rpcString);
|
||||
if(null==rpcString){
|
||||
if (null == rpcString) {
|
||||
throw new Exception("serverAddress not exist");
|
||||
}
|
||||
String thriftIp = rpcString.split(":")[0];
|
||||
System.out.println(thriftIp);
|
||||
String thriftPort = rpcString.split(":")[1];
|
||||
String thriftPort = rpcString.split(":")[1];
|
||||
System.out.println(thriftPort);
|
||||
if (thriftIp == null || thriftIp.isEmpty() || null == thriftPort || thriftPort.isEmpty()) {
|
||||
return -1;
|
||||
|
|
@ -87,7 +110,7 @@ public class GmController {
|
|||
Result result = RPCClient.gmSend(cmd, thriftIp, thriftPort);
|
||||
//异常或者错误
|
||||
if (result.getResultCode() != 0) {
|
||||
System.out.println("===================发送gm返回异常:"+result.getResultMsg());
|
||||
System.out.println("===================发送gm返回异常:" + result.getResultMsg());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
@ -98,15 +121,225 @@ public class GmController {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public int getHtmlLikeId() {
|
||||
htmlLikeId++;
|
||||
if (htmlLikeId >= Integer.MAX_VALUE){
|
||||
htmlLikeId = 0;
|
||||
/**
|
||||
* 创角删除道具的excel文件
|
||||
* @param content
|
||||
* @param serverIds
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
private void createExcelToItem(String content, String serverIds, HttpServletResponse response) throws Exception {
|
||||
LOGGER.info("删除道具0209============开始");
|
||||
// type#reason#start#end
|
||||
String[] strings = content.split("#");
|
||||
// 服务器列表
|
||||
String[] serverList = serverIds.split(",");
|
||||
|
||||
Map<String, ServerInfo> serverMap = serverInfoDao.getAllServerMap();
|
||||
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
|
||||
for (String serverId : serverList) {
|
||||
ServerInfo info = serverMap.get(serverId);
|
||||
if (info == null){
|
||||
continue;
|
||||
}
|
||||
CItemParam param = new CItemParam();
|
||||
param.setServerId(Integer.parseInt(serverId));
|
||||
param.setType(Integer.parseInt(strings[1]));
|
||||
param.setReason(Integer.parseInt(strings[2]));
|
||||
param.setStartTime(strings[3]);
|
||||
param.setEndTime(strings[4]);
|
||||
|
||||
List<CItemInfo> item2 = itemDao.getItem2(param);
|
||||
List<ItemLogVo> logVoList = ItemInfoToV(item2, serverId);
|
||||
LOGGER.info("删除道具0209,查询道具,区服:{},数量:{}============",info.getName(),logVoList.size());
|
||||
// 添加sheet
|
||||
createExcelToSheet(wb, logVoList, info.getName());
|
||||
LOGGER.info("删除道具0209,创建区服:{}============",info.getName());
|
||||
}
|
||||
return htmlLikeId;
|
||||
|
||||
//第六步将生成excel文件保存到指定路径下
|
||||
String osName = System.getProperty("os.name");
|
||||
String path;
|
||||
if (Pattern.matches("Linux.*", osName)) {
|
||||
path = "/data/jieling/玩家道具信息"+DateUtil.nowInt()+".xls";
|
||||
} else {
|
||||
path = "D:/Program Files (x86)/Quick/Downloads/玩家道具信息"+DateUtil.nowInt()+".xls";
|
||||
}
|
||||
|
||||
LOGGER.info("删除道具0209,文件地址:{}============",path);
|
||||
|
||||
try {
|
||||
FileOutputStream fout = new FileOutputStream(path);
|
||||
wb.write(fout);
|
||||
fout.close();
|
||||
|
||||
LOGGER.info("删除道具0209,下载本地完成:{}============",path);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
LOGGER.info("Excel文件生成成功...");
|
||||
}
|
||||
|
||||
// 下载
|
||||
// createExcelToDownload(path,response);
|
||||
}
|
||||
|
||||
private String getHeroHotRankKey(int subRank){
|
||||
/**
|
||||
* 封装vo对象
|
||||
* @param item2
|
||||
* @param serverId
|
||||
* @return
|
||||
*/
|
||||
private List<ItemLogVo> ItemInfoToV(List<CItemInfo> item2, String serverId){
|
||||
Map<Integer, String> itemNameMap = FileCacheUtils.itemNameMap;
|
||||
LinkedList<ItemLogVo> logVos = new LinkedList<>();
|
||||
for (CItemInfo info : item2) {
|
||||
ItemLogVo vo = new ItemLogVo();
|
||||
vo.setServerId(serverId);
|
||||
vo.setUid(info.getUid());
|
||||
vo.setReason(info.getReason());
|
||||
vo.setType(info.getType());
|
||||
vo.setItemId(info.getItemId());
|
||||
vo.setItemName(itemNameMap.getOrDefault(info.getItemId(),info.getItemId()+""));
|
||||
vo.setItemNum(info.getItemNum());
|
||||
vo.setTimeName(DateUtil.stampToTime(Long.parseLong(info.getTime())));
|
||||
logVos.add(vo);
|
||||
}
|
||||
return logVos;
|
||||
}
|
||||
|
||||
/**
|
||||
* @方法名称: createExcle
|
||||
* @实现功能: 导出值班值守表Excel文件 TODO: 方法入参根据页面对象设置
|
||||
* @return java.lang.String
|
||||
* @create by zyw at 2022-03-21 15:20:31
|
||||
**/
|
||||
private void createExcelToSheet(HSSFWorkbook wb, List<ItemLogVo> itemLogs, String serverName) {
|
||||
//第二步创建sheet
|
||||
HSSFSheet sheet = wb.getSheet(serverName);
|
||||
if (sheet == null){
|
||||
sheet = wb.createSheet(serverName);
|
||||
}
|
||||
|
||||
//第三步创建行row:添加表头0行
|
||||
//4个参数依次为:开始行,结束行,开始列,结束列
|
||||
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
|
||||
HSSFRow row = sheet.createRow(0);
|
||||
|
||||
HSSFCell cell1 = row.createCell(0);
|
||||
cell1.setCellValue("玩家道具信息");
|
||||
|
||||
HSSFCellStyle style = wb.createCellStyle();
|
||||
style.setAlignment(HSSFCellStyle.ALIGN_CENTER); //居中
|
||||
|
||||
HSSFRow row1 = sheet.createRow(1);
|
||||
|
||||
//第四步创建单元格
|
||||
HSSFCell cell = row1.createCell(0); //第一个单元格
|
||||
cell.setCellValue("服务器id"); //设定值
|
||||
cell.setCellStyle(style); //内容居中
|
||||
|
||||
cell = row1.createCell(1); //第三个单元格
|
||||
cell.setCellValue("角色id");
|
||||
cell.setCellStyle(style);
|
||||
|
||||
cell = row1.createCell(2); //第四个单元格
|
||||
cell.setCellValue("来源");
|
||||
cell.setCellStyle(style);
|
||||
|
||||
cell = row1.createCell(3); //第五个单元格
|
||||
cell.setCellValue("行为");
|
||||
cell.setCellStyle(style);
|
||||
|
||||
cell = row1.createCell(4); //第六个单元格
|
||||
cell.setCellValue("获得道具id");
|
||||
cell.setCellStyle(style);
|
||||
|
||||
cell = row1.createCell(5); //第七个单元格
|
||||
cell.setCellValue("获得道具名称");
|
||||
cell.setCellStyle(style);
|
||||
|
||||
cell = row1.createCell(6); //第六个单元格
|
||||
cell.setCellValue("获得道具数量");
|
||||
cell.setCellStyle(style);
|
||||
|
||||
cell = row1.createCell(7); //第七个单元格
|
||||
cell.setCellValue("时间");
|
||||
cell.setCellStyle(style);
|
||||
|
||||
//第五步插入数据
|
||||
for (int i = 0; i < itemLogs.size(); i++) {
|
||||
//创建行
|
||||
row = sheet.createRow(i+2);
|
||||
ItemLogVo vo = itemLogs.get(i);
|
||||
//创建单元格并且添加数据
|
||||
row.createCell(0).setCellValue(vo.getServerId());
|
||||
row.createCell(1).setCellValue(vo.getUid());
|
||||
row.createCell(2).setCellValue(vo.getReason());
|
||||
row.createCell(3).setCellValue(vo.getTypeName());
|
||||
row.createCell(4).setCellValue(vo.getItemId());
|
||||
row.createCell(5).setCellValue(vo.getItemName());
|
||||
row.createCell(6).setCellValue(vo.getItemNum());
|
||||
row.createCell(7).setCellValue(vo.getTimeName());
|
||||
}
|
||||
}
|
||||
|
||||
private void createExcelToDownload(String url, HttpServletResponse response){
|
||||
LOGGER.info("删除道具0209,前端下载============开始");
|
||||
FileInputStream ips = null;
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
//获取文件存放的路径
|
||||
File file = new File(url);
|
||||
String fileName = file.getName();
|
||||
//获取到文字 数据库里对应的附件名字加上老的文件名字:filename 截取到后面的文件类型 例:txt 组成一个新的文件名字:newFileName
|
||||
if(!file.exists())
|
||||
{
|
||||
//如果文件不存在就跳出
|
||||
LOGGER.error("文件不存在,路径错误:{}", url);
|
||||
return;
|
||||
}
|
||||
ips = new FileInputStream(file);
|
||||
response.setContentType("multipart/form-data");
|
||||
//为文件重新设置名字,采用数据库内存储的文件名称
|
||||
response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
|
||||
out = response.getOutputStream();
|
||||
//读取文件流
|
||||
int len = 0;
|
||||
byte[] buffer = new byte[1024 * 10];
|
||||
while((len = ips.read(buffer)) != -1)
|
||||
{
|
||||
out.write(buffer, 0, len);
|
||||
}
|
||||
out.flush();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
out.close();
|
||||
ips.close();
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
System.out.println("关闭流出现异常");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 热榜的redis key
|
||||
* @param subRank
|
||||
* @return
|
||||
*/
|
||||
private String getHeroHotRankKey(int subRank) {
|
||||
return RedisUserKey.HERO_HOT_RANK + ":" + subRank;
|
||||
}
|
||||
|
||||
|
|
@ -117,29 +350,38 @@ public class GmController {
|
|||
@RequestMapping(value = "/findHeroHotRankInfo", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String findHeroHotRankInfo(ModelMap map, int subRank) {
|
||||
List<HeroHotRankVo> rankVos = new ArrayList<>();
|
||||
if (subRank == 0){
|
||||
if (subRank == 0) {
|
||||
for (int i = 1; i < 5; i++) {
|
||||
Set<ZSetOperations.TypedTuple<String>> tuples = RedisUtil.getInstence().rangeWithScores(getHeroHotRankKey(i), 0, -1);
|
||||
rankVos.addAll(packHeroHotRank(i,tuples));
|
||||
rankVos.addAll(packHeroHotRank(i, tuples));
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
Set<ZSetOperations.TypedTuple<String>> tuples = RedisUtil.getInstence().rangeWithScores(getHeroHotRankKey(subRank), 0, -1);
|
||||
rankVos.addAll(packHeroHotRank(subRank,tuples));
|
||||
rankVos.addAll(packHeroHotRank(subRank, tuples));
|
||||
}
|
||||
map.addAttribute("subRank", subRank);
|
||||
map.addAttribute("ranks", rankVos);
|
||||
return "findHeroHotRankInfo";
|
||||
}
|
||||
|
||||
private int getHtmlLikeId() {
|
||||
htmlLikeId++;
|
||||
if (htmlLikeId >= Integer.MAX_VALUE) {
|
||||
htmlLikeId = 0;
|
||||
}
|
||||
return htmlLikeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装热度排行榜对象
|
||||
*
|
||||
* @param subRankId
|
||||
* @param set
|
||||
* @return
|
||||
*/
|
||||
private List<HeroHotRankVo> packHeroHotRank(int subRankId, Set<ZSetOperations.TypedTuple<String>> set){
|
||||
private List<HeroHotRankVo> packHeroHotRank(int subRankId, Set<ZSetOperations.TypedTuple<String>> set) {
|
||||
ArrayList<HeroHotRankVo> rankVos = new ArrayList<>();
|
||||
if (set == null || set.isEmpty()){
|
||||
if (set == null || set.isEmpty()) {
|
||||
return rankVos;
|
||||
}
|
||||
Map<Integer, SItemConfig> heroMap = FileCacheUtils.itemHeroMap;
|
||||
|
|
@ -165,42 +407,42 @@ public class GmController {
|
|||
String heroTid = parameterMap.get("heroTid");
|
||||
int likeNum = Integer.parseInt(parameterMap.get("likeNum"));
|
||||
|
||||
RedisUtil.getInstence().zSet(getHeroHotRankKey(rankId),heroTid,likeNum);
|
||||
RedisUtil.getInstence().zSet(getHeroHotRankKey(rankId), heroTid, likeNum);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/addhero", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody
|
||||
int addHero(@RequestBody HeroTemp heroTemp , HttpServletResponse response) throws Exception {
|
||||
int addHero(@RequestBody HeroTemp heroTemp, HttpServletResponse response) throws Exception {
|
||||
String stringUid = heroTemp.getUserId();
|
||||
for (String userId:stringUid.split("#")) {
|
||||
for (String userId : stringUid.split("#")) {
|
||||
|
||||
CUserInfo userInfo =null;
|
||||
CUserInfo userInfo = null;
|
||||
try {
|
||||
if(userId!=null&&!userId.isEmpty()){
|
||||
if (userId != null && !userId.isEmpty()) {
|
||||
userInfo = userInfoDao.findUserInfoByUserId(Integer.parseInt(userId));
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
throw new Exception("uid null");
|
||||
}
|
||||
|
||||
|
||||
if (userInfo == null){
|
||||
if (userInfo == null) {
|
||||
throw new Exception("userInfo null");
|
||||
}
|
||||
|
||||
WhiteList whiteList = userInfoDao.findWhiteListInfo(userInfo.getOpenId());
|
||||
if (whiteList == null){
|
||||
if (whiteList == null) {
|
||||
throw new Exception("not access");
|
||||
}
|
||||
|
||||
//TODO 分服
|
||||
String rpcString = RedisUtil.getInstence().getObject(RedisUserKey.LOGIC_SERVER_INFO, String.valueOf(userInfo.getServerid()), String.class, -1);
|
||||
if(null==rpcString){
|
||||
if (null == rpcString) {
|
||||
throw new Exception("serverAddress not exist");
|
||||
}
|
||||
String thriftIp = rpcString.split(":")[0];
|
||||
String thriftPort = rpcString.split(":")[1];
|
||||
String thriftPort = rpcString.split(":")[1];
|
||||
if (thriftIp == null || thriftIp.isEmpty() || null == thriftPort || thriftPort.isEmpty()) {
|
||||
return -1;
|
||||
} else {
|
||||
|
|
@ -209,15 +451,15 @@ public class GmController {
|
|||
for (int i = 0; i < heroTemp.getHeroId().size(); i++) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("addhero ").append(userId)
|
||||
.append(" ").append(heroTemp.getHeroId().get(i))
|
||||
.append(" ").append(heroTemp.getHeroId().get(i))
|
||||
.append(" ").append(heroTemp.getHeroStar().get(i));
|
||||
LOGGER.info("start addHero uid=>{},reward=>{}",userId,stringBuilder.toString());
|
||||
LOGGER.info("start addHero uid=>{},reward=>{}", userId, stringBuilder.toString());
|
||||
Result result = RPCClient.gmSend(stringBuilder.toString(), thriftIp, thriftPort);
|
||||
// 异常或者错误
|
||||
if (result.getResultCode() != 0) {
|
||||
continue;
|
||||
}else {
|
||||
LOGGER.info("addHero uid=>{},reward=>{}",userId,stringBuilder.toString());
|
||||
} else {
|
||||
LOGGER.info("addHero uid=>{},reward=>{}", userId, stringBuilder.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -230,7 +472,7 @@ public class GmController {
|
|||
|
||||
|
||||
@RequestMapping(value = "/addHeroPage", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String noticeInfos (HttpSession session, ModelMap map , HttpServletRequest request) throws Exception {
|
||||
public String noticeInfos(HttpSession session, ModelMap map, HttpServletRequest request) throws Exception {
|
||||
return "addHero";
|
||||
}
|
||||
|
||||
|
|
@ -250,9 +492,9 @@ public class GmController {
|
|||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
BufferedReader in = new BufferedReader(new FileReader(filePath));
|
||||
String str;
|
||||
Map<String,CPayOrder> allOrder = new HashMap<>();
|
||||
Map<String, CPayOrder> allOrder = new HashMap<>();
|
||||
while ((str = in.readLine()) != null) {
|
||||
if(str.contains("consumerid")&&str.contains("consumername")){
|
||||
if (str.contains("consumerid") && str.contains("consumername")) {
|
||||
System.out.println(str);
|
||||
String[] split1 = str.split("&");
|
||||
// String[] split = str.split("consumerid=")[1].split("&consumername");
|
||||
|
|
@ -264,40 +506,40 @@ public class GmController {
|
|||
|
||||
CPayOrder cPayOrder = new CPayOrder();
|
||||
String orderNo = "";
|
||||
for(String split:split1){
|
||||
if(split.contains("consumerid")){
|
||||
if(!split.contains("_")){
|
||||
for (String split : split1) {
|
||||
if (split.contains("consumerid")) {
|
||||
if (!split.contains("_")) {
|
||||
break;
|
||||
}
|
||||
String[] s = split.split("=")[1].split("_");
|
||||
cPayOrder.setUserId(s[0]);
|
||||
cPayOrder.setGoodsId(s[1]);
|
||||
}
|
||||
if(split.contains("mhtOrderAmt")){
|
||||
if (split.contains("mhtOrderAmt")) {
|
||||
cPayOrder.setAmount(split.split("=")[1]);
|
||||
}
|
||||
if(split.contains("orderNo")){
|
||||
if (split.contains("orderNo")) {
|
||||
orderNo = split.split("=")[1];
|
||||
cPayOrder.setOrderId(orderNo);
|
||||
}
|
||||
}
|
||||
Object o1 = redisUtil.get("C_PAYORDER:" + orderNo);
|
||||
if(o1==null){
|
||||
System.out.println(orderNo+"找不到");
|
||||
if (o1 == null) {
|
||||
System.out.println(orderNo + "找不到");
|
||||
continue;
|
||||
}else{
|
||||
System.out.println(orderNo+"find");
|
||||
} else {
|
||||
System.out.println(orderNo + "find");
|
||||
}
|
||||
String o = (String)o1;
|
||||
String o = (String) o1;
|
||||
CPayOrder errorOrder = gson.fromJson(o, CPayOrder.class);
|
||||
cPayOrder.setServerId(errorOrder.getServerId());
|
||||
cPayOrder.setDelivery_time(errorOrder.getDelivery_time());
|
||||
if(cPayOrder.getUserId()!=null){
|
||||
allOrder.put(orderNo,cPayOrder);
|
||||
if (cPayOrder.getUserId() != null) {
|
||||
allOrder.put(orderNo, cPayOrder);
|
||||
}
|
||||
String date = cPayOrder.getDelivery_time().substring(0, 10);
|
||||
redisUtil.putMapEntry("C_PAYORDER_MAP",date,orderNo,cPayOrder,-1);
|
||||
redisUtil.set("C_PAYORDER:" + orderNo,gson.toJson(cPayOrder));
|
||||
redisUtil.putMapEntry("C_PAYORDER_MAP", date, orderNo, cPayOrder, -1);
|
||||
redisUtil.set("C_PAYORDER:" + orderNo, gson.toJson(cPayOrder));
|
||||
}
|
||||
}
|
||||
// System.out.println(str);/
|
||||
|
|
@ -308,7 +550,7 @@ public class GmController {
|
|||
}
|
||||
|
||||
|
||||
// public void recharge() throws IOException {
|
||||
// public void recharge() throws IOException {
|
||||
// String osName = System.getProperty("os.name");
|
||||
// String filePath = "";
|
||||
// Gson gson = new Gson();
|
||||
|
|
@ -330,60 +572,62 @@ public class GmController {
|
|||
// in.close();
|
||||
// out.close();
|
||||
// }
|
||||
@RequestMapping(value = "/banFunction", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody String banFunction(HttpServletRequest request) throws Exception{
|
||||
String function = request.getParameter("type");// protocal/good
|
||||
String action = request.getParameter("operate");// ban/opend
|
||||
String id = request.getParameter("Id");// id
|
||||
String splitId[] = id.split(",");
|
||||
@RequestMapping(value = "/banFunction", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody
|
||||
String banFunction(HttpServletRequest request) throws Exception {
|
||||
String function = request.getParameter("type");// protocal/good
|
||||
String action = request.getParameter("operate");// ban/opend
|
||||
String id = request.getParameter("Id");// id
|
||||
String splitId[] = id.split(",");
|
||||
|
||||
ServerBanPro banDao = banFuctionDao.findUserInfo();
|
||||
if(banDao == null ){
|
||||
ServerBanPro serverBanPro = new ServerBanPro();
|
||||
//serverBanPro.setId(1);
|
||||
serverBanPro.setBanProtoId(new ArrayList<Integer>(Arrays.asList(1,2)));
|
||||
serverBanPro.setBanGoodList(new ArrayList<>());
|
||||
banFuctionDao.addServerBanPro(serverBanPro);
|
||||
banDao = serverBanPro;
|
||||
ServerBanPro banDao = banFuctionDao.findUserInfo();
|
||||
if (banDao == null) {
|
||||
ServerBanPro serverBanPro = new ServerBanPro();
|
||||
//serverBanPro.setId(1);
|
||||
serverBanPro.setBanProtoId(new ArrayList<Integer>(Arrays.asList(1, 2)));
|
||||
serverBanPro.setBanGoodList(new ArrayList<>());
|
||||
banFuctionDao.addServerBanPro(serverBanPro);
|
||||
banDao = serverBanPro;
|
||||
}
|
||||
switch (function) {
|
||||
case "protocal":
|
||||
if (action.equals("ban")) {
|
||||
for (String string : splitId) {
|
||||
if (!banDao.getBanProtoId().contains(Integer.valueOf(string))) {
|
||||
banDao.getBanProtoId().add(Integer.valueOf(string));
|
||||
banFuctionDao.updateServerBanPro(banDao);
|
||||
}
|
||||
}
|
||||
} else if (action.equals("open")) {
|
||||
for (String string : splitId) {
|
||||
if (banDao.getBanProtoId().contains(Integer.valueOf(string))) {
|
||||
banDao.getBanProtoId().remove(Integer.valueOf(string));
|
||||
banFuctionDao.updateServerBanPro(banDao);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "good":
|
||||
if (action.equals("ban")) {
|
||||
for (String string : splitId) {
|
||||
if (!banDao.getBanGoodList().contains(Integer.valueOf(string))) {
|
||||
banDao.getBanGoodList().add(Integer.valueOf(string));
|
||||
banFuctionDao.updateServerBanPro(banDao);
|
||||
}
|
||||
}
|
||||
} else if (action.equals("open")) {
|
||||
for (String string : splitId) {
|
||||
if (banDao.getBanGoodList().contains(Integer.valueOf(string))) {
|
||||
banDao.getBanGoodList().remove(Integer.valueOf(string));
|
||||
banFuctionDao.updateServerBanPro(banDao);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return "succeful";
|
||||
}
|
||||
switch (function){
|
||||
case "protocal":
|
||||
if(action.equals("ban")){
|
||||
for(String string:splitId) {
|
||||
if(!banDao.getBanProtoId().contains(Integer.valueOf(string))){
|
||||
banDao.getBanProtoId().add(Integer.valueOf(string));
|
||||
banFuctionDao.updateServerBanPro(banDao);
|
||||
}
|
||||
}
|
||||
}else if(action.equals("open")){
|
||||
for(String string:splitId){
|
||||
if(banDao.getBanProtoId().contains(Integer.valueOf(string))){
|
||||
banDao.getBanProtoId().remove(Integer.valueOf(string));
|
||||
banFuctionDao.updateServerBanPro(banDao);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "good":
|
||||
if(action.equals("ban")){
|
||||
for(String string:splitId){
|
||||
if(!banDao.getBanGoodList().contains(Integer.valueOf(string))){
|
||||
banDao.getBanGoodList().add(Integer.valueOf(string));
|
||||
banFuctionDao.updateServerBanPro(banDao);
|
||||
}
|
||||
}
|
||||
}else if(action.equals("open")){
|
||||
for(String string:splitId){
|
||||
if(banDao.getBanGoodList().contains(Integer.valueOf(string))){
|
||||
banDao.getBanGoodList().remove(Integer.valueOf(string));
|
||||
banFuctionDao.updateServerBanPro(banDao);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return "succeful";
|
||||
}
|
||||
|
||||
public void recharge() throws IOException {
|
||||
String osName = System.getProperty("os.name");
|
||||
String filePath = "";
|
||||
|
|
@ -393,19 +637,19 @@ public @ResponseBody String banFunction(HttpServletRequest request) throws Excep
|
|||
} else {// Linux 系统
|
||||
filePath = "../config/";
|
||||
}
|
||||
BufferedReader in = new BufferedReader(new FileReader(filePath+"rechargeImport.txt"));
|
||||
BufferedWriter out = new BufferedWriter(new FileWriter(filePath+"recharge.json"));
|
||||
BufferedReader in = new BufferedReader(new FileReader(filePath + "rechargeImport.txt"));
|
||||
BufferedWriter out = new BufferedWriter(new FileWriter(filePath + "recharge.json"));
|
||||
String str;
|
||||
out.write("返利json生成开始===============================");
|
||||
while ((str = in.readLine()) != null) {
|
||||
String[] s = str.split("\t");
|
||||
if(s[0].charAt(s[0].length()-1)==' '){
|
||||
s[0] = s[0].substring(0,s[0].length()-1);
|
||||
if (s[0].charAt(s[0].length() - 1) == ' ') {
|
||||
s[0] = s[0].substring(0, s[0].length() - 1);
|
||||
}
|
||||
RechargeInfo rechargeInfo = new RechargeInfo(s[0], Double.valueOf(s[1]), 0);
|
||||
String json = gson.toJson(rechargeInfo);
|
||||
System.out.println(s[0]+"||"+s[1]);
|
||||
out.write(json+"\n");
|
||||
System.out.println(s[0] + "||" + s[1]);
|
||||
out.write(json + "\n");
|
||||
}
|
||||
out.write("返利json生成完成===============================");
|
||||
in.close();
|
||||
|
|
@ -428,7 +672,7 @@ public @ResponseBody String banFunction(HttpServletRequest request) throws Excep
|
|||
|
||||
private String cpOrderId;//原厂订单号,通常为google或者ios充值才有,充值回调中的remark
|
||||
|
||||
private String recharge_type ; //
|
||||
private String recharge_type; //
|
||||
|
||||
private String amount;// 充值回调中的amount,单位为分
|
||||
|
||||
|
|
|
|||
|
|
@ -9,13 +9,15 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
public class ItemController {
|
||||
@Autowired
|
||||
public ItemDao itemDao;
|
||||
|
||||
@Resource
|
||||
private ItemDao itemDao;
|
||||
|
||||
@PostMapping (value = "/getItemFlow" )
|
||||
@ResponseBody
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import java.util.stream.Collectors;
|
|||
/**
|
||||
* Created by huangds on 2017/10/24.
|
||||
*/
|
||||
@SuppressWarnings("ALL")
|
||||
@Controller
|
||||
public class OrderInfoController {
|
||||
@Resource
|
||||
|
|
@ -65,16 +64,13 @@ public class OrderInfoController {
|
|||
int exportExcelRequest(HttpServletRequest request) throws Exception {
|
||||
String name = request.getParameter("name");
|
||||
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
|
||||
TaskKit.scheduleWithFixedOne(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
List<Corder> orders = findOrders(parameterMap);
|
||||
exportOrderExcel(name,orders);
|
||||
} catch (Exception e) {
|
||||
LoginController.addQueue("订单列表《"+name+"》导出报错2");
|
||||
e.printStackTrace();
|
||||
}
|
||||
TaskKit.scheduleWithFixedOne(() -> {
|
||||
try {
|
||||
List<Corder> orders = findOrders(parameterMap);
|
||||
exportOrderExcel(name,orders);
|
||||
} catch (Exception e) {
|
||||
LoginController.addQueue("订单列表《"+name+"》导出报错2");
|
||||
e.printStackTrace();
|
||||
}
|
||||
},1);
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import java.util.List;
|
|||
@Component
|
||||
public interface ItemDao {
|
||||
|
||||
List<CItemInfo> getItemFlowByUser(CItemParam param) throws Exception ;
|
||||
List<CItemInfo> getItemFlowByUser(CItemParam param) throws Exception;
|
||||
|
||||
List<CItemInfo> getItem2(CItemParam param) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,12 +12,17 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class ItemDaoImpl implements ItemDao {
|
||||
|
||||
private final static String collectionName = "itemLog";
|
||||
|
||||
@Resource
|
||||
private Connect connect;
|
||||
|
||||
|
|
@ -35,6 +40,27 @@ public class ItemDaoImpl implements ItemDao {
|
|||
query.addCriteria(Criteria.where("time").lte(String.valueOf(endTime)).gte(String.valueOf(startTime)));
|
||||
query.limit(10000);
|
||||
|
||||
return mongoTemplate.find(query, CItemInfo.class,"itemLog");
|
||||
return mongoTemplate.find(query, CItemInfo.class, collectionName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CItemInfo> getItem2(CItemParam param) throws Exception {
|
||||
String dbName = MongoName.getMongoDBName(param.getServerId());
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
||||
LocalDateTime start = LocalDateTime.parse(param.getStartTime(), formatter);
|
||||
LocalDateTime end = LocalDateTime.parse(param.getEndTime(), formatter);
|
||||
|
||||
long startTime = LocalDateTime.from(start).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||
long endTime = LocalDateTime.from(end).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||
|
||||
|
||||
Query query = new Query();
|
||||
query.addCriteria(Criteria.where("type").is(param.getType()));
|
||||
query.addCriteria(Criteria.where("reason").is(param.getReason()));
|
||||
query.addCriteria(Criteria.where("time").lte(String.valueOf(endTime)).gte(String.valueOf(startTime)));
|
||||
|
||||
return mongoTemplate.find(query, CItemInfo.class, collectionName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,6 @@ public class CItemInfo {
|
|||
|
||||
private int itemId;
|
||||
|
||||
private String itemName;
|
||||
|
||||
private String reasonStr;
|
||||
|
||||
private long itemNum;
|
||||
|
||||
private long itemTotalNum;
|
||||
|
|
@ -87,6 +83,10 @@ public class CItemInfo {
|
|||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(int itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public void setItemNum(long itemNum) {
|
||||
this.itemNum = itemNum;
|
||||
}
|
||||
|
|
@ -103,26 +103,6 @@ public class CItemInfo {
|
|||
return itemTotalNum;
|
||||
}
|
||||
|
||||
public void setItemTotalNum(int itemTotalNum) {
|
||||
this.itemTotalNum = itemTotalNum;
|
||||
}
|
||||
|
||||
public String getItemName() {
|
||||
return itemName;
|
||||
}
|
||||
|
||||
public void setItemName(String itemName) {
|
||||
this.itemName = itemName;
|
||||
}
|
||||
|
||||
public String getReasonStr() {
|
||||
return reasonStr;
|
||||
}
|
||||
|
||||
public void setReasonStr(String reasonStr) {
|
||||
this.reasonStr = reasonStr;
|
||||
}
|
||||
|
||||
public String getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ public class CItemParam {
|
|||
private String endTime;
|
||||
private int serverId;
|
||||
private int userId;
|
||||
private int type;
|
||||
private int reason;
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
|
|
@ -38,4 +40,20 @@ public class CItemParam {
|
|||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(int reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,71 @@
|
|||
package com.jmfy.model.vo;
|
||||
|
||||
import com.jmfy.model.CItemInfo;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2023/2/9 10:36:17
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public class ItemLogVo extends CItemInfo {
|
||||
|
||||
private String serverId;
|
||||
|
||||
private String serverName;
|
||||
|
||||
private String reasonName;
|
||||
|
||||
private String timeName;
|
||||
|
||||
private String itemName;
|
||||
|
||||
public String getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
|
||||
public void setServerId(String serverId) {
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
public String getServerName() {
|
||||
return serverName;
|
||||
}
|
||||
|
||||
public void setServerName(String serverName) {
|
||||
this.serverName = serverName;
|
||||
}
|
||||
|
||||
public String getTypeName() {
|
||||
String typeName = "获得";
|
||||
if (super.getType() == 1){
|
||||
typeName = "消耗";
|
||||
}
|
||||
return typeName;
|
||||
}
|
||||
|
||||
public String getReasonName() {
|
||||
return reasonName;
|
||||
}
|
||||
|
||||
public void setReasonName(String reasonName) {
|
||||
this.reasonName = reasonName;
|
||||
}
|
||||
|
||||
public String getTimeName() {
|
||||
return timeName;
|
||||
}
|
||||
|
||||
public void setTimeName(String timeName) {
|
||||
this.timeName = timeName;
|
||||
}
|
||||
|
||||
public String getItemName() {
|
||||
return itemName;
|
||||
}
|
||||
|
||||
public void setItemName(String itemName) {
|
||||
this.itemName = itemName;
|
||||
}
|
||||
}
|
||||
|
|
@ -168,7 +168,6 @@ public class FileCacheUtils {
|
|||
field.setAccessible(flag);
|
||||
map.put(id, obj);
|
||||
} catch (NoSuchFieldException e) {
|
||||
LOGGER.error("初始化表异常,表name:{},异常:{}",clazz.getSimpleName(),e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue