| | |
| | | import java.net.URLEncoder; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.accept.AdminAcceptData; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.fanli.controller.admin.utils.AdminUtils; |
| | | import com.yeshi.fanli.dto.ChartTDO; |
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo; |
| | | import com.yeshi.fanli.entity.bus.user.Extract; |
| | | import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord; |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2; |
| | |
| | | import com.yeshi.fanli.exception.NotExistObjectException; |
| | | import com.yeshi.fanli.exception.ObjectStateException; |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.service.AdminUserService; |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService; |
| | | import com.yeshi.fanli.service.inter.count.UserInfoCountService; |
| | |
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractCountService; |
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractService; |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderCountService; |
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService; |
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoWeiQuanOrderService; |
| | | import com.yeshi.fanli.service.inter.push.PushRecordService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService; |
| | | import com.yeshi.fanli.tag.PageEntity; |
| | | import com.yeshi.common.entity.PageEntity; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.TimeUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/new/api/v1/extract") |
| | | public class ExtractAdminController { |
| | | |
| | | @Resource |
| | | private ExtractService extractService; |
| | | @Resource |
| | | private ExtractService extractService; |
| | | |
| | | @Resource |
| | | private ConfigService configService; |
| | | @Resource |
| | | private ConfigService configService; |
| | | |
| | | @Resource |
| | | private UserInfoCountService userInfoCountService; |
| | | @Resource |
| | | private UserInfoCountService userInfoCountService; |
| | | |
| | | @Resource |
| | | private ExtractCountService extractCountService; |
| | | @Resource |
| | | private ExtractCountService extractCountService; |
| | | |
| | | @Resource |
| | | private PushRecordService pushRecordService; |
| | | @Resource |
| | | private ExtractAuditRecordService extractAuditRecordService; |
| | | |
| | | @Resource |
| | | private PushController xingePushController; |
| | | @Resource |
| | | private HongBaoV2CountService hongBaoV2CountService; |
| | | |
| | | @Resource |
| | | private ExtractAuditRecordService extractAuditRecordService; |
| | | @Resource |
| | | private UserInfoExtraService userInfoExtraService; |
| | | |
| | | @Resource |
| | | private HongBaoV2CountService hongBaoV2CountService; |
| | | @Resource |
| | | private CommonOrderCountService commonOrderCountService; |
| | | |
| | | @Resource |
| | | private AdminUserService adminUserService; |
| | | @Resource |
| | | private CommonOrderService commonOrderService; |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | @Resource |
| | | private TaoBaoOrderService taoBaoOrderService; |
| | | /** |
| | | * 方法说明: 通过提现请求 可jsonP方式 |
| | | * |
| | | * @param id |
| | | * @param code 验证码 |
| | | * @param out |
| | | * @param request |
| | | */ |
| | | @RequestMapping(value = "passExtractJP") |
| | | public void passExtractJP(AdminAcceptData acceptData, String callback, Long id, String code, PrintWriter out, HttpServletRequest request) { |
| | | |
| | | @Resource |
| | | private TaoBaoWeiQuanOrderService taoBaoWeiQuanOrderService; |
| | | /* 检验是否登陆 */ |
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); |
| | | if (admin == null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。")); |
| | | return; |
| | | } |
| | | |
| | | @Resource |
| | | private UserInfoExtraService userInfoExtraService; |
| | | /* 检验是否通过验证 */ |
| | | String codeType = (String) request.getSession().getAttribute(Constant.SESSION_EXTRACT_VERIFY_RESULT); |
| | | if (!"1".equals(codeType)) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(3, "邮箱验证未通过")); |
| | | return; |
| | | } |
| | | |
| | | @Resource |
| | | private CommonOrderCountService commonOrderCountService; |
| | | /* 允许提现 操作 */ |
| | | Integer integer = extractService.passExtract(id, admin); |
| | | |
| | | /** |
| | | * |
| | | * 方法说明: 通过提现请求 可jsonP方式 |
| | | * |
| | | * @param id |
| | | * @param code |
| | | * 验证码 |
| | | * @param out |
| | | * @param request |
| | | */ |
| | | @RequestMapping(value = "passExtractJP") |
| | | public void passExtractJP(String callback, Long id, String code, PrintWriter out, HttpServletRequest request) { |
| | | // 日志记录 |
| | | if (integer == null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("已通过")); |
| | | LogHelper |
| | | .userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "通过了[id=" + id + "]的提现申请!"); |
| | | } else if (integer == 1) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该提现记录已不存在,请刷新")); |
| | | LogHelper.userInfo( |
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 同意提现id=" + id + "的提现申请不存在"); |
| | | } else { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该用户已被处理,请刷新")); |
| | | LogHelper.userInfo( |
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 同意提现id=" + id + "的提现申请状态异常"); |
| | | } |
| | | |
| | | /* 检验是否登陆 */ |
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); |
| | | if (admin == null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。")); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | /* 检验是否通过验证 */ |
| | | String codeType = (String) request.getSession().getAttribute(Constant.SESSION_EXTRACT_VERIFY_RESULT); |
| | | if (!"1".equals(codeType)) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(3, "邮箱验证未通过")); |
| | | return; |
| | | } |
| | | /** |
| | | * 方法说明: 拒绝提现请求jsonP |
| | | * |
| | | * @param id |
| | | * @param reason |
| | | * @param out |
| | | * @param request |
| | | * @author mawurui createTime 2018年3月14日 下午3:15:55 |
| | | */ |
| | | @RequestMapping(value = "rejectExtractJP") |
| | | public void rejectExtractJP(AdminAcceptData acceptData, String callback, Long id, String code, String reason, PrintWriter out, |
| | | HttpServletRequest request) { |
| | | /* 检验是否登陆 */ |
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); |
| | | if (admin == null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆")); |
| | | return; |
| | | } |
| | | |
| | | /* 允许提现 操作 */ |
| | | Integer integer = extractService.passExtract(id, admin); |
| | | /* 检验是否通过验证 */ |
| | | String codeType = (String) request.getSession().getAttribute(Constant.SESSION_EXTRACT_VERIFY_RESULT); |
| | | if (!"1".equals(codeType)) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(3, "邮箱验证未通过")); |
| | | return; |
| | | } |
| | | |
| | | // 日志记录 |
| | | if (integer == null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("已通过")); |
| | | LogHelper |
| | | .userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "通过了[id=" + id + "]的提现申请!"); |
| | | } else if (integer == 1) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该提现记录已不存在,请刷新")); |
| | | LogHelper.userInfo( |
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 同意提现id=" + id + "的提现申请不存在"); |
| | | } else { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该用户已被处理,请刷新")); |
| | | LogHelper.userInfo( |
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 同意提现id=" + id + "的提现申请状态异常"); |
| | | } |
| | | try { |
| | | // 编码转换 |
| | | reason = URLDecoder.decode(reason, "UTF-8"); |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | try { |
| | | |
| | | /** |
| | | * |
| | | * 方法说明: 拒绝提现请求jsonP |
| | | * |
| | | * @author mawurui createTime 2018年3月14日 下午3:15:55 |
| | | * @param id |
| | | * @param reason |
| | | * @param out |
| | | * @param request |
| | | */ |
| | | @RequestMapping(value = "rejectExtractJP") |
| | | public void rejectExtractJP(String callback, Long id, String code, String reason, PrintWriter out, |
| | | HttpServletRequest request) { |
| | | /* 检验是否登陆 */ |
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); |
| | | if (admin == null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆")); |
| | | return; |
| | | } |
| | | extractService.rejectExtract(id, reason, admin);// 提现失败 |
| | | |
| | | /* 检验是否通过验证 */ |
| | | String codeType = (String) request.getSession().getAttribute(Constant.SESSION_EXTRACT_VERIFY_RESULT); |
| | | if (!"1".equals(codeType)) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(3, "邮箱验证未通过")); |
| | | return; |
| | | } |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("拒绝成功")); |
| | | |
| | | try { |
| | | // 编码转换 |
| | | reason = URLDecoder.decode(reason, "UTF-8"); |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "拒绝了[id=" + id |
| | | + "]的提现申请!拒绝原因是" + reason); |
| | | |
| | | try { |
| | | } catch (ObjectStateException e) { |
| | | LogHelper.userInfo( |
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 拒绝提现id=" + id + "的提现申请状态异常!"); // |
| | | |
| | | extractService.rejectExtract(id, reason, admin);// 提现失败 |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage())); |
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("拒绝成功")); |
| | | } catch (NotExistObjectException e) { |
| | | LogHelper.userInfo( |
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 拒绝提现id=" + id + "的提现申请不存在!"); |
| | | |
| | | LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "拒绝了[id=" + id |
| | | + "]的提现申请!拒绝原因是" + reason); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage())); |
| | | } |
| | | |
| | | } catch (ObjectStateException e) { |
| | | LogHelper.userInfo( |
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 拒绝提现id=" + id + "的提现申请状态异常!"); // |
| | | } |
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage())); |
| | | /** |
| | | * 获取今日提现记录:今日总额、总次数、成功次数、失败次数 获取系统提现记录:总额、总次数 |
| | | * |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "countExtract") |
| | | public void countExtract(AdminAcceptData acceptData, String callback, PrintWriter out) { |
| | | |
| | | } catch (NotExistObjectException e) { |
| | | LogHelper.userInfo( |
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 拒绝提现id=" + id + "的提现申请不存在!"); |
| | | Map<String, Object> totalcount = extractCountService.getTodayCount(); |
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage())); |
| | | } |
| | | // 今日提现成功金额 |
| | | BigDecimal todayextractMoney = extractCountService.getTodayTotalSuccessMoney(); |
| | | |
| | | } |
| | | // 当前用户余额总计:所有用户总余额 |
| | | BigDecimal amountMoney = userInfoCountService.countAllMoney(null); |
| | | |
| | | /** |
| | | * 获取今日提现记录:今日总额、总次数、成功次数、失败次数 获取系统提现记录:总额、总次数 |
| | | * |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "countExtract") |
| | | public void countExtract(String callback, PrintWriter out) { |
| | | // 可提现金额限制 |
| | | String minMoney = configService.getValue(ConfigKeyEnum.extractMoneyMin.getKey(), acceptData.getSystem()); |
| | | if (minMoney == null) { |
| | | minMoney = "0"; |
| | | } |
| | | // 当前可提现金额总计: 超过最低提现金额---计入统计 |
| | | BigDecimal extractApply = userInfoCountService.countAllMoney(Double.parseDouble(minMoney)); |
| | | |
| | | Map<String, Object> totalcount = extractCountService.getTodayCount(); |
| | | // 累计已提现金额总计:已提现成功的总额/ 次数 |
| | | Map<String, Object> resultData = extractCountService.countTotalSuccess(); |
| | | |
| | | // 今日提现成功金额 |
| | | BigDecimal todayextractMoney = extractCountService.getTodayTotalSuccessMoney(); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("todayCount", totalcount); |
| | | data.put("todayextractMoney", todayextractMoney); |
| | | |
| | | // 当前用户余额总计:所有用户总余额 |
| | | BigDecimal amountMoney = userInfoCountService.countAllMoney(null); |
| | | data.put("amountMoney", amountMoney); // 所有用户总余额 |
| | | data.put("extractApply", extractApply); // 可提现金额总计 |
| | | data.put("extractNumber", resultData.get("totalamount")); // 提现成功次数 |
| | | data.put("extractMoney", resultData.get("totalmoney")); // 提现成功金额 |
| | | |
| | | // 可提现金额限制 |
| | | String minMoney = configService.get(ConfigKeyEnum.extractMoneyMin.getKey()); |
| | | if (minMoney == null) { |
| | | minMoney = "0"; |
| | | } |
| | | // 当前可提现金额总计: 超过最低提现金额---计入统计 |
| | | BigDecimal extractApply = userInfoCountService.countAllMoney(Double.parseDouble(minMoney)); |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | |
| | | // 累计已提现金额总计:已提现成功的总额/ 次数 |
| | | Map<String, Object> resultData = extractCountService.countTotalSuccess(); |
| | | /** |
| | | * 查询所有审核记录信息 |
| | | * |
| | | * @param callback |
| | | * @param pageIndex |
| | | * @param key |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getFinishRecordList") |
| | | public void getFinishRecordList(AdminAcceptData acceptData, String callback, Integer pageIndex, String key, String startTime, String endTime, |
| | | PrintWriter out) { |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("todayCount", totalcount); |
| | | data.put("todayextractMoney", todayextractMoney); |
| | | try { |
| | | |
| | | data.put("amountMoney", amountMoney); // 所有用户总余额 |
| | | data.put("extractApply", extractApply); // 可提现金额总计 |
| | | data.put("extractNumber", resultData.get("totalamount")); // 提现成功次数 |
| | | data.put("extractMoney", resultData.get("totalmoney")); // 提现成功金额 |
| | | // 起始时间 为空设置默认值: |
| | | if (StringUtil.isNullOrEmpty(startTime)) { |
| | | startTime = "1970-01-01"; |
| | | } |
| | | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | // 结束时间 为空设置默认值当前日期 |
| | | if (StringUtil.isNullOrEmpty(endTime)) { |
| | | Date curDate = new Date(); |
| | | endTime = TimeUtil.getSimpleDate(curDate); |
| | | } |
| | | |
| | | /** |
| | | * 查询所有审核记录信息 |
| | | * |
| | | * @param callback |
| | | * @param pageIndex |
| | | * @param key |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getFinishRecordList") |
| | | public void getFinishRecordList(String callback, Integer pageIndex, String key, String startTime, String endTime, |
| | | PrintWriter out) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date enddate = sdf.parse(endTime); |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(enddate); |
| | | c.add(Calendar.DAY_OF_MONTH, 1);// 今天+1天 |
| | | |
| | | try { |
| | | endTime = sdf.format(c.getTime()); |
| | | |
| | | // 起始时间 为空设置默认值: |
| | | if (StringUtil.isNullOrEmpty(startTime)) { |
| | | startTime = "1970-01-01"; |
| | | } |
| | | if (pageIndex == null) |
| | | pageIndex = 1; |
| | | |
| | | // 结束时间 为空设置默认值当前日期 |
| | | if (StringUtil.isNullOrEmpty(endTime)) { |
| | | Date curDate = new Date(); |
| | | endTime = TimeUtil.getSimpleDate(curDate); |
| | | } |
| | | int pageSize = Constant.PAGE_SIZE; |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date enddate = sdf.parse(endTime); |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(enddate); |
| | | c.add(Calendar.DAY_OF_MONTH, 1);// 今天+1天 |
| | | List<ExtractAuditRecord> auditList = extractAuditRecordService.getList(pageIndex, pageSize, key, startTime, |
| | | endTime); |
| | | |
| | | endTime = sdf.format(c.getTime()); |
| | | int count = extractAuditRecordService.getCount(key, startTime, endTime); |
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; |
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); |
| | | |
| | | if (pageIndex == null) |
| | | pageIndex = 1; |
| | | if (auditList == null || auditList.size() == 0) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("暂无数据"))); |
| | | } else { |
| | | |
| | | int pageSize = Constant.PAGE_SIZE; |
| | | for (ExtractAuditRecord extractAuditRecord : auditList) { |
| | | int countByUid = 0; |
| | | int countCancel = 0; |
| | | Extract extract = extractAuditRecord.getExtract(); |
| | | if (extract != null) { |
| | | UserInfo userInfo = extract.getUserInfo(); |
| | | Long id = userInfo.getId(); |
| | | countByUid = hongBaoV2CountService.countNumberByUid(id); |
| | | countCancel = hongBaoV2CountService.countNumberByUidAndState(id, HongBaoV2.STATE_SHIXIAO); |
| | | } |
| | | extractAuditRecord.setCancelOrderNum((long) countCancel); |
| | | extractAuditRecord.setOrderNum((long) countByUid); |
| | | } |
| | | |
| | | List<ExtractAuditRecord> auditList = extractAuditRecordService.getList(pageIndex, pageSize, key, startTime, |
| | | endTime); |
| | | JSONObject data = new JSONObject(); |
| | | GsonBuilder gsonBuilder = new GsonBuilder(); |
| | | gsonBuilder.serializeNulls(); // 重点 |
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create(); |
| | | |
| | | int count = extractAuditRecordService.getCount(key, startTime, endTime); |
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; |
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); |
| | | data.put("pe", pe); |
| | | data.put("auditList", gson.toJson(auditList)); |
| | | |
| | | if (auditList == null || auditList.size() == 0) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("暂无数据"))); |
| | | } else { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | |
| | | for (ExtractAuditRecord extractAuditRecord : auditList) { |
| | | int countByUid = 0; |
| | | int countCancel = 0; |
| | | Extract extract = extractAuditRecord.getExtract(); |
| | | if (extract != null) { |
| | | UserInfo userInfo = extract.getUserInfo(); |
| | | Long id = userInfo.getId(); |
| | | countByUid = hongBaoV2CountService.countNumberByUid(id); |
| | | countCancel = hongBaoV2CountService.countNumberByUidAndState(id, HongBaoV2.STATE_SHIXIAO); |
| | | } |
| | | extractAuditRecord.setCancelOrderNum((long) countCancel); |
| | | extractAuditRecord.setOrderNum((long) countByUid); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("操作异常"))); |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | GsonBuilder gsonBuilder = new GsonBuilder(); |
| | | gsonBuilder.serializeNulls(); // 重点 |
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create(); |
| | | /** |
| | | * 查询客服个人提现审批记录信息 |
| | | * |
| | | * @param callback |
| | | * @param pageIndex 页码 |
| | | * @param key 筛选条件 |
| | | * @param timeSlot 查询时间段 |
| | | * @param state 查看审核状态 |
| | | * @param out |
| | | * @param request |
| | | */ |
| | | @RequestMapping(value = "getMyAuditedList") |
| | | public void getMyAuditedList(AdminAcceptData acceptData, String callback, Integer pageIndex, String key, String timeSlot, Integer state, |
| | | PrintWriter out, HttpServletRequest request) { |
| | | |
| | | data.put("pe", pe); |
| | | data.put("auditList", gson.toJson(auditList)); |
| | | try { |
| | | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | // AdminUser admin = (AdminUser) |
| | | // request.getSession().getAttribute(Constant.SESSION_ADMIN); |
| | | // if (admin == null) { |
| | | // JsonUtil.printMode(out, callback, |
| | | // JsonUtil.loadFalseResult("当前账户失效,请重新登陆")); |
| | | // return; |
| | | // } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("操作异常"))); |
| | | } |
| | | } |
| | | int pageSize = Constant.PAGE_SIZE; |
| | | Integer days = null; |
| | | if ("1".equals(timeSlot)) { |
| | | days = 0; // 今日 |
| | | } else if ("2".equals(timeSlot)) { |
| | | days = 3; // 前3天 |
| | | } else if ("3".equals(timeSlot)) { |
| | | days = 7; // 前7天 |
| | | } |
| | | |
| | | /** |
| | | * 查询客服个人提现审批记录信息 |
| | | * |
| | | * @param callback |
| | | * @param pageIndex |
| | | * 页码 |
| | | * @param key |
| | | * 筛选条件 |
| | | * @param timeSlot |
| | | * 查询时间段 |
| | | * @param state |
| | | * 查看审核状态 |
| | | * @param out |
| | | * @param request |
| | | */ |
| | | @RequestMapping(value = "getMyAuditedList") |
| | | public void getMyAuditedList(String callback, Integer pageIndex, String key, String timeSlot, Integer state, |
| | | PrintWriter out, HttpServletRequest request) { |
| | | if (state != null && state != 0 && state != 1 && state != 2) { |
| | | state = null; |
| | | } |
| | | |
| | | try { |
| | | // 查询当前人员的审核列表信息 |
| | | // Long adminId = admin.getId(); |
| | | // auditList = |
| | | // extractAuditRecordService.getMyAuditedTimeSlotList(pageIndex, |
| | | // pageSize, key,state, adminId, days); |
| | | // count = extractAuditRecordService.getMyAuditedTimeSlotCount(key, |
| | | // state, adminId,days); |
| | | |
| | | // AdminUser admin = (AdminUser) |
| | | // request.getSession().getAttribute(Constant.SESSION_ADMIN); |
| | | // if (admin == null) { |
| | | // JsonUtil.printMode(out, callback, |
| | | // JsonUtil.loadFalseResult("当前账户失效,请重新登陆")); |
| | | // return; |
| | | // } |
| | | // 暂不区分账号,默认所有 |
| | | List<ExtractAuditRecord> auditList = extractAuditRecordService.getMyAuditedTimeSlotList(pageIndex, pageSize, |
| | | key, state, null, days); |
| | | if (auditList == null || auditList.size() == 0) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据")); |
| | | return; |
| | | } |
| | | |
| | | int pageSize = Constant.PAGE_SIZE; |
| | | Integer days = null; |
| | | if ("1".equals(timeSlot)) { |
| | | days = 0; // 今日 |
| | | } else if ("2".equals(timeSlot)) { |
| | | days = 3; // 前3天 |
| | | } else if ("3".equals(timeSlot)) { |
| | | days = 7; // 前7天 |
| | | } |
| | | for (ExtractAuditRecord record : auditList) { |
| | | AdminUser adminUser = record.getAdminUser(); |
| | | if (adminUser == null) { |
| | | record.setAdminUser(new AdminUser()); |
| | | } |
| | | // 查询用户备注信息 |
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(record.getExtract().getUserInfo().getId()); |
| | | if (extra != null) { |
| | | record.getExtract().getUserInfo().setStateDesc(extra.getMark()); |
| | | } |
| | | |
| | | if (state != null && state != 0 && state != 1 && state != 2) { |
| | | state = null; |
| | | } |
| | | int warnLevel = 0; |
| | | Extract extract = record.getExtract(); |
| | | if (extract != null) { |
| | | Integer extractState = extract.getState(); |
| | | if (extractState != null && extractState == Extract.STATE_NOT_PROCESS) { |
| | | UserInfo userInfo = extract.getUserInfo(); |
| | | if (userInfo != null) { |
| | | BigDecimal countTodayMoney = extractService.sumTodayApplyMoney(userInfo.getId(), |
| | | TimeUtil.getGernalTime(extract.getExtractTime())); |
| | | if (countTodayMoney.compareTo(new BigDecimal(100)) > 0) { |
| | | warnLevel = 1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 查询当前人员的审核列表信息 |
| | | // Long adminId = admin.getId(); |
| | | // auditList = |
| | | // extractAuditRecordService.getMyAuditedTimeSlotList(pageIndex, |
| | | // pageSize, key,state, adminId, days); |
| | | // count = extractAuditRecordService.getMyAuditedTimeSlotCount(key, |
| | | // state, adminId,days); |
| | | if (record.getExtraInfo() != null) { |
| | | StringBuffer desc = new StringBuffer(); |
| | | if (System.currentTimeMillis() > TimeUtil.convertToTimeTemp("2019-06-21", "yyyy-MM-dd")) { |
| | | desc.append("大笔订单数:" + record.getExtraInfo().getOrderCount50More() + "\n#"); |
| | | desc.append("维权订单数:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#"); |
| | | desc.append("维权订单佣金:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#"); |
| | | if (record.getExtraInfo().getOrderCount50More() > 0 |
| | | || record.getExtraInfo().getWeiQuanOrderCount() > 0 |
| | | || record.getExtraInfo().getWeiQuanOrderFanAmount().compareTo(new BigDecimal(10)) >= 0) |
| | | warnLevel = 2; |
| | | } else { |
| | | if (record.getExtraInfo().getOrderCount50More() > 0 |
| | | || record.getExtraInfo().getWeiQuanOrderCount() > 0 |
| | | || record.getExtraInfo().getWeiQuanOrderFanAmount().compareTo(new BigDecimal(0)) > 0) |
| | | warnLevel = 2; |
| | | desc.append("大于50元订单:" + record.getExtraInfo().getOrderCount50More() + "\n#"); |
| | | desc.append("维权订单数:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#"); |
| | | desc.append("维权订单退回金额:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#"); |
| | | desc.append("180天安全订单数:" + record.getExtraInfo().getSafeOrderCount()); |
| | | } |
| | | |
| | | // 暂不区分账号,默认所有 |
| | | List<ExtractAuditRecord> auditList = extractAuditRecordService.getMyAuditedTimeSlotList(pageIndex, pageSize, |
| | | key, state, null, days); |
| | | if (auditList == null || auditList.size() == 0) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据")); |
| | | return; |
| | | } |
| | | if (record.getExtraInfo().getLess10OrderCount() != null && record.getExtraInfo().getLess10OrderCount() > 10) { |
| | | desc.append("刷单嫌疑\n#"); |
| | | } |
| | | |
| | | for (ExtractAuditRecord record : auditList) { |
| | | AdminUser adminUser = record.getAdminUser(); |
| | | if (adminUser == null) { |
| | | record.setAdminUser(new AdminUser()); |
| | | } |
| | | // 查询用户备注信息 |
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(record.getExtract().getUserInfo().getId()); |
| | | if (extra != null) { |
| | | record.getExtract().getUserInfo().setStateDesc(extra.getMark()); |
| | | } |
| | | record.setExtraInfoStr(desc.toString()); |
| | | } |
| | | |
| | | int warnLevel = 0; |
| | | Extract extract = record.getExtract(); |
| | | if (extract != null) { |
| | | Integer extractState = extract.getState(); |
| | | if (extractState != null && extractState == Extract.STATE_NOT_PROCESS) { |
| | | UserInfo userInfo = extract.getUserInfo(); |
| | | if (userInfo != null) { |
| | | BigDecimal countTodayMoney = extractService.sumTodayApplyMoney(userInfo.getId(), |
| | | TimeUtil.getGernalTime(extract.getExtractTime())); |
| | | if (countTodayMoney.compareTo(new BigDecimal(100)) > 0) { |
| | | warnLevel = 1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (record.getExtraInfo() != null) { |
| | | StringBuffer desc = new StringBuffer(); |
| | | if (System.currentTimeMillis() > TimeUtil.convertToTimeTemp("2019-06-21", "yyyy-MM-dd")) { |
| | | desc.append("大笔订单数:" + record.getExtraInfo().getOrderCount50More() + "\n#"); |
| | | desc.append("维权订单数:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#"); |
| | | desc.append("维权订单佣金:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#"); |
| | | if (record.getExtraInfo().getOrderCount50More() > 0 |
| | | || record.getExtraInfo().getWeiQuanOrderCount() > 0 |
| | | || record.getExtraInfo().getWeiQuanOrderFanAmount().compareTo(new BigDecimal(10)) >= 0) |
| | | warnLevel = 2; |
| | | } else { |
| | | if (record.getExtraInfo().getOrderCount50More() > 0 |
| | | || record.getExtraInfo().getWeiQuanOrderCount() > 0 |
| | | || record.getExtraInfo().getWeiQuanOrderFanAmount().compareTo(new BigDecimal(0)) > 0) |
| | | warnLevel = 2; |
| | | desc.append("大于50元订单:" + record.getExtraInfo().getOrderCount50More() + "\n#"); |
| | | desc.append("维权订单数:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#"); |
| | | desc.append("维权订单退回金额:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#"); |
| | | desc.append("180天安全订单数:" + record.getExtraInfo().getSafeOrderCount()); |
| | | } |
| | | |
| | | Integer countOrder = commonOrderCountService.countOderByUidAndLess10(extract.getUserInfo().getId()); |
| | | if (countOrder != null && countOrder > 10) { |
| | | desc.append("刷单嫌疑\n#"); |
| | | } |
| | | |
| | | record.setExtraInfoStr(desc.toString()); |
| | | } |
| | | |
| | | // if (warnLevel == 0) { |
| | | // // 查询同店铺商品,同商品订单超过一定数量的 |
| | | // List<Integer> typeList = new ArrayList<>(); |
| | | // typeList.add(HongBaoV2.TYPE_ZIGOU); |
| | | // long sameGoodsOrderCount = |
| | | // commonOrderCountService.countSameGoodsOrderByUidAndHongBaoType(typeList, |
| | | // record.getExtract().getUserInfo().getId(), |
| | | // Integer.parseInt(configService.get(ConfigKeyEnum.adminMinSameGoodsOrderCount.getKey()))); |
| | | // long sameShopOrderCount = |
| | | // commonOrderCountService.countSameShopOrderByUidAndHongBaoType(typeList, |
| | | // record.getExtract().getUserInfo().getId(), |
| | | // Integer.parseInt(configService.get(ConfigKeyEnum.adminMinSameShopOrderCount.getKey()))); |
| | | // if (sameGoodsOrderCount > 0 || sameShopOrderCount > 0) { |
| | | // warnLevel = 3; |
| | | // record.setExtraInfoStr( |
| | | // String.format("同店铺:%s 同商品:%s", sameShopOrderCount, |
| | | // sameGoodsOrderCount)); |
| | | // } |
| | | // } |
| | | |
| | | // if (warnLevel == 0) { |
| | | // // 查询同店铺商品,同商品订单超过一定数量的 |
| | | // List<Integer> typeList = new ArrayList<>(); |
| | | // typeList.add(HongBaoV2.TYPE_ZIGOU); |
| | | // long sameGoodsOrderCount = |
| | | // commonOrderCountService.countSameGoodsOrderByUidAndHongBaoType(typeList, |
| | | // record.getExtract().getUserInfo().getId(), |
| | | // Integer.parseInt(configService.get(ConfigKeyEnum.adminMinSameGoodsOrderCount.getKey()))); |
| | | // long sameShopOrderCount = |
| | | // commonOrderCountService.countSameShopOrderByUidAndHongBaoType(typeList, |
| | | // record.getExtract().getUserInfo().getId(), |
| | | // Integer.parseInt(configService.get(ConfigKeyEnum.adminMinSameShopOrderCount.getKey()))); |
| | | // if (sameGoodsOrderCount > 0 || sameShopOrderCount > 0) { |
| | | // warnLevel = 3; |
| | | // record.setExtraInfoStr( |
| | | // String.format("同店铺:%s 同商品:%s", sameShopOrderCount, |
| | | // sameGoodsOrderCount)); |
| | | // } |
| | | // } |
| | | record.setWarnLevel(warnLevel); |
| | | } |
| | | |
| | | record.setWarnLevel(warnLevel); |
| | | } |
| | | int count = extractAuditRecordService.getMyAuditedTimeSlotCount(key, state, null, days); |
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; |
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); |
| | | |
| | | int count = extractAuditRecordService.getMyAuditedTimeSlotCount(key, state, null, days); |
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; |
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); |
| | | GsonBuilder gsonBuilder = new GsonBuilder(); |
| | | gsonBuilder.serializeNulls(); |
| | | gsonBuilder.setDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | GsonBuilder gsonBuilder = new GsonBuilder(); |
| | | gsonBuilder.serializeNulls(); |
| | | gsonBuilder.setDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Gson gson = gsonBuilder.create(); |
| | | |
| | | Gson gson = gsonBuilder.create(); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("pe", pe); |
| | | data.put("list", gson.toJson(auditList)); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("pe", pe); |
| | | data.put("list", gson.toJson(auditList)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | out.print(JsonUtil.loadFalseResult(e.getMessage())); |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | out.print(JsonUtil.loadFalseResult(e.getMessage())); |
| | | } |
| | | } |
| | | @RequestMapping(value = "getMyAuditedDanger") |
| | | public void getMyAuditedDanger(AdminAcceptData acceptData, String callback, Long uid, PrintWriter out) { |
| | | if (uid == null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请登录")); |
| | | return; |
| | | } |
| | | SystemEnum system = userInfoService.getUserSystem(uid); |
| | | acceptData.setSystem(system); |
| | | |
| | | @RequestMapping(value = "getMyAuditedDanger") |
| | | public void getMyAuditedDanger(String callback, Long uid, PrintWriter out) { |
| | | if (uid == null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请登录")); |
| | | return; |
| | | } |
| | | // 查询同店铺商品,同商品订单超过一定数量的 |
| | | List<Integer> typeList = new ArrayList<>(); |
| | | typeList.add(HongBaoV2.TYPE_ZIGOU); |
| | | long sameGoodsOrderCount = commonOrderCountService.countSameGoodsOrderByUidAndHongBaoType(typeList, uid, |
| | | Integer.parseInt(configService.get(ConfigKeyEnum.adminMinSameGoodsOrderCount.getKey()))); |
| | | long sameShopOrderCount = commonOrderCountService.countSameShopOrderByUidAndHongBaoType(typeList, uid, |
| | | Integer.parseInt(configService.get(ConfigKeyEnum.adminMinSameShopOrderCount.getKey()))); |
| | | if (sameGoodsOrderCount > 0 || sameShopOrderCount > 0) { |
| | | String text = (String.format("同店铺:%s 同商品:%s", sameShopOrderCount, sameGoodsOrderCount)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(text)); |
| | | return; |
| | | } |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("店铺/商品无异常")); |
| | | } |
| | | |
| | | /** |
| | | * 获取今日提现记录:今日总额、总次数、成功次数、失败次数 获取系统提现记录:总额、总次数 |
| | | * |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getMyAuditedCount") |
| | | public void getMyAuditedCount(String callback, HttpServletRequest request, PrintWriter out) { |
| | | // 查询同店铺商品,同商品订单超过一定数量的 |
| | | List<Integer> typeList = new ArrayList<>(); |
| | | typeList.add(HongBaoV2.TYPE_ZIGOU); |
| | | |
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); |
| | | List<Long> goodsIds = commonOrderCountService.listSameGoodsIdByUidAndHongBaoType(typeList, uid, |
| | | Integer.parseInt(configService.getValue(ConfigKeyEnum.adminMinSameGoodsOrderCount.getKey(), acceptData.getSystem()))); |
| | | int sameGoodsDangerCount = 0; |
| | | if (goodsIds.size() > 0) { |
| | | for (int i = 0; i < goodsIds.size(); i++) { |
| | | long goodsId = goodsIds.get(i); |
| | | Date minDate = new Date(System.currentTimeMillis() - 1000 * 60 * 60L * 24 * 365L); |
| | | List<CommonOrder> commonOrdersList = commonOrderService.listByGoodsIdAndUidAndMinThirdCreateTime(goodsId, uid, minDate); |
| | | Map<String, Date> cmap = new HashMap<>(); |
| | | if (commonOrdersList != null) |
| | | for (CommonOrder co : commonOrdersList) { |
| | | if (co.getState() == CommonOrder.STATE_FK || co.getState() == CommonOrder.STATE_JS || co.getState() == CommonOrder.STATE_WQ) |
| | | cmap.put(co.getOrderNo(), co.getThirdCreateTime()); |
| | | } |
| | | List<Date> dateList = new ArrayList<>(); |
| | | for (Iterator<String> its = cmap.keySet().iterator(); its.hasNext(); ) { |
| | | String orderNo = its.next(); |
| | | dateList.add(cmap.get(orderNo)); |
| | | } |
| | | Collections.sort(dateList); |
| | | Date lastDate = null; |
| | | |
| | | if (admin == null) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。"))); |
| | | } else { |
| | | Long adminId = admin.getId(); |
| | | for (Date date : dateList) { |
| | | if (lastDate != null) { |
| | | if (Math.abs(date.getTime() - lastDate.getTime()) < 1000 * 60 * 60 * 24L * 15) { |
| | | sameGoodsDangerCount++; |
| | | break; |
| | | } |
| | | } else { |
| | | lastDate = date; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | int taskToday = extractCountService.countTodayApply(); |
| | | // int countTodayComplete = extractService.countTodayComplete(); |
| | | |
| | | // 今日累计处理数据 |
| | | int countToday = extractAuditRecordService.getMyAuditedCountToday(adminId); |
| | | // 本周累计处理数据 |
| | | int countWeek = extractAuditRecordService.getMyAuditedCountWeek(adminId); |
| | | // 本月累计处理数据 |
| | | int countMonth = extractAuditRecordService.getMyAuditedCountMonth(adminId); |
| | | long sameShopOrderCount = commonOrderCountService.countSameShopOrderByUidAndHongBaoType(typeList, uid, |
| | | Integer.parseInt(configService.getValue(ConfigKeyEnum.adminMinSameShopOrderCount.getKey(), acceptData.getSystem()))); |
| | | if (sameGoodsDangerCount>0 || sameShopOrderCount > 0) { |
| | | String text = (String.format("同店铺:%s 同商品:%s", sameShopOrderCount, sameGoodsDangerCount)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(text)); |
| | | return; |
| | | } |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("店铺/商品无异常")); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("adminUser", admin); |
| | | data.put("taskToday", taskToday); |
| | | data.put("countToday", countToday); |
| | | data.put("countWeek", countWeek); |
| | | data.put("countMonth", countMonth); |
| | | /** |
| | | * 获取今日提现记录:今日总额、总次数、成功次数、失败次数 获取系统提现记录:总额、总次数 |
| | | * |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getMyAuditedCount") |
| | | public void getMyAuditedCount(AdminAcceptData acceptData, String callback, HttpServletRequest request, PrintWriter out) { |
| | | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); |
| | | |
| | | } |
| | | if (admin == null) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。"))); |
| | | } else { |
| | | Long adminId = admin.getId(); |
| | | |
| | | /** |
| | | * 客服任务页面展示数据:传入提现申请id 则显示当前申请,若无id则显示客服任务下第一个申请数据 |
| | | * |
| | | * @param callback |
| | | * @param extractId |
| | | * 提现id |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getIaskInfo") |
| | | public void getIaskInfo(String callback, Long extractId, HttpServletRequest request, PrintWriter out) { |
| | | try { |
| | | int taskToday = extractCountService.countTodayApply(); |
| | | // int countTodayComplete = extractService.countTodayComplete(); |
| | | |
| | | String surplusTime = ""; |
| | | JSONObject data = new JSONObject(); |
| | | Extract extract = new Extract(); |
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); |
| | | if (admin == null) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。"))); |
| | | return; |
| | | } |
| | | // 今日累计处理数据 |
| | | int countToday = extractAuditRecordService.getMyAuditedCountToday(adminId); |
| | | // 本周累计处理数据 |
| | | int countWeek = extractAuditRecordService.getMyAuditedCountWeek(adminId); |
| | | // 本月累计处理数据 |
| | | int countMonth = extractAuditRecordService.getMyAuditedCountMonth(adminId); |
| | | |
| | | if (extractId != null) { |
| | | /* 传入提现申请id 查询前客服任务数据 */ |
| | | JSONObject data = new JSONObject(); |
| | | data.put("adminUser", admin); |
| | | data.put("taskToday", taskToday); |
| | | data.put("countToday", countToday); |
| | | data.put("countWeek", countWeek); |
| | | data.put("countMonth", countMonth); |
| | | |
| | | extract = extractService.selectByPrimaryKey(extractId); |
| | | if (extract == null) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前申请已不存在"))); |
| | | return; |
| | | } |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | |
| | | // 当前任务指定为该账户处理 |
| | | /* |
| | | * extract.setAdminId(admin.getId()); |
| | | * extractService.updateByPrimaryKeySelective(extract); |
| | | */ |
| | | } |
| | | |
| | | BigDecimal beforeMoney = null; |
| | | List<ExtractAuditRecord> records = extractAuditRecordService.getbyExtractId(extract.getId()); |
| | | if (records != null && records.size() > 0) { |
| | | ExtractAuditRecord extractAuditRecord = records.get(0); |
| | | if (extractAuditRecord != null) { |
| | | beforeMoney = extractAuditRecord.getBeforeMoney(); |
| | | } |
| | | } |
| | | /** |
| | | * 客服任务页面展示数据:传入提现申请id 则显示当前申请,若无id则显示客服任务下第一个申请数据 |
| | | * |
| | | * @param callback |
| | | * @param extractId 提现id |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getIaskInfo") |
| | | public void getIaskInfo(AdminAcceptData acceptData, String callback, Long extractId, HttpServletRequest request, PrintWriter out) { |
| | | try { |
| | | |
| | | Long extractTime = extract.getExtractTime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date date = new Date(extractTime); |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(date); |
| | | c.add(Calendar.DAY_OF_MONTH, 3);// 今天+3天 |
| | | Date todayTime = new Date(); |
| | | String formattodayTime = sdf.format(todayTime); |
| | | String formatTime = sdf.format(c.getTime()); |
| | | String surplusTime = ""; |
| | | JSONObject data = new JSONObject(); |
| | | Extract extract = new Extract(); |
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); |
| | | if (admin == null) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。"))); |
| | | return; |
| | | } |
| | | |
| | | long diff = sdf.parse(formatTime).getTime() - sdf.parse(formattodayTime).getTime(); |
| | | if (diff <= 0) { |
| | | surplusTime = "已超时"; |
| | | } else { |
| | | surplusTime = DateUtil.dateDiff(formattodayTime, formatTime); |
| | | } |
| | | if (extractId != null) { |
| | | /* 传入提现申请id 查询前客服任务数据 */ |
| | | |
| | | String mark = ""; |
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(extract.getUserInfo().getId()); |
| | | if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getMark())) { |
| | | mark = "警惕!! " + userInfoExtra.getMark(); |
| | | } |
| | | |
| | | Integer countOrder = commonOrderCountService.countOderByUidAndLess10(extract.getUserInfo().getId()); |
| | | if (countOrder != null && countOrder > 10) { |
| | | if (StringUtil.isNullOrEmpty(mark)) { |
| | | mark = "刷单预警!!"; |
| | | } else { |
| | | mark = mark + " 刷单预警!!"; |
| | | } |
| | | } |
| | | data.put("mark", mark); |
| | | data.put("extract", extract); |
| | | data.put("beforeMoney", beforeMoney); |
| | | data.put("surplusTime", surplusTime); |
| | | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | |
| | | } else { |
| | | /* 未传入提现申请id 查询当前客服任务 中的第一个 数据 */ |
| | | extract = extractService.selectByPrimaryKey(extractId); |
| | | if (extract == null) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前申请已不存在"))); |
| | | return; |
| | | } |
| | | |
| | | boolean newTask = false; |
| | | // 当前任务指定为该账户处理 |
| | | /* |
| | | * extract.setAdminId(admin.getId()); |
| | | * extractService.updateByPrimaryKeySelective(extract); |
| | | */ |
| | | |
| | | // 查询之前未处理完的任务 |
| | | extract = extractService.getMyTaskInfo(admin.getId()); |
| | | BigDecimal beforeMoney = null; |
| | | List<ExtractAuditRecord> records = extractAuditRecordService.getbyExtractId(extract.getId()); |
| | | if (records != null && records.size() > 0) { |
| | | ExtractAuditRecord extractAuditRecord = records.get(0); |
| | | if (extractAuditRecord != null) { |
| | | beforeMoney = extractAuditRecord.getBeforeMoney(); |
| | | } |
| | | } |
| | | |
| | | if (extract == null) { |
| | | // 新任务 |
| | | extract = extractService.getNewTaskInfo(); |
| | | if (extract != null) |
| | | newTask = true; |
| | | } |
| | | Long extractTime = extract.getExtractTime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date date = new Date(extractTime); |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(date); |
| | | c.add(Calendar.DAY_OF_MONTH, 3);// 今天+3天 |
| | | Date todayTime = new Date(); |
| | | String formattodayTime = sdf.format(todayTime); |
| | | String formatTime = sdf.format(c.getTime()); |
| | | |
| | | if (extract == null) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("暂无用户提现申请"))); |
| | | } else { |
| | | long diff = sdf.parse(formatTime).getTime() - sdf.parse(formattodayTime).getTime(); |
| | | if (diff <= 0) { |
| | | surplusTime = "已超时"; |
| | | } else { |
| | | surplusTime = DateUtil.dateDiff(formattodayTime, formatTime); |
| | | } |
| | | |
| | | if (newTask) { |
| | | // 当前任务指定为该账户处理 |
| | | /* |
| | | * extract.setAdminId(admin.getId()); |
| | | * |
| | | * extractService.updateByPrimaryKeySelective(extract); |
| | | */ |
| | | } |
| | | String mark = ""; |
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(extract.getUserInfo().getId()); |
| | | if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getMark())) { |
| | | mark = "警惕!! " + userInfoExtra.getMark(); |
| | | } |
| | | |
| | | BigDecimal beforeMoney = null; |
| | | Integer countOrder = commonOrderCountService.countOderByUidAndLess10(extract.getUserInfo().getId()); |
| | | if (countOrder != null && countOrder >= 10) { |
| | | if (StringUtil.isNullOrEmpty(mark)) { |
| | | mark = "刷单预警!!"; |
| | | } else { |
| | | mark = mark + " 刷单预警!!"; |
| | | } |
| | | } |
| | | data.put("mark", mark); |
| | | data.put("extract", extract); |
| | | data.put("beforeMoney", beforeMoney); |
| | | data.put("surplusTime", surplusTime); |
| | | |
| | | List<ExtractAuditRecord> records = extractAuditRecordService.getbyExtractId(extract.getId()); |
| | | if (records != null && records.size() > 0) { |
| | | ExtractAuditRecord extractAuditRecord = records.get(0); |
| | | if (extractAuditRecord != null) { |
| | | beforeMoney = extractAuditRecord.getBeforeMoney(); |
| | | } |
| | | } |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | |
| | | Long extractTime = extract.getExtractTime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date date = new Date(extractTime); |
| | | } else { |
| | | /* 未传入提现申请id 查询当前客服任务 中的第一个 数据 */ |
| | | |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(date); |
| | | c.add(Calendar.DAY_OF_MONTH, 3);// 今天+3天 |
| | | Date todayTime = new Date(); |
| | | boolean newTask = false; |
| | | |
| | | String formattodayTime = sdf.format(todayTime); |
| | | String formatTime = sdf.format(c.getTime()); |
| | | // 查询之前未处理完的任务 |
| | | extract = extractService.getMyTaskInfo(admin.getId()); |
| | | |
| | | long diff = sdf.parse(formatTime).getTime() - sdf.parse(formattodayTime).getTime(); |
| | | if (diff <= 0) { |
| | | surplusTime = "已超时"; |
| | | } else { |
| | | surplusTime = DateUtil.dateDiff(formattodayTime, formatTime); |
| | | } |
| | | if (extract == null) { |
| | | // 新任务 |
| | | extract = extractService.getNewTaskInfo(); |
| | | if (extract != null) |
| | | newTask = true; |
| | | } |
| | | |
| | | String mark = ""; |
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(extract.getUserInfo().getId()); |
| | | if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getMark())) { |
| | | mark = "警惕!! " + userInfoExtra.getMark(); |
| | | } |
| | | if (extract == null) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("暂无用户提现申请"))); |
| | | } else { |
| | | |
| | | Integer countOrder = commonOrderCountService.countOderByUidAndLess10(extract.getUserInfo().getId()); |
| | | if (countOrder != null && countOrder > 10) { |
| | | if (StringUtil.isNullOrEmpty(mark)) { |
| | | mark = "刷单预警!!"; |
| | | } else { |
| | | mark = mark + " 刷单预警!!"; |
| | | } |
| | | } |
| | | |
| | | data.put("mark", mark); |
| | | data.put("extract", extract); |
| | | data.put("beforeMoney", beforeMoney); |
| | | data.put("surplusTime", surplusTime); |
| | | if (newTask) { |
| | | // 当前任务指定为该账户处理 |
| | | /* |
| | | * extract.setAdminId(admin.getId()); |
| | | * |
| | | * extractService.updateByPrimaryKeySelective(extract); |
| | | */ |
| | | } |
| | | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | BigDecimal beforeMoney = null; |
| | | |
| | | } |
| | | List<ExtractAuditRecord> records = extractAuditRecordService.getbyExtractId(extract.getId()); |
| | | if (records != null && records.size() > 0) { |
| | | ExtractAuditRecord extractAuditRecord = records.get(0); |
| | | if (extractAuditRecord != null) { |
| | | beforeMoney = extractAuditRecord.getBeforeMoney(); |
| | | } |
| | | } |
| | | |
| | | } catch (ParseException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | Long extractTime = extract.getExtractTime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date date = new Date(extractTime); |
| | | |
| | | } |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(date); |
| | | c.add(Calendar.DAY_OF_MONTH, 3);// 今天+3天 |
| | | Date todayTime = new Date(); |
| | | |
| | | /** |
| | | * 查询用户历史提现记录 |
| | | * |
| | | * @param callback |
| | | * @param pageIndex |
| | | * 页码 |
| | | * @param key |
| | | * 用户id |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getByUidList") |
| | | public void getByUidList(String callback, Integer pageIndex, Long uid, HttpServletRequest request, |
| | | PrintWriter out) { |
| | | try { |
| | | if (uid == null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户不存在")); |
| | | return; |
| | | } |
| | | String formattodayTime = sdf.format(todayTime); |
| | | String formatTime = sdf.format(c.getTime()); |
| | | |
| | | if (pageIndex == null) |
| | | pageIndex = 1; |
| | | long diff = sdf.parse(formatTime).getTime() - sdf.parse(formattodayTime).getTime(); |
| | | if (diff <= 0) { |
| | | surplusTime = "已超时"; |
| | | } else { |
| | | surplusTime = DateUtil.dateDiff(formattodayTime, formatTime); |
| | | } |
| | | |
| | | int pageSize = Constant.PAGE_SIZE; |
| | | String mark = ""; |
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(extract.getUserInfo().getId()); |
| | | if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getMark())) { |
| | | mark = "警惕!! " + userInfoExtra.getMark(); |
| | | } |
| | | |
| | | List<ExtractAuditRecord> list = extractAuditRecordService.getByUidList(pageIndex, pageSize, uid); |
| | | if (list == null || list.size() == 0) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无提现记录")); |
| | | return; |
| | | } |
| | | Integer countOrder = commonOrderCountService.countOderByUidAndLess10(extract.getUserInfo().getId()); |
| | | if (countOrder != null && countOrder >= 10) { |
| | | if (StringUtil.isNullOrEmpty(mark)) { |
| | | mark = "刷单预警!!"; |
| | | } else { |
| | | mark = mark + " 刷单预警!!"; |
| | | } |
| | | } |
| | | |
| | | for (ExtractAuditRecord record : list) { |
| | | data.put("mark", mark); |
| | | data.put("extract", extract); |
| | | data.put("beforeMoney", beforeMoney); |
| | | data.put("surplusTime", surplusTime); |
| | | |
| | | if (record.getExtraInfo() != null) { |
| | | StringBuffer desc = new StringBuffer(); |
| | | desc.append("大于50元订单:" + record.getExtraInfo().getOrderCount50More() + "\n#"); |
| | | desc.append("维权订单数:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#"); |
| | | desc.append("维权订单退回金额:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#"); |
| | | desc.append("180天安全订单数:" + record.getExtraInfo().getSafeOrderCount()); |
| | | record.setExtraInfoStr(desc.toString()); |
| | | } |
| | | } |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | |
| | | int count = extractAuditRecordService.getByUidCount(uid); |
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; |
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); |
| | | } |
| | | |
| | | GsonBuilder gsonBuilder = new GsonBuilder(); |
| | | gsonBuilder.serializeNulls(); // 重点 |
| | | Gson gson = gsonBuilder.create(); |
| | | } catch (ParseException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("pe", pe); |
| | | data.put("list", gson.toJson(list)); |
| | | } |
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | /** |
| | | * 查询用户历史提现记录 |
| | | * |
| | | * @param callback |
| | | * @param pageIndex 页码 |
| | | * 用户id |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getByUidList") |
| | | public void getByUidList(AdminAcceptData acceptData, String callback, Integer pageIndex, Long uid, HttpServletRequest request, |
| | | PrintWriter out) { |
| | | try { |
| | | if (uid == null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户不存在")); |
| | | return; |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | // TODO: handle exception |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | if (pageIndex == null) |
| | | pageIndex = 1; |
| | | |
| | | /** |
| | | * 数量统计 |
| | | * |
| | | * @param callback |
| | | * @param uid |
| | | * 用户id |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "countByUid") |
| | | public void countByUid(String callback, Long uid, HttpServletRequest request, PrintWriter out) { |
| | | int pageSize = Constant.PAGE_SIZE; |
| | | |
| | | try { |
| | | List<ExtractAuditRecord> list = extractAuditRecordService.getByUidList(pageIndex, pageSize, uid); |
| | | if (list == null || list.size() == 0) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无提现记录")); |
| | | return; |
| | | } |
| | | |
| | | // 统计已领取金额 账户历史总收益 |
| | | BigDecimal receiveMoneys = hongBaoV2CountService.countMoneyByUidAndState(uid, HongBaoV2.STATE_YILINGQU); |
| | | if (receiveMoneys == null) { |
| | | receiveMoneys = new BigDecimal(0); |
| | | } |
| | | for (ExtractAuditRecord record : list) { |
| | | |
| | | // 历史提现成功金额 |
| | | double successMoneys = extractCountService.countSuccessMoneysByUid(uid); |
| | | if (record.getExtraInfo() != null) { |
| | | StringBuffer desc = new StringBuffer(); |
| | | desc.append("大于50元订单:" + record.getExtraInfo().getOrderCount50More() + "\n#"); |
| | | desc.append("维权订单数:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#"); |
| | | desc.append("维权订单退回金额:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#"); |
| | | desc.append("180天安全订单数:" + record.getExtraInfo().getSafeOrderCount()); |
| | | record.setExtraInfoStr(desc.toString()); |
| | | } |
| | | } |
| | | |
| | | // 历史提现总次数、成功次数、失败次数 |
| | | Map<String, Object> map = extractCountService.countRecordsByUid(uid); |
| | | int count = extractAuditRecordService.getByUidCount(uid); |
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; |
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); |
| | | |
| | | GsonBuilder gsonBuilder = new GsonBuilder(); |
| | | gsonBuilder.serializeNulls(); |
| | | Gson gson = gsonBuilder.create(); |
| | | GsonBuilder gsonBuilder = new GsonBuilder(); |
| | | gsonBuilder.serializeNulls(); // 重点 |
| | | Gson gson = gsonBuilder.create(); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("map", gson.toJson(map)); |
| | | data.put("successMoneys", gson.toJson(successMoneys)); |
| | | data.put("receiveMoneys", gson.toJson(receiveMoneys)); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("pe", pe); |
| | | data.put("list", gson.toJson(list)); |
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | // TODO: handle exception |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 校验用户资金是否异常 |
| | | * |
| | | * @param uid |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "checkMoney") |
| | | public void checkMoney(String callback, String uid, PrintWriter out) { |
| | | /** |
| | | * 数量统计 |
| | | * |
| | | * @param callback |
| | | * @param uid 用户id |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "countByUid") |
| | | public void countByUid(AdminAcceptData acceptData, String callback, Long uid, HttpServletRequest request, PrintWriter out) { |
| | | |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("UID不能为空")); |
| | | return; |
| | | } |
| | | try { |
| | | |
| | | try { |
| | | extractService.checkExtract(Long.parseLong(uid)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("资金正常")); |
| | | } catch (ExtractException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | | } |
| | | } |
| | | // 统计已领取金额 账户历史总收益 |
| | | BigDecimal receiveMoneys = hongBaoV2CountService.countMoneyByUidAndState(uid, HongBaoV2.STATE_YILINGQU); |
| | | if (receiveMoneys == null) { |
| | | receiveMoneys = new BigDecimal(0); |
| | | } |
| | | |
| | | /** |
| | | * 统计审核次数 |
| | | * |
| | | * @param callback |
| | | * @param state |
| | | * 审核状态:所有-3 通过-1 拒绝- 2 |
| | | * @param type |
| | | * 统计类型 1-24小时 2-所有3 |
| | | * @param dateType |
| | | * 类型 1日 2月 3年 |
| | | * @param year |
| | | * 2018 |
| | | * @param startTime |
| | | * 2018-12-01 |
| | | * @param endTime |
| | | * 2018-12-01 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getAuditTotal") |
| | | public void getAuditTotal(String callback, String stateArray, Integer dateType, String year, String startTime, |
| | | String endTime, PrintWriter out) { |
| | | try { |
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime); |
| | | if (validateMsg != null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg)); |
| | | return; |
| | | } |
| | | |
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) { |
| | | startTime = null; |
| | | endTime = null; |
| | | } |
| | | // 历史提现成功金额 |
| | | double successMoneys = extractCountService.countSuccessMoneysByUid(uid); |
| | | |
| | | Date beginDate = null; |
| | | Date endDate = null; |
| | | |
| | | if (dateType == 1) { |
| | | beginDate = TimeUtil.parse(startTime); |
| | | endDate = TimeUtil.parse(endTime); |
| | | } else if (dateType == 2) { |
| | | Calendar calendar=Calendar.getInstance(); |
| | | int currentYear = calendar.get(Calendar.YEAR); |
| | | if (!StringUtil.isNullOrEmpty(year)) { |
| | | currentYear = Integer.parseInt(year); |
| | | } |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | beginDate =calendar.getTime(); |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | calendar.roll(Calendar.DAY_OF_YEAR, -1); |
| | | endDate=calendar.getTime(); |
| | | } else if (dateType == 3) { |
| | | beginDate = TimeUtil.parse("2018-01-01"); |
| | | endDate = new Date(); |
| | | } |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | String substring = stateArray.substring(1, stateArray.length()-1); |
| | | List<Integer> channelList = null; |
| | | if (stateArray != null && stateArray.trim().length() > 4) { |
| | | channelList = gson.fromJson(stateArray, new TypeToken<ArrayList<Integer>>() {}.getType()); |
| | | } |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | |
| | | if (channelList != null && channelList.size() > 0) { |
| | | for (Integer state : channelList) { |
| | | List<Object> list = getAuditData(dateList, dateType, beginDate, endDate, state); |
| | | String name = ""; |
| | | if (state == 1) { |
| | | name = "通过"; |
| | | } else if (state == 2) { |
| | | name = "驳回"; |
| | | } |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", name); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | } else { |
| | | List<Object> list = getAuditData(dateList, dateType, beginDate, endDate, null); |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "全部"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | // 历史提现总次数、成功次数、失败次数 |
| | | Map<String, Object> map = extractCountService.countRecordsByUid(uid); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("line_list", line_list); |
| | | data.put("xAxis_list", gson.toJson(dateList)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | private List<Object> getAuditData(List<String> dateList, Integer dateType, Date beginDate, Date endDate, |
| | | Integer state) throws Exception{ |
| | | List<Object> list = new ArrayList<>(); |
| | | List<CountUserInfo> listHistory = extractAuditRecordService.getAuditCount(beginDate, endDate, state); |
| | | for (String date: dateList) { |
| | | int value = 0; |
| | | if (listHistory != null) { |
| | | for (CountUserInfo history: listHistory) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } else if (dateType == 2){ |
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); |
| | | if(gernalTime.startsWith("0")) { |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | list.add(value + ""); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | GsonBuilder gsonBuilder = new GsonBuilder(); |
| | | gsonBuilder.serializeNulls(); |
| | | Gson gson = gsonBuilder.create(); |
| | | |
| | | /** |
| | | * 统计提现申请总额 |
| | | * |
| | | * @param callback |
| | | * @param type |
| | | * 统计类型 1-24小时 2-所有 |
| | | * @param dateType |
| | | * 类型 1日 2月 3 |
| | | * @param year |
| | | * 2018 |
| | | * @param startTime |
| | | * 2018-12-01 |
| | | * @param endTime |
| | | * 2018-12-01 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getExtractApplyMoney") |
| | | public void getExtractApplyMoney(String callback, Integer dateType, String year, String startTime, String endTime, |
| | | PrintWriter out) { |
| | | try { |
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime); |
| | | if (validateMsg != null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg)); |
| | | return; |
| | | } |
| | | |
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) { |
| | | startTime = null; |
| | | endTime = null; |
| | | } |
| | | JSONObject data = new JSONObject(); |
| | | data.put("map", gson.toJson(map)); |
| | | data.put("successMoneys", gson.toJson(successMoneys)); |
| | | data.put("receiveMoneys", gson.toJson(receiveMoneys)); |
| | | |
| | | Date beginDate = null; |
| | | Date endDate = null; |
| | | if (dateType == 1) { |
| | | beginDate = TimeUtil.parse(startTime); |
| | | endDate = TimeUtil.parse(endTime); |
| | | } else if (dateType == 2) { |
| | | Calendar calendar=Calendar.getInstance(); |
| | | int currentYear = calendar.get(Calendar.YEAR); |
| | | if (!StringUtil.isNullOrEmpty(year)) { |
| | | currentYear = Integer.parseInt(year); |
| | | } |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | beginDate =calendar.getTime(); |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | calendar.roll(Calendar.DAY_OF_YEAR, -1); |
| | | endDate=calendar.getTime(); |
| | | } else if (dateType == 3) { |
| | | beginDate = TimeUtil.parse("2018-01-01"); |
| | | endDate = new Date(); |
| | | } |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | List<String> list = new ArrayList<>(); |
| | | List<CountUserInfo> listHistory = extractAuditRecordService.getApplyMoney(beginDate, endDate); |
| | | for (String date: dateList) { |
| | | BigDecimal money = new BigDecimal("0"); |
| | | if (listHistory == null) { |
| | | list.add(money.toString()); |
| | | continue; |
| | | } |
| | | |
| | | for (CountUserInfo history: listHistory) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | money = MoneyBigDecimalUtil.add(money, history.getMoney()); |
| | | continue; |
| | | } |
| | | } else if (dateType == 2){ |
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); |
| | | if(gernalTime.startsWith("0")) { |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | money = MoneyBigDecimalUtil.add(money, history.getMoney()); |
| | | continue; |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | money = MoneyBigDecimalUtil.add(money, history.getMoney()); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | list.add(money.toString()); |
| | | } |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "金额"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | line_list.add(innerList); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("xAxis_list", gson.toJson(dateList)); |
| | | data.put("line_list", line_list); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | /** |
| | | * 校验用户资金是否异常 |
| | | * |
| | | * @param uid |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "checkMoney") |
| | | public void checkMoney(AdminAcceptData acceptData, String callback, String uid, PrintWriter out) { |
| | | |
| | | /** |
| | | * 统计提现申请总次数 |
| | | * |
| | | * @param callback |
| | | * @param state |
| | | * 所有-空值或者不传 待审核-0 通过-1 拒绝- 2 |
| | | * @param type |
| | | * 统计类型 1-24小时 2-所有 |
| | | * @param dateType |
| | | * 类型 1日 2月 3年 |
| | | * @param year |
| | | * 2018 |
| | | * @param startTime |
| | | * 2018-12-01 |
| | | * @param endTime |
| | | * 2018-12-01 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getExtractApplyNumber") |
| | | public void getExtractApplyNumber(String callback, Integer state, Integer dateType, String year, String startTime, |
| | | String endTime, PrintWriter out) { |
| | | try { |
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime); |
| | | if (validateMsg != null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg)); |
| | | return; |
| | | } |
| | | |
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) { |
| | | startTime = null; |
| | | endTime = null; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("UID不能为空")); |
| | | return; |
| | | } |
| | | |
| | | |
| | | Date beginDate = null; |
| | | Date endDate = null; |
| | | |
| | | if (dateType == 1) { |
| | | beginDate = TimeUtil.parse(startTime); |
| | | endDate = TimeUtil.parse(endTime); |
| | | } else if (dateType == 2) { |
| | | Calendar calendar=Calendar.getInstance(); |
| | | int currentYear = calendar.get(Calendar.YEAR); |
| | | if (!StringUtil.isNullOrEmpty(year)) { |
| | | currentYear = Integer.parseInt(year); |
| | | } |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | beginDate =calendar.getTime(); |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | calendar.roll(Calendar.DAY_OF_YEAR, -1); |
| | | endDate=calendar.getTime(); |
| | | } else if (dateType == 3) { |
| | | beginDate = TimeUtil.parse("2018-01-01"); |
| | | endDate = new Date(); |
| | | } |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | List<Object> list = new ArrayList<>(); |
| | | List<CountUserInfo> listHistory = extractAuditRecordService.geApplyNumber(beginDate, endDate); |
| | | for (String date: dateList) { |
| | | int value = 0; |
| | | if (listHistory == null) { |
| | | list.add(value + ""); |
| | | continue; |
| | | } |
| | | |
| | | for (CountUserInfo history: listHistory) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } else if (dateType == 2){ |
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); |
| | | if(gernalTime.startsWith("0")) { |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | list.add(value + ""); |
| | | } |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "数量"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | try { |
| | | extractService.checkExtract(Long.parseLong(uid)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("资金正常")); |
| | | } catch (ExtractException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | | } |
| | | } |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | line_list.add(innerList); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("xAxis_list", gson.toJson(dateList)); |
| | | data.put("line_list", line_list); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | /** |
| | | * 下载提现红包Openid |
| | | * |
| | | * @param callback |
| | | * @param response |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "downAutoExtractTxt") |
| | | public void downAutoExtractTxt(AdminAcceptData acceptData, String callback, HttpServletResponse response, PrintWriter out) { |
| | | try { |
| | | List<String> list = extractService.getAutoExtractOpenIds(); |
| | | if (list == null || list.size() <= 1) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无用户满足自动提现条件")); |
| | | return; |
| | | } |
| | | |
| | | /** |
| | | * 下载提现红包Openid |
| | | * |
| | | * @param callback |
| | | * @param response |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "downAutoExtractTxt") |
| | | public void downAutoExtractTxt(String callback, HttpServletResponse response, PrintWriter out) { |
| | | try { |
| | | List<String> list = extractService.getAutoExtractOpenIds(); |
| | | if (list == null || list.size() <= 1) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无用户满足自动提现条件")); |
| | | return; |
| | | } |
| | | String filepath = "自动提现OpenId " + java.lang.System.currentTimeMillis() + ".txt"; |
| | | response.reset(); |
| | | response.setContentType("application/octet-stream"); |
| | | String fileName = URLDecoder.decode(filepath, "utf-8"); |
| | | response.addHeader("Content-Disposition", |
| | | "attachment;" + "filename=\"" + URLEncoder.encode(fileName, "utf-8") + "\""); |
| | | |
| | | String filepath = "自动提现OpenId " + java.lang.System.currentTimeMillis() + ".txt"; |
| | | response.reset(); |
| | | response.setContentType("application/octet-stream"); |
| | | String fileName = URLDecoder.decode(filepath, "utf-8"); |
| | | response.addHeader("Content-Disposition", |
| | | "attachment;" + "filename=\"" + URLEncoder.encode(fileName, "utf-8") + "\""); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (String t : list) { |
| | | sb.append(t + "\r\n"); |
| | | } |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (String t : list) { |
| | | sb.append(t + "\r\n"); |
| | | } |
| | | String opid_str = sb.toString(); |
| | | if (!StringUtil.isNullOrEmpty(opid_str) && opid_str.endsWith("\r\n")) { |
| | | opid_str = opid_str.substring(0, opid_str.length() - 2); |
| | | } |
| | | |
| | | String opid_str = sb.toString(); |
| | | if (!StringUtil.isNullOrEmpty(opid_str) && opid_str.endsWith("\r\n")) { |
| | | opid_str = opid_str.substring(0, opid_str.length() - 2); |
| | | } |
| | | OutputStream os = response.getOutputStream(); |
| | | byte[] byt = opid_str.getBytes(); |
| | | os.write(byt); |
| | | os.flush(); |
| | | os.close(); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | OutputStream os = response.getOutputStream(); |
| | | byte[] byt = opid_str.getBytes(); |
| | | os.write(byt); |
| | | os.flush(); |
| | | os.close(); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | /** |
| | | * 上传提现红包Excel |
| | | * |
| | | * @param file |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "uploadExcel", method = RequestMethod.POST) |
| | | public void uploadExcel(AdminAcceptData acceptData, @RequestParam("file") CommonsMultipartFile file, PrintWriter out) { |
| | | if (file == null) { |
| | | out.print(JsonUtil.loadFalseResult("上传文件不能为空!")); |
| | | return; |
| | | } |
| | | |
| | | /** |
| | | * 上传提现红包Excel |
| | | * |
| | | * @param file |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "uploadExcel", method = RequestMethod.POST) |
| | | public void uploadExcel(@RequestParam("file") CommonsMultipartFile file, PrintWriter out) { |
| | | if (file == null) { |
| | | out.print(JsonUtil.loadFalseResult("上传文件不能为空!")); |
| | | return; |
| | | } |
| | | try { |
| | | List<RedPackRecord> list = WXRedPackUtil.readCsv(file.getInputStream()); |
| | | extractService.updateManualExtractRecord(list); |
| | | out.print(JsonUtil.loadTrueResult("上传成功")); |
| | | } catch (ExtractException e) { |
| | | out.print(JsonUtil.loadFalseResult(e.getMsg())); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | out.print(JsonUtil.loadFalseResult("上传失败")); |
| | | } |
| | | } |
| | | |
| | | try { |
| | | List<RedPackRecord> list = WXRedPackUtil.readCsv(file.getInputStream()); |
| | | extractService.updateManualExtractRecord(list); |
| | | out.print(JsonUtil.loadTrueResult("上传成功")); |
| | | } catch (ExtractException e) { |
| | | out.print(JsonUtil.loadFalseResult(e.getMsg())); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | out.print(JsonUtil.loadFalseResult("上传失败")); |
| | | } |
| | | } |
| | | |
| | | |
| | | public static String getValue(String[] item,int index){ |
| | | if(item.length > index){ |
| | | public static String getValue(String[] item, int index) { |
| | | if (item.length > index) { |
| | | String value = item[index]; |
| | | return value; |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 预览红包发生人 |
| | | * |
| | | * @param callback |
| | | * @param pageIndex |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "preAutoUser") |
| | | public void preAutoUser(String callback, Integer pageIndex, PrintWriter out) { |
| | | try { |
| | | List<UserInfo> list = extractService.preAutoUser(); |
| | | if (list == null || list.isEmpty()) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无用户满足自动提现条件")); |
| | | return; |
| | | } |
| | | |
| | | if (pageIndex == null || pageIndex < 1) { |
| | | pageIndex = 1; |
| | | } |
| | | /** |
| | | * 预览红包发生人 |
| | | * |
| | | * @param callback |
| | | * @param pageIndex |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "preAutoUser") |
| | | public void preAutoUser(AdminAcceptData acceptData, String callback, Integer pageIndex, PrintWriter out) { |
| | | try { |
| | | List<UserInfo> list = extractService.preAutoUser(); |
| | | if (list == null || list.isEmpty()) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无用户满足自动提现条件")); |
| | | return; |
| | | } |
| | | |
| | | Integer pageSize = 100; |
| | | if (pageSize == null || pageSize < 1) { |
| | | pageSize = Constant.PAGE_SIZE; |
| | | } |
| | | if (pageIndex == null || pageIndex < 1) { |
| | | pageIndex = 1; |
| | | } |
| | | |
| | | int count = list.size(); |
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; |
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); |
| | | Integer pageSize = 100; |
| | | if (pageSize == null || pageSize < 1) { |
| | | pageSize = Constant.PAGE_SIZE; |
| | | } |
| | | |
| | | List<UserInfo> listResult = null; |
| | | if (pageIndex < totalPage) { |
| | | int start = (pageIndex - 1) * pageSize; |
| | | listResult = list.subList(start, start + pageSize); |
| | | } else if (pageIndex == totalPage) { |
| | | listResult = list.subList((pageIndex - 1) * pageSize, list.size()); |
| | | } else { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("没有更多了")); |
| | | return; |
| | | } |
| | | int count = list.size(); |
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; |
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("pe", pe); |
| | | data.put("result_list", listResult); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | List<UserInfo> listResult = null; |
| | | if (pageIndex < totalPage) { |
| | | int start = (pageIndex - 1) * pageSize; |
| | | listResult = list.subList(start, start + pageSize); |
| | | } else if (pageIndex == totalPage) { |
| | | listResult = list.subList((pageIndex - 1) * pageSize, list.size()); |
| | | } else { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("没有更多了")); |
| | | return; |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("pe", pe); |
| | | data.put("result_list", listResult); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |