订单功能修改

jieling
PC-202302260912\Administrator 2023-09-12 17:51:57 +08:00
parent 6a90300fe6
commit 5dbde85c79
1 changed files with 38 additions and 47 deletions

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jmfy.WebSecurityConfig;
import com.jmfy.dao.*;
import com.jmfy.handler.HeFuManager;
import com.jmfy.model.*;
import com.jmfy.model.config.SRechargeCommodityConfig;
import com.jmfy.model.vo.OrderExcelVo;
@ -12,6 +13,7 @@ import com.jmfy.utils.*;
import org.apache.poi.hssf.usermodel.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
@ -37,18 +39,25 @@ import java.util.stream.Collectors;
*/
@Controller
public class OrderInfoController {
@Resource
private UserInfoDao userInfoDao;
@Resource
private GSUserDao gsUserDao;
@Resource
private ChannelInfoDao channelInfoDao;
@Resource
private CUserDao cUserDao;
@Resource
private SeqUtils seqUtils;
@Resource
private ServerInfoDao serverInfoDao;
private static UserInfoDao userInfoDao;
private static GSUserDao gsUserDao;
private static SeqUtils seqUtils;
private static ServerInfoDao serverInfoDao;
@Autowired
public OrderInfoController(UserInfoDao userInfoDao, ServerInfoDao serverInfoDao, SeqUtils seqUtils, GSUserDao gsUserDao) {
OrderInfoController.userInfoDao = userInfoDao;
OrderInfoController.serverInfoDao = serverInfoDao;
OrderInfoController.seqUtils = seqUtils;
OrderInfoController.gsUserDao = gsUserDao;
}
private static final Logger LOGGER = LoggerFactory.getLogger(OrderInfoController.class);
@ -62,7 +71,7 @@ public class OrderInfoController {
@RequestMapping(value = "/exportExcelRequest", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody
int exportExcelRequest(HttpServletRequest request) throws Exception {
int exportExcelRequest(HttpServletRequest request) {
String name = request.getParameter("name");
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
TaskKit.scheduleWithFixedOne(() -> {
@ -70,8 +79,7 @@ public class OrderInfoController {
List<Corder> orders = findOrders(parameterMap);
exportOrderExcel(name,orders);
} catch (Exception e) {
LoginController.addQueue("订单列表《"+name+"》导出报错2");
e.printStackTrace();
LOGGER.error("订单列表导出报错:{}error{}",name,e.getMessage(),e);
}
},1);
return 1;
@ -86,7 +94,7 @@ public class OrderInfoController {
@RequestMapping(value = "/deleteExcel", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody
int deleteExcel(HttpServletRequest request, HttpServletResponse response) throws Exception {
int deleteExcel(HttpServletRequest request) {
String path = request.getParameter("path");
File file = new File(path);
// 删除文件
@ -99,13 +107,9 @@ public class OrderInfoController {
/**
*
* @param request
* @param map
* @return
* @throws Exception
*/
@RequestMapping(value = "/getOrderExcelList", method = {RequestMethod.POST, RequestMethod.GET})
public String getOrderExcelList(HttpServletRequest request, ModelMap map) throws Exception {
public String getOrderExcelList(ModelMap map) {
ArrayList<OrderExcelVo> excelVos = new ArrayList<>();
getOrderExcelVoList(excelVos,getPath());
map.put("excelVos",excelVos);
@ -114,8 +118,6 @@ public class OrderInfoController {
/**
*
* @param excelVos
* @param path
*/
private void getOrderExcelVoList(List<OrderExcelVo> excelVos, String path){
// 获取文件信息
@ -175,8 +177,6 @@ public class OrderInfoController {
/**
*
* @return
* @throws Exception
*/
private List<Corder> findOrders(HashMap<String, String> parameterMap) throws Exception {
// 参数
@ -210,8 +210,8 @@ public class OrderInfoController {
});
// 渠道信息
List<ChannelInfo> channelInfos = channelInfoDao.getChannelInfoList();
Map<String, String> channelMap = channelInfos.stream().collect(Collectors.toMap(ChannelInfo::getId, ChannelInfo::getName, (key1, key2) -> key2));
// List<ChannelInfo> channelInfos = channelInfoDao.getChannelInfoList();
// Map<String, String> channelMap = channelInfos.stream().collect(Collectors.toMap(ChannelInfo::getId, ChannelInfo::getName, (key1, key2) -> key2));
// 循环遍历
int i = 0;
@ -223,10 +223,10 @@ public class OrderInfoController {
continue;
}
// 渠道id cc值验证
String ccId = Optional.ofNullable(cgPayOrder.getCc_id()).orElse("-1");
if (!packId.equals("ALLORDER") && !ccId.equals(packId)){
continue;
}
// String ccId = Optional.ofNullable(cgPayOrder.getCc_id()).orElse("-1");
// if (!packId.equals("ALLORDER") && !ccId.equals(packId)){
// continue;
// }
// 玩家账号id验证
String accountid = cgPayOrder.getUserId();
if (userInfo!=null &&!accountid.equals(userInfo.getId())){
@ -259,7 +259,7 @@ public class OrderInfoController {
corder.setRegisterTime("");
corder.setOpenId("");
// 渠道id赋值
corder.setCc_id(channelMap.getOrDefault(ccId,ccId));
corder.setCc_id("");
// 获取订单配置
SRechargeCommodityConfig config = SRechargeCommodityConfig.sdkRechargeCommodityConfigMap.get(cgPayOrder.getGoodsId());
@ -449,32 +449,23 @@ public class OrderInfoController {
}
@RequestMapping(value = "toOrderPage",method = RequestMethod.GET)
public String toOrderPage(ModelMap map,HttpSession session){
public String toOrderPage(ModelMap map,HttpSession session) throws Exception {
String account = (String) session.getAttribute(WebSecurityConfig.SESSION_KEY);
try {
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
map.addAttribute("serverInfo",allServerInfo);
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
map.addAttribute("serverInfo",allServerInfo);
List<gameName> allGameName =serverInfoDao.getAllGameInfo();
map.addAttribute("allGameName",allGameName);
List<gameName> allGameName =serverInfoDao.getAllGameInfo();
map.addAttribute("allGameName",allGameName);
CAdmin admin = cUserDao.findAdmin(account);
List<ChannelInfo> infos = channelInfoDao.getChannelInfoListByIds(admin.getChannelPack());
map.addAttribute("channelPackInfo",infos);
} catch (Exception e) {
e.printStackTrace();
}
CAdmin admin = cUserDao.findAdmin(account);
List<ChannelInfo> infos = channelInfoDao.getChannelInfoListByIds(admin.getChannelPack());
map.addAttribute("channelPackInfo",infos);
return "findOrder";
}
@RequestMapping(value = "toExporOrderPage",method = RequestMethod.GET)
public String toExporOrderPage(ModelMap map){
List<gameName> allGameName = null;
try {
allGameName = serverInfoDao.getAllGameInfo();
} catch (Exception e) {
e.printStackTrace();
}
public String toExporOrderPage(ModelMap map) throws Exception {
List<gameName> allGameName = serverInfoDao.getAllGameInfo();;
map.addAttribute("allGameName",allGameName);
return "exporOrder";
}